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

Hfss argument refactoring #4481

Merged
merged 40 commits into from
Apr 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
cbe7b40
refactored all hfss.py arguments
Apr 9, 2024
27b81cb
Merge branch 'main' into hfss_argument_refactoring
Samuelopez-ansys Apr 10, 2024
d771a90
Parameter unification in HFSS and Sweep
Samuelopez-ansys Apr 10, 2024
9f52cb3
Setupname fix it to name
Samuelopez-ansys Apr 10, 2024
44223b1
Merge branch 'main' into hfss_argument_refactoring
Samuelopez-ansys Apr 10, 2024
c53b2d3
Fix bug
Samuelopez-ansys Apr 10, 2024
3484886
Fix hfss tests
Samuelopez-ansys Apr 10, 2024
8f8c26a
Merge branch 'main' into hfss_argument_refactoring
Samuelopez-ansys Apr 10, 2024
67e44fb
Mechanical setupname
Samuelopez-ansys Apr 10, 2024
25423fc
HFSS setupname
Samuelopez-ansys Apr 10, 2024
4ea5e31
Postprocessor setupname
Samuelopez-ansys Apr 10, 2024
e0a40db
Q3D setupname
Samuelopez-ansys Apr 10, 2024
b5c3014
PipKat comments merge
Samuelopez-ansys Apr 10, 2024
5a59019
Merge branch 'main' into hfss_argument_refactoring
Samuelopez-ansys Apr 10, 2024
0907661
Fix HFSS issue
Samuelopez-ansys Apr 10, 2024
98c589a
Fix HFSS issue
Samuelopez-ansys Apr 10, 2024
29f0421
Fix SolveSetup
Samuelopez-ansys Apr 10, 2024
aa3e689
Fix Codacy
Samuelopez-ansys Apr 10, 2024
5059a7e
Fix UT issues
Samuelopez-ansys Apr 10, 2024
68c84b5
Fix UT issues
Samuelopez-ansys Apr 11, 2024
e88cef4
Fix examples
Samuelopez-ansys Apr 11, 2024
5266361
Fix EMIT
Samuelopez-ansys Apr 11, 2024
75d81fc
Merge branch 'main' into hfss_argument_refactoring
Samuelopez-ansys Apr 11, 2024
1dba6d3
Fix HFSS test
Samuelopez-ansys Apr 11, 2024
1489af2
Fix conflicts
Samuelopez-ansys Apr 11, 2024
805eb0d
Merge branch 'main' into hfss_argument_refactoring
Samuelopez-ansys Apr 12, 2024
c9d8738
Fix style
Samuelopez-ansys Apr 15, 2024
bfbefcd
Apply suggestions from code review
Samuelopez-ansys Apr 15, 2024
8cac853
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 15, 2024
6fc086f
Update pyaedt/modules/PostProcessor.py
Samuelopez-ansys Apr 15, 2024
d4690b1
Apply suggestions from code review
Samuelopez-ansys Apr 15, 2024
44b7a25
Update create_sbr_linked_antenna
Samuelopez-ansys Apr 15, 2024
066c834
Apply suggestions from code review
Samuelopez-ansys Apr 15, 2024
79956b8
Update pyaedt/modules/SolveSweeps.py
Samuelopez-ansys Apr 15, 2024
8fbca4d
Update pyaedt/hfss.py
Samuelopez-ansys Apr 15, 2024
a0173b1
Update pyaedt/hfss3dlayout.py
Samuelopez-ansys Apr 15, 2024
ce4b6e9
Merge remote-tracking branch 'origin/hfss_argument_refactoring' into …
Samuelopez-ansys Apr 15, 2024
2eb53e1
Merge branch 'main' into hfss_argument_refactoring
Samuelopez-ansys Apr 15, 2024
f3967a0
Update _unittest/test_14_AedtLogger.py
Samuelopez-ansys Apr 15, 2024
f7beeab
Update pyaedt/application/Analysis.py
Samuelopez-ansys Apr 15, 2024
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
1 change: 0 additions & 1 deletion _unittest/test_01_3dlayout_edb.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,6 @@ def test_19_dcir(self):
assert self.dcir_example_project.post.available_report_quantities(is_siwave_dc=True, context="")
assert self.dcir_example_project.post.create_report(
self.dcir_example_project.post.available_report_quantities(is_siwave_dc=True, context="RL")[0],
setup_sweep_name="SIwaveDCIR1",
domain="DCIR",
context="RL",
)
Expand Down
26 changes: 16 additions & 10 deletions _unittest/test_04_SBR.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,22 +56,28 @@ def init(self, aedtapp, local_scratch):
osmnx.settings.cache_folder = os.path.join(local_scratch.path, "cache")

def test_01_open_source(self, source):
assert self.aedtapp.create_sbr_linked_antenna(source, target_cs="feederPosition", fieldtype="farfield")
assert self.aedtapp.create_sbr_linked_antenna(source, target_cs="feederPosition", field_type="farfield")
assert len(self.aedtapp.native_components) == 1
assert self.aedtapp.create_sbr_linked_antenna(
source, target_cs="feederPosition", fieldtype="farfield", source_name="LinkedAntenna"
source, target_cs="feederPosition", field_type="farfield", name="LinkedAntenna"
)
assert len(self.aedtapp.native_components) == 2
assert self.aedtapp.create_sbr_linked_antenna(
source, target_cs="feederPosition", name="LinkedAntennaNF1", current_conformance=True
)
assert len(self.aedtapp.native_components) == 3
assert self.aedtapp.create_sbr_linked_antenna(
source, target_cs="feederPosition", name="LinkedAntennaNF2", current_conformance=False
)
assert len(self.aedtapp.native_components) == 4

def test_02_add_antennas(self):
self.aedtapp.insert_design("add_antennas")
dict1 = {"polarization": "Horizontal"}
par_beam = self.aedtapp.create_sbr_antenna(
self.aedtapp.SbrAntennas.ParametricBeam, parameters_dict=dict1, antenna_name="TX1"
)
assert self.aedtapp.create_sbr_antenna(
self.aedtapp.SbrAntennas.ConicalHorn, parameters_dict=dict1, antenna_name="RX1"
self.aedtapp.SbrAntennas.ParametricBeam, parameters=dict1, name="TX1"
)
assert self.aedtapp.create_sbr_antenna(self.aedtapp.SbrAntennas.ConicalHorn, parameters=dict1, name="RX1")
par_beam.native_properties["Unit"] = "in"
assert par_beam.update()
self.aedtapp.modeler.user_defined_components["TX1_1"].native_properties["Unit"] = "mm"
Expand Down Expand Up @@ -116,7 +122,7 @@ def test_02_add_antennas(self):
def test_03_add_ffd_antenna(self):
self.aedtapp.insert_design("ffd_antenna")
assert self.aedtapp.create_sbr_file_based_antenna(
ffd_full_path=os.path.join(local_path, "example_models", test_subfolder, "test.ffd")
far_field_data=os.path.join(local_path, "example_models", test_subfolder, "test.ffd")
)

def test_04_add_environment(self):
Expand Down Expand Up @@ -158,8 +164,8 @@ def test_08_add_radar(self):
"library",
"radar_modules",
)
assert self.aedtapp.create_sbr_radar_from_json(radar_lib, radar_name="Example_1Tx_1Rx", speed=3)
assert self.aedtapp.create_sbr_radar_from_json(radar_lib, radar_name="Example_1Tx_4Rx")
assert self.aedtapp.create_sbr_radar_from_json(radar_lib, name="Example_1Tx_1Rx", speed=3)
assert self.aedtapp.create_sbr_radar_from_json(radar_lib, name="Example_1Tx_4Rx")

def test_09_add_doppler_sweep(self):
setup, sweep = self.aedtapp.create_sbr_pulse_doppler_setup(sweep_time_duration=30)
Expand All @@ -183,7 +189,7 @@ def test_11_add_sbr_boundaries_in_hfss_solution(self, add_app):

# sbr file based antenna should only work for SBR+ solution.
assert not hfss_terminal.create_sbr_file_based_antenna(
ffd_full_path=os.path.join(local_path, "example_models", test_subfolder, "test.ffd")
far_field_data=os.path.join(local_path, "example_models", test_subfolder, "test.ffd")
)

@pytest.mark.skipif(is_linux, reason="Not supported.")
Expand Down
18 changes: 7 additions & 11 deletions _unittest/test_08_Primitives3D.py
Original file line number Diff line number Diff line change
Expand Up @@ -1827,35 +1827,31 @@ def test_87_set_mesh_fusion_settings(self):
obj2_3dcomp = self.aedtapp.modeler.replace_3dcomponent(
object_list=[box2.name],
)
assert self.aedtapp.set_mesh_fusion_settings(component=obj2_3dcomp.name, volume_padding=None, priority=None)
assert self.aedtapp.set_mesh_fusion_settings(assignment=obj2_3dcomp.name, volume_padding=None, priority=None)

assert self.aedtapp.set_mesh_fusion_settings(
component=[obj_3dcomp.name, obj2_3dcomp.name, "Dummy"], volume_padding=None, priority=None
assignment=[obj_3dcomp.name, obj2_3dcomp.name, "Dummy"], volume_padding=None, priority=None
)

assert self.aedtapp.set_mesh_fusion_settings(
component=[obj_3dcomp.name, obj2_3dcomp.name],
assignment=[obj_3dcomp.name, obj2_3dcomp.name],
volume_padding=[[0, 5, 0, 0, 0, 1], [0, 0, 0, 2, 0, 0]],
priority=None,
)
assert not self.aedtapp.set_mesh_fusion_settings(
component=[obj_3dcomp.name, obj2_3dcomp.name], volume_padding=[[0, 0, 0, 2, 0, 0]], priority=None
assignment=[obj_3dcomp.name, obj2_3dcomp.name], volume_padding=[[0, 0, 0, 2, 0, 0]], priority=None
)

assert self.aedtapp.set_mesh_fusion_settings(
component=[obj_3dcomp.name, obj2_3dcomp.name], volume_padding=None, priority=[obj2_3dcomp.name, "Dummy"]
assignment=[obj_3dcomp.name, obj2_3dcomp.name], volume_padding=None, priority=[obj2_3dcomp.name, "Dummy"]
)

assert self.aedtapp.set_mesh_fusion_settings(
component=[obj_3dcomp.name, obj2_3dcomp.name],
assignment=[obj_3dcomp.name, obj2_3dcomp.name],
volume_padding=[[0, 5, 0, 0, 0, 1], [10, 0, 0, 2, 0, 0]],
priority=[obj_3dcomp.name],
)
assert self.aedtapp.set_mesh_fusion_settings(
component=None,
volume_padding=None,
priority=None,
)
assert self.aedtapp.set_mesh_fusion_settings(assignment=None, volume_padding=None, priority=None)

def test_88_import_primitives_file_json(self):
self.aedtapp.insert_design("PrimitiveFromFile")
Expand Down
4 changes: 2 additions & 2 deletions _unittest/test_11_Setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ def test_01b_create_hfss_sweep(self):
sweep1.props["SaveFields"] = True
assert sweep1.update()
assert self.aedtapp.get_sweeps("My_HFSS_Setup")
sweep2 = setup1.add_sweep(sweepname="test_sweeptype", sweeptype="invalid")
sweep2 = setup1.add_sweep(name="test_sweeptype", sweep_type="invalid")
assert sweep2.props["Type"] == "Interpolating"
sweep3 = setup1.create_frequency_sweep(freqstart=1, freqstop="500MHz")
sweep3 = setup1.create_frequency_sweep(start_frequency=1, stop_frequency="500MHz")
assert sweep3.props["Type"] == "Discrete"
sweep4 = setup1.create_frequency_sweep("GHz", 23, 25, 401, sweep_type="Fast")
assert sweep4.props["Type"] == "Fast"
Expand Down
10 changes: 4 additions & 6 deletions _unittest/test_12_1_PostProcessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@ def test_01_Animate_plt(self):
phases = [str(i * 5) + "deg" for i in range(2)]
model_gif = self.aedtapp.post.plot_animated_field(
quantity="Mag_E",
objects=cutlist,
assignment=cutlist,
plot_type="CutPlane",
setup_name=self.aedtapp.nominal_adaptive,
setup=self.aedtapp.nominal_adaptive,
intrinsics={"Freq": "5GHz", "Phase": "0deg"},
variation_variable="Phase",
variations=phases,
Expand Down Expand Up @@ -269,12 +269,10 @@ def test_09_manipulate_report(self):
assert self.aedtapp.post.create_report("dB(S(1,1))")
assert self.aedtapp.post.create_report(
expressions="MaxMagDeltaS",
setup_sweep_name="Setup1 : AdaptivePass",
variations={"Pass": ["All"]},
primary_sweep_variable="Pass",
report_category="Modal Solution Data",
plot_type="Rectangular Plot",
plot_name="Solution Convergence Plot",
)
new_report = self.aedtapp.post.reports_by_category.modal_solution("dB(S(1,1))")
assert new_report.create()
Expand Down Expand Up @@ -553,7 +551,7 @@ def test_14B_Field_Ploton_Vector(self):
"Vector_E",
cutlist,
"CutPlane",
setup_name=setup_name,
setup=setup_name,
intrinsics=intrinsic,
mesh_on_fields=False,
view="isometric",
Expand All @@ -580,7 +578,7 @@ def test_16_create_field_plot(self):
plot = self.aedtapp.post._create_fieldplot(
assignment=cutlist,
quantity="Mag_E",
setup_name=self.aedtapp.nominal_adaptive,
setup=self.aedtapp.nominal_adaptive,
intrinsics={},
list_type="CutPlane",
)
Expand Down
30 changes: 8 additions & 22 deletions _unittest/test_12_PostProcessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,8 @@ def test_09_manipulate_report_C(self, field_test):
field_test.nominal_adaptive,
variations=variations,
primary_sweep_variable="Theta",
context="3D",
report_category="Far Fields",
context="3D",
)
assert data.plot(is_polar=True)
assert data.plot_3d()
Expand All @@ -195,8 +195,8 @@ def test_09_manipulate_report_D(self, field_test):
field_test.nominal_adaptive,
variations=variations,
primary_sweep_variable="Theta",
context=context,
report_category="Far Fields",
context=context,
)
assert data.plot(is_polar=True)
assert data.plot_3d()
Expand All @@ -223,11 +223,7 @@ def test_09_manipulate_report_E(self, field_test):
new_report.report_type = "Smith Chart"
assert new_report.create()
data = field_test.setups[0].get_solution_data(
"Mag_E",
variations=variations2,
primary_sweep_variable="Theta",
context="Poly1",
report_category="Fields",
"Mag_E", variations=variations2, primary_sweep_variable="Theta", report_category="Fields", context="Poly1"
)
assert data.units_sweeps["Phase"] == "deg"

Expand Down Expand Up @@ -304,9 +300,7 @@ def test_17_circuit(self, circuit_test):
new_report.time_stop = "190ns"
new_report.plot_continous_spectrum = False
assert new_report.create()
assert circuit_test.post.create_report(
["dB(V(net_11))", "dB(V(Port1))"], setup_sweep_name="Transient", domain="Spectrum"
)
assert circuit_test.post.create_report(["dB(V(net_11))", "dB(V(Port1))"], domain="Spectrum")
new_report = circuit_test.post.reports_by_category.spectral(None, "Transient")
new_report.window = "Hanning"
new_report.max_freq = "1GHz"
Expand Down Expand Up @@ -386,10 +380,7 @@ def test_55_time_plot(self, sbr_test):
sbr_test.analyze(sbr_test.active_setup, use_auto_settings=False)
assert sbr_test.setups[0].is_solved
solution_data = sbr_test.post.get_solution_data(
expressions=["NearEX", "NearEY", "NearEZ"],
# variations={"_u": ["All"], "_v": ["All"], "Freq": ["All"]},
context="Near_Field",
report_category="Near Fields",
expressions=["NearEX", "NearEY", "NearEZ"], report_category="Near Fields", context="Near_Field"
)
assert solution_data
assert len(solution_data.primary_sweep_values) > 0
Expand Down Expand Up @@ -615,7 +606,7 @@ def test_70_far_field_data(self):

@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 = field_test.get_antenna_ffd_solution_data(frequencies=30e9, sphere="3D")
ffdata.phase_offset = [0, 90]
assert ffdata.phase_offset == [0, 90]
ffdata.phase_offset = [0]
Expand Down Expand Up @@ -667,7 +658,7 @@ def test_71_antenna_plot(self, field_test):

@pytest.mark.skipif(is_linux or sys.version_info < (3, 8), reason="FarFieldSolution not supported by IronPython")
def test_72_antenna_plot(self, array_test):
ffdata = array_test.get_antenna_ffd_solution_data(frequencies=3.5e9, sphere_name="3D")
ffdata = array_test.get_antenna_ffd_solution_data(frequencies=3.5e9, sphere="3D")
ffdata.frequency = 3.5e9
assert ffdata.plot_farfield_contour(
quantity="RealizedGain",
Expand Down Expand Up @@ -707,7 +698,7 @@ def test_72_antenna_plot(self, array_test):
convert_to_db=True,
)
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)
ffdata1 = array_test.get_antenna_ffd_solution_data(frequencies=3.5e9, sphere="3D", overwrite=False)
assert ffdata1.plot_farfield_contour(
quantity="RealizedGain",
title="Contour at {}Hz".format(ffdata1.frequency),
Expand All @@ -720,35 +711,30 @@ def test_73_ami_solution_data(self, ami_test):
ami_test.solution_type = "NexximAMI"
assert ami_test.post.get_solution_data(
expressions="WaveAfterProbe<b_input_43.int_ami_rx>",
setup_sweep_name="AMIAnalysis",
domain="Time",
variations=ami_test.available_variations.nominal,
)

assert ami_test.post.get_solution_data(
expressions="WaveAfterSource<b_output4_42.int_ami_tx>",
setup_sweep_name="AMIAnalysis",
domain="Time",
variations=ami_test.available_variations.nominal,
)

assert ami_test.post.get_solution_data(
expressions="InitialWave<b_output4_42.int_ami_tx>",
setup_sweep_name="AMIAnalysis",
domain="Time",
variations=ami_test.available_variations.nominal,
)

assert ami_test.post.get_solution_data(
expressions="WaveAfterChannel<b_input_43.int_ami_rx>",
setup_sweep_name="AMIAnalysis",
domain="Time",
variations=ami_test.available_variations.nominal,
)

assert ami_test.post.get_solution_data(
expressions="ClockTics<b_input_43.int_ami_rx>",
setup_sweep_name="AMIAnalysis",
domain="Clock Times",
variations=ami_test.available_variations.nominal,
)
Expand Down
2 changes: 1 addition & 1 deletion _unittest/test_14_AedtLogger.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ class TestLogMessages:
"""Class used to test log messages."""

def test_log_when_accessing_non_existing_object(self, caplog):
"""Check that accessing non existing object log an error message."""
"""Check that accessing a non-existent object logs an error message."""
from pyaedt import Hfss

app = Hfss(
Expand Down
Loading
Loading