Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into release/0.9
Browse files Browse the repository at this point in the history
  • Loading branch information
maxcapodi78 authored and maxcapodi78 committed Jul 12, 2024
2 parents a060847 + b498169 commit 59af88d
Show file tree
Hide file tree
Showing 47 changed files with 1,062 additions and 173 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/ci_cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ jobs:
.venv\Scripts\Activate.ps1
# Uninstall conflicting dependencies
pip uninstall --yes vtk
pip install --extra-index-url https://wheels.vtk.org vtk-osmesa==9.2.20230527.dev0
pip install --extra-index-url https://wheels.vtk.org vtk-osmesa
# TODO: Update this step once pyaedt-examples is ready
# NOTE: Use environment variable to keep the doctree and avoid redundant build for PDF pages
Expand Down Expand Up @@ -259,7 +259,7 @@ jobs:
.venv\Scripts\Activate.ps1
# Uninstall conflicting dependencies
pip uninstall --yes vtk
pip install --extra-index-url https://wheels.vtk.org vtk-osmesa==9.2.20230527.dev0
pip install --extra-index-url https://wheels.vtk.org vtk-osmesa
- name: Run tests on _unittest_solvers
env:
Expand Down Expand Up @@ -375,7 +375,7 @@ jobs:
.venv\Scripts\Activate.ps1
# Uninstall conflicting dependencies
pip uninstall --yes vtk
pip install --extra-index-url https://wheels.vtk.org vtk-osmesa==9.2.20230527.dev0
pip install --extra-index-url https://wheels.vtk.org vtk-osmesa
- name: Run tests on _unittest
uses: nick-fields/retry@v3
Expand Down Expand Up @@ -445,7 +445,7 @@ jobs:
source .venv/bin/activate
# Uninstall conflicting dependencies
pip uninstall --yes vtk
pip install --extra-index-url https://wheels.vtk.org vtk-osmesa==9.2.20230527.dev0
pip install --extra-index-url https://wheels.vtk.org vtk-osmesa
- name: Run tests on _unittest
uses: nick-fields/retry@v3
Expand Down
6 changes: 3 additions & 3 deletions _unittest/test_01_Design.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,10 +379,10 @@ def test_32_make_read_only_variable(self):

def test_33_aedt_object(self):
aedt_obj = AedtObjects()
assert aedt_obj.odesign
assert aedt_obj.oproject
assert aedt_obj._odesign
assert aedt_obj._oproject
aedt_obj = AedtObjects(self.aedtapp._desktop_class, self.aedtapp.oproject, self.aedtapp.odesign)
assert aedt_obj.odesign == self.aedtapp.odesign
assert aedt_obj._odesign == self.aedtapp.odesign

def test_34_force_project_path_disable(self):
settings.force_error_on_missing_project = True
Expand Down
39 changes: 39 additions & 0 deletions _unittest/test_03_Materials.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,3 +408,42 @@ def test_14_set_core_loss(self):
self.aedtapp.materials["mat_test"].set_coreloss_at_frequency(
points_at_frequency={60: [[0, 0], [1, 3.5], [2, 7.4]]}, thickness=50
)

def test_15_thermalmodifier_and_spatialmodifier(self):
assert self.aedtapp.materials["vacuum"].conductivity.thermalmodifier is None
assert self.aedtapp.materials["vacuum"].conductivity.spatialmodifier is None

self.aedtapp.materials["vacuum"].conductivity.thermalmodifier = "1"
assert self.aedtapp.materials["vacuum"].conductivity.thermalmodifier == "1"
self.aedtapp.materials["vacuum"].conductivity.spatialmodifier = "1"
assert self.aedtapp.materials["vacuum"].conductivity.spatialmodifier == "1"

self.aedtapp.materials["vacuum"].conductivity.thermalmodifier = None
assert self.aedtapp.materials["vacuum"].conductivity.thermalmodifier is None
self.aedtapp.materials["vacuum"].conductivity.thermalmodifier = "2"
assert self.aedtapp.materials["vacuum"].conductivity.thermalmodifier == "2"

self.aedtapp.materials["vacuum"].conductivity.spatialmodifier = None
assert self.aedtapp.materials["vacuum"].conductivity.spatialmodifier is None
self.aedtapp.materials["vacuum"].conductivity.spatialmodifier = "2"
assert self.aedtapp.materials["vacuum"].conductivity.spatialmodifier == "2"

self.aedtapp.materials["vacuum"].conductivity.thermalmodifier = None
assert self.aedtapp.materials["vacuum"].conductivity.thermalmodifier is None
self.aedtapp.materials["vacuum"].conductivity.spatialmodifier = None
assert self.aedtapp.materials["vacuum"].conductivity.spatialmodifier is None

self.aedtapp.materials["vacuum"].conductivity.thermalmodifier = "3"
assert self.aedtapp.materials["vacuum"].conductivity.thermalmodifier == "3"
self.aedtapp.materials["vacuum"].conductivity.spatialmodifier = "3"
assert self.aedtapp.materials["vacuum"].conductivity.spatialmodifier == "3"

self.aedtapp.materials["vacuum"].conductivity.thermalmodifier = None
self.aedtapp.materials["vacuum"].conductivity.spatialmodifier = None
self.aedtapp.materials["vacuum"].conductivity.thermalmodifier = "4"
assert self.aedtapp.materials["vacuum"].conductivity.thermalmodifier == "4"
self.aedtapp.materials["vacuum"].conductivity.spatialmodifier = "4"
assert self.aedtapp.materials["vacuum"].conductivity.spatialmodifier == "4"

self.aedtapp.materials["vacuum"].conductivity.thermalmodifier = None
self.aedtapp.materials["vacuum"].conductivity.spatialmodifier = None
2 changes: 0 additions & 2 deletions _unittest/test_04_SBR.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@

import builtins
import os
import sys
from unittest.mock import mock_open

from mock import patch
Expand Down Expand Up @@ -254,7 +253,6 @@ def test_12_import_map(self):
for part in parts_dict["parts"]:
assert os.path.exists(parts_dict["parts"][part]["file_name"])

@pytest.mark.skipif(sys.version_info > (3, 8), reason="Bug in VTK with 3.12")
@pytest.mark.skipif(is_linux, reason="feature supported in Cpython")
def test_16_read_hdm(self):
self.aedtapp.insert_design("hdm")
Expand Down
1 change: 1 addition & 0 deletions _unittest/test_08_Primitives3D.py
Original file line number Diff line number Diff line change
Expand Up @@ -1460,6 +1460,7 @@ def test_71_create_choke(self, filename):
self.aedtapp.delete_design(self.aedtapp.design_name)

def test_72_check_choke_values(self):
self.aedtapp.insert_design("ChokeValues")
choke_file1 = os.path.join(local_path, "example_models", "choke_json_file", "choke_1winding_1Layer.json")
choke_file2 = os.path.join(local_path, "example_models", "choke_json_file", "choke_2winding_1Layer_Common.json")
choke_file3 = os.path.join(
Expand Down
1 change: 0 additions & 1 deletion _unittest/test_12_PostProcessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,6 @@ def test_70_far_field_data(self):
)
assert isinstance(data_pyvista, Plotter)

@pytest.mark.skipif(sys.version_info > (3, 11), reason="Issues with VTK in Python 3.12")
@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="3D")
Expand Down
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)
8 changes: 6 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 Expand Up @@ -1019,6 +1022,7 @@ def test_52_flatten_3d_components(self):
self.aedtapp.delete_design()

def test_53_create_conduting_plate(self):
self.aedtapp.insert_design("conducting")
box = self.aedtapp.modeler.create_box([0, 0, 0], [10, 20, 10], name="box1")
self.aedtapp.modeler.create_rectangle(self.aedtapp.PLANE.XY, [0, 0, 0], [10, 20], name="surf1")
self.aedtapp.modeler.create_rectangle(self.aedtapp.PLANE.YZ, [0, 0, 0], [10, 20], name="surf2")
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
1 change: 1 addition & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ coverage:
- "pyaedt/common_rpc.py" # ignore folders and all its contents
- "pyaedt/generic/grpc_plugin_dll_class.py" # ignore file to interact with AEDT grpc api
- "pyaedt/edb.py" # ignore folders and all its contents
- "pyaedt/workflows/project/kernel_converter.py" # ignore folders and all its contents
21 changes: 12 additions & 9 deletions doc/source/Resources/pyaedt_installer_from_aedt.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,15 +193,18 @@ def install_pyaedt():

if args.wheel and os.path.exists(args.wheel):
wheel_pyaedt = args.wheel
import zipfile
unzipped_path = os.path.join(os.path.dirname(wheel_pyaedt),
os.path.splitext(os.path.basename(wheel_pyaedt))[0])
if os.path.exists(unzipped_path):
shutil.rmtree(unzipped_path, ignore_errors=True)
with zipfile.ZipFile(wheel_pyaedt, 'r') as zip_ref:
# Extract all contents to a directory. (You can specify a different extraction path if needed.)
zip_ref.extractall(unzipped_path)

if wheel_pyaedt.endswith(".zip"):
import zipfile
unzipped_path = os.path.join(os.path.dirname(wheel_pyaedt),
os.path.splitext(os.path.basename(wheel_pyaedt))[0])
if os.path.exists(unzipped_path):
shutil.rmtree(unzipped_path, ignore_errors=True)
with zipfile.ZipFile(wheel_pyaedt, 'r') as zip_ref:
# Extract all contents to a directory. (You can specify a different extraction path if needed.)
zip_ref.extractall(unzipped_path)
else:
# Extracted folder.
unzipped_path = wheel_pyaedt
if args.version <= "231":
run_command(
'"{}" install --no-cache-dir --no-index --find-links={} pyaedt[all,dotnet]'.format(pip_exe,
Expand Down
6 changes: 6 additions & 0 deletions doc/source/User_guide/extensions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ Project extension apply to all extensions that are applicable for all AEDT appli

Lear how to use the Advanced Fields Calculator.

.. grid-item-card:: Kernel converter
:link: pyaedt_extensions_doc/project/kernel_convert
:link-type: doc

Lear how to convert projects from 2022R2 to newer versions.


.. toctree::
:hidden:
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

0 comments on commit 59af88d

Please sign in to comment.