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

FIX: 5620 far field data #5632

Merged
merged 11 commits into from
Jan 14, 2025
11 changes: 8 additions & 3 deletions src/ansys/aedt/core/hfss.py
Original file line number Diff line number Diff line change
Expand Up @@ -839,6 +839,8 @@ def create_setup(self, name="MySetupAuto", setup_type=None, **kwargs):
setup_type = self.design_solutions.default_setup
elif setup_type in SetupKeys.SetupNames:
setup_type = SetupKeys.SetupNames.index(setup_type)
if name in self.setup_names:
name = self.create_uni
Samuelopez-ansys marked this conversation as resolved.
Show resolved Hide resolved
setup = self._create_setup(name=name, setup_type=setup_type)
setup.auto_update = False
for arg_name, arg_value in kwargs.items():
Expand Down Expand Up @@ -5847,15 +5849,18 @@ def get_antenna_data(
)
self.logger.info("Far field sphere %s is created.", setup)

frequency_units = self.odesktop.GetDefaultUnit("Frequency")
if setup in self.existing_analysis_sweeps and not frequencies:
trace_name = "mag(rETheta)"
farfield_data = self.post.get_far_field_data(expressions=trace_name, setup_sweep_name=setup, domain=sphere)
if farfield_data and getattr(farfield_data, "primary_sweep_values", None) is not None:
frequencies = farfield_data.primary_sweep_values
frequency_units = self.odesktop.GetDefaultUnit("Frequency")
frequencies = [str(freq) + frequency_units for freq in frequencies]

if not frequencies: # pragma: no cover
if frequencies:
if type(frequencies) in [float, int, str]:
frequencies = [frequencies]
frequencies = [str(freq) + frequency_units for freq in frequencies if is_number(freq)]
else: # pragma: no cover
self.logger.info("Frequencies could not be obtained.")
return False

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class FfdSolutionData(object):

Examples
--------
>>> from ansys.aedt.core
>>> from ansys.aedt.core import Hfss
>>> from ansys.aedt.core.visualization.advanced.farfield_visualization import FfdSolutionData
>>> app = ansys.aedt.core.Hfss(version="2023.2", design="Antenna")
>>> data = app.get_antenna_data()
Expand Down
5 changes: 3 additions & 2 deletions src/ansys/aedt/core/visualization/plot/matplotlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
from matplotlib.patches import PathPatch
from matplotlib.path import Path
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
except ImportError:
warnings.warn(
"The Matplotlib module is required to run some functionalities of PostProcess.\n"
Expand Down Expand Up @@ -730,9 +731,9 @@ def _update_grid(self):
self.ax.grid(which="minor", color=self.__grid_color)
if self._has_minor_axis:
if self.__grid_enable_minor_x:
self.ax.xaxis.minorticks_on()
self.ax.yaxis.set_minor_locator(ticker.AutoMinorLocator())
Samuelopez-ansys marked this conversation as resolved.
Show resolved Hide resolved
if self.__grid_enable_minor_y:
self.ax.yaxis.minorticks_on()
self.ax.yaxis.set_minor_locator(ticker.AutoMinorLocator())
self.ax.tick_params(which="minor", grid_linestyle="--")

@property
Expand Down
7 changes: 5 additions & 2 deletions tests/system/solvers/test_00_analyze.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,12 @@ def test_01a_sbr_link_array(self, sbr_platform, array):
profile = sbr_platform.setups[0].get_profile()
assert isinstance(profile, dict)
assert not sbr_platform.get_profile("Invented_setup")
solution_data = sbr_platform.setups[0].get_solution_data()

ffdata = sbr_platform.get_antenna_data(frequencies=12e9, sphere="3D")
ffdata2 = sbr_platform.get_antenna_data(frequencies=12e9, sphere="3D", overwrite=False)
ffdata = sbr_platform.get_antenna_data(frequencies=solution_data.intrinsics["Freq"], sphere="3D")
ffdata2 = sbr_platform.get_antenna_data(
frequencies=solution_data.intrinsics["Freq"], sphere="3D", overwrite=False
)

ffdata.farfield_data.plot_cut(
quantity="RealizedGain",
Expand Down
Loading