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

Return basis frequencies with the default units. #3966

Merged
merged 3 commits into from
Dec 12, 2023
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
Binary file modified _unittest/example_models/T12/coax_setup_solved_231.aedtz
Binary file not shown.
1 change: 1 addition & 0 deletions _unittest/test_12_1_PostProcessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ def test_01B_Field_Plot(self):
)
assert len(self.aedtapp.setups[0].sweeps[0].frequencies) > 0
assert isinstance(self.aedtapp.setups[0].sweeps[0].basis_frequencies, list)
assert len(self.aedtapp.setups[0].sweeps[1].basis_frequencies) == 2

@pytest.mark.skipif(is_linux or sys.version_info < (3, 8), reason="Not running in ironpython")
def test_01_Animate_plt(self):
Expand Down
15 changes: 14 additions & 1 deletion pyaedt/modules/SolveSweeps.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from pyaedt import pyaedt_function_handler
from pyaedt.generic.DataHandlers import _dict2arg
from pyaedt.generic.LoadAEDTFile import load_entire_aedt_file
from pyaedt.generic.constants import unit_converter
from pyaedt.modules.SetupTemplates import Sweep3DLayout
from pyaedt.modules.SetupTemplates import SweepHfss3D
from pyaedt.modules.SetupTemplates import SweepSiwave
Expand Down Expand Up @@ -166,6 +167,12 @@ def basis_frequencies(self):
try:
new_list = [float(i) for i in v["Fields"]["IDDblMap"][1::2]]
new_list.sort()
new_list = unit_converter(
values=new_list,
unit_system="Freq",
input_units="Hz",
output_units=self._app._app.odesktop.GetDefaultUnit("Frequency"),
)
fr.append(new_list)
except (KeyError, NameError, IndexError):
pass
Expand Down Expand Up @@ -697,9 +704,15 @@ def basis_frequencies(self):
solutions = load_entire_aedt_file(solutions_file)
for k, v in solutions.items():
if "SolutionBlock" in k and "SolutionName" in v and v["SolutionName"] == self.name and "Fields" in v:
try:
try: # pragma: no cover
new_list = [float(i) for i in v["Fields"]["IDDblMap"][1::2]]
new_list.sort()
new_list = unit_converter(
values=new_list,
unit_system="Freq",
input_units="Hz",
output_units=self._app._app.odesktop.GetDefaultUnit("Frequency"),
)
fr.append(new_list)
except (KeyError, NameError, IndexError):
pass
Expand Down
Loading