From 4444f50c85dc73a9bb3a2239620be32ccc5a67d3 Mon Sep 17 00:00:00 2001 From: Giulia Malinverno Date: Wed, 10 Apr 2024 09:49:55 +0200 Subject: [PATCH 1/4] assignment + docstrings --- _unittest/test_12_1_PostProcessing.py | 4 +- _unittest/test_12_PostProcessing.py | 4 +- .../Maxwell2D_PMSynchronousMotor.py | 2 +- examples/06-Multiphysics/Hfss_Mechanical.py | 2 +- examples/06-Multiphysics/MRI.py | 2 +- .../Maxwell3D_Icepak_2Way_Coupling.py | 2 +- examples/07-Circuit/Reports.py | 8 +- pyaedt/generic/compliance.py | 4 +- pyaedt/modules/AdvancedPostProcessing.py | 6 +- pyaedt/modules/PostProcessor.py | 247 ++++++++++-------- 10 files changed, 148 insertions(+), 133 deletions(-) diff --git a/_unittest/test_12_1_PostProcessing.py b/_unittest/test_12_1_PostProcessing.py index 7116492618f..342f61e8a1c 100644 --- a/_unittest/test_12_1_PostProcessing.py +++ b/_unittest/test_12_1_PostProcessing.py @@ -578,7 +578,7 @@ def test_15_export_plot(self): def test_16_create_field_plot(self): cutlist = ["Global:XY"] plot = self.aedtapp.post._create_fieldplot( - objects=cutlist, + assignment=cutlist, quantity="Mag_E", setup_name=self.aedtapp.nominal_adaptive, intrinsics={}, @@ -626,7 +626,7 @@ def test_61_export_mesh(self): def test_67_sweep_from_json(self): local_path = os.path.dirname(os.path.realpath(__file__)) dict_vals = read_json(os.path.join(local_path, "example_models", "report_json", "Modal_Report_Simple.json")) - assert self.aedtapp.post.create_report_from_configuration(input_dict=dict_vals) + assert self.aedtapp.post.create_report_from_configuration(report_settings=dict_vals) @pytest.mark.skipif( config["desktopVersion"] < "2022.2", reason="Not working in non graphical in version lower than 2022.2" diff --git a/_unittest/test_12_PostProcessing.py b/_unittest/test_12_PostProcessing.py index b341c4a5c77..07106a6c3e8 100644 --- a/_unittest/test_12_PostProcessing.py +++ b/_unittest/test_12_PostProcessing.py @@ -232,10 +232,10 @@ def test_09_manipulate_report_E(self, field_test): assert data.units_sweeps["Phase"] == "deg" assert field_test.post.get_far_field_data( - expression="RealizedGainTotal", setup_sweep_name=field_test.nominal_adaptive, domain="3D" + expressions="RealizedGainTotal", setup_sweep_name=field_test.nominal_adaptive, domain="3D" ) data_farfield2 = field_test.post.get_far_field_data( - expression="RealizedGainTotal", + expressions="RealizedGainTotal", setup_sweep_name=field_test.nominal_adaptive, domain={"Context": "3D", "SourceContext": "1:1"}, ) diff --git a/examples/03-Maxwell/Maxwell2D_PMSynchronousMotor.py b/examples/03-Maxwell/Maxwell2D_PMSynchronousMotor.py index 8804042ad2d..3437fab9a6c 100644 --- a/examples/03-Maxwell/Maxwell2D_PMSynchronousMotor.py +++ b/examples/03-Maxwell/Maxwell2D_PMSynchronousMotor.py @@ -718,7 +718,7 @@ def create_cs_magnets(pm_id, cs_name, point_direction): # formerly created when the section is applied. faces_reg = mod2D.get_object_faces(object_list[1].name) # Region -plot1 = M2D.post.create_fieldplot_surface(objects=faces_reg, quantity='Flux_Lines', intrinsics={ +plot1 = M2D.post.create_fieldplot_surface(assignment=faces_reg, quantity='Flux_Lines', intrinsics={ "Time": M2D.variable_manager.variables["StopTime"].evaluated_value}, plot_name="Flux_Lines") ########################################################## diff --git a/examples/06-Multiphysics/Hfss_Mechanical.py b/examples/06-Multiphysics/Hfss_Mechanical.py index 6c42724257b..c02292a2160 100644 --- a/examples/06-Multiphysics/Hfss_Mechanical.py +++ b/examples/06-Multiphysics/Hfss_Mechanical.py @@ -158,7 +158,7 @@ surfaces = [] for name in mech.get_all_conductors_names(): surfaces.extend(mech.modeler.get_object_faces(name)) -mech.post.create_fieldplot_surface(objects=surfaces, quantity="Temperature") +mech.post.create_fieldplot_surface(assignment=surfaces, quantity="Temperature") ############################################################################### # Release AEDT diff --git a/examples/06-Multiphysics/MRI.py b/examples/06-Multiphysics/MRI.py index 0f8b7a8b40a..c702c9740c6 100644 --- a/examples/06-Multiphysics/MRI.py +++ b/examples/06-Multiphysics/MRI.py @@ -107,7 +107,7 @@ # Draw Point1 at origin of the implant coordinate system hfss.sar_setup(-1, Average_SAR_method=1, TissueMass=1, MaterialDensity=1, ) -hfss.post.create_fieldplot_cutplane(objects="implant:YZ", quantity="Average_SAR", filter_objects=["implant_box"]) +hfss.post.create_fieldplot_cutplane(assignment="implant:YZ", quantity="Average_SAR", filter_objects=["implant_box"]) hfss.modeler.set_working_coordinate_system("implant") hfss.modeler.create_point([0, 0, 0], name="Point1") diff --git a/examples/06-Multiphysics/Maxwell3D_Icepak_2Way_Coupling.py b/examples/06-Multiphysics/Maxwell3D_Icepak_2Way_Coupling.py index 42d559732df..08bd6908349 100644 --- a/examples/06-Multiphysics/Maxwell3D_Icepak_2Way_Coupling.py +++ b/examples/06-Multiphysics/Maxwell3D_Icepak_2Way_Coupling.py @@ -250,7 +250,7 @@ surf_temperature = ipk.post.create_fieldplot_surface(surface_list, quantity="SurfTemperature", plot_name="Surface Temperature") -velocity_cutplane = ipk.post.create_fieldplot_cutplane(objects=["Global:XZ"], quantity="Velocity Vectors", +velocity_cutplane = ipk.post.create_fieldplot_cutplane(assignment=["Global:XZ"], quantity="Velocity Vectors", plot_name="Velocity Vectors") surf_temperature.export_image() diff --git a/examples/07-Circuit/Reports.py b/examples/07-Circuit/Reports.py index b4a27dcd0a0..baf0118c3e7 100644 --- a/examples/07-Circuit/Reports.py +++ b/examples/07-Circuit/Reports.py @@ -57,7 +57,7 @@ # notes and edit axes, the grid, and the legend. You can create custom reports # in non-graphical mode in AEDT 2023 R2 and later. -report1 = cir.post.create_report_from_configuration(os.path.join(project_path,'Spectrum_CISPR_Basic.json')) +report1 = cir.post.create_report_from_configuration(os.path.join(project_path, 'Spectrum_CISPR_Basic.json')) out = cir.post.export_report_to_jpg(cir.working_directory, report1.plot_name) Image(out) @@ -66,7 +66,7 @@ # ~~~~~~~~~~~~~~~~~~~~~~ # Every aspect of the report can be customized. -report1_full = cir.post.create_report_from_configuration(os.path.join(project_path,'Spectrum_CISPR_Custom.json')) +report1_full = cir.post.create_report_from_configuration(os.path.join(project_path, 'Spectrum_CISPR_Custom.json')) out = cir.post.export_report_to_jpg(cir.working_directory, report1_full.plot_name) Image(out) ############################################################################### @@ -80,7 +80,7 @@ props = pyaedt.general_methods.read_json(os.path.join(project_path, 'Transient_CISPR_Custom.json')) -report2 = cir.post.create_report_from_configuration(input_dict=props, solution_name="NexximTransient") +report2 = cir.post.create_report_from_configuration(report_settings=props, solution_name="NexximTransient") out = cir.post.export_report_to_jpg(cir.working_directory, report2.plot_name) Image(out) @@ -92,7 +92,7 @@ props["expressions"] = {"V(Battery)": {}, "V(U1_VDD)": {}} props["plot_name"] = "Battery Voltage" -report3 = cir.post.create_report_from_configuration(input_dict=props, solution_name="NexximTransient") +report3 = cir.post.create_report_from_configuration(report_settings=props, solution_name="NexximTransient") out = cir.post.export_report_to_jpg(cir.working_directory, report3.plot_name) Image(out) diff --git a/pyaedt/generic/compliance.py b/pyaedt/generic/compliance.py index c87de470e08..494c3d57b67 100644 --- a/pyaedt/generic/compliance.py +++ b/pyaedt/generic/compliance.py @@ -453,7 +453,7 @@ def _create_aedt_reports(self, pdf_report): sw_name = self._get_sweep_name(_design, local_config.get("solution_name", None)) _design.logger.info(f"Creating report {name}") aedt_report = _design.post.create_report_from_configuration( - input_dict=local_config, solution_name=sw_name + report_settings=local_config, solution_name=sw_name ) if not aedt_report: # pragma: no cover _design.logger.error(f"Failed to create report {name}") @@ -504,7 +504,7 @@ def _create_aedt_reports(self, pdf_report): sw_name = self._get_sweep_name(_design, local_config.get("solution_name", None)) _design.logger.info(f"Creating report {name} for trace {trace}") aedt_report = _design.post.create_report_from_configuration( - input_dict=local_config, solution_name=sw_name + report_settings=local_config, solution_name=sw_name ) if report_type != "contour eye diagram": aedt_report.hide_legend() diff --git a/pyaedt/modules/AdvancedPostProcessing.py b/pyaedt/modules/AdvancedPostProcessing.py index ab9b65cbedf..836c78b7488 100644 --- a/pyaedt/modules/AdvancedPostProcessing.py +++ b/pyaedt/modules/AdvancedPostProcessing.py @@ -135,7 +135,7 @@ def get_efields_data(self, setup_sweep_name="", ff_setup="Infinite Sphere1", fre trace_name = "rETheta" solnData = self.get_far_field_data( - expression=trace_name, setup_sweep_name=setup_sweep_name, domain=ff_setup + expressions=trace_name, setup_sweep_name=setup_sweep_name, domain=ff_setup ) data = solnData.nominal_variation @@ -152,7 +152,7 @@ def get_efields_data(self, setup_sweep_name="", ff_setup="Infinite Sphere1", fre trace_name = "rEPhi" solnData = self.get_far_field_data( - expression=trace_name, setup_sweep_name=setup_sweep_name, domain=ff_setup + expressions=trace_name, setup_sweep_name=setup_sweep_name, domain=ff_setup ) data = solnData.nominal_variation @@ -208,7 +208,7 @@ def get_model_plotter_geometries( files = [] if get_objects_from_aedt and self._app.solution_type not in ["HFSS3DLayout", "HFSS 3D Layout Design"]: files = self.export_model_obj( - objects=objects, export_as_single_objects=plot_as_separate_objects, air_objects=plot_air_objects + assignment=objects, export_as_single_objects=plot_as_separate_objects, air_objects=plot_air_objects ) model = ModelPlotter() diff --git a/pyaedt/modules/PostProcessor.py b/pyaedt/modules/PostProcessor.py index c67ea8369af..c190e640092 100644 --- a/pyaedt/modules/PostProcessor.py +++ b/pyaedt/modules/PostProcessor.py @@ -216,6 +216,10 @@ def fields(self, expressions=None, setup_name=None, polyline=None): setup is used. Be sure to build a setup string in the form of ``"SetupName : SetupSweep"``, where ``SetupSweep`` is the sweep name to use in the export or ``LastAdaptive``. + polyline : str, optional + Name of the polyline to plot the field on. + If polyline name is not provided the report might be incorrect. + The default value is ``None``. Returns ------- @@ -225,8 +229,8 @@ def fields(self, expressions=None, setup_name=None, polyline=None): -------- >>> from pyaedt import Hfss - >>> app = Hfss(my_project) - >>> report = app.post.reports_by_category.fields("Mag_E", "Setup : LastAdaptive", "Polyline1") + >>> hfss = Hfss(my_project) + >>> report = hfss.post.reports_by_category.fields("Mag_E", "Setup : LastAdaptive", "Polyline1") >>> report.create() >>> solutions = report.get_solution_data() """ @@ -254,6 +258,10 @@ def cg_fields(self, expressions=None, setup_name=None, polyline=None): setup is used. Be sure to build a setup string in the form of ``"SetupName : SetupSweep"``, where ``SetupSweep`` is the sweep name to use in the export or ``LastAdaptive``. + polyline : str, optional + Name of the polyline to plot the field on. + If polyline name is not provided the report might be incorrect. + The default value is ``None``. Returns ------- @@ -263,8 +271,8 @@ def cg_fields(self, expressions=None, setup_name=None, polyline=None): -------- >>> from pyaedt import Q3d - >>> app = Q3d(my_project) - >>> report = app.post.reports_by_category.cg_fields("SmoothQ", "Setup : LastAdaptive", "Polyline1") + >>> q3d = Q3d(my_project) + >>> report = q3d.post.reports_by_category.cg_fields("SmoothQ", "Setup : LastAdaptive", "Polyline1") >>> report.create() >>> solutions = report.get_solution_data() """ @@ -292,6 +300,10 @@ def dc_fields(self, expressions=None, setup_name=None, polyline=None): setup is used. Be sure to build a setup string in the form of ``"SetupName : SetupSweep"``, where ``SetupSweep`` is the sweep name to use in the export or ``LastAdaptive``. + polyline : str, optional + Name of the polyline to plot the field on. + If polyline name is not provided the report might be incorrect. + The default value is ``None``. Returns ------- @@ -301,8 +313,8 @@ def dc_fields(self, expressions=None, setup_name=None, polyline=None): -------- >>> from pyaedt import Q3d - >>> app = Q3d(my_project) - >>> report = app.post.reports_by_category.dc_fields("Mag_VolumeJdc", "Setup : LastAdaptive", "Polyline1") + >>> q3d = Q3d(my_project) + >>> report = q3d.post.reports_by_category.dc_fields("Mag_VolumeJdc", "Setup : LastAdaptive", "Polyline1") >>> report.create() >>> solutions = report.get_solution_data() """ @@ -330,6 +342,10 @@ def rl_fields(self, expressions=None, setup_name=None, polyline=None): setup is used. Be sure to build a setup string in the form of ``"SetupName : SetupSweep"``, where ``SetupSweep`` is the sweep name to use in the export or ``LastAdaptive``. + polyline : str, optional + Name of the polyline to plot the field on. + If polyline name is not provided the report might be incorrect. + The default value is ``None``. Returns ------- @@ -339,8 +355,8 @@ def rl_fields(self, expressions=None, setup_name=None, polyline=None): -------- >>> from pyaedt import Q3d - >>> app = Q3d(my_project) - >>> report = app.post.reports_by_category.rl_fields("Mag_SurfaceJac", "Setup : LastAdaptive", "Polyline1") + >>> q3d = Q3d(my_project) + >>> report = q3d.post.reports_by_category.rl_fields("Mag_SurfaceJac", "Setup : LastAdaptive", "Polyline1") >>> report.create() >>> solutions = report.get_solution_data() """ @@ -384,8 +400,8 @@ def far_field(self, expressions=None, setup_name=None, sphere_name=None, source_ -------- >>> from pyaedt import Hfss - >>> app = Hfss(my_project) - >>> report = app.post.reports_by_category.far_field("GainTotal", "Setup : LastAdaptive", "3D_Sphere") + >>> hfss = Hfss(my_project) + >>> report = hfss.post.reports_by_category.far_field("GainTotal", "Setup : LastAdaptive", "3D_Sphere") >>> report.primary_sweep = "Phi" >>> report.create() >>> solutions = report.get_solution_data() @@ -426,8 +442,8 @@ def antenna_parameters(self, expressions=None, setup_name=None, sphere_name=None -------- >>> from pyaedt import Hfss - >>> app = Hfss(my_project) - >>> report = app.post.reports_by_category.antenna_parameters("GainTotal", "Setup : LastAdaptive", "3D_Sphere") + >>> hfss = Hfss(my_project) + >>> report = hfss.post.reports_by_category.antenna_parameters("GainTotal", "Setup : LastAdaptive", "3D_Sphere") >>> report.create() >>> solutions = report.get_solution_data() """ @@ -463,8 +479,8 @@ def near_field(self, expressions=None, setup_name=None): -------- >>> from pyaedt import Hfss - >>> app = Hfss(my_project) - >>> report = app.post.reports_by_category.near_field("GainTotal", "Setup : LastAdaptive", "NF_1") + >>> hfss = Hfss(my_project) + >>> report = hfss.post.reports_by_category.near_field("GainTotal", "Setup : LastAdaptive", "NF_1") >>> report.primary_sweep = "Phi" >>> report.create() >>> solutions = report.get_solution_data() @@ -501,8 +517,8 @@ def modal_solution(self, expressions=None, setup_name=None): -------- >>> from pyaedt import Hfss - >>> app = Hfss(my_project) - >>> report = app.post.reports_by_category.modal_solution("dB(S(1,1))") + >>> hfss = Hfss(my_project) + >>> report = hfss.post.reports_by_category.modal_solution("dB(S(1,1))") >>> report.create() >>> solutions = report.get_solution_data() """ @@ -538,8 +554,8 @@ def terminal_solution(self, expressions=None, setup_name=None): -------- >>> from pyaedt import Hfss - >>> app = Hfss(my_project) - >>> report = app.post.reports_by_category.terminal_solution("dB(S(1,1))") + >>> hfss = Hfss(my_project) + >>> report = hfss.post.reports_by_category.terminal_solution("dB(S(1,1))") >>> report.create() >>> solutions = report.get_solution_data() """ @@ -575,8 +591,8 @@ def eigenmode(self, expressions=None, setup_name=None): -------- >>> from pyaedt import Hfss - >>> app = Hfss(my_project) - >>> report = app.post.reports_by_category.eigenmode("dB(S(1,1))") + >>> hfss = Hfss(my_project) + >>> report = hfss.post.reports_by_category.eigenmode("dB(S(1,1))") >>> report.create() >>> solutions = report.get_solution_data() """ @@ -1418,13 +1434,13 @@ def export_report_to_csv( use_trace_number_format=use_trace_number_format, ) - @pyaedt_function_handler() - def export_report_to_jpg(self, project_dir, plot_name, width=0, height=0): + @pyaedt_function_handler(project_dir="project_path") + def export_report_to_jpg(self, project_path, plot_name, width=0, height=0): """Export the SParameter plot to a JPG file. Parameters ---------- - project_dir : str + project_path : str Path to the project directory. plot_name : str Name of the plot to export. @@ -1444,7 +1460,7 @@ def export_report_to_jpg(self, project_dir, plot_name, width=0, height=0): >>> oModule.ExportImageToFile """ # path - npath = project_dir + npath = project_path file_name = os.path.join(npath, plot_name + ".jpg") # name of the image file if self._app.desktop_class.non_graphical: # pragma: no cover if width == 0: @@ -1683,15 +1699,14 @@ def create_report( Examples -------- >>> from pyaedt import Hfss - >>> aedtapp = Hfss() - >>> aedtapp.post.create_report("dB(S(1,1))") - - >>> variations = aedtapp.available_variations.nominal_w_values_dict + >>> hfss = Hfss() + >>> hfss.post.create_report("dB(S(1,1))") + >>> variations = hfss.available_variations.nominal_w_values_dict >>> variations["Theta"] = ["All"] >>> variations["Phi"] = ["All"] >>> variations["Freq"] = ["30GHz"] - >>> aedtapp.post.create_report(expressions="db(GainTotal)", - ... setup_sweep_name=aedtapp.nominal_adaptive, + >>> hfss.post.create_report(expressions="db(GainTotal)", + ... setup_sweep_name=hfss.nominal_adaptive, ... variations=variations, ... primary_sweep_variable="Phi", ... secondary_sweep_variable="Theta", @@ -1699,11 +1714,11 @@ def create_report( ... plot_type="3D Polar Plot", ... context="3D") - >>> aedtapp.post.create_report("S(1,1)",aedtapp.nominal_sweep,variations=variations,plot_type="Smith Chart") + >>> hfss.post.create_report("S(1,1)",hfss.nominal_sweep,variations=variations,plot_type="Smith Chart") >>> from pyaedt import Maxwell2d - >>> maxwell_2d = Maxwell2d() - >>> maxwell_2d.post.create_report(expressions="InputCurrent(PHA)", + >>> m2d = Maxwell2d() + >>> m2d.post.create_report(expressions="InputCurrent(PHA)", ... domain="Time", ... primary_sweep_variable="Time", ... plot_name="Winding Plot 1") @@ -1885,16 +1900,15 @@ def get_solution_data( Examples -------- >>> from pyaedt import Hfss - >>> aedtapp = Hfss() - >>> aedtapp.post.create_report("dB(S(1,1))") - - >>> variations = aedtapp.available_variations.nominal_w_values_dict + >>> hfss = Hfss() + >>> hfss.post.create_report("dB(S(1,1))") + >>> variations = hfss.available_variations.nominal_w_values_dict >>> variations["Theta"] = ["All"] >>> variations["Phi"] = ["All"] >>> variations["Freq"] = ["30GHz"] - >>> data1 = aedtapp.post.get_solution_data( + >>> data1 = hfss.post.get_solution_data( ... "GainTotal", - ... aedtapp.nominal_adaptive, + ... hfss.nominal_adaptive, ... variations=variations, ... primary_sweep_variable="Phi", ... secondary_sweep_variable="Theta", @@ -1902,16 +1916,16 @@ def get_solution_data( ... report_category="Far Fields", ...) - >>> data2 =aedtapp.post.get_solution_data( + >>> data2 =hfss.post.get_solution_data( ... "S(1,1)", - ... aedtapp.nominal_sweep, + ... hfss.nominal_sweep, ... variations=variations, ...) >>> data2.plot() >>> from pyaedt import Maxwell2d - >>> maxwell_2d = Maxwell2d() - >>> data3 = maxwell_2d.post.get_solution_data( + >>> m2d = Maxwell2d() + >>> data3 = m2d.post.get_solution_data( ... "InputCurrent(PHA)", domain="Time", primary_sweep_variable="Time", ... ) >>> data3.plot("InputCurrent(PHA)") @@ -2016,15 +2030,15 @@ def get_solution_data( solution_data = report.get_solution_data() return solution_data - @pyaedt_function_handler() - def create_report_from_configuration(self, input_file=None, input_dict=None, solution_name=None): + @pyaedt_function_handler(input_dict="report_settings") + def create_report_from_configuration(self, input_file=None, report_settings=None, solution_name=None): """Create a report based on a JSON file, TOML file, or dictionary of properties. Parameters ---------- input_file : str, optional Path to the JSON or TOML file containing report settings. - input_dict : dict, optional + report_settings : dict, optional Dictionary containing report settings. solution_name : setup name to use. @@ -2037,17 +2051,17 @@ def create_report_from_configuration(self, input_file=None, input_dict=None, sol -------- >>> from pyaedt import Hfss - >>> aedtapp = Hfss() - >>> aedtapp.post.create_report_from_configuration(r'C:\\temp\\my_report.json', - ... solution_name="Setup1 : LastAdpative") + >>> hfss = Hfss() + >>> hfss.post.create_report_from_configuration(r'C:\\temp\\my_report.json', + >>> solution_name="Setup1 : LastAdpative") """ - if not input_dict and not input_file: # pragma: no cover + if not report_settings and not input_file: # pragma: no cover self.logger.error("Either a JSON file or a dictionary must be passed as input.") return False if input_file: props = read_configuration_file(input_file) else: - props = input_dict + props = report_settings _dict_items_to_list_items(props, "expressions") if not solution_name: solution_name = self._app.nominal_sweep @@ -2101,8 +2115,8 @@ class PostProcessor(PostProcessorCommon, object): Basic usage demonstrated with an HFSS, Maxwell, or any other design: >>> from pyaedt import Hfss - >>> aedtapp = Hfss() - >>> post = aedtapp.post + >>> hfss = Hfss() + >>> post = hfss.post """ def __init__(self, app): @@ -2206,21 +2220,21 @@ def _get_intrinsic(self, setup): intr_dict[intr[0]] = intr[1].replace("\\", "").replace("'", "") return intr_dict - @pyaedt_function_handler(list_objs="objects") - def _get_volume_objects(self, objects): + @pyaedt_function_handler(list_objs="assignment") + def _get_volume_objects(self, assignment): if self._app.solution_type not in ["HFSS3DLayout", "HFSS 3D Layout Design"]: obj_list = [] editor = self._app._odesign.SetActiveEditor("3D Modeler") - for obj in objects: + for obj in assignment: obj_list.append(editor.GetObjectNameByID(int(obj))) if obj_list: return obj_list else: - return objects + return assignment - @pyaedt_function_handler(list_objs="objects") - def _get_surface_objects(self, objects): - faces = [int(i) for i in objects] + @pyaedt_function_handler(list_objs="assignment") + def _get_surface_objects(self, assignment): + faces = [int(i) for i in assignment] if self._app.solution_type not in ["HFSS3DLayout", "HFSS 3D Layout Design"]: planes = self._get_cs_plane_ids() objs = [] @@ -2310,13 +2324,13 @@ def _get_fields_plot(self): return plots # TODO: define a fields calculator module and make robust !! - @pyaedt_function_handler() - def volumetric_loss(self, object_name): + @pyaedt_function_handler(object_name="assignment") + def volumetric_loss(self, assignment): """Use the field calculator to create a variable for volumetric losses. Parameters ---------- - object_name : str + assignment : str Name of the object to compute volumetric losses on. Returns @@ -2334,9 +2348,9 @@ def volumetric_loss(self, object_name): """ oModule = self.ofieldsreporter oModule.EnterQty("OhmicLoss") - oModule.EnterVol(object_name) + oModule.EnterVol(assignment) oModule.CalcOp("Integrate") - name = "P_{}".format(object_name) # Need to check for uniqueness ! + name = "P_{}".format(assignment) # Need to check for uniqueness ! oModule.AddNamedExpression(name, "Fields") return name @@ -2978,10 +2992,10 @@ def change_field_plot_scale(self, plot_name, minimum_value, maximum_value, is_lo self.ofieldsreporter.SetPlotFolderSettings(plot_name, args) return True - @pyaedt_function_handler(objlist="objects", quantityName="quantity", listtype="list_type") + @pyaedt_function_handler(objlist="assignment", quantityName="quantity", listtype="list_type") def _create_fieldplot( self, - objects, + assignment, quantity, setup_name, intrinsics, @@ -2991,7 +3005,7 @@ def _create_fieldplot( field_type=None, ): if not list_type.startswith("Layer") and self._app.design_type != "HFSS 3D Layout Design": - objects = self._app.modeler.convert_to_selections(objects, True) + assignment = self._app.modeler.convert_to_selections(assignment, True) if not setup_name: setup_name = self._app.existing_analysis_sweeps[0] if not intrinsics: @@ -3011,20 +3025,20 @@ def _create_fieldplot( plot_name = quantity + "_" + "".join(random.sample(char_set, 6)) filter_boxes = [] if filter_boxes is None else filter_boxes if list_type == "CutPlane": - plot = FieldPlot(self, cutplanes=objects, solution=setup_name, quantity=quantity, intrinsics=intrinsics) + plot = FieldPlot(self, cutplanes=assignment, solution=setup_name, quantity=quantity, intrinsics=intrinsics) elif list_type == "FacesList": - plot = FieldPlot(self, surfaces=objects, solution=setup_name, quantity=quantity, intrinsics=intrinsics) + plot = FieldPlot(self, surfaces=assignment, solution=setup_name, quantity=quantity, intrinsics=intrinsics) elif list_type == "ObjList": - plot = FieldPlot(self, objects=objects, solution=setup_name, quantity=quantity, intrinsics=intrinsics) + plot = FieldPlot(self, objects=assignment, solution=setup_name, quantity=quantity, intrinsics=intrinsics) elif list_type == "Line": - plot = FieldPlot(self, lines=objects, solution=setup_name, quantity=quantity, intrinsics=intrinsics) + plot = FieldPlot(self, lines=assignment, solution=setup_name, quantity=quantity, intrinsics=intrinsics) elif list_type.startswith("Layer"): plot = FieldPlot( self, solution=setup_name, quantity=quantity, intrinsics=intrinsics, - layer_nets=objects, + layer_nets=assignment, layer_plot_type=list_type, ) if self._app.design_type == "Q3D Extractor": # pragma: no cover @@ -3093,15 +3107,15 @@ def _create_fieldplot_line_traces( else: return False - @pyaedt_function_handler(objlist="objects", quantityName="quantity") + @pyaedt_function_handler(objlist="assignment", quantityName="quantity") def create_fieldplot_line( - self, objects, quantity, setup_name=None, intrinsics=None, plot_name=None, field_type="DC R/L Fields" + self, assignment, quantity, setup_name=None, intrinsics=None, plot_name=None, field_type="DC R/L Fields" ): """Create a field plot of the line. Parameters ---------- - objects : list + assignment : list List of polyline to plot. quantity : str Name of the quantity to plot. @@ -3134,7 +3148,7 @@ def create_fieldplot_line( self.logger.info("Plot {} exists. returning the object.".format(plot_name)) return self.field_plots[plot_name] return self._create_fieldplot( - objects, quantity, setup_name, intrinsics, "Line", plot_name, field_type=field_type + assignment, quantity, setup_name, intrinsics, "Line", plot_name, field_type=field_type ) @pyaedt_function_handler(IntrinsincDict="intrinsics") @@ -3310,15 +3324,15 @@ def create_fieldplot_layers_nets( plot_type = "LayerNets" return self._create_fieldplot(layers_nets, quantity, setup_name, intrinsics, plot_type, plot_name) - @pyaedt_function_handler(objlist="objects", quantityName="quantity", IntrinsincDict="intrinsics") + @pyaedt_function_handler(objlist="assignment", quantityName="quantity", IntrinsincDict="intrinsics") def create_fieldplot_surface( - self, objects, quantity, setup_name=None, intrinsics=None, plot_name=None, field_type="DC R/L Fields" + self, assignment, quantity, setup_name=None, intrinsics=None, plot_name=None, field_type="DC R/L Fields" ): """Create a field plot of surfaces. Parameters ---------- - objects : list + assignment : list List of surfaces to plot. quantity : str Name of the quantity to plot. @@ -3350,10 +3364,10 @@ def create_fieldplot_surface( if plot_name and plot_name in list(self.field_plots.keys()): self.logger.info("Plot {} exists. returning the object.".format(plot_name)) return self.field_plots[plot_name] - if not isinstance(objects, (list, tuple)): - objects = [objects] + if not isinstance(assignment, (list, tuple)): + assignment = [assignment] new_obj_list = [] - for obj in objects: + for obj in assignment: if isinstance(obj, (int, FacePrimitive)): new_obj_list.append(obj) elif self._app.modeler[obj]: @@ -3362,10 +3376,10 @@ def create_fieldplot_surface( new_obj_list, quantity, setup_name, intrinsics, "FacesList", plot_name, field_type=field_type ) - @pyaedt_function_handler(objlist="objects", quantityName="quantity", IntrinsincDict="intrinsics") + @pyaedt_function_handler(objlist="assignment", quantityName="quantity", IntrinsincDict="intrinsics") def create_fieldplot_cutplane( self, - objects, + assignment, quantity, setup_name=None, intrinsics=None, @@ -3377,7 +3391,7 @@ def create_fieldplot_cutplane( Parameters ---------- - objects : list + assignment : list List of cut planes to plot. quantity : str Name of the quantity to plot. @@ -3414,7 +3428,7 @@ def create_fieldplot_cutplane( if filter_objects: filter_objects = self._app.modeler.convert_to_selections(filter_objects, True) return self._create_fieldplot( - objects, + assignment, quantity, setup_name, intrinsics, @@ -3424,15 +3438,15 @@ def create_fieldplot_cutplane( field_type=field_type, ) - @pyaedt_function_handler(objlist="objects", quantityName="quantity", IntrinsincDict="intrinsics") + @pyaedt_function_handler(objlist="assignment", quantityName="quantity", IntrinsincDict="intrinsics") def create_fieldplot_volume( - self, objects, quantity, setup_name=None, intrinsics=None, plot_name=None, field_type="DC R/L Fields" + self, assignment, quantity, setup_name=None, intrinsics=None, plot_name=None, field_type="DC R/L Fields" ): """Create a field plot of volumes. Parameters ---------- - objects : list + assignment : list List of volumes to plot. quantity : Name of the quantity to plot. @@ -3463,7 +3477,7 @@ def create_fieldplot_volume( self.logger.info("Plot {} exists. returning the object.".format(plot_name)) return self.field_plots[plot_name] return self._create_fieldplot( - objects, quantity, setup_name, intrinsics, "ObjList", plot_name, field_type=field_type + assignment, quantity, setup_name, intrinsics, "ObjList", plot_name, field_type=field_type ) @pyaedt_function_handler(fileName="file_name", plotName="plot_name", foldername="folder_name") @@ -3711,8 +3725,8 @@ def export_model_picture( self.oeditor.ExportModelImageToFile(full_name, width, height, arg) return full_name - @pyaedt_function_handler(families_dict="sweeps") - def get_far_field_data(self, expression="GainTotal", setup_sweep_name="", domain="Infinite Sphere1", sweeps=None): + @pyaedt_function_handler(expression="expressions", families_dict="sweeps") + def get_far_field_data(self, expressions="GainTotal", setup_sweep_name="", domain="Infinite Sphere1", sweeps=None): """Generate far field data using ``GetSolutionDataPerVariation``. This method returns the data ``solData``, ``ThetaVals``, @@ -3721,7 +3735,7 @@ def get_far_field_data(self, expression="GainTotal", setup_sweep_name="", domain Parameters ---------- - expression : str or list, optional + expressions : str or list, optional One or more formulas to add to the report. The default is ``"GainTotal"``. setup_sweep_name : str, optional Name of the setup for computing the report. The default is ``""``, @@ -3740,8 +3754,8 @@ def get_far_field_data(self, expression="GainTotal", setup_sweep_name="", domain >>> oModule.GetSolutionDataPerVariation """ - if type(expression) is not list: - expression = [expression] + if type(expressions) is not list: + expressions = [expressions] if not setup_sweep_name: setup_sweep_name = self._app.nominal_adaptive if sweeps is None: @@ -3752,20 +3766,20 @@ def get_far_field_data(self, expression="GainTotal", setup_sweep_name="", domain context = ["Context:=", domain["Context"], "Context:=", domain["SourceContext"]] solution_data = self.get_solution_data_per_variation( - "Far Fields", setup_sweep_name, context, sweeps, expression + "Far Fields", setup_sweep_name, context, sweeps, expressions ) if not solution_data: print("No Data Available. Check inputs") return False return solution_data - @pyaedt_function_handler(obj_list="objects") - def export_model_obj(self, objects=None, export_path=None, export_as_single_objects=False, air_objects=False): + @pyaedt_function_handler(obj_list="assignment") + def export_model_obj(self, assignment=None, export_path=None, export_as_single_objects=False, air_objects=False): """Export the model. Parameters ---------- - objects : list, optional + assignment : list, optional List of objects to export. Export every model object except 3D ones and vacuum and air objects. export_path : str, optional @@ -3781,19 +3795,19 @@ def export_model_obj(self, objects=None, export_path=None, export_as_single_obje list List of paths for OBJ files. """ - if objects and not isinstance(objects, (list, tuple)): - objects = [objects] + if assignment and not isinstance(assignment, (list, tuple)): + assignment = [assignment] assert self._app._aedt_version >= "2021.2", self.logger.error("Object is supported from AEDT 2021 R2.") if not export_path: export_path = self._app.working_directory - if not objects: + if not assignment: self._app.modeler.refresh_all_ids() non_model = self._app.modeler.non_model_objects[:] - objects = [i for i in self._app.modeler.object_names if i not in non_model] + assignment = [i for i in self._app.modeler.object_names if i not in non_model] if not air_objects: - objects = [ + assignment = [ i - for i in objects + for i in assignment if not self._app.modeler[i].is3d or ( self._app.modeler[i].material_name.lower() != "vacuum" @@ -3802,7 +3816,7 @@ def export_model_obj(self, objects=None, export_path=None, export_as_single_obje ] if export_as_single_objects: files_exported = [] - for el in objects: + for el in assignment: fname = os.path.join(export_path, "{}.obj".format(el)) self._app.modeler.oeditor.ExportModelMeshToFile(fname, [el]) @@ -3819,7 +3833,7 @@ def export_model_obj(self, objects=None, export_path=None, export_as_single_obje return files_exported else: fname = os.path.join(export_path, "Model_AllObjs_AllMats.obj") - self._app.modeler.oeditor.ExportModelMeshToFile(fname, objects) + self._app.modeler.oeditor.ExportModelMeshToFile(fname, assignment) return [[fname, "aquamarine", 0.3]] @pyaedt_function_handler() @@ -4851,8 +4865,9 @@ def sample_waveform( Examples -------- - >>> aedtapp = Circuit() - >>> aedtapp.post.sample_ami_waveform(setup_name,probe_name,source_name,aedtapp.available_variations.nominal) + >>> from pyaedt import Circuit + >>> circuit = Circuit() + >>> circuit.post.sample_ami_waveform(setup_name,probe_name,source_name,circuit.available_variations.nominal) """ @@ -4944,8 +4959,8 @@ def sample_ami_waveform( Examples -------- - >>> aedtapp = Circuit() - >>> aedtapp.post.sample_ami_waveform(setupname,probe_name,source_name,aedtapp.available_variations.nominal) + >>> circuit = Circuit() + >>> circuit.post.sample_ami_waveform(setupname,probe_name,source_name,circuit.available_variations.nominal) """ initial_solution_type = self.post_solution_type @@ -5182,14 +5197,14 @@ def get_field_summary_data(self, setup_name=None, design_variation={}, intrinsic return pd.DataFrame.from_dict(out_dict) return out_dict - @pyaedt_function_handler(filename="file_name", design_variation="variations") - def export_csv(self, file_name, setup_name=None, variations={}, intrinsics=""): + @pyaedt_function_handler(filename="output_file", design_variation="variations") + def export_csv(self, output_file, setup_name=None, variations={}, intrinsics=""): """ Get the field summary output computation. Parameters ---------- - file_name : str + output_file : str Path and filename to write the output file to. setup_name : str, optional Setup name to use for the computation. The @@ -5219,7 +5234,7 @@ def export_csv(self, file_name, setup_name=None, variations={}, intrinsics=""): "DesignVariationKey:=", dv_string, "ExportFileName:=", - file_name, + output_file, "IntrinsicValue:=", intrinsics, ] From 126a6c8ef9a6af5595a8d14860a50373ba295def Mon Sep 17 00:00:00 2001 From: Giulia Malinverno Date: Wed, 10 Apr 2024 17:52:55 +0200 Subject: [PATCH 2/4] args --- _unittest_solvers/test_00_analyze.py | 24 ++++----- .../03-Maxwell/Maxwell2D_Electrostatic.py | 2 +- pyaedt/modules/PostProcessor.py | 49 +++++++++---------- 3 files changed, 37 insertions(+), 38 deletions(-) diff --git a/_unittest_solvers/test_00_analyze.py b/_unittest_solvers/test_00_analyze.py index bd97e7a49d4..daf29ecd170 100644 --- a/_unittest_solvers/test_00_analyze.py +++ b/_unittest_solvers/test_00_analyze.py @@ -185,11 +185,12 @@ def test_02_hfss_export_results(self, hfss_app): assert len(exported_files) > 0 fld_file1 = os.path.join(self.local_scratch.path, "test_fld_hfss1.fld") - assert hfss_app.post.export_field_file(quantity="Mag_E", file_name=fld_file1, objects="Box1", intrinsics="1GHz", - phase="5deg") + assert hfss_app.post.export_field_file(quantity="Mag_E", output_dir=fld_file1, assignment="Box1", + intrinsics="1GHz", phase="5deg") assert os.path.exists(fld_file1) fld_file2 = os.path.join(self.local_scratch.path, "test_fld_hfss2.fld") - assert hfss_app.post.export_field_file(quantity="Mag_E", file_name=fld_file2, objects="Box1", intrinsics="1GHz") + assert hfss_app.post.export_field_file(quantity="Mag_E", output_dir=fld_file2, assignment="Box1", + intrinsics="1GHz") assert os.path.exists(fld_file2) def test_03a_icepak_analyze_and_export_summary(self): @@ -291,26 +292,26 @@ def test_03d_icepak_eval_tempc(self): def test_03e_icepak_ExportFLDFil(self): fld_file = os.path.join(self.local_scratch.path, "test_fld.fld") self.icepak_app.post.export_field_file(quantity="Temp", solution=self.icepak_app.nominal_sweep, variations={}, - file_name=fld_file, objects="box") + output_dir=fld_file, assignment="box") assert os.path.exists(fld_file) fld_file_1 = os.path.join(self.local_scratch.path, "test_fld_1.fld") sample_points_file = os.path.join(local_path, "example_models", test_subfolder, "temp_points.pts") self.icepak_app.post.export_field_file(quantity="Temp", solution=self.icepak_app.nominal_sweep, variations=self.icepak_app.available_variations.nominal_w_values_dict, - file_name=fld_file_1, objects="box", + output_dir=fld_file_1, assignment="box", sample_points_file=sample_points_file) assert os.path.exists(fld_file_1) fld_file_2 = os.path.join(self.local_scratch.path, "test_fld_2.fld") self.icepak_app.post.export_field_file(quantity="Temp", solution=self.icepak_app.nominal_sweep, variations=self.icepak_app.available_variations.nominal_w_values_dict, - file_name=fld_file_2, objects="box", + output_dir=fld_file_2, assignment="box", sample_points=[[0, 0, 0], [3, 6, 8], [4, 7, 9]]) assert os.path.exists(fld_file_2) cs = self.icepak_app.modeler.create_coordinate_system() fld_file_3 = os.path.join(self.local_scratch.path, "test_fld_3.fld") self.icepak_app.post.export_field_file(quantity="Temp", solution=self.icepak_app.nominal_sweep, variations=self.icepak_app.available_variations.nominal_w_values_dict, - file_name=fld_file_3, objects="box", + output_dir=fld_file_3, assignment="box", sample_points=[[0, 0, 0], [3, 6, 8], [4, 7, 9]], reference_coordinate_system=cs.name, export_in_si_system=False, export_field_in_reference=False) @@ -415,17 +416,18 @@ def test_07_export_maxwell_fields(self, m3dtransient): m3dtransient.analyze(m3dtransient.active_setup, num_cores=2) fld_file_3 = os.path.join(self.local_scratch.path, "test_fld_3.fld") assert m3dtransient.post.export_field_file(quantity="Mag_B", solution=m3dtransient.nominal_sweep, variations={}, - file_name=fld_file_3, objects="Coil_A2", objects_type="Surf", + output_dir=fld_file_3, assignment="Coil_A2", objects_type="Surf", intrinsics="10ms") assert os.path.exists(fld_file_3) fld_file_4 = os.path.join(self.local_scratch.path, "test_fld_4.fld") assert not m3dtransient.post.export_field_file(quantity="Mag_B", solution=m3dtransient.nominal_sweep, variations=m3dtransient.available_variations.nominal_w_values_dict, - file_name=fld_file_4, objects="Coil_A2", objects_type="invalid") + output_dir=fld_file_4, assignment="Coil_A2", + objects_type="invalid") setup = m3dtransient.setups[0] m3dtransient.setups[0].delete() - assert not m3dtransient.post.export_field_file(quantity="Mag_B", variations={}, file_name=fld_file_4, - objects="Coil_A2") + assert not m3dtransient.post.export_field_file(quantity="Mag_B", variations={}, output_dir=fld_file_4, + assignment="Coil_A2") new_setup = m3dtransient.create_setup(name=setup.name, setup_type=setup.setuptype) new_setup.props = setup.props diff --git a/examples/03-Maxwell/Maxwell2D_Electrostatic.py b/examples/03-Maxwell/Maxwell2D_Electrostatic.py index 18b3eca5f3f..eed6c3c126a 100644 --- a/examples/03-Maxwell/Maxwell2D_Electrostatic.py +++ b/examples/03-Maxwell/Maxwell2D_Electrostatic.py @@ -196,7 +196,7 @@ # Export field line traces plot. # For field lint traces plot, the export file format is ``.fldplt``. -M2D.post.export_field_plot(plot_name="LineTracesTest", file_path=M2D.toolkit_directory, file_format="fldplt") +M2D.post.export_field_plot(plot_name="LineTracesTest", output_dir=M2D.toolkit_directory, file_format="fldplt") ########################################################## # Export a field plot to an image file diff --git a/pyaedt/modules/PostProcessor.py b/pyaedt/modules/PostProcessor.py index c190e640092..3744fec9961 100644 --- a/pyaedt/modules/PostProcessor.py +++ b/pyaedt/modules/PostProcessor.py @@ -2716,8 +2716,8 @@ def export_field_file_on_grid( @pyaedt_function_handler( quantity_name="quantity", variation_dict="variations", - filename="file_name", - obj_list="objects", + filename="output_dir", + obj_list="assignment", obj_type="objects_type", sample_points_lists="sample_points", ) @@ -2726,8 +2726,8 @@ def export_field_file( quantity, solution=None, variations=None, - file_name=None, - objects="AllObjects", + output_dir=None, + assignment="AllObjects", objects_type="Vol", intrinsics=None, phase=None, @@ -2750,10 +2750,10 @@ def export_field_file( variations : dict, optional Dictionary of all variation variables with their values. The default is ``None``. - file_name : str, optional + output_dir : str, optional Full path and name to save the file to. The default is ``None`` which export file in working_directory. - objects : str, optional + assignment : str, optional List of objects to export. The default is ``"AllObjects"``. objects_type : str, optional Type of objects to export. The default is ``"Vol"``. @@ -2803,12 +2803,12 @@ def export_field_file( self.logger.error("There are no existing sweeps.") return False solution = self._app.existing_analysis_sweeps[0] - if not file_name: + if not output_dir: appendix = "" ext = ".fld" - file_name = os.path.join(self._app.working_directory, solution.replace(" : ", "_") + appendix + ext) + output_dir = os.path.join(self._app.working_directory, solution.replace(" : ", "_") + appendix + ext) else: - file_name = file_name.replace("//", "/").replace("\\", "/") + output_dir = output_dir.replace("//", "/").replace("\\", "/") self.ofieldsreporter.CalcStack("clear") try: self.ofieldsreporter.EnterQty(quantity) @@ -2837,14 +2837,14 @@ def export_field_file( variation.append("0deg") if not sample_points_file and not sample_points: if objects_type == "Vol": - self.ofieldsreporter.EnterVol(objects) + self.ofieldsreporter.EnterVol(assignment) elif objects_type == "Surf": - self.ofieldsreporter.EnterSurf(objects) + self.ofieldsreporter.EnterSurf(assignment) else: self.logger.error("No correct choice.") return False self.ofieldsreporter.CalcOp("Value") - self.ofieldsreporter.CalculatorWrite(file_name, ["Solution:=", solution], variation) + self.ofieldsreporter.CalculatorWrite(output_dir, ["Solution:=", solution], variation) elif sample_points_file: export_options = [ "NAME:ExportOption", @@ -2858,7 +2858,7 @@ def export_field_file( export_field_in_reference, ] self.ofieldsreporter.ExportToFile( - file_name, + output_dir, sample_points_file, solution, variation, @@ -2882,32 +2882,29 @@ def export_field_file( export_field_in_reference, ] self.ofieldsreporter.ExportToFile( - file_name, + output_dir, sample_points_file, solution, variation, export_options, ) - if os.path.exists(file_name): - return file_name + if os.path.exists(output_dir): + return output_dir return False # pragma: no cover - @pyaedt_function_handler(plotname="plot_name", filepath="file_path", filename="file_name") - def export_field_plot(self, plot_name, file_path, file_name="", file_format="aedtplt"): + @pyaedt_function_handler(plotname="plot_name", filepath="output_dir", filename="file_name") + def export_field_plot(self, plot_name, output_dir, file_name="", file_format="aedtplt"): """Export a field plot. Parameters ---------- plot_name : str Name of the plot. - - file_path : str + output_dir : str Path for saving the file. - file_name : str, optional Name of the file. The default is ``""``, in which case a name is automatically assigned. - file_format : str, optional Name of the file extension. The default is ``"aedtplt"``. Options are ``"case"`` and ``"fldplt"``. @@ -2922,13 +2919,13 @@ def export_field_plot(self, plot_name, file_path, file_name="", file_format="aed """ if not file_name: file_name = plot_name - file_path = os.path.join(file_path, file_name + "." + file_format) + output_dir = os.path.join(output_dir, file_name + "." + file_format) try: - self.ofieldsreporter.ExportFieldPlot(plot_name, False, file_path) + self.ofieldsreporter.ExportFieldPlot(plot_name, False, output_dir) if settings.remote_rpc_session_temp_folder: # pragma: no cover local_path = os.path.join(settings.remote_rpc_session_temp_folder, file_name + "." + file_format) - file_path = check_and_download_file(local_path, file_path) - return file_path + output_dir = check_and_download_file(local_path, output_dir) + return output_dir except Exception: # pragma: no cover self.logger.error("{} file format is not supported for this plot.".format(file_format)) return False From 7fd40077e5b1c6e1ec2dd45648dee8990e8c4800 Mon Sep 17 00:00:00 2001 From: gmalinve <103059376+gmalinve@users.noreply.github.com> Date: Thu, 11 Apr 2024 12:44:43 +0200 Subject: [PATCH 3/4] Apply suggestions from code review Co-authored-by: Kathy Pippert <84872299+PipKat@users.noreply.github.com> --- pyaedt/modules/PostProcessor.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pyaedt/modules/PostProcessor.py b/pyaedt/modules/PostProcessor.py index 3744fec9961..8bbabee1464 100644 --- a/pyaedt/modules/PostProcessor.py +++ b/pyaedt/modules/PostProcessor.py @@ -218,7 +218,7 @@ def fields(self, expressions=None, setup_name=None, polyline=None): use in the export or ``LastAdaptive``. polyline : str, optional Name of the polyline to plot the field on. - If polyline name is not provided the report might be incorrect. + If a name is not provided, the report might be incorrect. The default value is ``None``. Returns @@ -260,7 +260,7 @@ def cg_fields(self, expressions=None, setup_name=None, polyline=None): use in the export or ``LastAdaptive``. polyline : str, optional Name of the polyline to plot the field on. - If polyline name is not provided the report might be incorrect. + If a name is not provided, the report might be incorrect. The default value is ``None``. Returns @@ -302,7 +302,7 @@ def dc_fields(self, expressions=None, setup_name=None, polyline=None): use in the export or ``LastAdaptive``. polyline : str, optional Name of the polyline to plot the field on. - If polyline name is not provided the report might be incorrect. + If a name is not provided, the report might be incorrect. The default value is ``None``. Returns @@ -344,7 +344,7 @@ def rl_fields(self, expressions=None, setup_name=None, polyline=None): use in the export or ``LastAdaptive``. polyline : str, optional Name of the polyline to plot the field on. - If polyline name is not provided the report might be incorrect. + If a name is not provided, the report might be incorrect. The default value is ``None``. Returns @@ -3724,7 +3724,7 @@ def export_model_picture( @pyaedt_function_handler(expression="expressions", families_dict="sweeps") def get_far_field_data(self, expressions="GainTotal", setup_sweep_name="", domain="Infinite Sphere1", sweeps=None): - """Generate far field data using ``GetSolutionDataPerVariation``. + """Generate far field data using the ``GetSolutionDataPerVariation()`` method. This method returns the data ``solData``, ``ThetaVals``, ``PhiVals``, ``ScanPhiVals``, ``ScanThetaVals``, and From 2157b32f9fffeb3079fcee5896e868d5c1b184e4 Mon Sep 17 00:00:00 2001 From: Giulia Malinverno Date: Thu, 11 Apr 2024 14:06:18 +0200 Subject: [PATCH 4/4] fix comments review --- pyaedt/modules/PostProcessor.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pyaedt/modules/PostProcessor.py b/pyaedt/modules/PostProcessor.py index 8bbabee1464..541e5298274 100644 --- a/pyaedt/modules/PostProcessor.py +++ b/pyaedt/modules/PostProcessor.py @@ -2040,7 +2040,8 @@ def create_report_from_configuration(self, input_file=None, report_settings=None Path to the JSON or TOML file containing report settings. report_settings : dict, optional Dictionary containing report settings. - solution_name : setup name to use. + solution_name : str, optional + Setup name to use. Returns ------- @@ -3113,7 +3114,7 @@ def create_fieldplot_line( Parameters ---------- assignment : list - List of polyline to plot. + List of polylines to plot. quantity : str Name of the quantity to plot. setup_name : str, optional