Skip to content

Commit ca3c5b4

Browse files
authored
Advanced plot refactoring (#1302)
* Fixed method create_3d_plot * Added class FfdData * Added Unit Tests and Docs * Added Example. This example will work from Version 22R2 * Added Unit Test on Array * Improved ModelPlotter and new FfdSolutionData * Removed example since it is working only in 2022R2 * Removed Iropython compatibility issues * fixed test 71 * fixed test 71 Co-authored-by: maxcapodi78 <Shark78>
1 parent b412b2a commit ca3c5b4

File tree

11 files changed

+3093
-1687
lines changed

11 files changed

+3093
-1687
lines changed
637 KB
Binary file not shown.

_unittest/test_12_PostProcessing.py

Lines changed: 103 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
sbr_file = "poc_scat_small"
3535
q3d_file = "via_gsg"
3636
eye_diagram = "SimpleChannel"
37+
array = "array_simple"
3738

3839

3940
class TestClass(BasisTest, object):
@@ -50,6 +51,7 @@ def setup_class(self):
5051
self.q3dtest = BasisTest.add_app(self, project_name=q3d_file, application=Q3d)
5152
self.q2dtest = Q2d(projectname=q3d_file)
5253
self.eye_test = BasisTest.add_app(self, project_name=eye_diagram, application=Circuit)
54+
self.array_test = BasisTest.add_app(self, project_name=array)
5355

5456
def teardown_class(self):
5557
BasisTest.my_teardown(self)
@@ -289,6 +291,7 @@ def test_09_manipulate_report(self):
289291
if not is_ironpython:
290292
assert data.plot(is_polar=True)
291293
assert data.plot_3d()
294+
assert self.field_test.post.create_3d_plot(data)
292295
self.field_test.modeler.create_polyline([[0, 0, 0], [0, 5, 30]], name="Poly1", non_model=True)
293296
variations2 = self.field_test.available_variations.nominal_w_values_dict
294297
variations2["Theta"] = ["All"]
@@ -794,13 +797,6 @@ def test_61_export_mesh(self):
794797
assert os.path.exists(self.q3dtest.export_mesh_stats("Setup1", setup_type="AC RL"))
795798
assert os.path.exists(self.aedtapp.export_mesh_stats("Setup1"))
796799

797-
def test_62_delete_variations(self):
798-
assert self.q3dtest.cleanup_solution()
799-
vars = self.field_test.available_variations.get_variation_strings()
800-
assert self.field_test.available_variations.variations()
801-
assert self.field_test.cleanup_solution(vars, entire_solution=False)
802-
assert self.field_test.cleanup_solution(vars, entire_solution=True)
803-
804800
def test_62_eye_diagram(self):
805801
self.eye_test.analyze_nominal()
806802
rep = self.eye_test.post.reports_by_category.eye_diagram("AEYEPROBE(OutputEye)", "QuickEyeAnalysis")
@@ -890,3 +886,103 @@ def test_70_sweep_from_json(self):
890886
assert self.aedtapp.post.create_report_from_configuration(
891887
os.path.join(local_path, "example_models", "report_json", "Modal_Report.json")
892888
)
889+
890+
@pytest.mark.skipif(is_ironpython, reason="FarFieldSolution not supported by Ironpython")
891+
def test_71_antenna_plot(self):
892+
ffdata = self.field_test.get_antenna_ffd_solution_data(frequencies=30e9, sphere_name="3D")
893+
assert ffdata.plot_farfield_contour(
894+
qty_str="RealizedGain",
895+
convert_to_db=True,
896+
title="Contour at {}Hz".format(ffdata.frequency),
897+
export_image_path=os.path.join(self.local_scratch.path, "contour.jpg"),
898+
)
899+
assert os.path.exists(os.path.join(self.local_scratch.path, "contour.jpg"))
900+
901+
ffdata.plot_2d_cut(
902+
primary_sweep="theta",
903+
secondary_sweep_value=[-180, -75, 75],
904+
qty_str="RealizedGain",
905+
title="Azimuth at {}Hz".format(ffdata.frequency),
906+
convert_to_db=True,
907+
export_image_path=os.path.join(self.local_scratch.path, "2d1.jpg"),
908+
)
909+
assert os.path.exists(os.path.join(self.local_scratch.path, "2d1.jpg"))
910+
ffdata.plot_2d_cut(
911+
primary_sweep="phi",
912+
secondary_sweep_value=30,
913+
qty_str="RealizedGain",
914+
title="Azimuth at {}Hz".format(ffdata.frequency),
915+
convert_to_db=True,
916+
export_image_path=os.path.join(self.local_scratch.path, "2d2.jpg"),
917+
)
918+
919+
assert os.path.exists(os.path.join(self.local_scratch.path, "2d2.jpg"))
920+
921+
ffdata.polar_plot_3d(
922+
qty_str="RealizedGain",
923+
convert_to_db=True,
924+
export_image_path=os.path.join(self.local_scratch.path, "3d1.jpg"),
925+
)
926+
assert os.path.exists(os.path.join(self.local_scratch.path, "3d1.jpg"))
927+
928+
ffdata.polar_plot_3d_pyvista(
929+
qty_str="RealizedGain",
930+
convert_to_db=True,
931+
show=False,
932+
export_image_path=os.path.join(self.local_scratch.path, "3d2.jpg"),
933+
)
934+
assert os.path.exists(os.path.join(self.local_scratch.path, "3d2.jpg"))
935+
936+
@pytest.mark.skipif(is_ironpython, reason="FarFieldSolution not supported by Ironpython")
937+
def test_72_antenna_plot(self):
938+
ffdata = self.array_test.get_antenna_ffd_solution_data(frequencies=3.5e9, sphere_name="3D")
939+
ffdata.frequency = 3.5e9
940+
assert ffdata.plot_farfield_contour(
941+
qty_str="RealizedGain",
942+
convert_to_db=True,
943+
title="Contour at {}Hz".format(ffdata.frequency),
944+
export_image_path=os.path.join(self.local_scratch.path, "contour.jpg"),
945+
)
946+
assert os.path.exists(os.path.join(self.local_scratch.path, "contour.jpg"))
947+
948+
ffdata.plot_2d_cut(
949+
primary_sweep="theta",
950+
secondary_sweep_value=[-180, -75, 75],
951+
qty_str="RealizedGain",
952+
title="Azimuth at {}Hz".format(ffdata.frequency),
953+
convert_to_db=True,
954+
export_image_path=os.path.join(self.local_scratch.path, "2d1.jpg"),
955+
)
956+
assert os.path.exists(os.path.join(self.local_scratch.path, "2d1.jpg"))
957+
ffdata.plot_2d_cut(
958+
primary_sweep="phi",
959+
secondary_sweep_value=30,
960+
qty_str="RealizedGain",
961+
title="Azimuth at {}Hz".format(ffdata.frequency),
962+
convert_to_db=True,
963+
export_image_path=os.path.join(self.local_scratch.path, "2d2.jpg"),
964+
)
965+
966+
assert os.path.exists(os.path.join(self.local_scratch.path, "2d2.jpg"))
967+
968+
ffdata.polar_plot_3d(
969+
qty_str="RealizedGain",
970+
convert_to_db=True,
971+
export_image_path=os.path.join(self.local_scratch.path, "3d1.jpg"),
972+
)
973+
assert os.path.exists(os.path.join(self.local_scratch.path, "3d1.jpg"))
974+
975+
ffdata.polar_plot_3d_pyvista(
976+
qty_str="RealizedGain",
977+
convert_to_db=True,
978+
show=False,
979+
export_image_path=os.path.join(self.local_scratch.path, "3d2.jpg"),
980+
)
981+
assert os.path.exists(os.path.join(self.local_scratch.path, "3d2.jpg"))
982+
983+
def test_z99_delete_variations(self):
984+
assert self.q3dtest.cleanup_solution()
985+
vars = self.field_test.available_variations.get_variation_strings()
986+
assert self.field_test.available_variations.variations()
987+
assert self.field_test.cleanup_solution(vars, entire_solution=False)
988+
assert self.field_test.cleanup_solution(vars, entire_solution=True)

doc/source/API/Post.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ They are accessible through the ``post`` property:
2020
:nosignatures:
2121

2222
AdvancedPostProcessing.PostProcessor
23-
PostProcessor.SolutionData
24-
PostProcessor.FieldPlot
23+
solutions.SolutionData
24+
solutions.FieldPlot
25+
solutions.FfdSolutionData
2526
AdvancedPostProcessing.ModelPlotter
2627
report_templates.Trace
2728
report_templates.LimitLine

pyaedt/application/Analysis.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -969,7 +969,7 @@ def nominal_w_values(self):
969969

970970
@property
971971
def nominal_w_values_dict(self):
972-
"""Nominal with values in a dictionary.
972+
"""Nominal independent with values in a dictionary.
973973
974974
References
975975
----------
@@ -984,6 +984,23 @@ def nominal_w_values_dict(self):
984984

985985
return families
986986

987+
@property
988+
def nominal_w_values_dict_w_dependent(self):
989+
"""Nominal with values in a dictionary.
990+
991+
References
992+
----------
993+
994+
>>> oDesign.GetChildObject('Variables').GetChildNames
995+
>>> oDesign.GetVariables
996+
>>> oDesign.GetVariableValue
997+
>>> oDesign.GetNominalVariation"""
998+
families = {}
999+
for k, v in list(self._app.variable_manager.variables.items()):
1000+
families[k] = v.expression
1001+
1002+
return families
1003+
9871004
@property
9881005
def all(self):
9891006
"""List of all independent variables with `["All"]` value."""

pyaedt/circuit.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1000,7 +1000,7 @@ def get_touchstone_data(self, curvenames, solution_name=None, variation_dict=Non
10001000
10011001
Returns
10021002
-------
1003-
:class:`pyaedt.modules.PostProcessor.SolutionData`
1003+
:class:`pyaedt.modules.solutions.SolutionData`
10041004
Class containing all Requested Data
10051005
10061006
References

0 commit comments

Comments
 (0)