Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add jupytext header #3899

Closed
wants to merge 6 commits into from
Closed
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 46 additions & 27 deletions examples/02-HFSS/Array.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# ---
# jupyter:
# jupytext:
# text_representation:
# extension: .py
# format_name: sphinx
# format_version: '1.1'
# jupytext_version: 1.14.5
# kernelspec:
# display_name: Python 3 (ipykernel)
# language: python
# name: python3
# ---

"""
HFSS: component antenna array
-----------------------------
Expand All @@ -6,31 +20,33 @@
PyVista without opening the HFSS user interface. This examples runs only on Windows using CPython.
"""
##########################################################
# Perform required imports
# ~~~~~~~~~~~~~~~~~~~~~~~~
# # Perform required imports
#
# Perform required imports.

import os
import pyaedt

##########################################################
# Set non-graphical mode
# ~~~~~~~~~~~~~~~~~~~~~~
# ## Set non-graphical mode
#
# Set non-graphical mode.
# You can set ``non_graphical`` either to ``True`` or ``False``.

non_graphical = False

##########################################################
# Download 3D component
# ~~~~~~~~~~~~~~~~~~~~~
# ## Download 3D component
#
# Download the 3D component that is needed to run the example.

example_path = pyaedt.downloads.download_3dcomponent()

##########################################################
# Launch HFSS and save project
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# ## Launch HFSS and save project
#
# Launch HFSS and save the project.

project_name = pyaedt.generate_unique_project_name(project_name="array")
hfss = pyaedt.Hfss(projectname=project_name,
specified_version="2023.2",
Expand All @@ -41,12 +57,12 @@
print("Project name " + project_name)

##########################################################
# Read array definition from JSON file
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# ## Read array definition from JSON file
#
# Read the array definition from a JSON file. A JSON file
# can contain all information needed to import and set up a
# full array in HFSS.
#
#
# If a 3D component is not available in the design, it is loaded
# into the dictionary from the path that you specify. The following
# code edits the dictionary to point to the location of the A3DCOMP file.
Expand All @@ -57,8 +73,8 @@
array = hfss.add_3d_component_array_from_json(dict_in)

##########################################################
# Modify cells
# ~~~~~~~~~~~~
# ## Modify cells
#
# Make center element passive and rotate corner elements.

array.cells[1][1].is_active = False
Expand All @@ -68,8 +84,8 @@
array.cells[2][2].rotation = 90

##########################################################
# Set up simulation
# ~~~~~~~~~~~~~~~~~
# ## Set up simulation
#
# Set up a simulation and analyze it.

setup = hfss.create_setup()
Expand All @@ -79,26 +95,26 @@
hfss.analyze(num_cores=4)

##########################################################
# Get far field data
# ~~~~~~~~~~~~~~~~~~
# ## Get 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_ffd_solution_data(sphere_name="Infinite Sphere1", setup_name=hfss.nominal_adaptive,
frequencies=[5e9])

##########################################################
# Generate contour plot
# ~~~~~~~~~~~~~~~~~~~~~
# ## Generate contour plot
#
# Generate a contour plot. You can define the Theta scan
# and Phi scan.

ffdata.plot_farfield_contour(qty_str='RealizedGain', convert_to_db=True,
title='Contour at {}Hz'.format(ffdata.frequency))

##########################################################
# Generate 2D cutout plots
# ~~~~~~~~~~~~~~~~~~~~~~~~
# ## Generate 2D cutout plots
#
# Generate 2D cutout plots. You can define the Theta scan
# and Phi scan.

Expand All @@ -113,17 +129,17 @@
convert_to_db=True)

##########################################################
# Generate 3D polar plots in Matplotlib
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# ## Generate 3D polar plots in Matplotlib
#
# Generate 3D polar plots in Matplotlib. You can define
# the Theta scan and Phi scan.

ffdata.polar_plot_3d(qty_str='RealizedGain',
convert_to_db=True)

##########################################################
# Generate 3D plots in PyVista
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# ## Generate 3D plots in PyVista
#
# Generate 3D plots in PyVista. You can define the Theta and Phi
# scan angles. You can change the easy-to-use interactive plot
# that is generated on the fly.
Expand All @@ -134,8 +150,11 @@
show=False)

##########################################################
# Release AEDT
# ~~~~~~~~~~~~
# ## Release AEDT
#
# Release AEDT.

hfss.release_desktop()

""

Loading