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

Precommit fix #83

Merged
merged 4 commits into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ repos:
hooks:
- id: black
args:
- --line-length=88
- --line-length=120

- repo: https://github.com/adamchainz/blacken-docs
rev: 1.16.0
Expand All @@ -25,7 +25,7 @@ repos:
hooks:
- id: flake8
args: [
--max-line-length, "88",
--max-line-length, "120",
ansys, codegen, doc, examples, tests
]

Expand Down
24 changes: 15 additions & 9 deletions doc/source/Scripts_resources/SI/add_simulation_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
# Ansys release version
desktop_version = "2023.2"

#download and copy the layout file from examples
# download and copy the layout file from examples
temp_folder = pyaedt.generate_unique_folder_name()
targetfile = pyaedt.downloads.download_file('edb/ANSYS-HSD_V1.aedb', destination=temp_folder)
targetfile = pyaedt.downloads.download_file("edb/ANSYS-HSD_V1.aedb", destination=temp_folder)

# loading EDB
edbapp = Edb(edbpath=targetfile, edbversion=desktop_version)
Expand All @@ -16,24 +16,30 @@
simple_hfss_setup.add_frequency_sweep(name="MySweep", frequency_sweep=[["linear scale", "0GHz", "10GHz", "0.01GHz"]])

multi_freq_setup = edbapp.create_hfss_setup("MyMultiFreqSetup")
multi_freq_setup.set_solution_multi_frequencies(frequencies=["5GHz", "7GHz", "10GHz"], max_num_passes=30, max_delta_s=0.02)
multi_freq_setup.set_solution_multi_frequencies(
frequencies=["5GHz", "7GHz", "10GHz"], max_num_passes=30, max_delta_s=0.02
)
multi_freq_setup.add_frequency_sweep(name="MySweep", frequency_sweep=[["linear scale", "0GHz", "20GHz", "0.01GHz"]])

broad_band_sweep = edbapp.create_hfss_setup("MyBroadbandSetup")
broad_band_sweep.set_solution_broadband(low_frequency="5GHz", high_frequency="10GHz", max_num_passes=20, max_delta_s=0.01)
broad_band_sweep.set_solution_broadband(
low_frequency="5GHz", high_frequency="10GHz", max_num_passes=20, max_delta_s=0.01
)
broad_band_sweep.add_frequency_sweep(name="MySweep", frequency_sweep=[["linear scale", "0GHz", "20GHz", "0.01GHz"]])

# adding frequency sweeps
multi_freq_sweep_setup = edbapp.create_hfss_setup("MyMultiFrequencySweepSetup")
multi_freq_sweep_setup.set_solution_single_frequency(frequency="5GHz", max_num_passes=30, max_delta_s=0.02)
multi_freq_sweep_setup.add_frequency_sweep(frequency_sweep=[["linear count", "0", "1kHz", 1],
["log scale", "1kHz", "0.1GHz", 10],
["linear scale", "0.1GHz", "10GHz", "0.1GHz"],
])
multi_freq_sweep_setup.add_frequency_sweep(
frequency_sweep=[
["linear count", "0", "1kHz", 1],
["log scale", "1kHz", "0.1GHz", 10],
["linear scale", "0.1GHz", "10GHz", "0.1GHz"],
]
)

# save and close project
edbapp.save_edb()
edbapp.close_edb()
hfss = Hfss3dLayout(projectname=targetfile, specified_version=desktop_version)
hfss.release_desktop(close_desktop=False, close_projects=False)

Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import pyaedt
from pyaedt import Edb, Hfss3dLayout
from pyaedt.generic.constants import SourceType
from pyedb.generic.general_methods import generate_unique_folder_name
from pyedb.legacy.edb import EdbLegacy
from pyedb.misc.downloads import download_file

# Ansys release version
desktop_version = "2023.2"

# download and copy the layout file from examples
temp_folder = pyaedt.generate_unique_folder_name()
targetfile = pyaedt.downloads.download_file('edb/ANSYS-HSD_V1.aedb', destination=temp_folder)
temp_folder = generate_unique_folder_name()
targetfile = download_file("edb/ANSYS-HSD_V1.aedb", destination=temp_folder)

# loading EDB
edbapp = Edb(edbpath=targetfile, edbversion=desktop_version)
edbapp = EdbLegacy(edbpath=targetfile, edbversion=desktop_version)

signal_nets = ["DDR4_DQ0", "DDR4_DQ1", "DDR4_DQ2", "DDR4_DQ3", "DDR4_DQ4", "DDR4_DQ5", "DDR4_DQ6", "DDR4_DQ7"]
reference_nets = ["GND"]
Expand All @@ -29,5 +29,3 @@
# save and close project
edbapp.save_edb()
edbapp.close_edb()
hfss = Hfss3dLayout(projectname=targetfile, specified_version=desktop_version)
hfss.release_desktop(close_desktop=False, close_projects=False)
9 changes: 5 additions & 4 deletions doc/source/Scripts_resources/SI/clipping_design.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
# Ansys release version
desktop_version = "2023.2"

#download and copy the layout file from examples
# download and copy the layout file from examples
temp_folder = pyaedt.generate_unique_folder_name()
targetfile = pyaedt.downloads.download_file('edb/ANSYS-HSD_V1.aedb', destination=temp_folder)
targetfile = pyaedt.downloads.download_file("edb/ANSYS-HSD_V1.aedb", destination=temp_folder)

# loading EDB
edbapp = Edb(edbpath=targetfile, edbversion=desktop_version)
Expand All @@ -15,7 +15,8 @@
signal_nets = ["DDR4_DQ0", "DDR4_DQ1", "DDR4_DQ2", "DDR4_DQ3", "DDR4_DQ4", "DDR4_DQ5", "DDR4_DQ6", "DDR4_DQ7"]
# at least one reference net must be inclulded. Reference nets are included in the design but clipped.
reference_nets = ["GND"]
# defining the expansion factor. The value gives the distance for evaluating the cutout extent. Here we define a cutout
# defining the expansion factor.
# The value gives the distance for evaluating the cutout extent
expansion = 0.01 # 1cm in this case
# processing cutout
edbapp.cutout(signal_list=signal_nets, reference_list=reference_nets, expansion_size=expansion)
Expand All @@ -26,4 +27,4 @@
hfss = Hfss3dLayout(projectname=targetfile, specified_version=desktop_version)
# After opening AEDT with PyAEDT, if you want to be able to close manually the project you have to release
# AEDT from PyAEDT.
hfss.release_desktop(close_desktop=False, close_projects=False)
hfss.release_desktop(close_desktop=False, close_projects=False)
17 changes: 8 additions & 9 deletions doc/source/Scripts_resources/SI/editing_layer_stackup.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
import pyaedt
from pyaedt import Edb, Hfss3dLayout
from pyedb.generic.general_methods import generate_unique_folder_name
from pyedb.legacy.edb import EdbLegacy
from pyedb.misc.downloads import download_file

# Ansys release version
desktop_version = "2023.2"

#download and copy the layout file from examples
temp_folder = pyaedt.generate_unique_folder_name()
targetfile = pyaedt.downloads.download_file('edb/ANSYS-HSD_V1.aedb', destination=temp_folder)
# download and copy the layout file from examples
temp_folder = generate_unique_folder_name()
targetfile = download_file("edb/ANSYS-HSD_V1.aedb", destination=temp_folder)

# loading EDB
edbapp = Edb(edbpath=targetfile, edbversion=desktop_version)
edbapp = EdbLegacy(edbpath=targetfile, edbversion=desktop_version)

# ploting layer stackup in matplotlib
# plotting layer stackup in matplotlib
edbapp.stackup.plot()

# retrieving signal layers name
Expand All @@ -36,5 +37,3 @@
layer.material = "MyMetal"
edbapp.materials.add_material(name="SolderMask", permittivity=3.8, dielectric_loss_tangent=1e-3)
edbapp.stackup.add_layer(layer_name="Solder_mask", base_layer="1_Top", thickness="200um", material="SolderMask")


15 changes: 8 additions & 7 deletions doc/source/Scripts_resources/SI/layout_import.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import pyaedt
from pyaedt import Edb, Hfss3dLayout
from pyedb.generic.general_methods import generate_unique_folder_name
from pyedb.legacy.edb import EdbLegacy
from pyedb.misc.downloads import download_file

# Ansys release version
desktop_version = "2023.2"

#download and copy the layout file from examples
temp_folder = pyaedt.generate_unique_folder_name()
targetfile = pyaedt.downloads.download_file('edb/ANSYS-HSD_V1.aedb', destination=temp_folder)
# download and copy the layout file from examples
temp_folder = generate_unique_folder_name()
targetfile = download_file("edb/ANSYS-HSD_V1.aedb", destination=temp_folder)

# loading EDB
edbapp = Edb(edbpath=targetfile, edbversion=desktop_version)
edbapp = EdbLegacy(edbpath=targetfile, edbversion=desktop_version)

# Some layout statistics
stats = edbapp.get_statistics()
Expand All @@ -36,4 +37,4 @@
edbapp.nets.plot(None)

# plotting specific net
edbapp.nets.plot("GND")
edbapp.nets.plot("GND")
56 changes: 28 additions & 28 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,42 +2,45 @@

# -- Project information -----------------------------------------------------
import datetime
from importlib import import_module
import json
import os
import pathlib
from pprint import pformat
import sys
import warnings

import pyvista
import numpy as np
import json
from sphinx_gallery.sorting import FileNameSortKey
from ansys_sphinx_theme import (ansys_favicon,
get_version_match, pyansys_logo_black,
watermark,
ansys_logo_white,
ansys_logo_white_cropped, latex)
from importlib import import_module
from pprint import pformat
from docutils.parsers.rst import Directive
from ansys_sphinx_theme import (
ansys_favicon,
ansys_logo_white,
ansys_logo_white_cropped,
get_version_match,
latex,
pyansys_logo_black,
watermark,
)
from docutils import nodes
from docutils.parsers.rst import Directive
import numpy as np
import pyvista
from sphinx import addnodes

# <-----------------Override the sphinx pdf builder---------------->
# Some pages do not render properly as per the expected Sphinx LaTeX PDF signature.
# This issue can be resolved by migrating to the autoapi format.
# Additionally, when documenting images in formats other than the supported ones,
# Additionally, when documenting images in formats other than the supported ones,
# make sure to specify their types.
from sphinx.builders.latex import LaTeXBuilder
from sphinx_gallery.sorting import FileNameSortKey

LaTeXBuilder.supported_image_types = ["image/png", "image/pdf", "image/svg+xml", "image/webp"]

from sphinx.writers.latex import CR
from sphinx.writers.latex import LaTeXTranslator
from docutils.nodes import Element
from sphinx.writers.latex import CR, LaTeXTranslator


def visit_desc_content(self, node: Element) -> None:
self.body.append(CR + r'\pysigstopsignatures')
self.body.append(CR + r"\pysigstopsignatures")
self.in_desc_signature = False


Expand All @@ -46,23 +49,22 @@ def visit_desc_content(self, node: Element) -> None:

# <----------------- End of sphinx pdf builder override---------------->


class PrettyPrintDirective(Directive):
"""Renders a constant using ``pprint.pformat`` and inserts into the document."""

required_arguments = 1

def run(self):
module_path, member_name = self.arguments[0].rsplit('.', 1)
module_path, member_name = self.arguments[0].rsplit(".", 1)

member_data = getattr(import_module(module_path), member_name)
code = pformat(member_data, 2, width=68)

literal = nodes.literal_block(code, code)
literal['language'] = 'python'
literal["language"] = "python"

return [
addnodes.desc_name(text=member_name),
addnodes.desc_content('', literal)
]
return [addnodes.desc_name(text=member_name), addnodes.desc_content("", literal)]


def autodoc_skip_member(app, what, name, obj, skip, options):
Expand All @@ -76,8 +78,8 @@ def autodoc_skip_member(app, what, name, obj, skip, options):


def setup(app):
app.add_directive('pprint', PrettyPrintDirective)
app.connect('autodoc-skip-member', autodoc_skip_member)
app.add_directive("pprint", PrettyPrintDirective)
app.connect("autodoc-skip-member", autodoc_skip_member)


local_path = os.path.dirname(os.path.realpath(__file__))
Expand All @@ -86,7 +88,6 @@ def setup(app):
try:
from pyedb import __version__
except ImportError:

sys.path.append(os.path.abspath(os.path.join(local_path)))
sys.path.append(os.path.join(root_path))
from pyedb import __version__
Expand Down Expand Up @@ -246,7 +247,6 @@ def setup(app):

# gallery build requires AEDT install
if os.name != "posix" and "PYAEDT_CI_NO_EXAMPLES" not in os.environ:

# suppress annoying matplotlib bug
warnings.filterwarnings(
"ignore",
Expand All @@ -267,7 +267,7 @@ def setup(app):
"examples_dirs": ["../../examples/"],
# path where to save gallery generated examples
"gallery_dirs": ["examples"],
# Patter to search for examples files
# Pattern to search for examples files
"filename_pattern": r"\.py",
# Remove the "Download all examples" button from the top level gallery
"download_all_examples": False,
Expand Down Expand Up @@ -351,7 +351,7 @@ def setup(app):
# These paths are either relative to html_static_path
# or fully qualified paths (eg. https://...)
html_css_files = [
'custom.css',
"custom.css",
]

# -- Options for HTMLHelp output ---------------------------------------------
Expand Down
17 changes: 8 additions & 9 deletions examples/legacy/01_edb_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,15 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~
# Perform required imports.

import shutil

import os
import time

import pyedb
from pyedb.legacy.downloads import download_file
from pyedb.generic.general_methods import generate_unique_folder_name

from pyedb.legacy.downloads import download_file

temp_folder = generate_unique_folder_name()
targetfile = download_file('edb/ANSYS-HSD_V1.aedb', destination=temp_folder)
targetfile = download_file("edb/ANSYS-HSD_V1.aedb", destination=temp_folder)

siwave_file = os.path.join(os.path.dirname(targetfile), "ANSYS-HSD_V1.siw")
print(targetfile)
Expand Down Expand Up @@ -123,7 +121,6 @@
print(edb.stackup.limits())



###############################################################################
# Create voltage source and Siwave DCIR analysis
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand All @@ -137,22 +134,24 @@
setup.add_source_terminal_to_ground("V1", 1)



###############################################################################
# Save modifications
# ~~~~~~~~~~~~~~~~~~
# Save modifications.

edb.save_edb()
edb.nets.plot(None, "1_Top",plot_components_on_top=True)
edb.nets.plot(None, "1_Top", plot_components_on_top=True)

siw_file = edb.solve_siwave()

###############################################################################
# Export Siwave Reports
# ~~~~~~~~~~~~~~~~~~~~~
# Export all DC Reports quantities.
outputs = edb.export_siwave_dc_results(siw_file, setup.name, )
outputs = edb.export_siwave_dc_results(
siw_file,
setup.name,
)

###############################################################################
# Close EDB
Expand Down
Loading
Loading