Skip to content

Commit

Permalink
Merge branch 'main' into release/0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Samuelopez-ansys committed Aug 12, 2024
2 parents 66d4ef9 + f762a3d commit 09dcd45
Show file tree
Hide file tree
Showing 30 changed files with 1,056 additions and 549 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/ci_cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ jobs:
runs-on: [self-hosted, pyaedt, toolkits, Linux]
needs: [ smoke-tests ]
env:
ANSYSEM_ROOT241: '/ansys_inc/AnsysEM/v241/Linux64'
ANSYSEM_ROOT242: '/ansys_inc/AnsysEM/v242/Linux64'
ANS_NODEPCHECK: '1'
steps:
- uses: actions/checkout@v4
Expand All @@ -242,28 +242,28 @@ jobs:
python -c "import sys; print(sys.executable)"
python -m pip install --upgrade pip
pip install --upgrade build wheel
pip install .[tests]
pip install --no-cache-dir .[tests]
pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host files.pythonhosted.org pytest-azurepipelines
- name: Antenna models testing
timeout-minutes: 5
run: |
export LD_LIBRARY_PATH=${{ env.ANSYSEM_ROOT241 }}/common/mono/Linux64/lib64:${{ env.ANSYSEM_ROOT241 }}/Delcross:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=${{ env.ANSYSEM_ROOT242 }}/common/mono/Linux64/lib64:${{ env.ANSYSEM_ROOT242 }}/Delcross:$LD_LIBRARY_PATH
source .venv_linux/bin/activate
pytest -v -m antenna_models_common_api
pytest -v -m antenna_models_api
- name: Toolkit API testing
timeout-minutes: 30
run: |
export LD_LIBRARY_PATH=${{ env.ANSYSEM_ROOT241 }}/common/mono/Linux64/lib64:${{ env.ANSYSEM_ROOT241 }}/Delcross:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=${{ env.ANSYSEM_ROOT242 }}/common/mono/Linux64/lib64:${{ env.ANSYSEM_ROOT242 }}/Delcross:$LD_LIBRARY_PATH
source .venv_linux/bin/activate
pytest -v -m antenna_toolkit_api
- name: Toolkit REST API testing
timeout-minutes: 30
run: |
export LD_LIBRARY_PATH=${{ env.ANSYSEM_ROOT241 }}/common/mono/Linux64/lib64:${{ env.ANSYSEM_ROOT241 }}/Delcross:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=${{ env.ANSYSEM_ROOT242 }}/common/mono/Linux64/lib64:${{ env.ANSYSEM_ROOT242 }}/Delcross:$LD_LIBRARY_PATH
source .venv_linux/bin/activate
pytest -v -m antenna_toolkit_rest_api
Expand Down
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ exclude: |
repos:

- repo: https://github.com/psf/black
rev: 24.4.2 # IF VERSION CHANGES --> MODIFY "blacken-docs" MANUALLY AS WELL!!
rev: 24.8.0 # IF VERSION CHANGES --> MODIFY "blacken-docs" MANUALLY AS WELL!!
hooks:
- id: black
args:
- --line-length=120

- 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]
additional_dependencies: [black==24.8.0]

- repo: https://github.com/pycqa/isort
rev: 5.13.2
Expand All @@ -28,14 +28,14 @@ repos:
args: ['--force-single-line-imports', '--profile', 'black']

- repo: https://github.com/PyCQA/flake8
rev: 7.0.0
rev: 7.1.1
hooks:
- id: flake8
args:
- --max-line-length=120

- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
rev: v2.3.0
hooks:
- id: codespell
args: ["--ignore-words=doc/styles/config/vocabularies/ANSYS/accept.txt"]
2 changes: 1 addition & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ contributors and maintainers pledge to making participation in our
project and our community a harassment-free experience for everyone,
regardless of age, body size, disability, ethnicity, sex
characteristics, gender identity and expression, level of experience,
education, socio-economic status, nationality, personal appearance,
education, socioeconomic status, nationality, personal appearance,
race, religion, or sexual identity and orientation.

## Our Standards
Expand Down
3 changes: 2 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ Antenna Toolkit
The Antenna Toolkit is a Python interface for accelerating antenna design
using `Ansys Electronics Desktop <https://www.ansys.com/products/electronics>`_
(AEDT). You can launch this toolkit from the AEDT UI or launch it directly
from a Python console.
from a Python console. This toolkit can also be launched as desktop application
based on `Pyside6 <https://doc.qt.io/qtforpython-6/quickstart.html>`_.

Requirements
~~~~~~~~~~~~
Expand Down
20 changes: 9 additions & 11 deletions doc/source/examples/antenna_toolkit_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import tempfile

import pyaedt
from pyaedt.modules.solutions import FfdSolutionData
from pyaedt.generic.farfield_visualization import FfdSolutionData

from ansys.aedt.toolkits.antenna.backend.api import ToolkitBackend
from ansys.aedt.toolkits.antenna.backend.models import properties
Expand All @@ -18,7 +18,7 @@
#
# Set AEDT version.

aedt_version = "2024.1"
aedt_version = "2024.2"

# ## Set non-graphical mode
#
Expand All @@ -29,7 +29,7 @@
# ## Create temporary directory

temp_dir = tempfile.TemporaryDirectory(suffix="_ansys")
project_name = pyaedt.generate_unique_project_name(rootname=temp_dir.name, project_name="antenna_toolkit")
project_name = pyaedt.generate_unique_project_name(root_name=temp_dir.name, project_name="antenna_toolkit")

# ## Set default properties

Expand Down Expand Up @@ -183,12 +183,10 @@

# ## Get farfield results

farfield_data = toolkit_api.farfield_results()

# ## Get farfield results

frequency_str = str(properties.antenna.synthesis.frequency) + properties.antenna.synthesis.frequency_unit
farfield_eep, farfield_frequency = toolkit_api.export_farfield(frequencies=frequency_str, sphere="3D", encode=False)
farfield_metadata, farfield_frequency = toolkit_api.export_farfield(
frequencies=frequency_str, sphere="3D", encode=False
)

# ## Get antenna model

Expand All @@ -210,15 +208,15 @@
for file in files:
model.add_object(file[0], file[1], file[2])

model.plot()
model.plot(show=False)

# ## Load far field

farfield_data = FfdSolutionData(farfield_eep[0], farfield_frequency)
farfield_data = FfdSolutionData(farfield_metadata)

# ## Plot far field

data = farfield_data.polar_plot_3d_pyvista()
data = farfield_data.plot_3d(show=False)

# ## Clean temporary directory

Expand Down
6 changes: 3 additions & 3 deletions doc/source/examples/create_antenna_simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#
# Set AEDT version.

aedt_version = "2024.1"
aedt_version = "2024.2"

# ## Set non-graphical mode
#
Expand All @@ -29,7 +29,7 @@
# ## Create temporary directory

temp_dir = tempfile.TemporaryDirectory(suffix="_ansys")
project_name = pyaedt.generate_unique_project_name(rootname=temp_dir.name, project_name="bowtie_example")
project_name = pyaedt.generate_unique_project_name(root_name=temp_dir.name, project_name="bowtie_example")

# ## Create antenna object only for synthesis
#
Expand Down Expand Up @@ -63,7 +63,7 @@
#
# Create an empty HFSS design.

app = pyaedt.Hfss(projectname=project_name, specified_version=aedt_version, non_graphical=non_graphical)
app = pyaedt.Hfss(project=project_name, version=aedt_version, non_graphical=non_graphical)

# ## Create antenna in HFSS
#
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ line-length = 120
profile = "black"
force_sort_within_sections = true
line_length = 120
default_section = "THIRDPARTY"
src_paths = ["doc", "src", "tests"]

[tool.coverage.run]
Expand Down
66 changes: 33 additions & 33 deletions src/ansys/aedt/toolkits/antenna/backend/antenna_models/bowtie.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,10 +200,10 @@ def model_hfss(self):

# Substrate
sub = self._app.modeler.create_box(
position=["-" + sub_x + "/2", "-" + sub_y + "/2", 0.0],
dimensions_list=[sub_x, sub_y, sub_h],
origin=["-" + sub_x + "/2", "-" + sub_y + "/2", 0.0],
sizes=[sub_x, sub_y, sub_h],
name="sub_" + antenna_name,
matname=self.material,
material=self.material,
)
sub.color = (0, 128, 0)
sub.transparency = 0.8
Expand All @@ -225,9 +225,9 @@ def model_hfss(self):
ant2 = self._app.modeler[ant2_name]
ant2.transparency = 0.1
p1 = self._app.modeler.create_rectangle(
csPlane=self._app.PLANE.XY,
position=["-{}/2".format(inner_width), "-{}/2".format(port_gap), 0.0],
dimension_list=[inner_width, port_gap],
orientation=self._app.PLANE.XY,
origin=["-{}/2".format(inner_width), "-{}/2".format(port_gap), 0.0],
sizes=[inner_width, port_gap],
name="port_lump_" + antenna_name,
)
p1.color = (128, 0, 0)
Expand Down Expand Up @@ -433,10 +433,10 @@ def model_hfss(self):

# Substrate
sub = self._app.modeler.create_box(
position=["-" + sub_x + "/2", "-" + sub_y + "/2", 0.0],
dimensions_list=[sub_x, sub_y, sub_h],
origin=["-" + sub_x + "/2", "-" + sub_y + "/2", 0.0],
sizes=[sub_x, sub_y, sub_h],
name="sub_" + antenna_name,
matname=self.material,
material=self.material,
)
sub.color = (0, 128, 0)
sub.transparency = 0.8
Expand Down Expand Up @@ -466,9 +466,9 @@ def model_hfss(self):
ant2 = self._app.modeler[ant2_name]
ant2.transparency = 0.1
p1 = self._app.modeler.create_rectangle(
csPlane=self._app.PLANE.XY,
position=["-{}/2".format(inner_width), "-{}/2".format(port_gap), 0.0],
dimension_list=[inner_width, port_gap],
orientation=self._app.PLANE.XY,
origin=["-{}/2".format(inner_width), "-{}/2".format(port_gap), 0.0],
sizes=[inner_width, port_gap],
name="port_lump_" + antenna_name,
)
p1.color = (128, 0, 0)
Expand Down Expand Up @@ -674,30 +674,30 @@ def model_hfss(self):

# Substrate
sub = self._app.modeler.create_box(
position=["-" + sub_x + "/2", "-" + sub_y + "/2", 0.0],
dimensions_list=[sub_x, sub_y, sub_h],
origin=["-" + sub_x + "/2", "-" + sub_y + "/2", 0.0],
sizes=[sub_x, sub_y, sub_h],
name="sub_" + antenna_name,
matname=self.material,
material=self.material,
)
sub.color = (0, 128, 0)
sub.transparency = 0.8
sub.history().props["Coordinate System"] = coordinate_system

# Slot
slot = self._app.modeler.create_rectangle(
csPlane=self._app.PLANE.XY,
position=["-" + sub_x + "/2", "-" + sub_y + "/2", 0.0],
dimension_list=[sub_x, sub_y],
orientation=self._app.PLANE.XY,
origin=["-" + sub_x + "/2", "-" + sub_y + "/2", 0.0],
sizes=[sub_x, sub_y],
name="ant_" + antenna_name,
)
slot.color = (0, 128, 0)
slot.history().props["Coordinate System"] = coordinate_system

# Inner Slot
islot = self._app.modeler.create_rectangle(
csPlane=self._app.PLANE.XY,
position=["-" + inner_width + "/2", "-" + port_gap + "/2", 0.0],
dimension_list=[inner_width, port_gap],
orientation=self._app.PLANE.XY,
origin=["-" + inner_width + "/2", "-" + port_gap + "/2", 0.0],
sizes=[inner_width, port_gap],
name="slot_" + antenna_name,
)
islot.color = (0, 128, 0)
Expand Down Expand Up @@ -727,19 +727,19 @@ def model_hfss(self):
)

feed = self._app.modeler.create_rectangle(
csPlane=self._app.PLANE.XY,
position=["-{}/2".format(inner_width), "-{}/2".format(port_gap), 0.0],
dimension_list=["-{}/2+{}/2".format(sub_x, inner_width), "-{}".format(port_gap)],
orientation=self._app.PLANE.XY,
origin=["-{}/2".format(inner_width), "-{}/2".format(port_gap), 0.0],
sizes=["-{}/2+{}/2".format(sub_x, inner_width), "-{}".format(port_gap)],
name="feed_" + antenna_name,
)
feed.color = (128, 0, 0)
feed.history().props["Coordinate System"] = coordinate_system
self._app.modeler.move([feed.name], [0, feed_offset, 0])

feed1 = self._app.modeler.create_rectangle(
csPlane=self._app.PLANE.XY,
position=["{}/2".format(inner_width), "-{}/2".format(port_gap), 0.0],
dimension_list=["{}/2-{}/2".format(sub_x, inner_width), "-{}".format(port_gap)],
orientation=self._app.PLANE.XY,
origin=["{}/2".format(inner_width), "-{}/2".format(port_gap), 0.0],
sizes=["{}/2-{}/2".format(sub_x, inner_width), "-{}".format(port_gap)],
name="feed_" + antenna_name,
)
feed1.color = (128, 0, 0)
Expand All @@ -749,19 +749,19 @@ def model_hfss(self):
self._app.modeler.unite([slot.name, feed.name, feed1.name])

p1 = self._app.modeler.create_rectangle(
csPlane=self._app.PLANE.XY,
position=["{}/2".format(inner_width), "-{}/2".format(port_gap), 0.0],
dimension_list=["-{}*0.95".format(inner_width), "-{}".format(port_gap)],
orientation=self._app.PLANE.XY,
origin=["{}/2".format(inner_width), "-{}/2".format(port_gap), 0.0],
sizes=["-{}*0.95".format(inner_width), "-{}".format(port_gap)],
name="port_lump_" + antenna_name,
)
p1.color = (128, 0, 0)
p1.history().props["Coordinate System"] = coordinate_system
self._app.modeler.move([p1.name], [0, feed_offset, 0])

ref = self._app.modeler.create_rectangle(
csPlane=self._app.PLANE.XY,
position=["-{}/2".format(inner_width), "-{}/2".format(port_gap), 0.0],
dimension_list=["{}*0.05".format(inner_width), "-{}".format(port_gap)],
orientation=self._app.PLANE.XY,
origin=["-{}/2".format(inner_width), "-{}/2".format(port_gap), 0.0],
sizes=["{}*0.05".format(inner_width), "-{}".format(port_gap)],
name="gnd_" + antenna_name,
)
ref.color = (128, 0, 0)
Expand Down
Loading

0 comments on commit 09dcd45

Please sign in to comment.