Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

assignment + docstrings - PostProcessor refacto #4480

Merged
merged 5 commits into from
Apr 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions _unittest/test_12_1_PostProcessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -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={},
Expand Down Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions _unittest/test_12_PostProcessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
)
Expand Down
24 changes: 13 additions & 11 deletions _unittest_solvers/test_00_analyze.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion examples/03-Maxwell/Maxwell2D_Electrostatic.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion examples/03-Maxwell/Maxwell2D_PMSynchronousMotor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

##########################################################
Expand Down
2 changes: 1 addition & 1 deletion examples/06-Multiphysics/Hfss_Mechanical.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion examples/06-Multiphysics/MRI.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion examples/06-Multiphysics/Maxwell3D_Icepak_2Way_Coupling.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
8 changes: 4 additions & 4 deletions examples/07-Circuit/Reports.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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)
###############################################################################
Expand All @@ -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)

Expand All @@ -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)

Expand Down
4 changes: 2 additions & 2 deletions pyaedt/generic/compliance.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
Expand Down Expand Up @@ -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()
Expand Down
6 changes: 3 additions & 3 deletions pyaedt/modules/AdvancedPostProcessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down Expand Up @@ -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()
Expand Down
Loading
Loading