Skip to content

Commit

Permalink
Merge branch 'main' into release/0.9
Browse files Browse the repository at this point in the history
  • Loading branch information
Samuelopez-ansys committed Jul 5, 2024
2 parents 3df0fa0 + a24bfdb commit a060847
Show file tree
Hide file tree
Showing 79 changed files with 618 additions and 885 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/ci_cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check documentation style
uses: ansys/actions/doc-style@v4
uses: ansys/actions/doc-style@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
vale-config: "doc/.vale.ini"
vale-version: "2.29.6"
token: ${{ secrets.GITHUB_TOKEN }}

smoke-tests:
name: Build wheelhouse and smoke tests
Expand Down
3 changes: 2 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ repos:
rev: v2.3.0
hooks:
- id: codespell
args: ["--ignore-words", "doc/styles/config/vocabularies/ANSYS/accept.txt"]
additional_dependencies:
- tomli

Expand All @@ -53,7 +54,7 @@ repos:
- id: check-github-workflows

- repo: https://github.com/asottile/blacken-docs
rev: 1.16.0
rev: 1.18.0
hooks:
- id: blacken-docs
additional_dependencies: [black==24.4.2]
Expand Down
15 changes: 15 additions & 0 deletions _unittest/test_01_Design.py
Original file line number Diff line number Diff line change
Expand Up @@ -484,3 +484,18 @@ def test_41_desktop_reference_counting(self, desktop):
hfss.set_active_design(hfss.design_name)
assert desktop._connected_app_instances == num_references + 1
assert desktop._connected_app_instances == num_references

def test_42_save_project_with_file_name(self):
# Save into path with existing parent dir
self.aedtapp.create_new_project("Test")
new_project = os.path.join(self.local_scratch.path, "new.aedt")
assert os.path.exists(self.local_scratch.path)
self.aedtapp.save_project(file_name=new_project)
assert os.path.isfile(new_project)

# Save into path with non-existing parent dir
new_parent_dir = os.path.join(self.local_scratch.path, "new_dir")
new_project = os.path.join(new_parent_dir, "new_2.aedt")
assert not os.path.exists(new_parent_dir)
self.aedtapp.save_project(file_name=new_project)
assert os.path.isfile(new_project)
2 changes: 1 addition & 1 deletion _unittest/test_01_configuration_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ def test_04a_icepak(self, icepak_a, aedtapp, add_app):

@pytest.mark.skipif(
config["desktopVersion"] < "2023.1" and config["use_grpc"],
reason="Not working in 2022.2 GRPC",
reason="Not working in 2022.2 gRPC",
)
def test_04b_icepak(self, icepak_b, add_app):
box1 = icepak_b.modeler.create_box([0, 0, 0], [10, 10, 10])
Expand Down
4 changes: 2 additions & 2 deletions _unittest/test_08_Primitives3D.py
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@ def test_35_get_face_area(self):
area = self.aedtapp.modeler.get_face_area(listfaces[0])
assert area == 7 * 13

@pytest.mark.skipif(config["desktopVersion"] < "2023.1" and config["use_grpc"], reason="Not working in 2022.2 GRPC")
@pytest.mark.skipif(config["desktopVersion"] < "2023.1" and config["use_grpc"], reason="Not working in 2022.2 gRPC")
def test_36_get_face_center(self):
plane = self.aedtapp.PLANE.XY
rectid = self.aedtapp.modeler.create_rectangle(plane, [1, 2, 3], [7, 13], name="rect_for_get2")
Expand Down Expand Up @@ -1760,7 +1760,7 @@ def test_80_udm_operations(self):
assert not obj_udm.duplicate_along_line(udp, num_clones)

@pytest.mark.skipif(config["desktopVersion"] > "2022.2", reason="Method failing in version higher than 2022.2")
@pytest.mark.skipif(config["desktopVersion"] < "2023.1" and config["use_grpc"], reason="Not working in 2022.2 GRPC")
@pytest.mark.skipif(config["desktopVersion"] < "2023.1" and config["use_grpc"], reason="Not working in 2022.2 gRPC")
def test_81_operations_3dcomponent(self):
my_udmPairs = []
mypair = ["OuterRadius", "20.2mm"]
Expand Down
2 changes: 1 addition & 1 deletion _unittest/test_21_Circuit.py
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ def test_38_browse_log_file(self):
for i in range(10):
f.write("L{} net_{} net_{} 1e-9\n".format(i, i, i + 1))
f.write("C{} net_{} 0 5e-12\n".format(i, i + 1))
self.aedtapp.modeler.components.create_interface_port("net_0", (0, 0))
self.aedtapp.modeler.components.create_interface_port("net_0", (0, 0), angle=90)
self.aedtapp.modeler.components.create_interface_port("net_10", (0.01, 0))
lna = self.aedtapp.create_setup("mylna", self.aedtapp.SETUPS.NexximLNA)
lna.props["SweepDefinition"]["Data"] = "LINC 0Hz 1GHz 101"
Expand Down
31 changes: 29 additions & 2 deletions _unittest/test_28_Maxwell3D.py
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,14 @@ def test_32a_matrix(self, add_app):
m3d.assign_current(rectangle4.faces[0], amplitude=1, name="Cur4")

L = m3d.assign_matrix(assignment=["Cur1", "Cur2", "Cur3"], matrix_name="Matrix1")
assert not L.reduced_matrices
m3d.solution_type = SOLUTIONS.Maxwell3d.Magnetostatic
out = L.join_series(sources=["Cur1", "Cur2"], matrix_name="ReducedMatrix3")
assert not out[0]
assert not out[1]
m3d.solution_type = SOLUTIONS.Maxwell3d.EddyCurrent
out = L.join_series(sources=["Cur1", "Cur2"], matrix_name="ReducedMatrix1")
assert L.reduced_matrices
assert isinstance(out[0], str)
assert isinstance(out[1], str)
out = L.join_parallel(["Cur1", "Cur3"], matrix_name="ReducedMatrix2")
Expand All @@ -534,7 +541,27 @@ def test_32a_matrix(self, add_app):
out = L.join_parallel(["Cur5"])
assert not out[0]

def test_32b_export_rl_matrix(self):
def test_32b_reduced_matrix(self):
self.aedtapp.set_active_design("Matrix2")
parent_matrix = [m for m in self.aedtapp.boundaries if m.type == "Matrix"][0]
assert parent_matrix.reduced_matrices
reduced_matrix_1 = parent_matrix.reduced_matrices[0]
assert reduced_matrix_1.name == "ReducedMatrix1"
assert reduced_matrix_1.parent_matrix == parent_matrix.name
source_name = list(reduced_matrix_1.sources.keys())[0]
assert reduced_matrix_1.update(old_source=source_name, source_type="series", new_source="new_series")
assert list(reduced_matrix_1.sources.keys())[0] == "new_series"
assert reduced_matrix_1.sources["new_series"] == "Cur1, Cur2"
assert reduced_matrix_1.update(old_source="new_series", source_type="series", new_excitations="Cur2, Cur3")
assert list(reduced_matrix_1.sources.keys())[0] == "new_series"
assert reduced_matrix_1.sources["new_series"] == "Cur2, Cur3"
assert not reduced_matrix_1.update(old_source="invalid", source_type="series", new_excitations="Cur2, Cur3")
assert not reduced_matrix_1.update(old_source="new_series", source_type="invalid", new_excitations="Cur2, Cur3")
assert not reduced_matrix_1.delete(source="invalid")
assert reduced_matrix_1.delete(source="new_series")
assert len(parent_matrix.reduced_matrices) == 1

def test_32c_export_rl_matrix(self):
self.aedtapp.set_active_design("Matrix2")
L = self.aedtapp.assign_matrix(assignment=["Cur1", "Cur2", "Cur3"], matrix_name="matrix_export_test")
L.join_series(["Cur1", "Cur2"], matrix_name="reduced_matrix_export_test")
Expand All @@ -553,7 +580,7 @@ def test_32b_export_rl_matrix(self):
assert self.aedtapp.export_rl_matrix("matrix_export_test", export_path_2, False, 10, 3, True)
assert os.path.exists(export_path_2)

def test_32c_post_processing(self):
def test_32d_post_processing(self):
expressions = self.aedtapp.post.available_report_quantities(
report_category="EddyCurrent", display_type="Data Table", context={"Matrix1": "ReducedMatrix1"}
)
Expand Down
4 changes: 2 additions & 2 deletions _unittest/test_98_Icepak.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ def test_12a_AssignMeshOperation(self):
assert test
assert test.delete()

@pytest.mark.skipif(config["use_grpc"], reason="GRPC usage leads to SystemExit.")
@pytest.mark.skipif(config["use_grpc"], reason="gRPC usage leads to SystemExit.")
def test_12b_failing_AssignMeshOperation(self):
assert self.aedtapp.mesh.assign_mesh_region("N0C0MP", 1, is_submodel=True)
test = self.aedtapp.mesh.assign_mesh_region(["USB_ID"], 1)
Expand Down Expand Up @@ -1128,7 +1128,7 @@ def test_54_assign_stationary_wall(self):
shell_conduction=False,
)

@pytest.mark.skipif(config["desktopVersion"] < "2023.1" and config["use_grpc"], reason="Not working in 2022.2 GRPC")
@pytest.mark.skipif(config["desktopVersion"] < "2023.1" and config["use_grpc"], reason="Not working in 2022.2 gRPC")
def test_55_native_components_history(self):
fan = self.aedtapp.create_fan("test_fan")
self.aedtapp.modeler.user_defined_components[fan.name].move([1, 2, 3])
Expand Down
18 changes: 17 additions & 1 deletion doc/.vale.ini
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,22 @@ Vocab = ANSYS
# Apply the following styles
BasedOnStyles = Vale, Google

# Removing Vale terms rule
Vale.Terms = NO

# Removing Google-specific rule - Not applicable under some circumstances
Google.WordList = NO
Google.Colons = NO
Google.Colons = NO


# Removing Google-specific rule - Update severity level to error on rules with default warnings
# See https://github.com/ansys/pyaedt/pull/4881 for more information
Google.Ellipses = error
Google.FirstPerson = error
Google.Headings = error
Google.HeadingPunctuation = error
Google.OxfordComma = error
Google.Spelling = error
Google.We = error
Google.Will = error
Google.WordList = error
23 changes: 0 additions & 23 deletions doc/source/API/Post.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ plots in AEDT. They are accessible through the ``post`` property.
:nosignatures:

AdvancedPostProcessing.PostProcessor
solutions.SolutionData
solutions.FieldPlot
solutions.FfdSolutionData


.. code:: python
Expand Down Expand Up @@ -77,26 +74,6 @@ PyAEDT has classes for manipulating any report property.
report_templates.Spectral


Plot fields and data outside AEDT
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
PyAEDT supports external report capabilities available with installed third-party
packages like `numpy <https://numpy.org/doc/stable/>`_,
`pandas <https://pandas.pydata.org/>`_, `matplotlib <https://matplotlib.org/>`_,
and `pyvista <https://docs.pyvista.org/>`_.

.. currentmodule:: pyaedt.modules

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


solutions.SolutionData
solutions.FieldPlot
solutions.FfdSolutionData
AdvancedPostProcessing.ModelPlotter


Icepak monitors
~~~~~~~~~~~~~~~

Expand Down
90 changes: 90 additions & 0 deletions doc/source/API/Visualization.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
Visualization
=============
This section lists modules for creating and editing data outside AEDT.

Plot fields and data outside AEDT
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
PyAEDT supports external report capabilities available with installed third-party
packages like `numpy <https://numpy.org/doc/stable/>`_,
`pandas <https://pandas.pydata.org/>`_, `matplotlib <https://matplotlib.org/>`_,
and `pyvista <https://docs.pyvista.org/>`_.


.. currentmodule:: pyaedt.modules

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

solutions.SolutionData
solutions.FieldPlot
solutions.FfdSolutionData


ModelPlotter is a class that benefits of `pyvista <https://docs.pyvista.org/>`_ package and allows to generate
models and 3D plots.


.. currentmodule:: pyaedt.generic.plot

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

ModelPlotter


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

.. 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.

.. code:: python
from pyaedt.generic.touchstone_parser import TouchstoneData
ts1 = TouchstoneData(touchstone_file=os.path.join(test_T44_dir, "port_order_1234.s8p"))
assert ts1.get_mixed_mode_touchstone_data()
ts2 = TouchstoneData(touchstone_file=os.path.join(test_T44_dir, "port_order_1324.s8p"))
assert ts2.get_mixed_mode_touchstone_data(port_ordering="1324")
assert ts1.plot_insertion_losses(plot=False)
assert ts1.get_worst_curve(curve_list=ts1.get_return_loss_index(), plot=False)
...
1 change: 1 addition & 0 deletions doc/source/API/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ Example with ``Desktop`` class implicit initialization:
Mesh
Setup
Post
Visualization
DesktopMessenger
Optimetrics
Variables
Expand Down
4 changes: 2 additions & 2 deletions doc/source/Getting_started/versioning.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ gRPC interface

This is the default and preferred interface to connect to AEDT.
Ansys 2022 R2 and later support the latest gRPC interface, allowing
for remote management of MAPDL with rapid streaming of mesh, results,
and files from the MAPDL service.
for remote management of AEDT with rapid streaming of mesh, results,
and files from the AEDT service.


Legacy interfaces
Expand Down
15 changes: 14 additions & 1 deletion doc/source/User_guide/extensions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,24 @@ Project extension apply to all extensions that are applicable for all AEDT appli
.. grid:: 2

.. grid-item-card:: Import Nastran
:link: pyaedt_extensions_doc/project
:link: pyaedt_extensions_doc/project/import_nastran
:link-type: doc

Import a Nastran or STL file in any 3D modeler application.

.. grid-item-card:: Configure Layout
:link: pyaedt_extensions_doc/project/configure_edb
:link-type: doc

Configure layout for PCB & package analysis.

.. grid-item-card:: Configure layout
:link: pyaedt_extensions_doc/project/advanced_fields_calculator
:link-type: doc

Lear how to use the Advanced Fields Calculator.


.. toctree::
:hidden:
:maxdepth: 2
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,6 @@
Import Nastran
==============

You can import a Nastran or STL file in any 3D modeler. You can also preview the imported file and decimate it prior to import.

You can access the extension from the icon created on the **Automation** tab using the Extension Manager.

The following image shows the extension user interface:

.. image:: import_nastran_ui.png
:width: 800
:alt: Import Nastran UI

You can also launch the extension user interface from the terminal:
Command line extension launch
=============================
Every extension can also launch the extension user interface from the terminal:

.. code::
Expand Down
Loading

0 comments on commit a060847

Please sign in to comment.