Skip to content

Commit

Permalink
Merge branch 'main' into fix_toml
Browse files Browse the repository at this point in the history
  • Loading branch information
SMoraisAnsys authored Jul 11, 2024
2 parents 45bc67b + f541b56 commit 1bc7b81
Show file tree
Hide file tree
Showing 19 changed files with 270 additions and 186 deletions.
2 changes: 1 addition & 1 deletion _unittest/test_27_Maxwell2D.py
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,6 @@ def test_37_boundaries_by_type(self):
def test_38_export_fields_calc(self):
output_file = os.path.join(self.local_scratch.path, "e_tang_field.fld")
assert self.m2d_field_export.post.export_field_file(
quantity="E_Line", output_dir=output_file, assignment="Poly1", objects_type="Line"
quantity="E_Line", output_file=output_file, assignment="Poly1", objects_type="Line"
)
assert os.path.exists(output_file)
7 changes: 5 additions & 2 deletions _unittest/test_98_Icepak.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,9 @@ def test_05_EMLoss(self):
"uUSB", "Setup1", "LastAdaptive", "2.5GHz", surface_list, HFSSpath, param_list, object_list
)

def test_06_clear_linked_data(self):
assert self.aedtapp.clear_linked_data()

def test_07_ExportStepForWB(self):
file_path = self.local_scratch.path
file_name = "WBStepModel"
Expand All @@ -321,8 +324,8 @@ def test_08_Setup(self):
assert self.aedtapp.assign_2way_coupling(setup_name, 2, True, 20)
templates = SetupKeys().get_default_icepak_template(default_type="Natural Convection")
assert templates
self.aedtapp.setups[0].props = templates["IcepakSteadyState"]
assert self.aedtapp.setups[0].update()
my_setup.props = templates["IcepakSteadyState"]
assert my_setup.update()
assert SetupKeys().get_default_icepak_template(default_type="Default")
assert SetupKeys().get_default_icepak_template(default_type="Forced Convection")
with pytest.raises(AttributeError):
Expand Down
18 changes: 9 additions & 9 deletions _unittest_solvers/test_00_analyze.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,11 +192,11 @@ def test_02_hfss_export_results(self, hfss_app):
assert len(exported_files) > 0

fld_file1 = os.path.join(self.local_scratch.path, "test_fld_hfss1.fld")
assert hfss_app.post.export_field_file(quantity="Mag_E", output_dir=fld_file1, assignment="Box1",
assert hfss_app.post.export_field_file(quantity="Mag_E", output_file=fld_file1, assignment="Box1",
intrinsics="1GHz", phase="5deg")
assert os.path.exists(fld_file1)
fld_file2 = os.path.join(self.local_scratch.path, "test_fld_hfss2.fld")
assert hfss_app.post.export_field_file(quantity="Mag_E", output_dir=fld_file2, assignment="Box1",
assert hfss_app.post.export_field_file(quantity="Mag_E", output_file=fld_file2, assignment="Box1",
intrinsics="1GHz")
assert os.path.exists(fld_file2)

Expand Down Expand Up @@ -298,26 +298,26 @@ def test_03d_icepak_eval_tempc(self):
def test_03e_icepak_ExportFLDFil(self):
fld_file = os.path.join(self.local_scratch.path, "test_fld.fld")
self.icepak_app.post.export_field_file(quantity="Temp", solution=self.icepak_app.nominal_sweep, variations={},
output_dir=fld_file, assignment="box")
output_file=fld_file, assignment="box")
assert os.path.exists(fld_file)
fld_file_1 = os.path.join(self.local_scratch.path, "test_fld_1.fld")
sample_points_file = os.path.join(local_path, "example_models", test_subfolder, "temp_points.pts")
self.icepak_app.post.export_field_file(quantity="Temp", solution=self.icepak_app.nominal_sweep,
variations=self.icepak_app.available_variations.nominal_w_values_dict,
output_dir=fld_file_1, assignment="box",
output_file=fld_file_1, assignment="box",
sample_points_file=sample_points_file)
assert os.path.exists(fld_file_1)
fld_file_2 = os.path.join(self.local_scratch.path, "test_fld_2.fld")
self.icepak_app.post.export_field_file(quantity="Temp", solution=self.icepak_app.nominal_sweep,
variations=self.icepak_app.available_variations.nominal_w_values_dict,
output_dir=fld_file_2, assignment="box",
output_file=fld_file_2, assignment="box",
sample_points=[[0, 0, 0], [3, 6, 8], [4, 7, 9]])
assert os.path.exists(fld_file_2)
cs = self.icepak_app.modeler.create_coordinate_system()
fld_file_3 = os.path.join(self.local_scratch.path, "test_fld_3.fld")
self.icepak_app.post.export_field_file(quantity="Temp", solution=self.icepak_app.nominal_sweep,
variations=self.icepak_app.available_variations.nominal_w_values_dict,
output_dir=fld_file_3, assignment="box",
output_file=fld_file_3, assignment="box",
sample_points=[[0, 0, 0], [3, 6, 8], [4, 7, 9]],
reference_coordinate_system=cs.name, export_in_si_system=False,
export_field_in_reference=False)
Expand Down Expand Up @@ -422,17 +422,17 @@ def test_07_export_maxwell_fields(self, m3dtransient):
m3dtransient.analyze(m3dtransient.active_setup, cores=4, use_auto_settings=False)
fld_file_3 = os.path.join(self.local_scratch.path, "test_fld_3.fld")
assert m3dtransient.post.export_field_file(quantity="Mag_B", solution=m3dtransient.nominal_sweep, variations={},
output_dir=fld_file_3, assignment="Coil_A2", objects_type="Surf",
output_file=fld_file_3, assignment="Coil_A2", objects_type="Surf",
intrinsics="10ms")
assert os.path.exists(fld_file_3)
fld_file_4 = os.path.join(self.local_scratch.path, "test_fld_4.fld")
assert not m3dtransient.post.export_field_file(quantity="Mag_B", solution=m3dtransient.nominal_sweep,
variations=m3dtransient.available_variations.nominal_w_values_dict,
output_dir=fld_file_4, assignment="Coil_A2",
output_file=fld_file_4, assignment="Coil_A2",
objects_type="invalid")
setup = m3dtransient.setups[0]
m3dtransient.setups[0].delete()
assert not m3dtransient.post.export_field_file(quantity="Mag_B", variations={}, output_dir=fld_file_4,
assert not m3dtransient.post.export_field_file(quantity="Mag_B", variations={}, output_file=fld_file_4,
assignment="Coil_A2")

new_setup = m3dtransient.create_setup(name=setup.name, setup_type=setup.setuptype)
Expand Down
35 changes: 33 additions & 2 deletions doc/source/API/Visualization.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,43 @@ models and 3D plots.
ModelPlotter


The class TouchstoneData instead, is based on `scikit-rf <https://scikit-rf.readthedocs.io/en/latest/>`_,
The following methods allows to read and check touchstone files.

.. currentmodule:: pyaedt.generic.touchstone_parser

.. autosummary::
:toctree: _autosummary
:nosignatures:

read_touchstone
check_touchstone_files



Using the above methods you are getting an object of a class TouchstoneData.
The class TouchstoneData is based on `scikit-rf <https://scikit-rf.readthedocs.io/en/latest/>`_,
Additional methods are added to provide easy access to touchstone curves.


.. currentmodule:: pyaedt.generic.touchstone_parser

.. autoclass:: TouchstoneData
.. autosummary::
:toctree: _autosummary
:nosignatures:

TouchstoneData.get_insertion_loss_index
TouchstoneData.plot_insertion_losses
TouchstoneData.plot
TouchstoneData.plot_return_losses
TouchstoneData.get_mixed_mode_touchstone_data
TouchstoneData.get_return_loss_index
TouchstoneData.get_insertion_loss_index_from_prefix
TouchstoneData.get_next_xtalk_index
TouchstoneData.get_fext_xtalk_index_from_prefix
TouchstoneData.plot_next_xtalk_losses
TouchstoneData.plot_fext_xtalk_losses
TouchstoneData.get_worst_curve



Here an example on how to use TouchstoneData class.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ The following image shows the extension user interface:


The available arguments are: ``aedb_path``, ``configuration_path``.
User can pass as an argument a configuration file (a json formatted file or a toml file) or a folder containing more
User can pass as an argument a configuration file (a json formatted file or a toml file), or a folder containing more
than N configuration files. In such case the script creates N new aedb projects, each one with corresponding
setting file applied.

Expand All @@ -22,10 +22,19 @@ setting file applied.
:alt: Principle of working of Layout UI


A brief description of which options are defined in the configuration file:

You can also launch the extension user interface from the terminal. An example can be found here:

.. toctree::
:maxdepth: 2

../commandline
.. image:: ../../../_static/extensions/edb_config_setup.png
:width: 800
:alt: Setup defined by a configuration file

As depicted above, these options are importing a stackup, defining components and solderballs / bumps on them,
doing a cutout (much faster and easier than the UI one),
creating coaxial ports with an appropriate PEC backing, as well as, automatically creating distributed circuit ports (or current / voltage sources) on a component,
with the negative terminal of each being its nearest pin of the reference net. Moreover, a variety of simulation setups are supported, namely HFSS, SIwave SYZ, SIwave DC,
as well as, mesh operations that is length based. Last but not least, exporting a configuration file from the active design is also supported, hence the user can get the
configuration setup and re-use it with or without modifications as many times as possible.

The value of this format and toolkit, lies in the fact that it is totally reusable, it is really user-friendly, even with users that are not familiar with scripting.
It supports most of the options that the UI also supports (not only the ones explained above, but many additional), and it has the advantage of obtaining the initial
configuration file from the design, by using its export property.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion doc/styles/config/vocabularies/ANSYS/accept.txt
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,6 @@ assign_mesh_region
assign_mesh_level
assign_mesh_reuse
json
toml
toml
i.e.
solderballs
10 changes: 7 additions & 3 deletions examples/07-Circuit/Reports.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,14 @@
###############################################################################
# Create transient report
# ~~~~~~~~~~~~~~~~~~~~~~~
# Property dictionary can be customized in any aspect and new report can be created easily.
# In this example the curve name is customized.
# You can customize any aspect of the property dictionary and easily create a new report.
# The following code customizes the curve name.
# The expressions key can be a list of expressions as follows or a dictionary containing the expressions to plot and line properties.
# props["expressions"] = { "V(Battery)" :
# {"color": [0, 255, 0], "trace_style": "Solid", "width": 1, "trace_type": "Continuous"}}

props["expressions"] = {"V(Battery)": {}, "V(U1_VDD)": {}}

props["expressions"] = ["V(Battery)", "V(U1_VDD)"]
props["plot_name"] = "Battery Voltage"
report3 = cir.post.create_report_from_configuration(report_settings=props, solution_name="NexximTransient")
out = cir.post.export_report_to_jpg(cir.working_directory, report3.plot_name)
Expand Down
3 changes: 1 addition & 2 deletions pyaedt/application/Design.py
Original file line number Diff line number Diff line change
Expand Up @@ -1085,8 +1085,7 @@ def odesign(self):
Returns
-------
type
Design object.
Design object
References
----------
Expand Down
25 changes: 11 additions & 14 deletions pyaedt/generic/touchstone_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ def plot_insertion_losses(self, threshold=-3, plot=True):
----------
threshold : float, int, optional
Threshold to determine shorted ports in dB.
plot: bool
Whether to plot.
plot : bool, optional
Whether to plot. The default is ``True``.
Returns
-------
Expand All @@ -171,7 +171,7 @@ def plot(self, index_couples=None, show=True):
----------
index_couples : list, optional
List of indexes couple to plot. Default is ``None`` to plot all ``port_tuples``.
show: bool
show : bool
Whether to plot. Default is ``True``.
Returns
Expand All @@ -191,8 +191,6 @@ def plot(self, index_couples=None, show=True):
def plot_return_losses(self): # pragma: no cover
"""Plot all return losses.
Parameters
----------
Returns
-------
bool
Expand Down Expand Up @@ -344,7 +342,7 @@ def get_next_xtalk_index(self, tx_prefix=""):
Returns
-------
list
list of index couples representing Near End XTalks
List of index couples representing Near End XTalks.
"""
if tx_prefix:
Expand Down Expand Up @@ -432,27 +430,26 @@ def plot_fext_xtalk_losses(self, tx_prefix, rx_prefix, skip_same_index_couples=T

@pyaedt_function_handler()
def get_worst_curve(self, freq_min=None, freq_max=None, worst_is_higher=True, curve_list=None, plot=True):
"""This method analyze a solution data object with multiple curves and
find the worst curve returning its name and an ordered dictionary with each curve mean.
Actual algorithm simply takes the mean of the magnitude over the frequency range.
"""Analyze a solution data object with multiple curves and find the worst curve.
Take the mean of the magnitude over the frequency range.
Parameters
----------
freq_min : float, optional
minimum frequency to analyze in GHz (None to 0). Default value is ``None``.
Minimum frequency to analyze in GHz (None to 0). Default value is ``None``.
freq_max : float, optional
maximum frequency to analyze in GHz (None to max freq). Default value is ``None``.
Maximum frequency to analyze in GHz (None to max freq). Default value is ``None``.
worst_is_higher : bool
boolean. if True, the worst curve is the one with higher mean value. Default value is ``None``.
Worst curve is the one with higher mean value. Default value is ``True``.
curve_list : list
List of [m,n] index of curves on which to search. None to search on all curves. Default value is ``None``.
plot : bool, optional
Whether to plot or not the chart.
Returns
-------
type
worst element str, dictionary of ordered expression and their mean
tuple
Worst element, dictionary of ordered expression.
"""

Expand Down
22 changes: 22 additions & 0 deletions pyaedt/icepak.py
Original file line number Diff line number Diff line change
Expand Up @@ -6464,6 +6464,28 @@ def create_square_wave_transient_assignment(self, on_value, initial_time_off, on
"""
return SquareWaveDictionary(on_value, initial_time_off, on_time, off_time, off_value)

@pyaedt_function_handler()
def clear_linked_data(self):
"""
Clear the linked data of all the solution setups.
Returns
-------
bool
``True`` when successful, ``False`` when failed.
References
----------
>>> oDesign.ClearLinkedData
"""
try:
self.odesign.ClearLinkedData()
except:
return False
else:
return True


class IcepakDesignSettingsManipulation(DesignSettingsManipulation):
def __init__(self, app):
Expand Down
Loading

0 comments on commit 1bc7b81

Please sign in to comment.