Skip to content

Commit

Permalink
Merge branch 'main' into release/0.7
Browse files Browse the repository at this point in the history
# Conflicts:
#	.github/workflows/full_documentation.yml
#	pyaedt/__init__.py
  • Loading branch information
Samuelopez-ansys committed Oct 19, 2023
2 parents 02f39c6 + 8713283 commit 54e4b70
Show file tree
Hide file tree
Showing 70 changed files with 2,263 additions and 765 deletions.
7 changes: 7 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,10 @@ testing:
- _unittest/conftest.py
- _unittest_ironpython/run_unittests.py
- _unittest_ironpython/run_unittests_batchmode.cmd
# TODO : Remove once EDB is extracted from PyAEDT
edb:
- examples/00-EDB/**
- examples/01-HFSS3DLayout/EDB_in_3DLayout.py
- examples/05-Q3D/Q3D_from_EDB.py
- pyaedt/edb_core/**
- pyaedt/edb.py
40 changes: 20 additions & 20 deletions .github/workflows/full_documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
# The type of runner that the job will run on
name: full_documentation
runs-on: [windows-latest, pyaedt]
timeout-minutes: 600
timeout-minutes: 480
strategy:
matrix:
python-version: ['3.10']
Expand Down Expand Up @@ -73,10 +73,10 @@ jobs:
testenv\Scripts\Activate.ps1
sphinx-build -j auto --color -b html -a doc/source doc/_build/html
# - name: Create PDF Documentations
# run: |
# testenv\Scripts\Activate.ps1
# .\doc\make.bat pdf
- name: Create PDF Documentations
run: |
testenv\Scripts\Activate.ps1
.\doc\make.bat pdf
- name: Upload HTML documentation artifact
uses: actions/upload-artifact@v3
Expand All @@ -92,20 +92,20 @@ jobs:
path: doc/_build/html/EDBAPI
retention-days: 7

# - name: Upload PDF documentation artifact
# uses: actions/upload-artifact@v3
# with:
# name: documentation-pdf
# path: doc/_build/pdf
# retention-days: 7

# - name: Release
# uses: softprops/action-gh-release@v1
# if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
# with:
# generate_release_notes: true
# files: |
# doc/_build/pdf
- name: Upload PDF documentation artifact
uses: actions/upload-artifact@v3
with:
name: documentation-pdf
path: doc/_build/pdf
retention-days: 7

- name: Release
uses: softprops/action-gh-release@v1
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
with:
generate_release_notes: true
files: |
doc/_build/pdf
doc-deploy-stable:
name: Deploy stable documentation
Expand Down Expand Up @@ -169,4 +169,4 @@ jobs:
host-url: ${{ vars.MEILISEARCH_HOST_URL }}
api-key: ${{ env.MEILISEARCH_API_KEY }}
doc-artifact-name: documentation-html-edb # Add only EDB API as page in this index.
pymeilisearchopts: --port 8001 #serve in another port
pymeilisearchopts: --port 8001 #serve in another port
28 changes: 18 additions & 10 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,15 @@ jobs:
# uses: pyansys/pydpf-actions/check-licenses@v2.0

- name: 'Unit testing'
timeout-minutes: 40
run: |
testenv_s\Scripts\Activate.ps1
Set-Item -Path env:PYTHONMALLOC -Value "malloc"
pytest --durations=50 -v --cov=pyaedt --cov-report=xml --cov-report=html --junitxml=junit/test-results.xml _unittest_solvers
uses: nick-fields/retry@v2
with:
max_attempts: 3
retry_on: error
timeout_minutes: 40
command: |
testenv_s\Scripts\Activate.ps1
Set-Item -Path env:PYTHONMALLOC -Value "malloc"
pytest --durations=50 -v --cov=pyaedt --cov-report=xml --cov-report=html --junitxml=junit/test-results.xml _unittest_solvers
- uses: codecov/codecov-action@v3
env:
Expand Down Expand Up @@ -125,11 +129,15 @@ jobs:
# uses: pyansys/pydpf-actions/check-licenses@v2.0

- name: 'Unit testing'
timeout-minutes: 40
run: |
testenv\Scripts\Activate.ps1
Set-Item -Path env:PYTHONMALLOC -Value "malloc"
pytest -n 6 --dist loadfile --durations=50 -v --cov=pyaedt --cov-report=xml --cov-report=html --junitxml=junit/test-results.xml _unittest
uses: nick-fields/retry@v2
with:
max_attempts: 3
retry_on: error
timeout_minutes: 40
command: |
testenv\Scripts\Activate.ps1
Set-Item -Path env:PYTHONMALLOC -Value "malloc"
pytest -n 6 --dist loadfile --durations=50 -v --cov=pyaedt --cov-report=xml --cov-report=html --junitxml=junit/test-results.xml _unittest
- uses: codecov/codecov-action@v3
env:
Expand Down
12 changes: 9 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,22 +38,22 @@ repos:
- --max-line-length=120

- repo: https://github.com/codespell-project/codespell
rev: v2.2.5
rev: v2.2.6
hooks:
- id: codespell
additional_dependencies:
- tomli

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.5.0
hooks:
- id: requirements-txt-fixer
- id: debug-statements
- id: trailing-whitespace

# validate GitHub workflow files
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.26.3
rev: 0.27.0
hooks:
- id: check-github-workflows

Expand All @@ -63,6 +63,12 @@ repos:
- id: blacken-docs
additional_dependencies: [black==23.9.1]


# - repo: https://github.com/numpy/numpydoc
# rev: v1.6.0
# hooks:
# - id: numpydoc-validation

# - repo: https://github.com/pycqa/pydocstyle
# rev: 6.1.1
# hooks:
Expand Down
92 changes: 92 additions & 0 deletions _unittest/example_models/TEDB/stackup.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
{
"materials": {
"copper": {
"name": "copper",
"conductivity": 58000000.0
},
"fr4_epoxy": {
"name": "fr4_epoxy",
"loss_tangent": 0.02,
"permittivity": 4.4
},
"solder_mask": {
"name": "solder_mask",
"loss_tangent": 0.035,
"permittivity": 3.1
}
},
"layers": {
"TOP": {
"name": "TOP",
"type": "signal",
"material": "copper",
"dielectric_fill": "copper",
"thickness": 5.000000000000004e-05
},
"D1": {
"name": "D1",
"type": "dielectric",
"material": "fr4_epoxy",
"thickness": 0.0001
},
"L2": {
"name": "L2",
"type": "signal",
"material": "copper",
"dielectric_fill": "copper",
"thickness": 3.5000000000000004e-05
},
"D2": {
"name": "D2",
"type": "dielectric",
"material": "fr4_epoxy",
"thickness": 0.0001
},
"L3": {
"name": "L3",
"type": "signal",
"material": "copper",
"dielectric_fill": "copper",
"thickness": 3.5000000000000004e-05
},
"D3": {
"name": "D3",
"type": "dielectric",
"material": "fr4_epoxy",
"thickness": 0.0001
},
"L4": {
"name": "L4",
"type": "signal",
"material": "copper",
"dielectric_fill": "copper",
"thickness": 3.5000000000000004e-05
},
"D4": {
"name": "D4",
"type": "dielectric",
"material": "fr4_epoxy",
"thickness": 0.0001
},
"L5": {
"name": "L5",
"type": "signal",
"material": "copper",
"dielectric_fill": "copper",
"thickness": 3.5000000000000004e-05
},
"D5": {
"name": "D5",
"type": "dielectric",
"material": "fr4_epoxy",
"thickness": 0.0001
},
"BOT": {
"name": "BOT",
"type": "signal",
"material": "copper",
"dielectric_fill": "copper",
"thickness": 5.000000000000004e-05
}
}
}
46 changes: 45 additions & 1 deletion _unittest/test_00_EDB.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import json
import os

# Setup paths for module imports
Expand Down Expand Up @@ -117,6 +118,7 @@ def test_003_create_coax_port_on_component(self):
assert self.edbapp.components["U6"].pins["R3"].id
assert self.edbapp.terminals
assert self.edbapp.ports
assert self.edbapp.components["U6"].pins["R3"].get_connected_objects()

def test_004_get_properties(self):
assert len(self.edbapp.components.components) > 0
Expand Down Expand Up @@ -884,6 +886,11 @@ def test_069_create_path(self):
assert trace
assert isinstance(trace.get_center_line(), list)
assert isinstance(trace.get_center_line(True), list)
self.edbapp["delta_x"] = "1mm"
assert trace.add_point("delta_x", "1mm", True)
assert trace.get_center_line(True)[-1][0] == "(delta_x)+(0.025)"
assert trace.add_point(0.001, 0.002)
assert trace.get_center_line()[-1] == [0.001, 0.002]

def test_070_create_outline(self):
edbapp = Edb(
Expand Down Expand Up @@ -1840,6 +1847,18 @@ def test_125c_layer(self):
assert layer.material == "copper"
edbapp.close()

def test_125d_stackup(self):
fpath = os.path.join(local_path, "example_models", test_subfolder, "stackup.json")
stackup_json = json.load(open(fpath, "r"))

edbapp = Edb(edbversion=desktop_version)
edbapp.stackup.load(fpath)
edbapp.close()

edbapp = Edb(edbversion=desktop_version)
edbapp.stackup.load(stackup_json)
edbapp.close()

def test_126_comp_def(self):
source_path = os.path.join(local_path, "example_models", test_subfolder, "ANSYS-HSD_V1.aedb")
target_path = os.path.join(self.local_scratch.path, "test_0126.aedb")
Expand Down Expand Up @@ -2461,6 +2480,11 @@ def test_130_create_padstack_instance(self):
assert pad_instance3.dcir_equipotential_region
pad_instance3.dcir_equipotential_region = False
assert not pad_instance3.dcir_equipotential_region

trace = edb.modeler.create_trace([[0, 0], [0, 10e-3]], "1_Top", "0.1mm", "trace_with_via_fence")
edb.padstacks.create_padstack("via_0")
trace.create_via_fence("1mm", "1mm", "via_0")

edb.close()

def test_131_assign_hfss_extent_non_multiple_with_simconfig(self):
Expand Down Expand Up @@ -2841,6 +2865,7 @@ def test_145_arc_data(self):
assert self.edbapp.nets["1.2V_DVDDL"].primitives[0].arcs[0].height

def test_145_via_volume(self):
#
vias = [
via
for via in list(self.edbapp.padstacks.padstack_instances.values())
Expand Down Expand Up @@ -2879,10 +2904,29 @@ def test_147_find_dc_shorts(self):
target_path = os.path.join(self.local_scratch.path, "test_dc_shorts", "ANSYS-HSD_V1_dc_shorts.aedb")
self.local_scratch.copyfolder(source_path, target_path)
edbapp = Edb(target_path, edbversion=desktop_version)
dc_shorts = edbapp.nets.find_dc_shorts()
dc_shorts = edbapp.layout_validation.dc_shorts()
assert dc_shorts
edbapp.nets.nets["DDR4_A0"].name = "DDR4$A0"
edbapp.layout_validation.illegal_net_names(True)
edbapp.layout_validation.illegal_rlc_values(True)

# assert len(dc_shorts) == 20
assert ["LVDS_CH09_N", "GND"] in dc_shorts
assert ["LVDS_CH09_N", "DDR4_DM3"] in dc_shorts
assert ["DDR4_DM3", "LVDS_CH07_N"] in dc_shorts
assert len(edbapp.nets["DDR4_DM3"].find_dc_short()) > 0
edbapp.nets["DDR4_DM3"].find_dc_short(True)
assert len(edbapp.nets["DDR4_DM3"].find_dc_short()) == 0
edbapp.close()

def test_148_load_amat(self):
assert "Rogers RO3003 (tm)" in self.edbapp.materials.materials_in_aedt
material_file = os.path.join(self.edbapp.materials.syslib, "Materials.amat")
assert self.edbapp.materials.add_material_from_aedt("Arnold_Magnetics_N28AH_-40C")
assert "Arnold_Magnetics_N28AH_-40C" in self.edbapp.materials.materials.keys()
assert self.edbapp.materials.load_amat(material_file)
material_list = list(self.edbapp.materials.materials.keys())
assert material_list
assert len(material_list) > 0
assert self.edbapp.materials.materials["Rogers RO3003 (tm)"].loss_tangent == 0.0013
assert self.edbapp.materials.materials["Rogers RO3003 (tm)"].permittivity == 3.0
1 change: 1 addition & 0 deletions _unittest/test_01_downloads.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ def test_13_download_specific_folder(self):
def test_14_download_icepak_3d_component(self):
assert self.examples.download_icepak_3d_component()

@pytest.mark.skipif(is_linux, reason="Failing download files")
def test_15_download_fss_file(self):
example_folder = self.examples.download_FSS_3dcomponent()
assert os.path.exists(example_folder)
13 changes: 11 additions & 2 deletions _unittest/test_03_Materials.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,17 @@ def test_02_create_material(self):
assert self.aedtapp.change_validation_settings()
assert self.aedtapp.change_validation_settings(ignore_unclassified=True, skip_intersections=True)

assert mat1.set_magnetic_coercitivity(1, 2, 3, 4)
assert mat1.get_magnetic_coercitivity() == ("1A_per_meter", "2", "3", "4")
assert mat1.set_magnetic_coercivity(1, 2, 3, 4)
assert mat1.get_magnetic_coercivity() == ("1A_per_meter", "2", "3", "4")
mat1.coordinate_system = "Cylindrical"
assert mat1.coordinate_system == "Cylindrical"
mat1.magnetic_coercivity = [2, 1, 0, 1]

assert mat1.get_magnetic_coercivity() == ("2A_per_meter", "1", "0", "1")
mat1.magnetic_coercivity.value = ["1", "2", "3", "4"]
assert mat1.get_magnetic_coercivity() == ("1A_per_meter", "2", "3", "4")
assert mat1.magnetic_coercivity.evaluated_value == [1.0, 2.0, 3.0, 4.0]

assert mat1.set_electrical_steel_coreloss(1, 2, 3, 4, 0.002)
assert mat1.get_curve_coreloss_type() == "Electrical Steel"
assert mat1.get_curve_coreloss_values()["core_loss_equiv_cut_depth"] == "0.002meter"
Expand Down
Loading

0 comments on commit 54e4b70

Please sign in to comment.