Skip to content

Commit

Permalink
Refactor ffd solution data (#3896)
Browse files Browse the repository at this point in the history
* refactor of FfdSolutionData

* Fix typo

* Far Field solution data refactoring

* Fix logger issue

* Remove installation batch

* Add deprecation warning

* Farfield beamform refactoring

* Farfield beamform refactoring

* Multi frequency support

* Array refactorin I

* Delete 2Beams method because it was not used and tested

* Is polar option

* PyVista modification

* PyVista modification

* Beamforming refactoring

* Beamforming refactoring

* Pyvista array plot

* Pyvista array plot

* Pyvista scale fix

* Create geometries on each frequency folder

* Taper fix

* Remove old properties

* Fix array orientation depending on Lattice vector

* Remove SBR array old argument

* Fix example

* Fix typo

* Update pyaedt/modules/solutions.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fix codacy

* New unit test to improve coverage

* Fix Ironpython compatibility

* Update pyaedt/modules/solutions.py

Co-authored-by: Kathy Pippert <[email protected]>

* Update pyaedt/generic/general_methods.py

Co-authored-by: Kathy Pippert <[email protected]>

* Update pyaedt/modules/solutions.py

Co-authored-by: Kathy Pippert <[email protected]>

* Update pyaedt/modules/solutions.py

Co-authored-by: Kathy Pippert <[email protected]>

* Update pyaedt/modules/solutions.py

Co-authored-by: Kathy Pippert <[email protected]>

* Update pyaedt/modules/solutions.py

Co-authored-by: Kathy Pippert <[email protected]>

* Update pyaedt/modules/solutions.py

Co-authored-by: Kathy Pippert <[email protected]>

* Update pyaedt/modules/solutions.py

Co-authored-by: Kathy Pippert <[email protected]>

* Update pyaedt/modules/solutions.py

Co-authored-by: Kathy Pippert <[email protected]>

* Update pyaedt/modules/solutions.py

Co-authored-by: Kathy Pippert <[email protected]>

* Update pyaedt/modules/solutions.py

Co-authored-by: Kathy Pippert <[email protected]>

* Update pyaedt/modules/solutions.py

Co-authored-by: Kathy Pippert <[email protected]>

* Update pyaedt/modules/solutions.py

Co-authored-by: Kathy Pippert <[email protected]>

* Update pyaedt/modules/solutions.py

Co-authored-by: Kathy Pippert <[email protected]>

* Update pyaedt/modules/solutions.py

Co-authored-by: Kathy Pippert <[email protected]>

* Update pyaedt/modules/solutions.py

Co-authored-by: Kathy Pippert <[email protected]>

* Update pyaedt/modules/solutions.py

Co-authored-by: Kathy Pippert <[email protected]>

* Update pyaedt/modules/solutions.py

Co-authored-by: Kathy Pippert <[email protected]>

* Update pyaedt/modules/solutions.py

Co-authored-by: Kathy Pippert <[email protected]>

* Update pyaedt/modules/solutions.py

Co-authored-by: Kathy Pippert <[email protected]>

* Update pyaedt/modules/solutions.py

Co-authored-by: Kathy Pippert <[email protected]>

* Update pyaedt/modules/solutions.py

Co-authored-by: Kathy Pippert <[email protected]>

* Update pyaedt/modules/solutions.py

Co-authored-by: Kathy Pippert <[email protected]>

* Update pyaedt/modules/solutions.py

Co-authored-by: Kathy Pippert <[email protected]>

* Update pyaedt/modules/solutions.py

Co-authored-by: Kathy Pippert <[email protected]>

* Update pyaedt/modules/solutions.py

Co-authored-by: Kathy Pippert <[email protected]>

* Update pyaedt/modules/solutions.py

Co-authored-by: Kathy Pippert <[email protected]>

* Update pyaedt/generic/general_methods.py

Co-authored-by: Kathy Pippert <[email protected]>

* Update pyaedt/generic/general_methods.py

Co-authored-by: Kathy Pippert <[email protected]>

* Update pyaedt/generic/plot.py

Co-authored-by: Kathy Pippert <[email protected]>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update pyaedt/hfss.py

Co-authored-by: Kathy Pippert <[email protected]>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update pyaedt/hfss.py

Co-authored-by: Kathy Pippert <[email protected]>

* Update pyaedt/modules/solutions.py

Co-authored-by: Kathy Pippert <[email protected]>

* Update pyaedt/modules/solutions.py

Co-authored-by: Kathy Pippert <[email protected]>

* Update pyaedt/modules/solutions.py

Co-authored-by: Kathy Pippert <[email protected]>

* Update pyaedt/modules/solutions.py

Co-authored-by: Kathy Pippert <[email protected]>

* Update pyaedt/modules/solutions.py

Co-authored-by: Kathy Pippert <[email protected]>

* Update pyaedt/modules/solutions.py

Co-authored-by: Kathy Pippert <[email protected]>

* Update pyaedt/modules/solutions.py

Co-authored-by: Kathy Pippert <[email protected]>

* Update pyaedt/modules/solutions.py

Co-authored-by: Kathy Pippert <[email protected]>

* Update pyaedt/modules/solutions.py

Co-authored-by: Kathy Pippert <[email protected]>

* Update pyaedt/modules/solutions.py

Co-authored-by: Kathy Pippert <[email protected]>

* Update pyaedt/modules/solutions.py

Co-authored-by: Kathy Pippert <[email protected]>

* Update pyaedt/modules/solutions.py

Co-authored-by: Kathy Pippert <[email protected]>

* Update pyaedt/modules/solutions.py

Co-authored-by: Kathy Pippert <[email protected]>

* Update pyaedt/modules/solutions.py

Co-authored-by: Kathy Pippert <[email protected]>

* Update pyaedt/modules/solutions.py

Co-authored-by: Kathy Pippert <[email protected]>

* Update pyaedt/modules/solutions.py

Co-authored-by: Kathy Pippert <[email protected]>

* Update pyaedt/modules/solutions.py

Co-authored-by: Kathy Pippert <[email protected]>

* Update pyaedt/modules/solutions.py

Co-authored-by: Kathy Pippert <[email protected]>

* Update pyaedt/modules/solutions.py

Co-authored-by: Kathy Pippert <[email protected]>

* Update pyaedt/modules/solutions.py

Co-authored-by: Kathy Pippert <[email protected]>

* Update pyaedt/modules/solutions.py

Co-authored-by: Kathy Pippert <[email protected]>

* Update pyaedt/modules/solutions.py

Co-authored-by: Kathy Pippert <[email protected]>

* Update pyaedt/modules/solutions.py

Co-authored-by: Kathy Pippert <[email protected]>

* Update pyaedt/modules/solutions.py

Co-authored-by: Kathy Pippert <[email protected]>

* Update pyaedt/modules/solutions.py

Co-authored-by: Kathy Pippert <[email protected]>

* Update pyaedt/modules/solutions.py

Co-authored-by: Kathy Pippert <[email protected]>

* Update pyaedt/modules/solutions.py

Co-authored-by: Kathy Pippert <[email protected]>

* Update pyaedt/modules/solutions.py

Co-authored-by: Kathy Pippert <[email protected]>

* Update pyaedt/modules/solutions.py

Co-authored-by: Kathy Pippert <[email protected]>

* Update pyaedt/modules/solutions.py

Co-authored-by: Kathy Pippert <[email protected]>

* Update pyaedt/modules/solutions.py

Co-authored-by: Kathy Pippert <[email protected]>

* Update pyaedt/modules/solutions.py

Co-authored-by: Kathy Pippert <[email protected]>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update pyaedt/modules/solutions.py

Co-authored-by: Kathy Pippert <[email protected]>

* Update pyaedt/modules/solutions.py

Co-authored-by: Kathy Pippert <[email protected]>

* Update pyaedt/modules/solutions.py

Co-authored-by: Kathy Pippert <[email protected]>

* Update pyaedt/modules/solutions.py

Co-authored-by: Kathy Pippert <[email protected]>

* Update pyaedt/modules/solutions.py

Co-authored-by: Kathy Pippert <[email protected]>

* Update pyaedt/modules/solutions.py

Co-authored-by: Kathy Pippert <[email protected]>

* Update pyaedt/modules/solutions.py

Co-authored-by: Kathy Pippert <[email protected]>

* Update pyaedt/modules/solutions.py

Co-authored-by: Kathy Pippert <[email protected]>

* Update pyaedt/modules/solutions.py

Co-authored-by: Kathy Pippert <[email protected]>

* Fix docstring issues

* Update pyaedt/hfss.py

Co-authored-by: Kathy Pippert <[email protected]>

* Update pyaedt/modules/solutions.py

Co-authored-by: Kathy Pippert <[email protected]>

* Update pyaedt/modules/solutions.py

Co-authored-by: Kathy Pippert <[email protected]>

* Update pyaedt/modules/solutions.py

Co-authored-by: Kathy Pippert <[email protected]>

* Update pyaedt/modules/solutions.py

Co-authored-by: Kathy Pippert <[email protected]>

* Update pyaedt/modules/solutions.py

Co-authored-by: Kathy Pippert <[email protected]>

* Update pyaedt/modules/solutions.py

Co-authored-by: Kathy Pippert <[email protected]>

* Update pyaedt/modules/solutions.py

Co-authored-by: Kathy Pippert <[email protected]>

* Update pyaedt/modules/solutions.py

Co-authored-by: Kathy Pippert <[email protected]>

* Update pyaedt/modules/solutions.py

Co-authored-by: Kathy Pippert <[email protected]>

* Update pyaedt/modules/solutions.py

Co-authored-by: Kathy Pippert <[email protected]>

* Update pyaedt/modules/solutions.py

Co-authored-by: Kathy Pippert <[email protected]>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fix Alphabetize

* Improve conversion_function

* Commit Sebastien suggestions

* Commit Sebastien suggestions

* Update pyaedt/generic/general_methods.py

Co-authored-by: Alberto Di Maria <[email protected]>

* Update pyaedt/generic/general_methods.py

Co-authored-by: Alberto Di Maria <[email protected]>

* Update pyaedt/generic/general_methods.py

Co-authored-by: Alberto Di Maria <[email protected]>

* Update pyaedt/generic/general_methods.py

Co-authored-by: Alberto Di Maria <[email protected]>

* Alberto modifications

* Update pyaedt/generic/general_methods.py

Co-authored-by: Kathy Pippert <[email protected]>

* Update pyaedt/modules/solutions.py

Co-authored-by: Kathy Pippert <[email protected]>

* Update pyaedt/modules/solutions.py

Co-authored-by: Kathy Pippert <[email protected]>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Docstring modification

* Docstring modification

* Update pyaedt/modules/solutions.py

Co-authored-by: Kathy Pippert <[email protected]>

* Update pyaedt/modules/solutions.py

Co-authored-by: Kathy Pippert <[email protected]>

* Docstring modification

* Update pyaedt/modules/solutions.py

Co-authored-by: Kathy Pippert <[email protected]>

* Update pyaedt/modules/solutions.py

Co-authored-by: Kathy Pippert <[email protected]>

* Update pyaedt/modules/solutions.py

Co-authored-by: Kathy Pippert <[email protected]>

* Docstring modification

* Add exception if extra arguemnt is not valid

* Fix examples

* Fix UT

---------

Co-authored-by: maxcapodi78 <Shark78>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Kathy Pippert <[email protected]>
Co-authored-by: Alberto Di Maria <[email protected]>
  • Loading branch information
4 people authored Jan 9, 2024
1 parent 47b0ff9 commit 7c9977c
Show file tree
Hide file tree
Showing 30 changed files with 526,889 additions and 1,187 deletions.
1,091 changes: 1,091 additions & 0 deletions _unittest/example_models/T12/eep/eep.json

Large diffs are not rendered by default.

18 changes: 18 additions & 0 deletions _unittest/example_models/T12/eep/eep.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Source Name File Name X Y Z
A1[3,3]02_Patch1_1:1 eep_1 -1.1999999999999998e-01 -8.3049999999999985e-02 7.6199999999999966e-04
A1[3,4]02_Patch1_1:1 eep_2 -3.9999999999999994e-02 -8.3049999999999985e-02 7.6200000000001353e-04
A1[3,5]02_Patch1_1:1 eep_3 4.0000000000000022e-02 -8.3049999999999985e-02 7.6200000000002741e-04
A1[3,6]02_Patch1_1:1 eep_4 1.2000000000000001e-01 -8.3049999999999985e-02 7.6200000000004129e-04
A1[4,3]02_Patch1_1:1 eep_5 -1.1999999999999998e-01 -3.0499999999999972e-03 7.6199999999998578e-04
A1[4,4]02_Patch1_1:1 eep_6 -3.9999999999999994e-02 -3.0499999999999972e-03 7.6199999999999966e-04
A1[4,5]02_Patch1_1:1 eep_7 4.0000000000000022e-02 -3.0499999999999972e-03 7.6200000000001353e-04
A1[4,6]02_Patch1_1:1 eep_8 1.2000000000000001e-01 -3.0499999999999972e-03 7.6200000000002741e-04
A1[5,3]02_Patch1_1:1 eep_9 -1.1999999999999998e-01 7.6950000000000018e-02 7.6199999999997190e-04
A1[5,4]02_Patch1_1:1 eep_10 -3.9999999999999994e-02 7.6950000000000018e-02 7.6199999999998578e-04
A1[5,5]02_Patch1_1:1 eep_11 4.0000000000000022e-02 7.6950000000000018e-02 7.6199999999999966e-04
A1[5,6]02_Patch1_1:1 eep_12 1.2000000000000001e-01 7.6950000000000018e-02 7.6200000000001353e-04
A1[6,3]02_Patch1_1:1 eep_13 -1.1999999999999998e-01 1.5695000000000001e-01 7.6199999999995802e-04
A1[6,4]02_Patch1_1:1 eep_14 -3.9999999999999994e-02 1.5695000000000001e-01 7.6199999999997190e-04
A1[6,5]02_Patch1_1:1 eep_15 4.0000000000000022e-02 1.5695000000000001e-01 7.6199999999998578e-04
A1[6,6]02_Patch1_1:1 eep_16 1.2000000000000001e-01 1.5695000000000001e-01 7.6199999999999966e-04

32,765 changes: 32,765 additions & 0 deletions _unittest/example_models/T12/eep/eep_1.ffd

Large diffs are not rendered by default.

32,765 changes: 32,765 additions & 0 deletions _unittest/example_models/T12/eep/eep_10.ffd

Large diffs are not rendered by default.

32,765 changes: 32,765 additions & 0 deletions _unittest/example_models/T12/eep/eep_11.ffd

Large diffs are not rendered by default.

32,765 changes: 32,765 additions & 0 deletions _unittest/example_models/T12/eep/eep_12.ffd

Large diffs are not rendered by default.

32,765 changes: 32,765 additions & 0 deletions _unittest/example_models/T12/eep/eep_13.ffd

Large diffs are not rendered by default.

32,765 changes: 32,765 additions & 0 deletions _unittest/example_models/T12/eep/eep_14.ffd

Large diffs are not rendered by default.

32,765 changes: 32,765 additions & 0 deletions _unittest/example_models/T12/eep/eep_15.ffd

Large diffs are not rendered by default.

32,765 changes: 32,765 additions & 0 deletions _unittest/example_models/T12/eep/eep_16.ffd

Large diffs are not rendered by default.

32,765 changes: 32,765 additions & 0 deletions _unittest/example_models/T12/eep/eep_2.ffd

Large diffs are not rendered by default.

32,765 changes: 32,765 additions & 0 deletions _unittest/example_models/T12/eep/eep_3.ffd

Large diffs are not rendered by default.

32,765 changes: 32,765 additions & 0 deletions _unittest/example_models/T12/eep/eep_4.ffd

Large diffs are not rendered by default.

32,765 changes: 32,765 additions & 0 deletions _unittest/example_models/T12/eep/eep_5.ffd

Large diffs are not rendered by default.

32,765 changes: 32,765 additions & 0 deletions _unittest/example_models/T12/eep/eep_6.ffd

Large diffs are not rendered by default.

32,765 changes: 32,765 additions & 0 deletions _unittest/example_models/T12/eep/eep_7.ffd

Large diffs are not rendered by default.

32,765 changes: 32,765 additions & 0 deletions _unittest/example_models/T12/eep/eep_8.ffd

Large diffs are not rendered by default.

32,765 changes: 32,765 additions & 0 deletions _unittest/example_models/T12/eep/eep_9.ffd

Large diffs are not rendered by default.

93 changes: 74 additions & 19 deletions _unittest/test_12_PostProcessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from pyaedt.generic.general_methods import is_linux
from pyaedt.generic.plot import _parse_aedtplt
from pyaedt.generic.plot import _parse_streamline
from pyaedt.modules.solutions import FfdSolutionData

if config["desktopVersion"] > "2022.2":
test_field_name = "Potter_Horn_231"
Expand Down Expand Up @@ -552,15 +553,73 @@ def test_69_spectral_from_json(self, circuit_test):
os.path.join(local_path, "example_models", "report_json", "Spectral_Report.json"), solution_name="Transient"
)

def test_70_far_field_data(self):
local_path = os.path.dirname(os.path.realpath(__file__))
eep_file1 = os.path.join(local_path, "example_models", test_subfolder, "eep", "eep.txt")
eep_file2 = os.path.join(local_path, "example_models", test_subfolder, "eep", "eep.txt")
frequencies = [0.9e9, "0.9GHz"]
eep_files = [eep_file1, eep_file2]

ffdata = FfdSolutionData(frequencies=frequencies[1], eep_files=eep_file1)
assert len(ffdata.frequencies) == 1

ffdata = FfdSolutionData(frequencies=frequencies, eep_files=eep_files)
assert len(ffdata.frequencies) == 2
farfield = ffdata.combine_farfield()
assert "rETheta" in farfield

ffdata.taper = "cosine"
assert ffdata.combine_farfield()
ffdata.taper = "taper"
assert not ffdata.taper == "taper"

ffdata.origin = [0, 2]
assert ffdata.origin != [0, 2]
ffdata.origin = [0, 0, 1]
assert ffdata.origin == [0, 0, 1]

img1 = os.path.join(self.local_scratch.path, "ff_2d1.jpg")
ffdata.plot_2d_cut(secondary_sweep_value="all", primary_sweep="Theta", export_image_path=img1)
assert os.path.exists(img1)
img2 = os.path.join(self.local_scratch.path, "ff_2d2.jpg")
ffdata.plot_2d_cut(secondary_sweep_value=[0, 1], export_image_path=img2)
assert os.path.exists(img2)
img3 = os.path.join(self.local_scratch.path, "ff_2d2.jpg")
ffdata.plot_2d_cut(export_image_path=img3)
assert os.path.exists(img3)
curve_2d = ffdata.plot_2d_cut(show=False)
assert len(curve_2d[0]) == 3
data = ffdata.polar_plot_3d(show=False)
assert len(data) == 3

img4 = os.path.join(self.local_scratch.path, "ff_3d1.jpg")
ffdata.polar_plot_3d_pyvista(
farfield_quantity="RealizedGain",
convert_to_db=True,
show=False,
export_image_path=img4,
background=[255, 0, 0],
show_geometry=False,
)
assert os.path.exists(img4)
data_pyvista = ffdata.polar_plot_3d_pyvista(
farfield_quantity="RealizedGain",
convert_to_db=True,
show=False,
background=[255, 0, 0],
show_geometry=False,
)
assert data_pyvista

@pytest.mark.skipif(is_linux or sys.version_info < (3, 8), reason="FarFieldSolution not supported by IronPython")
def test_71_antenna_plot(self, field_test):
ffdata = field_test.get_antenna_ffd_solution_data(frequencies=30e9, sphere_name="3D")
ffdata.phase_offset = [0, 90, 0, 90]
assert ffdata.phase_offset == [0.0]
ffdata.phase_offset = [90]
ffdata.phase_offset = [0, 90]
assert ffdata.phase_offset == [0, 90]
ffdata.phase_offset = [0]
assert ffdata.phase_offset != [0.0]
assert ffdata.plot_farfield_contour(
qty_str="RealizedGain",
farfield_quantity="RealizedGain",
convert_to_db=True,
title="Contour at {}Hz".format(ffdata.frequency),
export_image_path=os.path.join(self.local_scratch.path, "contour.jpg"),
Expand All @@ -570,40 +629,38 @@ def test_71_antenna_plot(self, field_test):
ffdata.plot_2d_cut(
primary_sweep="theta",
secondary_sweep_value=[-180, -75, 75],
qty_str="RealizedGain",
farfield_quantity="RealizedGain",
title="Azimuth at {}Hz".format(ffdata.frequency),
convert_to_db=True,
export_image_path=os.path.join(self.local_scratch.path, "2d1.jpg"),
)
assert os.path.exists(os.path.join(self.local_scratch.path, "2d1.jpg"))
ffdata.plot_2d_cut(
primary_sweep="phi",
secondary_sweep_value=30,
qty_str="RealizedGain",
farfield_quantity="RealizedGain",
title="Azimuth at {}Hz".format(ffdata.frequency),
convert_to_db=True,
export_image_path=os.path.join(self.local_scratch.path, "2d2.jpg"),
)

assert os.path.exists(os.path.join(self.local_scratch.path, "2d2.jpg"))

ffdata.polar_plot_3d(
qty_str="RealizedGain",
farfield_quantity="RealizedGain",
convert_to_db=True,
export_image_path=os.path.join(self.local_scratch.path, "3d1.jpg"),
)
assert os.path.exists(os.path.join(self.local_scratch.path, "3d1.jpg"))

ffdata.polar_plot_3d_pyvista(
qty_str="RealizedGain",
farfield_quantity="RealizedGain",
convert_to_db=True,
show=False,
export_image_path=os.path.join(self.local_scratch.path, "3d2.jpg"),
)
assert os.path.exists(os.path.join(self.local_scratch.path, "3d2.jpg"))

try:
p = ffdata.polar_plot_3d_pyvista(qty_str="RealizedGain", convert_to_db=True, show=False)
p = ffdata.polar_plot_3d_pyvista(farfield_quantity="RealizedGain", convert_to_db=True, show=False)
assert isinstance(p, object)
except:
assert True
Expand All @@ -613,7 +670,7 @@ def test_72_antenna_plot(self, array_test):
ffdata = array_test.get_antenna_ffd_solution_data(frequencies=3.5e9, sphere_name="3D")
ffdata.frequency = 3.5e9
assert ffdata.plot_farfield_contour(
qty_str="RealizedGain",
farfield_quantity="RealizedGain",
convert_to_db=True,
title="Contour at {}Hz".format(ffdata.frequency),
export_image_path=os.path.join(self.local_scratch.path, "contour.jpg"),
Expand All @@ -623,40 +680,38 @@ def test_72_antenna_plot(self, array_test):
ffdata.plot_2d_cut(
primary_sweep="theta",
secondary_sweep_value=[-180, -75, 75],
qty_str="RealizedGain",
farfield_quantity="RealizedGain",
title="Azimuth at {}Hz".format(ffdata.frequency),
convert_to_db=True,
export_image_path=os.path.join(self.local_scratch.path, "2d1.jpg"),
)
assert os.path.exists(os.path.join(self.local_scratch.path, "2d1.jpg"))
ffdata.plot_2d_cut(
primary_sweep="phi",
secondary_sweep_value=30,
qty_str="RealizedGain",
farfield_quantity="RealizedGain",
title="Azimuth at {}Hz".format(ffdata.frequency),
convert_to_db=True,
export_image_path=os.path.join(self.local_scratch.path, "2d2.jpg"),
)

assert os.path.exists(os.path.join(self.local_scratch.path, "2d2.jpg"))

ffdata.polar_plot_3d(
qty_str="RealizedGain",
farfield_quantity="RealizedGain",
convert_to_db=True,
export_image_path=os.path.join(self.local_scratch.path, "3d1.jpg"),
)
assert os.path.exists(os.path.join(self.local_scratch.path, "3d1.jpg"))

ffdata.polar_plot_3d_pyvista(
qty_str="RealizedGain",
farfield_quantity="RealizedGain",
convert_to_db=True,
show=False,
export_image_path=os.path.join(self.local_scratch.path, "3d2.jpg"),
)
assert os.path.exists(os.path.join(self.local_scratch.path, "3d2.jpg"))
ffdata1 = array_test.get_antenna_ffd_solution_data(frequencies=3.5e9, sphere_name="3D", overwrite=False)
assert ffdata1.plot_farfield_contour(
qty_str="RealizedGain",
farfield_quantity="RealizedGain",
convert_to_db=True,
title="Contour at {}Hz".format(ffdata1.frequency),
export_image_path=os.path.join(self.local_scratch.path, "contour1.jpg"),
Expand Down
10 changes: 10 additions & 0 deletions _unittest/test_20_HFSS.py
Original file line number Diff line number Diff line change
Expand Up @@ -1575,6 +1575,12 @@ def test_65_component_array(self, add_app):

assert array.b_size == 8

assert array.a_length == 0.64

assert array.b_length == 0.64

assert len(array.lattice_vector()) == 6

assert array.padding_cells == 0
array.padding_cells = 2
assert oarray.GetPropValue("Padding") == "2"
Expand All @@ -1589,6 +1595,10 @@ def test_65_component_array(self, add_app):
assert len(array_info) == 4
assert array_info["component"][1] == "02_Patch1"

assert len(array.get_component_objects()) == 4

assert len(array.get_cell_position()) == array.a_size

# Delete 3D Component
hfss_array.modeler.user_defined_components["03_Radome_Side1"].delete()
array.update_properties()
Expand Down
9 changes: 4 additions & 5 deletions _unittest_solvers/test_00_analyze.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def hfss_app(add_app):
yield app
app.close_project(save_project=False)


@pytest.fixture(scope="class")
def icepak_app(add_app):
app = add_app(application=Icepak, design_name="SolveTest")
Expand Down Expand Up @@ -99,18 +99,17 @@ def test_01a_sbr_link_array(self, sbr_platform, array):
primary_sweep="theta",
secondary_sweep_value=[75],
theta_scan=20,
qty_str="RealizedGain",
farfield_quantity="RealizedGain",
title="Azimuth at {}Hz".format(ffdata.frequency),
convert_to_db=True,
quantity_format="dB10",
export_image_path=os.path.join(self.local_scratch.path, "2d1_array.jpg"),
)
assert os.path.exists(os.path.join(self.local_scratch.path, "2d1_array.jpg"))

ffdata2.polar_plot_3d_pyvista(
qty_str="RealizedGain",
farfield_quantity="RealizedGain",
convert_to_db=True,
show=False,
position=[-0.11749961434125, -1.68, 0.20457438854331],
rotation=[[1, 0.0, 0.0], [0.0, 0.0, 1.0], [0.0, 1.0, 0.0]],
export_image_path=os.path.join(self.local_scratch.path, "3d2_array.jpg"),
)
Expand Down
52 changes: 35 additions & 17 deletions examples/02-HFSS/Array.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

import os
import pyaedt
from pyaedt.modules.solutions import FfdSolutionData

##########################################################
# Set non-graphical mode
Expand Down Expand Up @@ -93,7 +94,34 @@
# Generate a contour plot. You can define the Theta scan
# and Phi scan.

ffdata.plot_farfield_contour(qty_str='RealizedGain', convert_to_db=True,
ffdata.plot_farfield_contour(farfield_quantity='RealizedGain',
title='Contour at {}Hz'.format(ffdata.frequency))

##########################################################
# Release AEDT
# ~~~~~~~~~~~~
# Release AEDT.
# Far field post-processing can be performed without AEDT because the data is stored.

eep_file = ffdata.eep_files
frequencies = ffdata.frequencies

hfss.release_desktop()

##########################################################
# Load far field data
# ~~~~~~~~~~~~~~~~~~~
# Load far field data stored.

ffdata = FfdSolutionData(frequencies=frequencies[0], eep_files=eep_file[0])

##########################################################
# Generate contour plot
# ~~~~~~~~~~~~~~~~~~~~~
# Generate a contour plot. You can define the Theta scan
# and Phi scan.

ffdata.plot_farfield_contour(farfield_quantity='RealizedGain',
title='Contour at {}Hz'.format(ffdata.frequency))

##########################################################
Expand All @@ -103,23 +131,22 @@
# and Phi scan.

ffdata.plot_2d_cut(primary_sweep='theta', secondary_sweep_value=[-180, -75, 75],
qty_str='RealizedGain',
farfield_quantity='RealizedGain',
title='Azimuth at {}Hz'.format(ffdata.frequency),
convert_to_db=True)
quantity_format="dB10")

ffdata.plot_2d_cut(primary_sweep="phi", secondary_sweep_value=30,
qty_str='RealizedGain',
farfield_quantity='RealizedGain',
title='Elevation',
convert_to_db=True)
quantity_format="dB10")

##########################################################
# Generate 3D polar plots in Matplotlib
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Generate 3D polar plots in Matplotlib. You can define
# the Theta scan and Phi scan.

ffdata.polar_plot_3d(qty_str='RealizedGain',
convert_to_db=True)
ffdata.polar_plot_3d(farfield_quantity='RealizedGain')

##########################################################
# Generate 3D plots in PyVista
Expand All @@ -128,14 +155,5 @@
# scan angles. You can change the easy-to-use interactive plot
# that is generated on the fly.

ffdata.polar_plot_3d_pyvista(qty_str='RealizedGain',
convert_to_db=True,
export_image_path=os.path.join(hfss.working_directory, "picture.jpg"),
ffdata.polar_plot_3d_pyvista(farfield_quantity='RealizedGain',
show=False)

##########################################################
# Release AEDT
# ~~~~~~~~~~~~
# Release AEDT.

hfss.release_desktop()
Loading

0 comments on commit 7c9977c

Please sign in to comment.