diff --git a/examples/high_frequency/antenna/array.py b/examples/high_frequency/antenna/array.py
index ab57e3b86..7b66bd027 100644
--- a/examples/high_frequency/antenna/array.py
+++ b/examples/high_frequency/antenna/array.py
@@ -2,10 +2,17 @@
# This example shows how to create an antenna array using 3D components for the unit
# cell definition. You will see how to set
-# up the analysis, generates the EM solution, and post-process the solution data
+# up the analysis, generate the EM solution, and plot the far-field
# using Matplotlib and
# PyVista. This example runs only on Windows using CPython.
#
+# The 3x3 patch antenna array is shown below
+#
+#
+#
+# The array is automatically built by defining the number of cells in each direction.
+# The unit cell vectors are shown as red and blue arrows in the image above.
+
# Keywords: **HFSS**, **antenna array**, **3D components**, **far field**.
# ## Prerequisites
@@ -20,8 +27,9 @@
from ansys.aedt.core import Hfss
from ansys.aedt.core.visualization.advanced.farfield_visualization import \
FfdSolutionData
-from ansys.aedt.core.examples.downloads import download_3dcomponent
+from ansys.aedt.core.examples.downloads import download_file
from ansys.aedt.core.generic import file_utils
+from pathlib import Path
# -
# ### Define constants
@@ -43,47 +51,48 @@
temp_folder = tempfile.TemporaryDirectory(suffix=".ansys")
# ### Download 3D component
-# Download the 3D component that will be used to define
-# the unit cell in the antenna array.
+# Download the data used to define the antenna array. Data is retrieved from
+# the [example-data repository](https://github.com/ansys/example-data/tree/main/pyaedt)
+# on GitHub. The data
-path_to_3dcomp = download_3dcomponent(local_path=temp_folder.name)
+path_to_3dcomp = download_file(source="array_3d_component", local_path=temp_folder.name)
+# ## Model Preparation
# ### Launch HFSS
#
# The following cell creates a new ``Hfss`` object. Electronics desktop is launched and
# a new HFSS design is inserted into the project.
# +
-project_name = os.path.join(temp_folder.name, "array.aedt")
+project = Path(temp_folder.name) / "array.aedt"
hfss = Hfss(
- project=project_name,
+ project=project,
version=AEDT_VERSION,
design="Array_Simple",
non_graphical=NG_MODE,
new_desktop=False, # Set to `False` to connect to an existing AEDT session.
)
-print("Project name " + project_name)
+print("Project name " + project.name)
# -
# ### Read array definition
#
-# Read array definition from the JSON file.
+# Read array definition from the JSON file. The
+# return type is a dictionary.
-array_definition = file_utils.read_json(
- os.path.join(path_to_3dcomp, "array_simple.json")
-)
+array_definition = file_utils.read_json(Path(path_to_3dcomp) / "array_simple_2by6.json")
# ### Add the 3D component definition
#
# The JSON file links the unit cell to the 3D component
-# named "Circ_Patch_5GHz1".
+# named ``"Circ_Patch_5GHz1"``.
# This can be seen by examining ``array_definition["cells"]``. The following
# code prints the row and column indices of the array elements along with the name
# of the 3D component for each element.
#
# > **Note:** The ``array_definition["cells"]`` is of type ``dict`` and the key
-# > is builta as a string from the _(row, column)_ indices of the array element. For example:
+# > is a string built from the _(row, column)_ indices of the array element. For example:
# > the key for the element in the first row and 2nd column is ``"(1,2)"``.
print("Element\t\tName")
@@ -97,7 +106,7 @@
# [Hfss.modeler.insert_3d_component()](https://aedt.docs.pyansys.com/version/stable/API/_autosummary/ansys.aedt.core.modeler.modeler_3d.Modeler3D.insert_3d_component.html)
# or it can be added as a key to the ``array_definition`` as shown below.
-array_definition["Circ_Patch_5GHz1"] = os.path.join(path_to_3dcomp, "Circ_Patch_5GHz.a3dcomp")
+array_definition["Circ_Patch_5GHz1"] = Path(path_to_3dcomp) / "Circ_Patch_5GHz.a3dcomp"
# Note that the 3D component name is identical to the value for each element
# in the ``"cells"`` dictionary. For example,
@@ -117,11 +126,17 @@
#
# Make the center element passive and rotate the corner elements.
-array.cells[1][1].is_active = False
-array.cells[0][0].rotation = 90
-array.cells[0][2].rotation = 90
-array.cells[2][0].rotation = 90
-array.cells[2][2].rotation = 90
+# array.cells[1][1].is_active = False # Demonstrate turning element on/off.
+for nrow in range(2):
+ for ncolumn in range(6):
+ array.cells[nrow][ncolumn] = 90 # Rotate 90 degrees
+
+# The changes to the array elements can be confirmed in the HFSS user
+# interface. The center element is passive, and the corner elements are rotated
+# 90 degrees.
+#
+#
+#
# ### Set up simulation and run analysis
#
@@ -129,39 +144,58 @@
setup = hfss.create_setup()
setup.props["Frequency"] = "5GHz"
-setup.props["MaximumPasses"] = 3
-hfss.analyze(cores=NUM_CORES)
-
+setup.props["MaximumPasses"] = 2
+setup.analyze(cores=NUM_CORES)
# ## Postprocess
#
# ### Retrieve far-field data
#
-# Get far-field data. After the simulation completes, the far
-# field data is generated port by port and stored in a data class.
-
-ffdata = hfss.get_antenna_data(setup=hfss.nominal_adaptive, sphere="Infinite Sphere1")
+# After the simulation completes, the far-field data can be retrieved as
+# an instance of the
+# ``FfdSolutionData`` class by calling the
+# ``get_antenna_data()`` method as shown below.
+#
+# The default resolution for $\theta$ and $\phi$ is 5 degrees.
+# If you want to change the scan range
+# or resolution, create a far-field setup in HFSS and pass the setup name as an argument to
+# ``get_antenna_data()``.
+
+far_field_setup = hfss.insert_infinite_sphere(
+ x_start=0, # phi
+ x_stop=180,
+ x_step=5,
+ y_start=-180, # theta
+ y_stop=180, y_step=1,
+ name="FFSetup"
+ )
+
+ffdata = hfss.get_antenna_data(setup=hfss.nominal_adaptive, sphere=far_field_setup.name)
# ### Generate contour plot
#
-# Generate a contour plot. You can define the Theta scan and Phi scan.
+# The 3d far-field plot can be created using the ``plot_contour()`` method. Setting
+# ``max_theta=90`` restricts the plot to only the upper hemisphere. The pointing angel can
+# be modified using the ``phi`` and ``theta`` named arguments.
ffdata.farfield_data.plot_contour(
- quantity="RealizedGain",
- title=f"Contour at {ffdata.farfield_data.frequency * 1E-9:0.1f} GHz"
+ quantity="RealizedGain", phi=0, theta=25,
+ title=f"Contour at {ffdata.farfield_data.frequency * 1E-9:0.1f} GHz",
+ max_theta=90
)
# ### Save the project and data
#
-# Farfield data can be accessed from disk after the solution has been generated
-# using the ``metadata_file`` property of ``ffdata``.
+# Far-field data can be accessed from disk after the solution has been generated
+# using ``ffdata.metadata_file``. Subsequent post-processing can
+# continue without using HFSS.
# +
metadata_file = ffdata.metadata_file
working_directory = hfss.working_directory
hfss.save_project()
-hfss.release_desktop()
+hfss.desktop_class.release_desktop()
# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory.
time.sleep(3)
# -
@@ -176,11 +210,12 @@
# ## Generate contour plot
#
-# Generate a contour plot. You can define the Theta scan
-# and Phi scan.
+# Generate a contour plot. In this plot the ``theta_max`` is not set. The radial axis is $\theta$
+# so the field intensity at the outer edge of the plot corresponds to backward radiation ($\theta=180 \degree$).
ffdata.plot_contour(
- quantity="RealizedGain", title=f"Contour at {ffdata.frequency * 1e-9:.1f} GHz"
+ quantity="RealizedGain", title=f"Contour at {ffdata.frequency * 1e-9:.1f} GHz",
+ theta=30, phi=0
)
# ### Generate 2D cutout plots
@@ -192,7 +227,7 @@
ffdata.plot_cut(
quantity="RealizedGain",
primary_sweep="theta",
- secondary_sweep_value=[-180, -75, 75],
+ secondary_sweep_value=[ 180, 75],
title=f"Azimuth at {ffdata.frequency * 1E-9:.1f} GHz",
quantity_format="dB10",
)
@@ -208,7 +243,7 @@
# ### Generate 3D plot
#
-# Generate 3D plots. You can define the Theta scan and Phi scan.
+# The following command creates a widget using PyVista that allows you to change the steering angle interactively. You will have to download the Jupyter Notebook for this example and make sure you have installed all dependencies. Enjoy exploring the ``FfdSolutionData`` class by downloading this example and running your own Jupyter Notebook.
ffdata.plot_3d(
quantity="RealizedGain",
@@ -216,6 +251,8 @@
show=False,
)
+# ## Finish
+#
# ### Clean up
#
# All project files are saved in the folder ``temp_folder.name``.
diff --git a/examples/high_frequency/antenna/dipole.py b/examples/high_frequency/antenna/dipole.py
index 63018375e..a5ee9dabc 100644
--- a/examples/high_frequency/antenna/dipole.py
+++ b/examples/high_frequency/antenna/dipole.py
@@ -237,21 +237,20 @@
ff_el_data.plot(x_label="Theta", y_label="Gain", is_polar=True)
-# ## Release AEDT
+# ## Finish
+#
+# ### Save the project
-# +
hfss.save_project()
hfss.release_desktop()
-
# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory.
time.sleep(3)
-# -
-# ## Clean up
+# ### Clean up
#
# All project files are saved in the folder ``temp_folder.name``.
# If you've run this example as a Jupyter notebook, you
-# can retrieve those project files.
-# The following cell removes all temporary files, including the project folder.
+# can retrieve those project files. The following cell
+# removes all temporary files, including the project folder.
temp_folder.cleanup()
diff --git a/examples/high_frequency/antenna/fss_unitcell.py b/examples/high_frequency/antenna/fss_unitcell.py
index 5089df6bc..a95b9e9b7 100644
--- a/examples/high_frequency/antenna/fss_unitcell.py
+++ b/examples/high_frequency/antenna/fss_unitcell.py
@@ -21,6 +21,7 @@
# Constants help ensure consistency and avoid repetition throughout the example.
AEDT_VERSION = "2025.2"
+NUM_CORES = 4
NG_MODE = False # Open AEDT UI when it is launched.
# ### Create temporary directory
@@ -238,17 +239,20 @@
solution = report.get_solution_data()
plt = solution.plot(solution.expressions)
-# ## Release AEDT
+# ## Finish
+#
+# ### Save the project
+hfss.save_project()
hfss.release_desktop()
# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory.
time.sleep(3)
-# ## Clean up
+# ### Clean up
#
# All project files are saved in the folder ``temp_folder.name``.
# If you've run this example as a Jupyter notebook, you
-# can retrieve those project files. The following cell removes
-# all temporary files, including the project folder.
+# can retrieve those project files. The following cell
+# removes all temporary files, including the project folder.
temp_folder.cleanup()
diff --git a/examples/high_frequency/antenna/interferences/antenna.py b/examples/high_frequency/antenna/interferences/antenna.py
index 7ff71a465..e306163ba 100644
--- a/examples/high_frequency/antenna/interferences/antenna.py
+++ b/examples/high_frequency/antenna/interferences/antenna.py
@@ -7,9 +7,9 @@
#
# Keywords: **EMIT**, **Antenna**.
-# ## Perform imports and define constants
+# ## Prerequisites
#
-# Perform required imports.
+# ### Perform imports
# +
import tempfile
@@ -21,12 +21,14 @@
from ansys.aedt.core.emit_core.nodes.generated import AntennaNode, RadioNode
# -
-# Define constants.
+# ### Define constants
+# Constants help ensure consistency and avoid repetition throughout the example.
AEDT_VERSION = "2025.2"
+NUM_CORES = 4
NG_MODE = False # Open AEDT UI when it is launched.
-# ## Create temporary directory
+# ### Create temporary directory
#
# Create a temporary directory where downloaded data or
# dumped data can be stored.
@@ -35,7 +37,7 @@
temp_folder = tempfile.TemporaryDirectory(suffix=".ansys")
-# ## Launch AEDT with EMIT
+# ### Launch EMIT
#
# Launch AEDT with EMIT. The ``launch_desktop()`` method initializes AEDT
# using the specified version. The second argument can be set to ``True`` to
@@ -92,18 +94,20 @@
emi = worst.get_value(ResultType.EMI)
print("Worst case interference is: {} dB".format(emi))
-# ## Release AEDT
+# ## Finish
#
-# Release AEDT and close the example.
+# ### Save the project
aedtapp.save_project()
aedtapp.release_desktop()
# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory.
time.sleep(3)
-# ## Clean up
+# ### Clean up
#
-# All project files are saved in the folder ``temp_folder.name``. If you've run this example as a Jupyter notebook, you
-# can retrieve those project files. The following cell removes all temporary files, including the project folder.
+# All project files are saved in the folder ``temp_folder.name``.
+# If you've run this example as a Jupyter notebook, you
+# can retrieve those project files. The following cell
+# removes all temporary files, including the project folder.
temp_folder.cleanup()
diff --git a/examples/high_frequency/antenna/interferences/hfss_emit.py b/examples/high_frequency/antenna/interferences/hfss_emit.py
index 99d5d9376..9c539f8b6 100644
--- a/examples/high_frequency/antenna/interferences/hfss_emit.py
+++ b/examples/high_frequency/antenna/interferences/hfss_emit.py
@@ -11,9 +11,9 @@
#
# Keywords: **EMIT**, **Coupling**.
-# ## Perform imports and define constants
+# ## Prerequisites
#
-# Perform required imports.
+# ### Perform imports
# +
import os
@@ -22,17 +22,18 @@
import time
import ansys.aedt.core
-
from ansys.aedt.core.emit_core.emit_constants import ResultType, TxRxMode
from ansys.aedt.core.emit_core.nodes.generated import AntennaNode, RadioNode
# -
-# Define constants.
+# ### Define constants
+# Constants help ensure consistency and avoid repetition throughout the example.
AEDT_VERSION = "2025.2"
+NUM_CORES = 4
NG_MODE = False # Open AEDT UI when it is launched.
-# ## Create temporary directory
+# ### Create temporary directory
#
# Create a temporary directory where downloaded data or
# dumped data can be stored.
@@ -41,7 +42,7 @@
temp_folder = tempfile.TemporaryDirectory(suffix=".ansys")
-# ## Launch AEDT with EMIT
+# ### Launch EMIT
#
# Launch AEDT with EMIT. The ``Desktop`` class initializes AEDT and starts it
# on the specified version and in the specified graphical mode.
@@ -126,18 +127,20 @@
emi = worst.get_value(ResultType.EMI)
print("Worst case interference is: {} dB".format(emi))
-# ## Release AEDT
+# ## Finish
#
-# Release AEDT and close the example.
+# ### Save the project
aedtapp.save_project()
aedtapp.release_desktop()
# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory.
time.sleep(3)
-# ## Clean up
+# ### Clean up
#
-# All project files are saved in the folder ``temp_folder.name``. If you've run this example as a Jupyter notebook, you
-# can retrieve those project files. The following cell removes all temporary files, including the project folder.
+# All project files are saved in the folder ``temp_folder.name``.
+# If you've run this example as a Jupyter notebook, you
+# can retrieve those project files. The following cell
+# removes all temporary files, including the project folder.
temp_folder.cleanup()
diff --git a/examples/high_frequency/antenna/interferences/interference.py b/examples/high_frequency/antenna/interferences/interference.py
index 294556cc1..51eab121e 100644
--- a/examples/high_frequency/antenna/interferences/interference.py
+++ b/examples/high_frequency/antenna/interferences/interference.py
@@ -6,7 +6,9 @@
#
# Keywords: **EMIT**, **interference**.
-# ## Perform imports and define constants
+# ## Prerequisites
+#
+# ### Perform imports
# +
import sys
@@ -18,12 +20,14 @@
from ansys.aedt.core.emit_core.emit_constants import InterfererType
# -
-# Define constants.
+# ### Define constants
+# Constants help ensure consistency and avoid repetition throughout the example.
AEDT_VERSION = "2025.2"
+NUM_CORES = 4
NG_MODE = False # Open AEDT UI when it is launched.
-# ## Create temporary directory
+# ### Create temporary directory
#
# Create a temporary directory where downloaded data or
# dumped data can be stored.
@@ -44,7 +48,7 @@
"emit", "interference.aedtz", local_path=temp_folder.name
)
-# ## Launch EMIT and open project
+# ### Launch EMIT and open project
emitapp = Emit(
non_graphical=NG_MODE, new_desktop=True, project=project_name, version=AEDT_VERSION
@@ -217,7 +221,9 @@ def create_legend_table():
# Create a legend for the interference types
create_legend_table()
-# ## Clean up
+# ## Finish
+#
+# ### Clean up
#
# All project files are saved in the folder ``temp_folder.name``.
# If you've run this example as a Jupyter notebook, you
diff --git a/examples/high_frequency/antenna/interferences/protection.py b/examples/high_frequency/antenna/interferences/protection.py
index 0bd4b1f56..efbbc1d09 100644
--- a/examples/high_frequency/antenna/interferences/protection.py
+++ b/examples/high_frequency/antenna/interferences/protection.py
@@ -7,8 +7,9 @@
#
# Keywords: **EMIT**, **protection levels**.
-# ## Perform imports and define constants
+# ## Prerequisites
#
+# ### Perform imports
# +
import os
@@ -23,12 +24,14 @@
# from ansys.aedt.core.emit_core.emit_constants import \
# InterfererType # noqa: F401
-# Define constants.
+# ### Define constants
+# Constants help ensure consistency and avoid repetition throughout the example.
AEDT_VERSION = "2025.2"
+NUM_CORES = 4
NG_MODE = False # Open AEDT UI when it is launched.
-# ## Create temporary directory
+# ### Create temporary directory
#
# Create a temporary directory where downloaded data or
# dumped data can be stored.
@@ -37,7 +40,7 @@
temp_folder = tempfile.TemporaryDirectory(suffix=".ansys")
-# ## Launch AEDT with EMIT
+# ### Launch EMIT
#
# Launch AEDT with EMIT. The ``Desktop`` class initializes AEDT and starts it
# on the specified version and in the specified graphical mode.
@@ -273,18 +276,20 @@ def create_scenario_view(emis, colors, tx_radios, rx_radios):
# ## Create a legend for the protection levels
# create_legend_table()
-# ## Release AEDT
+# ## Finish
#
-# Release AEDT and close the example.
+# ### Save the project
emitapp.save_project()
emitapp.release_desktop()
# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory.
time.sleep(3)
-# ## Clean up
+# ### Clean up
#
-# All project files are saved in the folder ``temp_folder.name``. If you've run this example as a Jupyter notebook, you
-# can retrieve those project files. The following cell removes all temporary files, including the project folder.
+# All project files are saved in the folder ``temp_folder.name``.
+# If you've run this example as a Jupyter notebook, you
+# can retrieve those project files. The following cell
+# removes all temporary files, including the project folder.
temp_folder.cleanup()
diff --git a/examples/high_frequency/antenna/large_scenarios/city.py b/examples/high_frequency/antenna/large_scenarios/city.py
index def0468bd..512878558 100644
--- a/examples/high_frequency/antenna/large_scenarios/city.py
+++ b/examples/high_frequency/antenna/large_scenarios/city.py
@@ -23,6 +23,7 @@
# Constants help ensure consistency and avoid repetition throughout the example.
AEDT_VERSION = "2025.2"
+NUM_CORES = 4
NG_MODE = False # Open AEDT UI when it is launched.
# ### Create temporary directory
diff --git a/examples/high_frequency/antenna/large_scenarios/doppler.py b/examples/high_frequency/antenna/large_scenarios/doppler.py
index 32e530222..28459d9ec 100644
--- a/examples/high_frequency/antenna/large_scenarios/doppler.py
+++ b/examples/high_frequency/antenna/large_scenarios/doppler.py
@@ -5,9 +5,9 @@
#
# Keywords: **HFSS**, **SBR+**, **doppler**.
-# ## Perform imports and define constants
+# ## Prerequisites
#
-# Perform required imports.
+# ### Perform imports
# +
import os
@@ -20,13 +20,14 @@
from ansys.aedt.core.examples.downloads import unzip
# -
-# Define constants.
+# ### Define constants
+# Constants help ensure consistency and avoid repetition throughout the example.
AEDT_VERSION = "2025.2"
NUM_CORES = 4
NG_MODE = False # Open AEDT UI when it is launched.
-# ## Create temporary directory
+# ### Create temporary directory
#
# Create a temporary directory where downloaded data or
# dumped data can be stored.
@@ -52,7 +53,7 @@
unzip(zip_file, results)
-# ## Launch HFSS and open project
+# ### Launch HFSS
#
# Launch HFSS and open the project.
@@ -209,18 +210,20 @@
frtm_plotter.plot_range_doppler(frame=frame_number)
frtm_plotter.plot_range_angle_map(frame=frame_number, polar=True)
-# ## Release AEDT
+# ## Finish
#
-# Release AEDT and close the example.
+# ### Save the project
app.save_project()
app.release_desktop()
# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory.
time.sleep(3)
-# ## Clean up
+# ### Clean up
#
-# All project files are saved in the folder ``temp_folder.name``. If you've run this example as a Jupyter notebook, you
-# can retrieve those project files. The following cell removes all temporary files, including the project folder.
+# All project files are saved in the folder ``temp_folder.name``.
+# If you've run this example as a Jupyter notebook, you
+# can retrieve those project files. The following cell
+# removes all temporary files, including the project folder.
temp_folder.cleanup()
diff --git a/examples/high_frequency/antenna/large_scenarios/reflector.py b/examples/high_frequency/antenna/large_scenarios/reflector.py
index a7ed48351..4c0ec319e 100644
--- a/examples/high_frequency/antenna/large_scenarios/reflector.py
+++ b/examples/high_frequency/antenna/large_scenarios/reflector.py
@@ -5,10 +5,9 @@
#
# Keywords: **HFSS**, **SBR+**, **reflector**.
-# ## Perform imports and define constants
+# ## Prerequisites
#
-# Perform required imports and set up the local path to the path for the PyAEDT
-# directory.
+# ### Perform imports
# +
import tempfile
@@ -19,13 +18,14 @@
# -
-# Define constants.
+# ### Define constants
+# Constants help ensure consistency and avoid repetition throughout the example.
AEDT_VERSION = "2025.2"
NUM_CORES = 4
NG_MODE = False # Open AEDT UI when it is launched.
-# ## Create temporary directory
+# ### Create temporary directory
#
# Create a temporary directory where downloaded data or
# dumped data can be stored.
@@ -115,18 +115,20 @@
)
solution.plot()
-# ## Release AEDT
+# ## Finish
#
-# Release AEDT and close the example.
+# ### Save the project
target.save_project()
target.release_desktop()
# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory.
time.sleep(3)
-# ## Clean up
+# ### Clean up
#
-# All project files are saved in the folder ``temp_folder.name``. If you've run this example as a Jupyter notebook, you
-# can retrieve those project files. The following cell removes all temporary files, including the project folder.
+# All project files are saved in the folder ``temp_folder.name``.
+# If you've run this example as a Jupyter notebook, you
+# can retrieve those project files. The following cell
+# removes all temporary files, including the project folder.
temp_folder.cleanup()
diff --git a/examples/high_frequency/antenna/large_scenarios/time_domain.py b/examples/high_frequency/antenna/large_scenarios/time_domain.py
index 032109570..e60737aa8 100644
--- a/examples/high_frequency/antenna/large_scenarios/time_domain.py
+++ b/examples/high_frequency/antenna/large_scenarios/time_domain.py
@@ -5,9 +5,9 @@
#
# Keywords: **HFSS**, **SBR+**, **time domain**, **IFFT**.
-# ## Perform imports and define constants
+# ## Prerequisites
#
-# Perform required imports.
+# ### Perform imports
# +
import os
@@ -18,14 +18,15 @@
from ansys.aedt.core.examples.downloads import download_sbr_time
# -
-# Define constants.
+# ### Define constants
+# Constants help ensure consistency and avoid repetition throughout the example.
AEDT_VERSION = "2025.2"
NUM_CORES = 4
NG_MODE = False # Open AEDT UI when it is launched.
-# ## Create temporary directory
+# ### Create temporary directory
#
# Create a temporary directory where downloaded data or
# dumped data can be stored.
@@ -39,7 +40,7 @@
project_file = download_sbr_time(local_path=temp_folder.name)
-# ## Launch HFSS and analyze
+# ### Launch HFSS
hfss = Hfss(
project=project_file,
@@ -92,18 +93,20 @@
zoom=1,
)
-# ## Release AEDT
+# ## Finish
#
-# Release AEDT and close the example.
+# ### Save the project
hfss.save_project()
hfss.release_desktop()
# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory.
time.sleep(3)
-# ## Clean up
+# ### Clean up
#
-# All project files are saved in the folder ``temp_folder.name``. If you've run this example as a Jupyter notebook, you
-# can retrieve those project files. The following cell removes all temporary files, including the project folder.
+# All project files are saved in the folder ``temp_folder.name``.
+# If you've run this example as a Jupyter notebook, you
+# can retrieve those project files. The following cell
+# removes all temporary files, including the project folder.
temp_folder.cleanup()
diff --git a/examples/high_frequency/antenna/patch.py b/examples/high_frequency/antenna/patch.py
index f8b7573f1..c0d58e99c 100644
--- a/examples/high_frequency/antenna/patch.py
+++ b/examples/high_frequency/antenna/patch.py
@@ -8,10 +8,6 @@
# laminate structures such as the patch antenna.
#
# Keywords: **HFSS**, **terminal**, **antenna**., **patch**.
-#
-# ## Perform imports and define constants
-#
-# Perform required imports.
# ## Prerequisites
#
diff --git a/examples/high_frequency/emc/armoured_cable.py b/examples/high_frequency/emc/armoured_cable.py
index b4dbf23de..eabe22ea5 100644
--- a/examples/high_frequency/emc/armoured_cable.py
+++ b/examples/high_frequency/emc/armoured_cable.py
@@ -11,9 +11,9 @@
#
# Keywords: **Q2D**, **EMC**, **cable**.
-# ## Perform imports and define constants
+# ## Prerequisites
#
-# Perform required imports.
+# ### Perform imports
# +
import math
@@ -24,12 +24,14 @@
import ansys.aedt.core
# -
-# Define constants.
+# ### Define constants
+# Constants help ensure consistency and avoid repetition throughout the example.
AEDT_VERSION = "2025.2"
+NUM_CORES = 4
NG_MODE = False # Open AEDT UI when it is launched.
-# ## Create temporary directory
+# ### Create temporary directory
#
# Create a temporary directory where downloaded data or
# dumped data can be stored.
@@ -286,14 +288,16 @@
coupling_matrix_name="Original",
)
-# ## Release AEDT
+# ## Finish
+#
+# ### Save the project
tb.save_project()
tb.release_desktop()
# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory.
time.sleep(3)
-# ## Clean up
+# ### Clean up
#
# All project files are saved in the folder ``temp_folder.name``.
# If you've run this example as a Jupyter notebook, you
diff --git a/examples/high_frequency/emc/busbar.py b/examples/high_frequency/emc/busbar.py
index 0fb9c8f08..eacfbdd90 100644
--- a/examples/high_frequency/emc/busbar.py
+++ b/examples/high_frequency/emc/busbar.py
@@ -5,9 +5,9 @@
#
# Keywords: **Q3D**, **EMC*, **busbar**.
-# ## Perform imports and define constants
+# ## Prerequisites
#
-# Perform required imports.
+# ### Perform imports
# +
import os
@@ -17,13 +17,14 @@
import ansys.aedt.core
# -
-# Define constants.
+# ### Define constants
+# Constants help ensure consistency and avoid repetition throughout the example.
AEDT_VERSION = "2025.2"
NUM_CORES = 4
-NG_MODE = False
+NG_MODE = False # Open AEDT UI when it is launched.
-# ## Create temporary directory
+# ### Create temporary directory
#
# Create a temporary directory where downloaded data or
# dumped data can be stored.
@@ -32,9 +33,9 @@
temp_folder = tempfile.TemporaryDirectory(suffix=".ansys")
-# ## Launch AEDT and Q3D Extractor
+# ### Launch Q3D Extractor
#
-# Launch AEDT 2024 R2 in graphical mode and launch Q3D Extractor. This example uses SI units.
+# Launch AEDT in graphical mode and launch Q3D Extractor. This example uses SI units.
q3d = ansys.aedt.core.Q3d(
project=os.path.join(temp_folder.name, "busbar.aedt"),
@@ -227,14 +228,16 @@
data = q3d.post.get_solution_data(expressions=original_matrix_self, context="Original")
data.plot()
-# ## Release AEDT
+# ## Finish
+#
+# ### Save the project
q3d.save_project()
q3d.release_desktop()
# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory.
time.sleep(3)
-# ## Clean up
+# ### Clean up
#
# All project files are saved in the folder ``temp_folder.name``.
# If you've run this example as a Jupyter notebook, you
diff --git a/examples/high_frequency/emc/choke.py b/examples/high_frequency/emc/choke.py
index bb8251073..25361a5ee 100644
--- a/examples/high_frequency/emc/choke.py
+++ b/examples/high_frequency/emc/choke.py
@@ -4,9 +4,9 @@
#
# Keywords: **HFSS**, **EMC**, **choke**, .
-# ## Perform imports and define constants
+# ## Prerequisites
#
-# Perform required imports.
+# ### Perform imports
# +
import json
@@ -18,12 +18,14 @@
# -
-# Define constants.
+# ### Define constants
+# Constants help ensure consistency and avoid repetition throughout the example.
AEDT_VERSION = "2025.2"
+NUM_CORES = 4
NG_MODE = False # Open AEDT UI when it is launched.
-# ## Create temporary directory
+# ### Create temporary directory
#
# Create a temporary directory where downloaded data or
# dumped data can be stored.
@@ -32,7 +34,7 @@
temp_folder = tempfile.TemporaryDirectory(suffix=".ansys")
-# ## Launch HFSS
+# ### Launch HFSS
project_name = os.path.join(temp_folder.name, "choke.aedt")
hfss = ansys.aedt.core.Hfss(
@@ -243,14 +245,16 @@
)
-# ## Release AEDT
+# ## Finish
+#
+# ### Save the project
hfss.save_project()
hfss.release_desktop()
# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory.
time.sleep(3)
-# ## Clean up
+# ### Clean up
#
# All project files are saved in the folder ``temp_folder.name``.
# If you've run this example as a Jupyter notebook, you
diff --git a/examples/high_frequency/emc/double_pulse_test.py b/examples/high_frequency/emc/double_pulse_test.py
index ec8cb1b6f..ef4777e07 100644
--- a/examples/high_frequency/emc/double_pulse_test.py
+++ b/examples/high_frequency/emc/double_pulse_test.py
@@ -10,9 +10,9 @@
#
# Keywords: **Power Electronics**, **Double Pulse Testing**
-# ## Perform imports and define constants
+# ## Prerequisites
#
-# Perform required imports.
+# ### Perform imports
# +
import os
@@ -23,13 +23,14 @@
from ansys.aedt.core.generic.constants import Setups
# -
-# Define constants.
+# ### Define constants
+# Constants help ensure consistency and avoid repetition throughout the example.
AEDT_VERSION = "2025.2"
NUM_CORES = 4
NG_MODE = False # Open AEDT UI when it is launched.
-# ## Create temporary directory
+# ### Create temporary directory
#
# Create a temporary directory where downloaded data or
# dumped data can be stored.
@@ -38,7 +39,7 @@
temp_folder = tempfile.TemporaryDirectory(suffix=".ansys")
-# ## Launch AEDT and Circuit
+# ### Launch Circuit
project_name = os.path.join(temp_folder.name, "my_project.aedt")
circuit = ansys.aedt.core.Circuit(
@@ -369,14 +370,16 @@
context={"time_stop": "15us"}
)
-# ## Release AEDT
+# ## Finish
+#
+# ### Save the project
circuit.save_project()
circuit.release_desktop()
# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory.
time.sleep(3)
-# ## Clean up
+# ### Clean up
#
# All project files are saved in the folder ``temp_folder.name``.
# If you've run this example as a Jupyter notebook, you
diff --git a/examples/high_frequency/emc/eigenmode.py b/examples/high_frequency/emc/eigenmode.py
index c470e6054..f5ac358c9 100644
--- a/examples/high_frequency/emc/eigenmode.py
+++ b/examples/high_frequency/emc/eigenmode.py
@@ -189,11 +189,11 @@ def find_resonance(num_modes):
# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory.
time.sleep(3)
-# ## Clean up
+# ### Clean up
#
# All project files are saved in the folder ``temp_folder.name``.
# If you've run this example as a Jupyter notebook, you
-# can retrieve those project files. The following cell removes
-# all temporary files, including the project folder.
+# can retrieve those project files. The following cell
+# removes all temporary files, including the project folder.
temp_folder.cleanup()
diff --git a/examples/high_frequency/emc/flex_cable.py b/examples/high_frequency/emc/flex_cable.py
index 524063624..f369e6f88 100644
--- a/examples/high_frequency/emc/flex_cable.py
+++ b/examples/high_frequency/emc/flex_cable.py
@@ -5,13 +5,14 @@
#
# Keywords: **HFSS**, **flex cable**, **CPWG**.
-# ## Perform imports and define constants
+# ## Prerequisites
#
-# Perform required imports.
+# ### Perform imports
# +
import os
import tempfile
+import time
from math import cos, radians, sin, sqrt
import ansys.aedt.core
@@ -19,18 +20,14 @@
# -
-# Define constants.
+# ### Define constants
+# Constants help ensure consistency and avoid repetition throughout the example.
AEDT_VERSION = "2025.2"
+NUM_CORES = 4
+NG_MODE = False # Open AEDT UI when it is launched.
-# ## Set non-graphical mode
-#
-# Set non-graphical mode.
-# You can set ``non_graphical`` either to ``True`` or ``False``.
-
-non_graphical = False
-
-# ## Create temporary directory
+# ### Create temporary directory
#
# Create a temporary directory where downloaded data or
# dumped data can be stored.
@@ -39,7 +36,7 @@
temp_folder = tempfile.TemporaryDirectory(suffix=".ansys")
-# ## Launch AEDT
+# ### Launch HFSS
#
# Launch AEDT, create an HFSS design, and save the project.
@@ -47,7 +44,7 @@
version=AEDT_VERSION,
solution_type="DrivenTerminal",
new_desktop=True,
- non_graphical=non_graphical,
+ non_graphical=NG_MODE,
)
hfss.save_project(os.path.join(temp_folder.name, generate_unique_name("example") + ".aedt"))
@@ -231,15 +228,20 @@ def create_bending(radius, extension=0):
sweep_type="Interpolating",
)
-# ## Release AEDT
+# ## Finish
+#
+# ### Save the project
+hfss.save_project()
hfss.release_desktop()
+# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory.
+time.sleep(3)
-# ## Clean up
+# ### Clean up
#
# All project files are saved in the folder ``temp_folder.name``.
# If you've run this example as a Jupyter notebook, you
-# can retrieve those project files.
-# The following cell removes all temporary files, including the project folder.
+# can retrieve those project files. The following cell
+# removes all temporary files, including the project folder.
temp_folder.cleanup()
diff --git a/examples/high_frequency/emc/subcircuit.py b/examples/high_frequency/emc/subcircuit.py
index a919f45be..ad459c802 100644
--- a/examples/high_frequency/emc/subcircuit.py
+++ b/examples/high_frequency/emc/subcircuit.py
@@ -6,9 +6,9 @@
#
# Keywords: **Circuit**, **EMC**, **schematic**.
-# ## Perform imports and define constants
+# ## Prerequisites
#
-# Perform required imports.
+# ### Perform imports
# +
import os
@@ -18,12 +18,14 @@
import ansys.aedt.core
# -
-# Define constants.
+# ### Define constants
+# Constants help ensure consistency and avoid repetition throughout the example.
AEDT_VERSION = "2025.2"
+NUM_CORES = 4
NG_MODE = False # Open AEDT UI when it is launched.
-# ## Create temporary directory
+# ### Create temporary directory
#
# Create a temporary directory where downloaded data or
# dumped data can be stored.
@@ -32,7 +34,7 @@
temp_folder = tempfile.TemporaryDirectory(suffix=".ansys")
-# ## Launch AEDT with Circuit
+# ### Launch Circuit
#
# Launch AEDT in graphical mode. Instantite an instance of the ``Circuit`` class.
@@ -74,18 +76,20 @@
)
circuit.pop_up()
-# ## Release AEDT
+# ## Finish
#
-# Release AEDT and close the example.
+# ### Save the project
circuit.save_project()
circuit.release_desktop()
-# Wait 5 seconds to allow AEDT to shut down before cleaning the temporary directory.
-time.sleep(5)
+# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory.
+time.sleep(3)
-# ## Clean up
+# ### Clean up
#
-# All project files are saved in the folder ``temp_folder.name``. If you've run this example as a Jupyter notebook, you
-# can retrieve those project files. The following cell removes all temporary files, including the project folder.
+# All project files are saved in the folder ``temp_folder.name``.
+# If you've run this example as a Jupyter notebook, you
+# can retrieve those project files. The following cell
+# removes all temporary files, including the project folder.
temp_folder.cleanup()
diff --git a/examples/high_frequency/layout/gui_manipulation.py b/examples/high_frequency/layout/gui_manipulation.py
index 4db4892a2..3a024790b 100644
--- a/examples/high_frequency/layout/gui_manipulation.py
+++ b/examples/high_frequency/layout/gui_manipulation.py
@@ -5,8 +5,9 @@
#
# Keywords: **HFSS 3D Layout**, **UI**, **user interface**.
-# ## Perform imports and define constants
-# Perform required imports.
+# ## Prerequisites
+#
+# ### Perform imports
# +
import sys
@@ -17,7 +18,8 @@
from ansys.aedt.core.examples.downloads import download_file
# -
-# Define constants.
+# ### Define constants
+# Constants help ensure consistency and avoid repetition throughout the example.
AEDT_VERSION = "2025.2"
NUM_CORES = 4
@@ -29,13 +31,22 @@
print("Warning: This example requires graphical mode enabled.")
sys.exit()
-# Download example board.
+# ### Create temporary directory
+#
+# Create a temporary working directory.
+# The name of the working folder is stored in ``temp_folder.name``.
+#
+# > **Note:** The final cell in the notebook cleans up the temporary folder. If you want to
+# > retrieve the AEDT project and data, do so before executing the final cell in the notebook.
temp_folder = tempfile.TemporaryDirectory(suffix=".ansys")
+
+# Download example board.
+
aedb = download_file(source="edb/ANSYS-HSD_V1.aedb", local_path=temp_folder.name)
-# ## Launch HFSS 3D Layout
+# ### Launch HFSS 3D Layout
#
# Initialize AEDT and launch HFSS 3D Layout.
@@ -78,14 +89,16 @@
h3d.modeler.fit_all()
-# ## Release AEDT
+# ## Finish
+#
+# ### Save the project
h3d.save_project()
h3d.release_desktop()
# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory.
time.sleep(3)
-# ## Clean up
+# ### Clean up
#
# All project files are saved in the folder ``temp_folder.name``.
# If you've run this example as a Jupyter notebook, you
diff --git a/examples/high_frequency/layout/power_integrity/ac_q3d.py b/examples/high_frequency/layout/power_integrity/ac_q3d.py
index 50b9ed8ab..ce90bde1d 100644
--- a/examples/high_frequency/layout/power_integrity/ac_q3d.py
+++ b/examples/high_frequency/layout/power_integrity/ac_q3d.py
@@ -5,9 +5,9 @@
#
# Keywords: **Q3D**, **PCB**.
-# ## Perform imports and define constants
+# ## Prerequisites
#
-# Perform required imports.
+# ### Perform imports
# +
import os
@@ -20,13 +20,14 @@
# -
-# Define constants.
+# ### Define constants
+# Constants help ensure consistency and avoid repetition throughout the example.
AEDT_VERSION = "2025.2"
NUM_CORES = 4
NG_MODE = False # Open AEDT UI when it is launched.
-# ## Create temporary directory
+# ### Create temporary directory
#
# Create a temporary directory where downloaded data or
# dumped data can be stored.
@@ -158,14 +159,16 @@
solution2 = q3d.post.get_solution_data(traces_acr)
solution2.plot()
-# ## Release AEDT
+# ## Finish
+#
+# ### Save the project
q3d.save_project()
q3d.release_desktop()
# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory.
time.sleep(3)
-# ## Clean up
+# ### Clean up
#
# All project files are saved in the folder ``temp_folder.name``.
# If you've run this example as a Jupyter notebook, you
diff --git a/examples/high_frequency/layout/power_integrity/dcir_hfss.py b/examples/high_frequency/layout/power_integrity/dcir_hfss.py
index 826fdd135..c2fdafb93 100644
--- a/examples/high_frequency/layout/power_integrity/dcir_hfss.py
+++ b/examples/high_frequency/layout/power_integrity/dcir_hfss.py
@@ -19,8 +19,9 @@
#
# Keywords: **HFSS 3D Layout**, **DC IR**.
-# ## Perform imports and define constants
-# Perform required imports.
+# ## Prerequisites
+#
+# ### Perform imports
import json
import os
@@ -31,17 +32,28 @@
from ansys.aedt.core.examples.downloads import download_file
from pyedb import Edb
-# Define constants.
+# ### Define constants
+# Constants help ensure consistency and avoid repetition throughout the example.
AEDT_VERSION = "2025.2"
NUM_CORES = 4
NG_MODE = False # Open AEDT UI when it is launched.
-# Download example board.
+# ### Create temporary directory
+#
+# Create a temporary working directory.
+# The name of the working folder is stored in ``temp_folder.name``.
+#
+# > **Note:** The final cell in the notebook cleans up the temporary folder. If you want to
+# > retrieve the AEDT project and data, do so before executing the final cell in the notebook.
temp_folder = tempfile.TemporaryDirectory(suffix=".ansys")
+
+# Download example board.
aedb = download_file(source="edb/ANSYS-HSD_V1.aedb", local_path=temp_folder.name)
-_ = download_file(source="spice", name="ferrite_bead_BLM15BX750SZ1.mod", local_path=temp_folder.name)
+_ = download_file(
+ source="spice", name="ferrite_bead_BLM15BX750SZ1.mod", local_path=temp_folder.name
+)
# ## Create configuration file
# This example uses a configuration file to set up the layout for analysis.
@@ -96,7 +108,9 @@
"type": "current",
"magnitude": 0.5,
"positive_terminal": {"net": "SFPA_VCCR"},
- "negative_terminal": {"pin_group": "J5_GND"}, # Defined in "pin_groups" section.
+ "negative_terminal": {
+ "pin_group": "J5_GND" # Defined in "pin_groups" section.
+ },
}
)
cfg["sources"].append(
@@ -175,9 +189,11 @@
# The HFSS 3D Layout interface to SIwave is used to open the EDB and run the DCIR analysis
# using SIwave
-# ### Load EDB into HFSS 3D Layout.
+# ### Launch HFSS 3D Layout
-siw = ansys.aedt.core.Hfss3dLayout(aedb, version=AEDT_VERSION, non_graphical=NG_MODE, new_desktop=True)
+siw = ansys.aedt.core.Hfss3dLayout(
+ aedb, version=AEDT_VERSION, non_graphical=NG_MODE, new_desktop=True
+)
# ### Analyze
@@ -187,14 +203,16 @@
siw.get_dcir_element_data_current_source("siwave_dc")
-# ## Release AEDT
+# ## Finish
+#
+# ### Save the project
siw.save_project()
siw.release_desktop()
# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory.
time.sleep(3)
-# ## Clean up
+# ### Clean up
#
# All project files are saved in the folder ``temp_folder.name``.
# If you've run this example as a Jupyter notebook, you
diff --git a/examples/high_frequency/layout/power_integrity/dcir_q3d.py b/examples/high_frequency/layout/power_integrity/dcir_q3d.py
index 17ae3b2b9..bf2b53d20 100644
--- a/examples/high_frequency/layout/power_integrity/dcir_q3d.py
+++ b/examples/high_frequency/layout/power_integrity/dcir_q3d.py
@@ -5,9 +5,9 @@
#
# Keywords: **Q3D**, **layout**, **DCIR**.
-# ## Perform imports and define constants
+# ## Prerequisites
#
-# Perform required imports.
+# ### Perform imports
# +
import os
@@ -21,13 +21,14 @@
# -
-# Define constants.
+# ### Define constants
+# Constants help ensure consistency and avoid repetition throughout the example.
AEDT_VERSION = "2025.2"
NUM_CORES = 4
-NG_MODE = False
+NG_MODE = False # Open AEDT UI when it is launched.
-# ## Create temporary directory
+# ### Create temporary directory
#
# Create a temporary directory where downloaded data or
# dumped data can be stored.
@@ -306,14 +307,16 @@
# print(data.get_expression_data("V{}".format(source_bound.name))[1])
# -
-# ## Release AEDT
+# ## Finish
+#
+# ### Save the project
q3d.save_project()
q3d.release_desktop()
# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory.
time.sleep(3)
-# ## Clean up
+# ### Clean up
#
# All project files are saved in the folder ``temp_folder.name``.
# If you've run this example as a Jupyter notebook, you
diff --git a/examples/high_frequency/layout/power_integrity/power_integrity.py b/examples/high_frequency/layout/power_integrity/power_integrity.py
index 02f310755..2f92032eb 100644
--- a/examples/high_frequency/layout/power_integrity/power_integrity.py
+++ b/examples/high_frequency/layout/power_integrity/power_integrity.py
@@ -17,8 +17,9 @@
#
# Keywords: **HFSS 3D Layout**, **power integrity**.
-# ## Perform imports and define constants
-# Import the required packages
+# ## Prerequisites
+#
+# ### Perform imports
# +
import json
@@ -31,13 +32,14 @@
# -
-# Define constants.
+# ### Define constants
+# Constants help ensure consistency and avoid repetition throughout the example.
AEDT_VERSION = "2025.2"
NUM_CORES = 4
NG_MODE = False # Open AEDT UI when it is launched.
-# ## Create temporary directory
+# ### Create temporary directory
#
# Create a temporary directory where downloaded data or
# dumped data can be stored.
@@ -188,8 +190,8 @@
print(temp_folder.name)
# ## Analyze in HFSS 3D Layout
-
-# ### Load EDB into HFSS 3D Layout
+#
+# ### Launch HFSS 3D Layout
h3d = ansys.aedt.core.Hfss3dLayout(aedb, version=AEDT_VERSION, non_graphical=NG_MODE, new_desktop=True)
@@ -202,14 +204,16 @@
solutions = h3d.post.get_solution_data(expressions="Z(port1,port1)")
solutions.plot()
-# ## Release AEDT
+# ## Finish
+#
+# ### Save the project
h3d.save_project()
h3d.release_desktop()
# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory.
time.sleep(3)
-# ## Clean up
+# ### Clean up
#
# All project files are saved in the folder ``temp_folder.name``.
# If you've run this example as a Jupyter notebook, you
diff --git a/examples/high_frequency/layout/signal_integrity/ami.py b/examples/high_frequency/layout/signal_integrity/ami.py
index 15f5468b1..e04c2d158 100644
--- a/examples/high_frequency/layout/signal_integrity/ami.py
+++ b/examples/high_frequency/layout/signal_integrity/ami.py
@@ -4,9 +4,9 @@
#
# Keywords: **Circuit**, **AMI**.
-# ## Perform imports and define constants
+# ## Prerequisites
#
-# Perform required imports.
+# ### Perform imports
#
# > **Note:** [Numpy](https://numpy.org/)
# > and [Matplotlib](https://matplotlib.org/) are required to run this example.
@@ -22,12 +22,14 @@
from matplotlib import pyplot as plt
# -
-# Define constants.
+# ### Define constants
+# Constants help ensure consistency and avoid repetition throughout the example.
AEDT_VERSION = "2025.2"
+NUM_CORES = 4
NG_MODE = False # Open AEDT UI when it is launched.
-# ## Create temporary directory and download example files
+# ### Create temporary directory
#
# Create a temporary directory where downloaded data or
# dumped data can be stored.
@@ -54,7 +56,7 @@
)
-# ## Launch AEDT with Circuit and enable Pandas as the output format
+# ### Launch Circuit
#
# All outputs obtained with the `get_solution_data()` method are in the
# [Pandas](https://pandas.pydata.org/docs/user_guide/index.html) format.
@@ -334,18 +336,20 @@
ax2.set_ylabel("V")
plt.show()
-# ## Release AEDT
+# ## Finish
#
-# Release AEDT and close the example.
+# ### Save the project
circuit.save_project()
circuit.release_desktop()
# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory.
time.sleep(3)
-# ## Clean up
+# ### Clean up
#
-# All project files are saved in the folder ``temp_folder.name``. If you've run this example as a Jupyter notebook, you
-# can retrieve those project files. The following cell removes all temporary files, including the project folder.
+# All project files are saved in the folder ``temp_folder.name``.
+# If you've run this example as a Jupyter notebook, you
+# can retrieve those project files. The following cell
+# removes all temporary files, including the project folder.
temp_folder.cleanup()
diff --git a/examples/high_frequency/layout/signal_integrity/circuit_transient.py b/examples/high_frequency/layout/signal_integrity/circuit_transient.py
index b5ddbab50..43d43f5a9 100644
--- a/examples/high_frequency/layout/signal_integrity/circuit_transient.py
+++ b/examples/high_frequency/layout/signal_integrity/circuit_transient.py
@@ -5,9 +5,9 @@
#
# Keywords: **Circuit**, **transient**, **eye diagram**.
-# ## Perform imports and define constants
+# ## Prerequisites
#
-# Perform required imports.
+# ### Perform imports
# +
import os
@@ -20,12 +20,14 @@
from matplotlib import pyplot as plt
# -
-# Define constants.
+# ### Define constants
+# Constants help ensure consistency and avoid repetition throughout the example.
AEDT_VERSION = "2025.2"
+NUM_CORES = 4
NG_MODE = False # Open AEDT UI when it is launched.
-# ## Create temporary directory
+# ### Create temporary directory
#
# Create a temporary directory where downloaded data or
# dumped data can be stored.
@@ -34,7 +36,7 @@
temp_folder = tempfile.TemporaryDirectory(suffix=".ansys")
-# ## Launch AEDT with Circuit
+# ### Launch Circuit
#
# Launch AEDT in graphical mode with the Circuit schematic editor.
@@ -197,18 +199,20 @@
plt.show()
# -
-# ## Release AEDT
+# ## Finish
#
-# Release AEDT and close the example.
+# ### Save the project
circuit.save_project()
circuit.release_desktop()
# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory.
time.sleep(3)
-# ## Clean up
+# ### Clean up
#
-# All project files are saved in the folder ``temp_folder.name``. If you've run this example as a Jupyter notebook, you
-# can retrieve those project files. The following cell removes all temporary files, including the project folder.
+# All project files are saved in the folder ``temp_folder.name``.
+# If you've run this example as a Jupyter notebook, you
+# can retrieve those project files. The following cell
+# removes all temporary files, including the project folder.
temp_folder.cleanup()
diff --git a/examples/high_frequency/layout/signal_integrity/com_analysis.py b/examples/high_frequency/layout/signal_integrity/com_analysis.py
index f3c8a5637..80fe05019 100644
--- a/examples/high_frequency/layout/signal_integrity/com_analysis.py
+++ b/examples/high_frequency/layout/signal_integrity/com_analysis.py
@@ -22,8 +22,9 @@
#
# Keywords: **COM**, **signal integrity**, **virtual compliance**.
-# ## Perform imports
-# Perform required imports.
+# ## Prerequisites
+#
+# ### Perform imports
import os
import tempfile
@@ -34,7 +35,14 @@
)
from pyedb.misc.downloads import download_file
-# ## Create temporary directory and download example files
+# ### Define constants
+# Constants help ensure consistency and avoid repetition throughout the example.
+
+AEDT_VERSION = "2025.2"
+NUM_CORES = 4
+NG_MODE = False # Open AEDT UI when it is launched.
+
+# ### Create temporary directory
#
# Create a temporary directory where downloaded data or
# dumped data can be stored.
diff --git a/examples/high_frequency/layout/signal_integrity/pre_layout.py b/examples/high_frequency/layout/signal_integrity/pre_layout.py
index 6ac39b419..c9ac12808 100644
--- a/examples/high_frequency/layout/signal_integrity/pre_layout.py
+++ b/examples/high_frequency/layout/signal_integrity/pre_layout.py
@@ -25,8 +25,9 @@
#
# Keywords: **HFSS 3D Layout**, **signal integrity**.
-# ## Perform imports and define constants
-# Perform required packages.
+# ## Prerequisites
+#
+# ### Perform imports
# +
import os
@@ -39,14 +40,15 @@
# -
-# Define constants.
+# ### Define constants
+# Constants help ensure consistency and avoid repetition throughout the example.
AEDT_VERSION = "2025.2"
NUM_CORES = 4
NG_MODE = False # Open AEDT UI when it is launched.
-# ## Create temporary directory and download example files
+# ### Create temporary directory
#
# Create a temporary directory where downloaded data or
# dumped data can be stored.
@@ -303,8 +305,8 @@
edbapp.close()
# # Analyze in HFSS 3D Layout
-
-# ## Load EDB into HFSS 3D Layout.
+#
+# ### Launch HFSS 3D Layout
h3d = Hfss3dLayout(aedb, version=AEDT_VERSION, non_graphical=NG_MODE, new_desktop=True)
@@ -341,16 +343,18 @@
plot = h3d.post.create_fieldplot_cutplane(cp_name, "Mag_E", h3d.nominal_adaptive, intrinsics={"Freq": "5GHz", "Phase": "0deg"})
-# ## Release AEDT
+# ## Finish
+#
+# ### Save the project
h3d.save_project()
h3d.release_desktop()
# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory.
time.sleep(3)
-# ## Clean up
+# ### Clean up
#
-# All project files are saved in the folder ``temp_dir.name``.
+# All project files are saved in the folder ``temp_folder.name``.
# If you've run this example as a Jupyter notebook, you
# can retrieve those project files. The following cell
# removes all temporary files, including the project folder.
diff --git a/examples/high_frequency/layout/signal_integrity/pre_layout_parametrized.py b/examples/high_frequency/layout/signal_integrity/pre_layout_parametrized.py
index b4e301f85..61db7d492 100644
--- a/examples/high_frequency/layout/signal_integrity/pre_layout_parametrized.py
+++ b/examples/high_frequency/layout/signal_integrity/pre_layout_parametrized.py
@@ -20,7 +20,6 @@
from ansys.aedt.core import Hfss3dLayout
from pyedb import Edb
-
# -
# ## Define constants
@@ -237,8 +236,16 @@
trace_p = []
trace_n = []
for n in range(len(points_p)):
- trace_p.append(edb.modeler.create_trace(points_p[n], route_layer[n], width[n], net_p, "Flat", "Flat"))
- trace_n.append(edb.modeler.create_trace(points_n[n], route_layer[n], width[n], net_n, "Flat", "Flat"))
+ trace_p.append(
+ edb.modeler.create_trace(
+ points_p[n], route_layer[n], width[n], net_p, "Flat", "Flat"
+ )
+ )
+ trace_n.append(
+ edb.modeler.create_trace(
+ points_n[n], route_layer[n], width[n], net_n, "Flat", "Flat"
+ )
+ )
# Create the wave ports
@@ -332,7 +339,9 @@
# add void if the layer is the signal routing layer.
void = [void_shape] if layer["name"] == route_layer[1] else []
- edb.modeler.create_polygon(main_shape=gnd_shape, layer_name=layer["name"], voids=void, net_name="gnd")
+ edb.modeler.create_polygon(
+ main_shape=gnd_shape, layer_name=layer["name"], voids=void, net_name="gnd"
+ )
# Plot the layout.
@@ -343,7 +352,7 @@
edb.save_edb()
edb.close_edb()
-# ## Open the project in HFSS 3D Layout.
+# ### Launch HFSS 3D Layout
h3d = Hfss3dLayout(
project=aedb_path,
@@ -356,14 +365,16 @@
# +
setup = h3d.create_setup()
-setup.props["AdaptiveSettings"]["SingleFrequencyDataList"]["AdaptiveFrequencyData"]["MaxPasses"] = 3
+setup.props["AdaptiveSettings"]["SingleFrequencyDataList"]["AdaptiveFrequencyData"][
+ "MaxPasses"
+] = 3
h3d.create_linear_count_sweep(
setup=setup.name,
unit="GHz",
start_frequency=0,
stop_frequency=10,
- num_of_freq_points=101,
+ num_of_freq_points=1001,
name="sweep1",
sweep_type="Interpolating",
interpolation_tol_percent=1,
@@ -375,8 +386,12 @@
# ### Define the differential pairs to used to calculate differential and common mode s-parameters
-h3d.set_differential_pair(differential_mode="In", assignment="wave_port_1:T1", reference="wave_port_1:T2")
-h3d.set_differential_pair(differential_mode="Out", assignment="wave_port_2:T1", reference="wave_port_2:T2")
+h3d.set_differential_pair(
+ differential_mode="In", assignment="wave_port_1:T1", reference="wave_port_1:T2"
+)
+h3d.set_differential_pair(
+ differential_mode="Out", assignment="wave_port_2:T1", reference="wave_port_2:T2"
+)
# Solve the project.
@@ -384,21 +399,30 @@
# Plot the results and shut down AEDT.
-solutions = h3d.post.get_solution_data(expressions=["dB(S(In,In))", "dB(S(In,Out))"], context="Differential Pairs")
+solutions = h3d.post.get_solution_data(
+ expressions=["dB(S(In,In))", "dB(S(In,Out))"], context="Differential Pairs"
+)
solutions.plot()
-# ## Release AEDT
+# ## Finish
+#
+# ### Save the project
h3d.save_project()
h3d.release_desktop()
# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory.
time.sleep(3)
+# ### Clean up
+#
# Note that the ground nets are only connected to each other due
# to the wave ports. The problem with poor grounding can be seen in the
# S-parameters. This example can be downloaded as a Jupyter Notebook, so
# you can modify it. Try changing parameters or adding ground vias to improve performance.
#
-# The final cell cleans up the temporary directory, removing all files.
+# All project files are saved in the folder ``temp_folder.name``.
+# If you've run this example as a Jupyter notebook, you
+# can retrieve those project files. The following cell
+# removes all temporary files, including the project folder.
temp_folder.cleanup()
diff --git a/examples/high_frequency/layout/signal_integrity/serdes_differential.py b/examples/high_frequency/layout/signal_integrity/serdes_differential.py
index 410903205..d2d982bb0 100644
--- a/examples/high_frequency/layout/signal_integrity/serdes_differential.py
+++ b/examples/high_frequency/layout/signal_integrity/serdes_differential.py
@@ -4,13 +4,14 @@
# Database (EDB) interface to create a layout using the BOM and
# a configuration file.
-# ## Perform imports and define constants
+# ## Prerequisites
#
-# Perform required imports.
+# ### Perform imports
# +
import os
import tempfile
+import time
import ansys.aedt.core
@@ -18,22 +19,30 @@
from pyedb.misc.downloads import download_file
# -
-# Download the AEDB file and copy it to a temporary folder.
+# ### Define constants
+# Constants help ensure consistency and avoid repetition throughout the example.
-temp_dir = tempfile.TemporaryDirectory(suffix=".ansys")
-target_aedb = download_file("edb/ANSYS-HSD_V1.aedb", destination=temp_dir.name)
-print("Project folder is", target_aedb)
+AEDT_VERSION = "2025.2"
+NUM_CORES = 4
+NG_MODE = False # Open AEDT UI when it is launched.
-# ## Launch EDB
+# ### Create temporary directory
+#
+# Create a temporary working directory.
+# The name of the working folder is stored in ``temp_folder.name``.
#
-# Launch the ``pyedb.Edb`` class using EDB 2023 R2. Length units are SI.
+# > **Note:** The final cell in the notebook cleans up the temporary folder. If you want to
+# > retrieve the AEDT project and data, do so before executing the final cell in the notebook.
-# +
-# Select EDB version (change it manually if needed, e.g. "2025.1")
-edb_version = "2025.2"
-print(f"EDB version: {edb_version}")
+temp_folder = tempfile.TemporaryDirectory(suffix=".ansys")
+target_aedb = download_file("edb/ANSYS-HSD_V1.aedb", destination=temp_folder.name)
+print("Project folder is", target_aedb)
-edbapp = pyedb.Edb(target_aedb, edbversion=edb_version)
+# ### Launch EDB
+#
+# Launch the ``pyedb.Edb`` class. Length units are SI.
+
+edbapp = pyedb.Edb(target_aedb, edbversion=AEDT_VERSION)
# -
# ## Import definitions
@@ -163,7 +172,7 @@
#
# The cutout and all other simulation settings are applied to the simulation model.
-sim_setup.export_json(os.path.join(temp_dir.name, "configuration.json"))
+sim_setup.export_json(os.path.join(temp_folder.name, "configuration.json"))
edbapp.build_simulation_project(sim_setup)
# ## Display the cutout
@@ -180,19 +189,17 @@
edbapp.save_edb()
edbapp.close_edb()
-# ## Open Electronics Desktop
+# ### Launch HFSS 3D Layout
#
# The EDB is opened in AEDT Hfss3DLayout.
#
# Set ``non_graphical=True`` to run the simulation in non-graphical mode.
-aedt_version = edb_version
-
h3d = ansys.aedt.core.Hfss3dLayout(
- version=aedt_version,
+ version=AEDT_VERSION,
project=target_aedb,
- non_graphical=False,
- new_desktop=False,
+ non_graphical=NG_MODE,
+ new_desktop=True,
)
# ## Analyze
@@ -214,14 +221,20 @@
solutions.plot(solutions.expressions, "db20")
-# ## Save and close AEDT
+# ## Finish
#
-# HFSS 3D Layout is saved and closed.
+# ### Save the project
h3d.save_project()
h3d.release_desktop()
+# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory.
+time.sleep(3)
-# Clean up the temporary directory. All files and the temporary project
-# folder will be deleted in the next step.
+# ### Clean up
+#
+# All project files are saved in the folder ``temp_folder.name``.
+# If you've run this example as a Jupyter notebook, you
+# can retrieve those project files. The following cell
+# removes all temporary files, including the project folder.
-temp_dir.cleanup()
+temp_folder.cleanup()
diff --git a/examples/high_frequency/multiphysics/hfss_mechanical.py b/examples/high_frequency/multiphysics/hfss_mechanical.py
index 354cdcf11..b5a98b68a 100644
--- a/examples/high_frequency/multiphysics/hfss_mechanical.py
+++ b/examples/high_frequency/multiphysics/hfss_mechanical.py
@@ -5,9 +5,9 @@
#
# Keywords: **Multiphysics**, **HFSS**, **Mechanical AEDT**, **Circuit**.
-# ## Perform imports and define constants
+# ## Prerequisites
#
-# Perform required imports.
+# ### Perform imports
# +
import tempfile
@@ -17,13 +17,14 @@
from ansys.aedt.core.examples.downloads import download_via_wizard
# -
-# Define constants.
+# ### Define constants
+# Constants help ensure consistency and avoid repetition throughout the example.
AEDT_VERSION = "2025.2"
NUM_CORES = 4
NG_MODE = False # Open AEDT UI when it is launched.
-# ## Create temporary directory
+# ### Create temporary directory
#
# Create a temporary directory where downloaded data or
# dumped data can be stored.
@@ -40,7 +41,7 @@
local_path=temp_folder.name
)
-# ## Start HFSS
+# ### Launch HFSS
#
# Initialize HFSS.
@@ -149,18 +150,20 @@
surfaces.extend(mech.modeler.get_object_faces(name))
mech.post.create_fieldplot_surface(assignment=surfaces, quantity="Temperature")
-# ## Release AEDT
+# ## Finish
#
-# Release AEDT and close the example.
+# ### Save the project
mech.save_project()
mech.release_desktop()
# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory.
time.sleep(3)
-# ## Clean up
+# ### Clean up
#
-# All project files are saved in the folder ``temp_folder.name``. If you've run this example as a Jupyter notebook, you
-# can retrieve those project files. The following cell removes all temporary files, including the project folder.
+# All project files are saved in the folder ``temp_folder.name``.
+# If you've run this example as a Jupyter notebook, you
+# can retrieve those project files. The following cell
+# removes all temporary files, including the project folder.
temp_folder.cleanup()
diff --git a/examples/high_frequency/multiphysics/microwave_oven.py b/examples/high_frequency/multiphysics/microwave_oven.py
index f82d6fd76..7977bee28 100644
--- a/examples/high_frequency/multiphysics/microwave_oven.py
+++ b/examples/high_frequency/multiphysics/microwave_oven.py
@@ -35,19 +35,22 @@
# ### Create temporary directory
#
# Create a temporary working directory.
-# The name of the working folder is stored in ``working_dir.name``.
+# The name of the working folder is stored in ``temp_folder.name``.
+#
+# > **Note:** The final cell in the notebook cleans up the temporary folder. If you want to
+# > retrieve the AEDT project and data, do so before executing the final cell in the notebook.
-working_dir = tempfile.TemporaryDirectory(suffix=".ansys")
+temp_folder = tempfile.TemporaryDirectory(suffix=".ansys")
# ### Download the project
# Download and open the project. Save it to the temporary working folder.
parasolid_path = download_file(
- source="oven", name="gingerbread.x_t", local_path=working_dir.name
+ source="oven", name="gingerbread.x_t", local_path=temp_folder.name
)
oven_path = download_file(
- source="oven", name="microwave_oven.aedt", local_path=working_dir.name
+ source="oven", name="microwave_oven.aedt", local_path=temp_folder.name
)
# ### Launch HFSS
@@ -59,7 +62,7 @@
project=oven_path,
non_graphical=NG_MODE,
new_desktop=True)
-hfss.save_project(file_name=os.path.join(working_dir.name, 'lets_cook.aedt'))
+hfss.save_project(file_name=os.path.join(temp_folder.name, 'lets_cook.aedt'))
# ## Model Preparation
#
@@ -96,7 +99,7 @@
#
# We now save an image of the model as a PNG file to insert into the report later.
-hfss.post.export_model_picture(full_name=os.path.join(working_dir.name, 'ginger_bread_cookie.png'))
+hfss.post.export_model_picture(full_name=os.path.join(temp_folder.name, 'ginger_bread_cookie.png'))
# ### Launch Icepak
#
@@ -214,7 +217,7 @@
report.add_text("1- Ansys HFSS")
report.add_text("2- PyAEDT")
-report.add_image(path=os.path.join(working_dir.name, 'ginger_bread_cookie.png'),
+report.add_image(path=os.path.join(temp_folder.name, 'ginger_bread_cookie.png'),
caption="HFSS Design of Ansys Microwave Oven")
report.add_page_break()
@@ -259,7 +262,7 @@ def generate_case(quantity_in, field_time, assignment=["ovenCavity", "rotating_c
quantity=quantity_in,
intrinsics={"Time": f"{field_time}s"})
air_ux_case = ipk.post.export_field_plot(plot_name=f1.name,
- output_dir=working_dir.name,
+ output_dir=temp_folder.name,
file_format="case")
mesh_in = pyvista.read(air_ux_case)
return mesh_in
@@ -310,8 +313,8 @@ def generate_case(quantity_in, field_time, assignment=["ovenCavity", "rotating_c
pl.camera.elevation += 20
pl.enable_ssao(kernel_size=128, radius=15, bias=0.5)
pl.enable_anti_aliasing("ssaa")
- pl.screenshot(os.path.join(working_dir.name, "streamlines.png"))
- return os.path.join(working_dir.name, "streamlines.png")
+ pl.screenshot(os.path.join(temp_folder.name, "streamlines.png"))
+ return os.path.join(temp_folder.name, "streamlines.png")
# ### Method to generate temperature plot on gingerbread
@@ -336,7 +339,7 @@ def generate_temps(stop):
pl.add_object(mw_obj[0], mw_obj[1], mw_obj[2])
pl.camera_position = 'yz'
pl.elevation_angle = 20
- pl.plot(export_image_path=os.path.join(working_dir.name, f'{generate_unique_name("Temperature")}.jpg'),
+ pl.plot(export_image_path=os.path.join(temp_folder.name, f'{generate_unique_name("Temperature")}.jpg'),
show=False)
return pl
@@ -368,7 +371,7 @@ def generate_temps(stop):
if mean_temperature > 30:
report.add_text(f"Gingerbread is almost ready. Don't worry we will notify you when ready.")
output_file = generate_streamline(stop_time)
- report.add_image(os.path.join(working_dir.name, "streamlines.png"),
+ report.add_image(os.path.join(temp_folder.name, "streamlines.png"),
f"GingerBread while cooking after {stop_time}s")
else:
report.add_text(f"Take a cup of tea and relax. It will take longer.")
@@ -377,11 +380,11 @@ def generate_temps(stop):
# ### Generate PDF
report.add_toc()
-report.save_pdf(working_dir.name, "Gingerbread_ansys_recipe.pdf")
+report.save_pdf(temp_folder.name, "Gingerbread_ansys_recipe.pdf")
-# ## Release AEDT
+# ## Finish
#
-# Release AEDT and close the example.
+# ### Save the project
ipk.save_project()
ipk.release_desktop()
@@ -390,7 +393,9 @@ def generate_temps(stop):
# ### Clean up
#
-# All project files are saved in the folder ``temp_folder.name``. If you've run this example as a Jupyter notebook, you
-# can retrieve those project files. The following cell removes all temporary files, including the project folder.
+# All project files are saved in the folder ``temp_folder.name``.
+# If you've run this example as a Jupyter notebook, you
+# can retrieve those project files. The following cell
+# removes all temporary files, including the project folder.
-working_dir.cleanup()
+temp_folder.cleanup()
diff --git a/examples/high_frequency/multiphysics/mri.py b/examples/high_frequency/multiphysics/mri.py
index f41068afa..c6939eff5 100644
--- a/examples/high_frequency/multiphysics/mri.py
+++ b/examples/high_frequency/multiphysics/mri.py
@@ -18,8 +18,9 @@
#
# Keywords: **multiphysics**, **HFSS**, **Mechanical AEDT**, **Circuit**.
-# ## Perform imports and define constants
-# Perform required imports.
+# ## Prerequisites
+#
+# ### Perform imports
# +
import os.path
@@ -31,14 +32,15 @@
# -
-# Define constants.
+# ### Define constants
+# Constants help ensure consistency and avoid repetition throughout the example.
AEDT_VERSION = "2025.2"
NUM_CORES = 4
NG_MODE = False # Open AEDT UI when it is launched.
-# ## Create temporary directory
+# ### Create temporary directory
#
# Create a temporary directory where downloaded data or
# dumped data can be stored.
@@ -48,7 +50,7 @@
temp_folder = tempfile.TemporaryDirectory(suffix=".ansys")
-# ## Load project
+# ### Launch HFSS
#
# Open AEDT and the ``background_SAR.aedt`` project. This project
# contains the phantom and airbox. The phantom consists of two objects: ``phantom`` and ``implant_box``.
@@ -334,18 +336,20 @@
ipk.assign_openings(ipk.modeler["Region"].top_face_z)
# -
-# ## Release AEDT
+# ## Finish
#
-# Release AEDT and close the example.
+# ### Save the project
hfss.save_project()
hfss.release_desktop()
# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory.
time.sleep(3)
-# ## Clean up
+# ### Clean up
#
-# All project files are saved in the folder ``temp_folder.name``. If you've run this example as a Jupyter notebook, you
-# can retrieve those project files. The following cell removes all temporary files, including the project folder.
+# All project files are saved in the folder ``temp_folder.name``.
+# If you've run this example as a Jupyter notebook, you
+# can retrieve those project files. The following cell
+# removes all temporary files, including the project folder.
temp_folder.cleanup()
diff --git a/examples/high_frequency/radiofrequency_mmwave/distributed_filter.py b/examples/high_frequency/radiofrequency_mmwave/distributed_filter.py
index c82847b17..5f94032f1 100644
--- a/examples/high_frequency/radiofrequency_mmwave/distributed_filter.py
+++ b/examples/high_frequency/radiofrequency_mmwave/distributed_filter.py
@@ -9,7 +9,6 @@
#
# ### Perform imports
-# +
import os
import tempfile
import time
@@ -23,7 +22,6 @@
)
from ansys.aedt.core.filtersolutions_core.distributed_topology import TopologyType
from ansys.aedt.core.filtersolutions_core.distributed_substrate import SubstrateType, SubstrateEr, SubstrateResistivity
-# -
# ### Define constants.
# Constants help ensure consistency and avoid repetition throughout the example.
@@ -140,7 +138,7 @@ def plot(data_list):
# To update the plot with the simulated data, the HFSS 3D Layout design is analyzed using the analyze method.
# The S-parameters S11 and S21 in dB are extracted from the simulation results and plotted against frequency.
# The simulated S-parameters are overlaid on the synthesized frequency response for comparison.
-
+
hfss3dl.analyze()
solutions = hfss3dl.post.get_solution_data(
expressions=hfss3dl.get_traces_for_plot(category="S"),
diff --git a/examples/high_frequency/radiofrequency_mmwave/iris_filter.py b/examples/high_frequency/radiofrequency_mmwave/iris_filter.py
index b0cadcfcc..7a4810842 100644
--- a/examples/high_frequency/radiofrequency_mmwave/iris_filter.py
+++ b/examples/high_frequency/radiofrequency_mmwave/iris_filter.py
@@ -7,10 +7,9 @@
#
-# ## Perform imports and define constants
-#
-# Perform required imports.
+# ## Prerequisites
#
+# ### Perform imports
# +
import os
@@ -20,15 +19,14 @@
import ansys.aedt.core
# -
-# Define constants.
+# ### Define constants
+# Constants help ensure consistency and avoid repetition throughout the example.
AEDT_VERSION = "2025.2"
NUM_CORES = 4
NG_MODE = False # Open AEDT UI when it is launched.
-# ## Launch AEDT
-
# ### Define parameters and values for waveguide iris filter
#
# Define these parameters:
@@ -55,16 +53,17 @@
}
# -
-# ## Create temporary directory
+# ### Create temporary directory
+#
+# Create a temporary working directory.
+# The name of the working folder is stored in ``temp_folder.name``.
#
-# Create a temporary directory where downloaded data or
-# dumped data can be stored.
-# If you'd like to retrieve the project data for subsequent use,
-# the temporary folder name is given by ``temp_folder.name``.
+# > **Note:** The final cell in the notebook cleans up the temporary folder. If you want to
+# > retrieve the AEDT project and data, do so before executing the final cell in the notebook.
temp_folder = tempfile.TemporaryDirectory(suffix=".ansys")
-# ### Create HFSS design
+# ### Launch HFSS
project_name = os.path.join(temp_folder.name, "waveguide.aedt")
hfss = ansys.aedt.core.Hfss(
@@ -260,20 +259,20 @@ def place_iris(z_pos, dz, param_count):
show=False,
)
-# ## Release AEDT
+# ## Finish
#
-# The following command saves the project to a file and closes AEDT.
+# ### Save the project
hfss.save_project()
hfss.release_desktop()
# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory.
time.sleep(3)
-# ## Clean up
+# ### Clean up
#
# All project files are saved in the folder ``temp_folder.name``.
# If you've run this example as a Jupyter notebook, you
-# can retrieve those project files. The following cell removes
-# all temporary files, including the project folder.
+# can retrieve those project files. The following cell
+# removes all temporary files, including the project folder.
temp_folder.cleanup()
diff --git a/examples/high_frequency/radiofrequency_mmwave/lumped_element.py b/examples/high_frequency/radiofrequency_mmwave/lumped_element.py
index a3aee8f40..8bf914bad 100644
--- a/examples/high_frequency/radiofrequency_mmwave/lumped_element.py
+++ b/examples/high_frequency/radiofrequency_mmwave/lumped_element.py
@@ -5,9 +5,9 @@
#
# Keywords: **filter solutions**
-# ## Perform imports and define constants
+# ## Prerequisites
#
-# Perform required imports.
+# ### Perform imports
import ansys.aedt.core
@@ -19,9 +19,12 @@
SParametersResponseColumn,
)
-# Define constants.
+# ### Define constants
+# Constants help ensure consistency and avoid repetition throughout the example.
AEDT_VERSION = "2025.2"
+NUM_CORES = 4
+NG_MODE = False # Open AEDT UI when it is launched.
# ## Define function used for plotting
#
diff --git a/examples/high_frequency/radiofrequency_mmwave/spiral.py b/examples/high_frequency/radiofrequency_mmwave/spiral.py
index e51293400..dea6abd50 100644
--- a/examples/high_frequency/radiofrequency_mmwave/spiral.py
+++ b/examples/high_frequency/radiofrequency_mmwave/spiral.py
@@ -4,9 +4,9 @@
#
# Keywords: **HFSS**, **spiral**, **inductance**, **output variable**.
-# ## Perform imports and define constants
+# ## Prerequisites
#
-# Perform required imports.
+# ### Perform imports
# +
import os
@@ -18,13 +18,14 @@
# -
-# Define constants.
+# ### Define constants
+# Constants help ensure consistency and avoid repetition throughout the example.
AEDT_VERSION = "2025.2"
NUM_CORES = 4
NG_MODE = False # Open AEDT UI when it is launched.
-# ## Create temporary directory
+# ### Create temporary directory
#
# Create a temporary directory where downloaded data or
# dumped data can be stored.
@@ -33,7 +34,7 @@
temp_folder = tempfile.TemporaryDirectory(suffix=".ansys")
-# ## Launch HFSS
+# ### Launch HFSS
#
# Create an HFSS design and change the units to microns.
@@ -216,20 +217,20 @@ def create_line(pts):
data.export_data_to_csv(os.path.join(hfss.toolkit_directory, "output.csv"))
-# ## Save project and close AEDT
+# ## Finish
#
-# Save the project and close AEDT.
+# ### Save the project
hfss.save_project()
hfss.release_desktop()
# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory.
time.sleep(3)
-# ## Clean up
+# ### Clean up
#
# All project files are saved in the folder ``temp_folder.name``.
# If you've run this example as a Jupyter notebook, you
-# can retrieve those project files. The following cell removes
-# all temporary files, including the project folder.
+# can retrieve those project files. The following cell
+# removes all temporary files, including the project folder.
temp_folder.cleanup()
diff --git a/examples/high_frequency/radiofrequency_mmwave/stripline.py b/examples/high_frequency/radiofrequency_mmwave/stripline.py
index 7efddaf20..7b2bca1b1 100644
--- a/examples/high_frequency/radiofrequency_mmwave/stripline.py
+++ b/examples/high_frequency/radiofrequency_mmwave/stripline.py
@@ -5,9 +5,9 @@
#
# Keywords: **Q2D**, **Stripline**.
-# ## Perform imports and define constants
+# ## Prerequisites
#
-# Perform required imports.
+# ### Perform imports
# +
import os
@@ -19,13 +19,15 @@
# -
-# Define constants.
+# ### Define constants
+# Constants help ensure consistency and avoid repetition throughout the example.
AEDT_VERSION = "2025.2"
NUM_CORES = 4
+NG_MODE = False # Open AEDT UI when it is launched.
-# ## Create temporary directory
+# ### Create temporary directory
#
# Create a temporary directory where downloaded data or
# dumped data can be stored.
@@ -34,16 +36,16 @@
temp_folder = tempfile.TemporaryDirectory(suffix=".ansys")
-# ## Launch AEDT and 2D Extractor
+# ### Launch 2D Extractor
#
-# Launch AEDT 2025.2 in graphical mode and launch 2D Extractor. This example
+# Launch AEDT in graphical mode and launch 2D Extractor. This example
# uses SI units.
q2d = ansys.aedt.core.Q2d(
project=os.path.join(temp_folder.name, "stripline"),
design="differential_stripline",
version=AEDT_VERSION,
- non_graphical=False,
+ non_graphical=NG_MODE,
new_desktop=True,
)
@@ -232,14 +234,16 @@
# -
-# ## Release AEDT
+# ## Finish
+#
+# ### Save the project
q2d.save_project()
q2d.release_desktop()
# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory.
time.sleep(3)
-# ## Clean up
+# ### Clean up
#
# All project files are saved in the folder ``temp_folder.name``.
# If you've run this example as a Jupyter notebook, you
diff --git a/examples/template.py b/examples/template.py
index 824929d0c..857c0eb79 100644
--- a/examples/template.py
+++ b/examples/template.py
@@ -40,6 +40,12 @@
temp_folder = tempfile.TemporaryDirectory(suffix=".ansys")
+# ## Model Preparation
+#
+# Description of steps used to create and prepare the model for simulation.
+# Add as many sections as needed for preprocessing tasks. Use level 3 headers
+# for subsequent headers in this section.
+#
# ### Launch application
#
# AEDT applications are accessed through Python classes.
@@ -68,12 +74,6 @@
new_desktop=True,
)
-# ## Model Preparation
-#
-# Description of steps used to create and prepare the model for simulation.
-# Add as many sections as needed for preprocessing tasks. Use level 3 headers
-# for subsequent headers in this section.
-
# ### Create 3D model
#
# > Insert code to build the model from scratch or import a model.
@@ -111,7 +111,7 @@
# ### Save the project
m3d.save_project()
-m3d.release_desktop()
+m3d.desktop_class.release_desktop()
# Wait 3 seconds to allow AEDT to shut down before cleaning the temporary directory.
time.sleep(3)