Skip to content

REFACTOR: deprecate all methods that wrap analyze() #6050

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

Closed
Closed
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
1 change: 1 addition & 0 deletions doc/changelog.d/6050.miscellaneous.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
deprecate all methods that wrap analyze()
69 changes: 54 additions & 15 deletions src/ansys/aedt/core/circuit.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import re
import shutil
import time
import warnings

from ansys.aedt.core.application.analysis_hf import ScatteringMethods
from ansys.aedt.core.application.analysis_nexxim import FieldAnalysisCircuit
Expand Down Expand Up @@ -1657,9 +1658,9 @@
differential=True,
rise_time=30,
use_convolution=True,
analyze=True,
design_name="LNA",
impedance=50,
**kwargs,
):
"""Create a schematic from a Touchstone file and automatically setup a TDR transient analysis.

Expand All @@ -1682,8 +1683,6 @@
use_convolution : bool, optional
Whether to use convolution for the Touchstone file. The default is ``True``.
If ``False``, state-space is used.
analyze : bool
Whether to automatically assign differential pairs. The default is ``False``.
design_name : str, optional
New schematic name. The default is ``"LNA"``.
impedance : float, optional
Expand All @@ -1693,6 +1692,16 @@
-------

"""
analyze = True
if "analyze" in kwargs:
warnings.warn(

Check warning on line 1697 in src/ansys/aedt/core/circuit.py

View check run for this annotation

Codecov / codecov/patch

src/ansys/aedt/core/circuit.py#L1695-L1697

Added lines #L1695 - L1697 were not covered by tests
"The ``analyze`` argument will be deprecated in future versions."
"Automatically assign differential "
"pairs.",
DeprecationWarning,
)
analyze = kwargs["analyze"]

Check warning on line 1703 in src/ansys/aedt/core/circuit.py

View check run for this annotation

Codecov / codecov/patch

src/ansys/aedt/core/circuit.py#L1703

Added line #L1703 was not covered by tests

if design_name in self.design_list:
self.logger.warning("Design already exists. renaming.")
design_name = generate_unique_name(design_name)
Expand Down Expand Up @@ -1800,8 +1809,8 @@
auto_assign_diff_pairs=False,
separation=".",
pattern=None,
analyze=True,
design_name="LNA",
**kwargs,
):
"""Create a schematic from a Touchstone file and automatically set up an LNA analysis.

Expand All @@ -1821,8 +1830,6 @@
Character to use to separate port names. The default is ``"."``.
pattern : list, optional
Port name pattern. The default is ``["component", "pin", "net"]``.
analyze : bool
Whether to automatically assign differential pairs. The default is ``False``.
design_name : str, optional
New schematic name. The default is ``"LNA"``.

Expand All @@ -1832,6 +1839,16 @@
First argument is ``True`` if succeeded.
Second and third argument are respectively names of the differential and common mode pairs.
"""
analyze = True
if "analyze" in kwargs:
warnings.warn(

Check warning on line 1844 in src/ansys/aedt/core/circuit.py

View check run for this annotation

Codecov / codecov/patch

src/ansys/aedt/core/circuit.py#L1842-L1844

Added lines #L1842 - L1844 were not covered by tests
"The ``analyze`` argument will be deprecated in future versions."
"Automatically assign differential "
"pairs.",
DeprecationWarning,
)
analyze = kwargs["analyze"]

Check warning on line 1850 in src/ansys/aedt/core/circuit.py

View check run for this annotation

Codecov / codecov/patch

src/ansys/aedt/core/circuit.py#L1850

Added line #L1850 was not covered by tests

if pattern is None:
pattern = ["component", "pin", "net"]
if design_name in self.design_list:
Expand Down Expand Up @@ -1923,10 +1940,10 @@
bit_pattern=None,
unit_interval=None,
use_convolution=True,
analyze=False,
design_name="AMI",
ibis_rx_file=None,
create_setup=True,
**kwargs,
):
"""Create a schematic from a Touchstone file and automatically set up an IBIS-AMI analysis.

Expand Down Expand Up @@ -1968,8 +1985,6 @@
use_convolution : bool, optional
Whether to use convolution for the Touchstone file. The default is
``True``. If ``False``, state-space is used.
analyze : bool
Whether to automatically assign differential pairs. The default is ``False``.
design_name : str, optional
New schematic name. The default is ``"LNA"``.
ibis_rx_file : str, optional
Expand All @@ -1983,6 +1998,15 @@
First argument is ``True`` if successful.
Second and third arguments are respectively the names of the tx and rx mode probes.
"""
analyze = False
if "analyze" in kwargs:
warnings.warn(

Check warning on line 2003 in src/ansys/aedt/core/circuit.py

View check run for this annotation

Codecov / codecov/patch

src/ansys/aedt/core/circuit.py#L2001-L2003

Added lines #L2001 - L2003 were not covered by tests
"The ``analyze`` argument will be deprecated in future versions."
"Automatically assign differential "
"pairs.",
DeprecationWarning,
)
analyze = kwargs["analyze"]

Check warning on line 2009 in src/ansys/aedt/core/circuit.py

View check run for this annotation

Codecov / codecov/patch

src/ansys/aedt/core/circuit.py#L2009

Added line #L2009 was not covered by tests

return self.create_ibis_schematic_from_snp(
input_file=input_file,
Expand Down Expand Up @@ -2026,10 +2050,10 @@
bit_pattern=None,
unit_interval=None,
use_convolution=True,
analyze=False,
design_name="IBIS",
is_ami=False,
create_setup=True,
**kwargs,
):
"""Create a schematic from a Touchstone file and automatically set up an IBIS-AMI analysis.

Expand Down Expand Up @@ -2072,8 +2096,6 @@
use_convolution : bool, optional
Whether to use convolution for the Touchstone file. The default is
``True``. If ``False``, state-space is used.
analyze : bool
Whether to automatically assign differential pairs. The default is ``False``.
design_name : str, optional
New schematic name. The default is ``"IBIS"``.
is_ami : bool, optional
Expand All @@ -2089,6 +2111,16 @@
First argument is ``True`` if successful.
Second and third arguments are respectively the names of the tx and rx mode probes.
"""
analyze = False
if "analyze" in kwargs:
warnings.warn(

Check warning on line 2116 in src/ansys/aedt/core/circuit.py

View check run for this annotation

Codecov / codecov/patch

src/ansys/aedt/core/circuit.py#L2114-L2116

Added lines #L2114 - L2116 were not covered by tests
"The ``analyze`` argument will be deprecated in future versions."
"Automatically assign differential "
"pairs.",
DeprecationWarning,
)
analyze = kwargs["analyze"]

Check warning on line 2122 in src/ansys/aedt/core/circuit.py

View check run for this annotation

Codecov / codecov/patch

src/ansys/aedt/core/circuit.py#L2122

Added line #L2122 was not covered by tests

if design_name in self.design_list:
self.logger.warning("Design already exists. Renaming.")
design_name = generate_unique_name(design_name)
Expand Down Expand Up @@ -2141,9 +2173,9 @@
bit_pattern=None,
unit_interval=None,
use_convolution=True,
analyze=False,
is_ami=False,
create_setup=True,
**kwargs,
):
"""Create a schematic from a list of pins and automatically set up an IBIS-AMI analysis.

Expand Down Expand Up @@ -2190,8 +2222,6 @@
use_convolution : bool, optional
Whether to use convolution for the Touchstone file. The default is
``True``. If ``False``, state-space is used.
analyze : bool
Whether to automatically assign differential pairs. The default is ``False``.
is_ami : bool, optional
Whether the ibis is AMI. The default is ``False``.
create_setup : bool, optional
Expand All @@ -2204,6 +2234,15 @@
First argument is ``True`` if successful.
Second and third arguments are respectively the names of the tx and rx mode probes.
"""
analyze = False
if "analyze" in kwargs:
warnings.warn(

Check warning on line 2239 in src/ansys/aedt/core/circuit.py

View check run for this annotation

Codecov / codecov/patch

src/ansys/aedt/core/circuit.py#L2237-L2239

Added lines #L2237 - L2239 were not covered by tests
"The ``analyze`` argument will be deprecated in future versions."
"Automatically assign differential "
"pairs.",
DeprecationWarning,
)
analyze = kwargs["analyze"]

Check warning on line 2245 in src/ansys/aedt/core/circuit.py

View check run for this annotation

Codecov / codecov/patch

src/ansys/aedt/core/circuit.py#L2245

Added line #L2245 was not covered by tests

if tx_component_name is None:
try:
Expand Down
13 changes: 9 additions & 4 deletions src/ansys/aedt/core/q3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -2499,14 +2499,11 @@
return True

@pyaedt_function_handler()
def export_w_elements(self, analyze=False, export_folder=None):
def export_w_elements(self, export_folder=None, **kwargs):
"""Export all W-elements to files.

Parameters
----------
analyze : bool, optional
Whether to analyze before export. Solutions must be present for the design.
The default is ``False``.
export_folder : str or :class:`pathlib.Path`, optional
Full path to the folder to export files to. The default is ``None``, in
which case the working directory is used.
Expand All @@ -2516,6 +2513,14 @@
list
List of all exported files.
"""
analyze = False
if "analyze" in kwargs:
warnings.warn(

Check warning on line 2518 in src/ansys/aedt/core/q3d.py

View check run for this annotation

Codecov / codecov/patch

src/ansys/aedt/core/q3d.py#L2516-L2518

Added lines #L2516 - L2518 were not covered by tests
"The ``analyze`` argument will be deprecated in future versions." "Analyze before export.",
DeprecationWarning,
)
analyze = kwargs["analyze"]

Check warning on line 2522 in src/ansys/aedt/core/q3d.py

View check run for this annotation

Codecov / codecov/patch

src/ansys/aedt/core/q3d.py#L2522

Added line #L2522 was not covered by tests

exported_files = []
if not export_folder:
export_folder = self.working_directory
Expand Down
6 changes: 3 additions & 3 deletions tests/system/general/test_36_Q2D_PostProcessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def init(self, q2d_solved_sweep_app, q2d_solved_nominal_app, local_scratch):

def test_01_export_w_elements_from_sweep(self, q2d_solved_sweep_app, local_scratch):
export_folder = Path(local_scratch.path) / "export_folder"
files = q2d_solved_sweep_app.export_w_elements(False, export_folder)
files = q2d_solved_sweep_app.export_w_elements(analyze=False, export_folder=export_folder)
assert len(files) == 3
for file in files:
ext = Path(file).suffix
Expand All @@ -69,15 +69,15 @@ def test_01_export_w_elements_from_sweep(self, q2d_solved_sweep_app, local_scrat

def test_02_export_w_elements_from_nominal(self, q2d_solved_nominal_app, local_scratch):
export_folder = Path(local_scratch.path) / "export_folder"
files = q2d_solved_nominal_app.export_w_elements(False, export_folder)
files = q2d_solved_nominal_app.export_w_elements(analyze=False, export_folder=export_folder)
assert len(files) == 1
for file in files:
ext = Path(file).suffix
assert ext == ".sp"
assert Path(file).is_file()

def test_03_export_w_elements_to_working_directory(self, q2d_solved_nominal_app):
files = q2d_solved_nominal_app.export_w_elements(False)
files = q2d_solved_nominal_app.export_w_elements()
assert len(files) == 1
for file in files:
ext = Path(file).suffix
Expand Down