From c6a0f17b4e6f912076e83d826feb188331854ccf Mon Sep 17 00:00:00 2001 From: Giulia Malinverno Date: Fri, 23 Aug 2024 14:15:14 +0200 Subject: [PATCH] update and sort imports --- .../examples/antenna_toolkit_example.py | 9 +++-- doc/source/examples/create_antenna_simple.py | 6 +-- doc/source/getting_started/user_guide.rst | 2 +- doc/source/toolkit/models/bowtie.rst | 2 +- doc/source/toolkit/models/conical_spiral.rst | 2 +- doc/source/toolkit/models/helix.rst | 2 +- doc/source/toolkit/models/horn.rst | 2 +- doc/source/toolkit/models/index.rst | 2 +- doc/source/toolkit/models/patch.rst | 2 +- .../antenna/backend/antenna_models/bowtie.py | 16 ++++---- .../antenna/backend/antenna_models/common.py | 30 +++++++------- .../backend/antenna_models/conical_spiral.py | 10 ++--- .../antenna/backend/antenna_models/helix.py | 8 ++-- .../antenna/backend/antenna_models/horn.py | 40 +++++++++---------- .../antenna/backend/antenna_models/patch.py | 16 ++++---- .../aedt/toolkits/antenna/backend/api.py | 6 +-- src/ansys/aedt/toolkits/antenna/ui/actions.py | 6 +-- .../antenna_results/antenna_results_menu.py | 3 -- tests/backend/conftest.py | 3 +- .../test_antenna_models_api/conftest.py | 3 +- .../test_antenna_models_api/test_00_common.py | 2 +- .../test_antenna_models_api/test_01_patch.py | 5 +-- .../test_antenna_models_api/test_02_horn.py | 7 +--- .../test_antenna_models_api/test_03_helix.py | 6 +-- .../test_antenna_models_api/test_04_bowtie.py | 6 +-- .../test_05_conical_spiral.py | 3 +- tests/backend/tests_toolkit_api/conftest.py | 2 +- .../tests_toolkit_api/test_backend_toolkit.py | 10 +---- .../tests_toolkit_rest_api/conftest.py | 2 +- .../test_rest_api_toolkit.py | 10 +---- tests/conftest.py | 3 -- 31 files changed, 96 insertions(+), 130 deletions(-) diff --git a/doc/source/examples/antenna_toolkit_example.py b/doc/source/examples/antenna_toolkit_example.py index 6f9270cca..e87e521d2 100644 --- a/doc/source/examples/antenna_toolkit_example.py +++ b/doc/source/examples/antenna_toolkit_example.py @@ -6,10 +6,11 @@ # ## Perform required imports +import sys import tempfile -import pyaedt -from pyaedt.generic.farfield_visualization import FfdSolutionData +from ansys.aedt.core import generate_unique_project_name +from ansys.aedt.core.generic.farfield_visualization import FfdSolutionData from ansys.aedt.toolkits.antenna.backend.api import ToolkitBackend from ansys.aedt.toolkits.antenna.backend.models import properties @@ -29,7 +30,7 @@ # ## Create temporary directory temp_dir = tempfile.TemporaryDirectory(suffix="_ansys") -project_name = pyaedt.generate_unique_project_name(root_name=temp_dir.name, project_name="antenna_toolkit") +project_name = generate_unique_project_name(root_name=temp_dir.name, project_name="antenna_toolkit") # ## Set default properties @@ -202,7 +203,7 @@ # Plot exported files -from pyaedt.generic.plot import ModelPlotter +from ansys.aedt.core.generic.plot import ModelPlotter model = ModelPlotter() for file in files: diff --git a/doc/source/examples/create_antenna_simple.py b/doc/source/examples/create_antenna_simple.py index 59fbe747b..3e4c66eef 100644 --- a/doc/source/examples/create_antenna_simple.py +++ b/doc/source/examples/create_antenna_simple.py @@ -10,7 +10,7 @@ import tempfile -import pyaedt +import ansys.aedt.core from ansys.aedt.toolkits.antenna.backend.antenna_models.bowtie import BowTieRounded @@ -29,7 +29,7 @@ # ## Create temporary directory temp_dir = tempfile.TemporaryDirectory(suffix="_ansys") -project_name = pyaedt.generate_unique_project_name(root_name=temp_dir.name, project_name="bowtie_example") +project_name = ansys.aedt.core.generate_unique_project_name(root_name=temp_dir.name, project_name="bowtie_example") # ## Create antenna object only for synthesis # @@ -63,7 +63,7 @@ # # Create an empty HFSS design. -app = pyaedt.Hfss(project=project_name, version=aedt_version, non_graphical=non_graphical) +app = ansys.aedt.core.Hfss(project=project_name, version=aedt_version, non_graphical=non_graphical) # ## Create antenna in HFSS # diff --git a/doc/source/getting_started/user_guide.rst b/doc/source/getting_started/user_guide.rst index 08d7968cd..8a42d061e 100644 --- a/doc/source/getting_started/user_guide.rst +++ b/doc/source/getting_started/user_guide.rst @@ -144,7 +144,7 @@ and toolkit level. .. code:: python # Import required modules - from pyaedt import Hfss + from ansys.aedt.core import Hfss from ansys.aedt.toolkits.antenna.backend.antenna_models.bowtie import BowTie # Open AEDT and create an HFSS design diff --git a/doc/source/toolkit/models/bowtie.rst b/doc/source/toolkit/models/bowtie.rst index 30abe4f99..ed1a6c7e2 100644 --- a/doc/source/toolkit/models/bowtie.rst +++ b/doc/source/toolkit/models/bowtie.rst @@ -15,7 +15,7 @@ You must use these methods from PyAEDT as shown in this example: .. code:: python - from pyaedt import Hfss + from ansys.aedt.core import Hfss from ansys.aedt.toolkits.antenna.backend.antenna_models.bowtie import BowTieNormal diff --git a/doc/source/toolkit/models/conical_spiral.rst b/doc/source/toolkit/models/conical_spiral.rst index 1d152913d..cbcbbc17f 100644 --- a/doc/source/toolkit/models/conical_spiral.rst +++ b/doc/source/toolkit/models/conical_spiral.rst @@ -13,7 +13,7 @@ You must use these methods from PyAEDT as shown in this example: .. code:: python - from pyaedt import Hfss + from ansys.aedt.core import Hfss from ansys.aedt.toolkits.antenna.backend.antenna_models.conical_spiral import ( Archimedean, diff --git a/doc/source/toolkit/models/helix.rst b/doc/source/toolkit/models/helix.rst index 6a0523ab9..c3fc296f9 100644 --- a/doc/source/toolkit/models/helix.rst +++ b/doc/source/toolkit/models/helix.rst @@ -13,7 +13,7 @@ You must use these methods from PyAEDT as shown in this example: .. code:: python - from pyaedt import Hfss + from ansys.aedt.core import Hfss from ansys.aedt.toolkits.antenna.backend.antenna_models.helix import AxialMode diff --git a/doc/source/toolkit/models/horn.rst b/doc/source/toolkit/models/horn.rst index 1bde1db49..9155cb52d 100644 --- a/doc/source/toolkit/models/horn.rst +++ b/doc/source/toolkit/models/horn.rst @@ -20,7 +20,7 @@ You must use these methods from PyAEDT as shown in this example: .. code:: python - import pyaedt.Hfss + import ansys.aedt.core.Hfss from ansys.aedt.toolkits.antenna.backend.antenna_models.horn import Conical diff --git a/doc/source/toolkit/models/index.rst b/doc/source/toolkit/models/index.rst index efebec3cc..eb82f7efa 100644 --- a/doc/source/toolkit/models/index.rst +++ b/doc/source/toolkit/models/index.rst @@ -35,7 +35,7 @@ This code shows how to synthesize and create a model of an antenna in HFSS: .. code:: python # Import HFSS - from pyaedt import Hfss + from ansys.aedt.core import Hfss # Import backend from ansys.aedt.toolkits.antenna.backend.models.horn import Conical diff --git a/doc/source/toolkit/models/patch.rst b/doc/source/toolkit/models/patch.rst index d55b294c2..527f74fa9 100644 --- a/doc/source/toolkit/models/patch.rst +++ b/doc/source/toolkit/models/patch.rst @@ -15,7 +15,7 @@ You must use these methods from PyAEDT as shown in this example: .. code:: python - from pyaedt import Hfss + from ansys.aedt.core import Hfss from ansys.aedt.toolkits.antenna.backend.antenna_models.patch import ( RectangularPatchEdge, diff --git a/src/ansys/aedt/toolkits/antenna/backend/antenna_models/bowtie.py b/src/ansys/aedt/toolkits/antenna/backend/antenna_models/bowtie.py index 0786c943c..1af4369bc 100644 --- a/src/ansys/aedt/toolkits/antenna/backend/antenna_models/bowtie.py +++ b/src/ansys/aedt/toolkits/antenna/backend/antenna_models/bowtie.py @@ -23,8 +23,8 @@ from collections import OrderedDict import math -import pyaedt.generic.constants as constants -from pyaedt.generic.general_methods import pyaedt_function_handler +import ansys.aedt.core.generic.constants as constants +from ansys.aedt.core.generic.general_methods import pyaedt_function_handler from ansys.aedt.toolkits.antenna.backend.antenna_models.common import TransmissionLine from ansys.aedt.toolkits.antenna.backend.antenna_models.patch import CommonPatch @@ -67,8 +67,8 @@ class BowTieNormal(CommonPatch): Examples -------- >>> from ansys.aedt.toolkits.antenna.backend.antenna_models.bowtie import BowTieNormal - >>> import pyaedt - >>> app = pyaedt.Hfss() + >>> import ansys.aedt.core + >>> app = ansys.aedt.core.Hfss() >>> oantenna1 = BowTieNormal(app) >>> oantenna1.frequency = 12.0 >>> oantenna1.model_hfss() @@ -295,8 +295,8 @@ class BowTieRounded(CommonPatch): Examples -------- >>> from ansys.aedt.toolkits.antenna.backend.antenna_models.bowtie import BowTieRounded - >>> import pyaedt - >>> app = pyaedt.Hfss() + >>> import ansys.aedt.core + >>> app = ansys.aedt.core.Hfss() >>> oantenna1 = BowTieRounded(app) >>> oantenna1.frequency = 12.0 >>> oantenna1.model_hfss() @@ -536,8 +536,8 @@ class BowTieSlot(CommonPatch): Examples -------- >>> from ansys.aedt.toolkits.antenna.backend.antenna_models.bowtie import BowTieSlot - >>> import pyaedt - >>> app = pyaedt.Hfss() + >>> import ansys.aedt.core + >>> app = ansys.aedt.core.Hfss() >>> oantenna1 = BowTieSlot(app) >>> oantenna1.frequency = 12.0 >>> oantenna1.model_hfss() diff --git a/src/ansys/aedt/toolkits/antenna/backend/antenna_models/common.py b/src/ansys/aedt/toolkits/antenna/backend/antenna_models/common.py index d4249b451..b3323c930 100644 --- a/src/ansys/aedt/toolkits/antenna/backend/antenna_models/common.py +++ b/src/ansys/aedt/toolkits/antenna/backend/antenna_models/common.py @@ -24,9 +24,9 @@ import math import os -import pyaedt.generic.constants as constants -from pyaedt.generic.general_methods import generate_unique_name -from pyaedt.generic.general_methods import pyaedt_function_handler +import ansys.aedt.core.generic.constants as constants +from ansys.aedt.core.generic.general_methods import generate_unique_name +from ansys.aedt.core.generic.general_methods import pyaedt_function_handler from ansys.aedt.toolkits.antenna.backend.antenna_models.parameters import InputParameters from ansys.aedt.toolkits.antenna.backend.antenna_models.parameters import Property @@ -225,15 +225,15 @@ def create_lattice_pair(self, lattice_height=None, bottom_extend=False): Returns ------- - :class:`pyaedt.modeler.object3d.Object3d` + :class:`ansys.aedt.core.modeler.object3d.Object3d` 3D object. Examples -------- - >>> from pyaedt import Hfss - >>> from ansys.aedt.toolkits.antenna.horn import ConicalHorn + >>> from ansys.aedt.core import Hfss + >>> from ansys.aedt.toolkits.antenna.backend.antenna_models.horn import Conical >>> hfss = Hfss() - >>> horn = hfss.add_from_toolkit(ConicalHorn, draw=True) + >>> horn = hfss.add_from_toolkit(Conical, draw=True) >>> horn = horn.create_lattice_pair(lattice_height="20mm") """ if not lattice_height: @@ -299,7 +299,7 @@ def create_3dcomponent(self, component_file=None, component_name=None, replace=F Parameters ---------- component_file : str, optional - Full path to the A3DCOMP file. The default is the ``pyaedt`` folder. + Full path to the A3DCOMP file. The default is the ``ansys.aedt.core`` folder. component_name : str, optional Name of the component. The default is the antenna name. replace : bool, optional @@ -309,14 +309,14 @@ def create_3dcomponent(self, component_file=None, component_name=None, replace=F ------- str Path of the 3D component file or - :class:`pyaedt.modeler.components_3d.UserDefinedComponent`. + :class:`ansys.aedt.core.modeler.components_3d.UserDefinedComponent`. Examples -------- - >>> from pyaedt import Hfss - >>> from ansys.aedt.toolkits.antenna.horn import ConicalHorn + >>> from ansys.aedt.core import Hfss + >>> from ansys.aedt.toolkits.antenna.backend.antenna_models.horn import Conical >>> hfss = Hfss() - >>> horn = hfss.add_from_toolkit(ConicalHorn, draw=True) + >>> horn = hfss.add_from_toolkit(Conical, draw=True) >>> horn = horn.create_3dcomponent() """ if not component_file: @@ -378,10 +378,10 @@ def duplicate_along_line(self, vector, num_clones=2): Examples -------- - >>> from pyaedt import Hfss - >>> from ansys.aedt.toolkits.antenna.horn import ConicalHorn + >>> from ansys.aedt.core import Hfss + >>> from ansys.aedt.toolkits.antenna.backend.antenna_models.horn import Conical >>> hfss = Hfss() - >>> horn = hfss.add_from_toolkit(ConicalHorn, draw=True) + >>> horn = hfss.add_from_toolkit(Conical, draw=True) >>> new_horn = horn.duplicate_along_line([10, 0, 0], 2) """ new_objects = {} diff --git a/src/ansys/aedt/toolkits/antenna/backend/antenna_models/conical_spiral.py b/src/ansys/aedt/toolkits/antenna/backend/antenna_models/conical_spiral.py index 54f3cb0fb..8686b9ba5 100644 --- a/src/ansys/aedt/toolkits/antenna/backend/antenna_models/conical_spiral.py +++ b/src/ansys/aedt/toolkits/antenna/backend/antenna_models/conical_spiral.py @@ -23,9 +23,9 @@ from collections import OrderedDict import math +import ansys.aedt.core.generic.constants as constants +from ansys.aedt.core.generic.general_methods import pyaedt_function_handler from ansys.aedt.toolkits.common.backend.logger_handler import logger -import pyaedt.generic.constants as constants -from pyaedt.generic.general_methods import pyaedt_function_handler from ansys.aedt.toolkits.antenna.backend.antenna_models.common import CommonAntenna @@ -157,7 +157,7 @@ class Archimedean(CommonConicalSpiral): Examples -------- - >>> from pyaedt import Hfss + >>> from ansys.aedt.core import Hfss >>> from ansys.aedt.toolkits.antenna.backend.antenna_models.conical_spiral import Archimedean >>> hfss = Hfss() >>> antenna = Archimedean(hfss, start_frequency=20.0, @@ -366,7 +366,7 @@ class Log(CommonConicalSpiral): Examples -------- - >>> from pyaedt import Hfss + >>> from ansys.aedt.core import Hfss >>> from ansys.aedt.toolkits.antenna.backend.antenna_models.conical_spiral import Log >>> hfss = Hfss() >>> antenna = Log(hfss, start_frequency=20.0, @@ -563,7 +563,7 @@ class Sinuous(CommonConicalSpiral): Examples -------- - >>> from pyaedt import Hfss + >>> from ansys.aedt.core import Hfss >>> from ansys.aedt.toolkits.antenna.backend.antenna_models.conical_spiral import Sinuous >>> hfss = Hfss() >>> antenna = Archimedean(hfss, start_frequency=20.0, diff --git a/src/ansys/aedt/toolkits/antenna/backend/antenna_models/helix.py b/src/ansys/aedt/toolkits/antenna/backend/antenna_models/helix.py index 0b2bf825d..e76532765 100644 --- a/src/ansys/aedt/toolkits/antenna/backend/antenna_models/helix.py +++ b/src/ansys/aedt/toolkits/antenna/backend/antenna_models/helix.py @@ -23,9 +23,9 @@ from collections import OrderedDict import math +import ansys.aedt.core.generic.constants as constants +from ansys.aedt.core.generic.general_methods import pyaedt_function_handler from ansys.aedt.toolkits.common.backend.logger_handler import logger -import pyaedt.generic.constants as constants -from pyaedt.generic.general_methods import pyaedt_function_handler from ansys.aedt.toolkits.antenna.backend.antenna_models.common import CommonAntenna @@ -164,8 +164,8 @@ class AxialMode(CommonHelix): Examples -------- >>> from ansys.aedt.toolkits.antenna.backend.antenna_models.helix import AxialMode - >>> import pyaedt - >>> app = pyaedt.Hfss() + >>> import ansys.aedt.core + >>> app = ansys.aedt.core.Hfss() >>> oantenna1 = AxialMode(app) >>> oantenna1.frequency = 12.0 >>> oantenna1.model_hfss() diff --git a/src/ansys/aedt/toolkits/antenna/backend/antenna_models/horn.py b/src/ansys/aedt/toolkits/antenna/backend/antenna_models/horn.py index c1cf8d60d..20de4b14b 100644 --- a/src/ansys/aedt/toolkits/antenna/backend/antenna_models/horn.py +++ b/src/ansys/aedt/toolkits/antenna/backend/antenna_models/horn.py @@ -22,9 +22,9 @@ from collections import OrderedDict +import ansys.aedt.core.generic.constants as constants +from ansys.aedt.core.generic.general_methods import pyaedt_function_handler from ansys.aedt.toolkits.common.backend.logger_handler import logger -import pyaedt.generic.constants as constants -from pyaedt.generic.general_methods import pyaedt_function_handler from ansys.aedt.toolkits.antenna.backend.antenna_models.common import CommonAntenna from ansys.aedt.toolkits.antenna.backend.antenna_models.common import StandardWaveguide @@ -122,10 +122,10 @@ class Conical(CommonHorn): Examples -------- >>> from ansys.aedt.toolkits.antenna.backend.antenna_models.horn import Conical - >>> import pyaedt + >>> import ansys.aedt.core >>> oantenna1 = Conical(None) >>> oantenna1.frequency = 12.0 - >>> app = pyaedt.Hfss() + >>> app = ansys.aedt.core.Hfss() >>> oantenna1 = Conical(app) >>> oantenna1.model_hfss() >>> oantenna1.setup_hfss() @@ -407,8 +407,8 @@ class PyramidalRidged(CommonHorn): Examples -------- >>> from ansys.aedt.toolkits.antenna.backend.antenna_models.horn import PyramidalRidged - >>> import pyaedt - >>> app = pyaedt.Hfss() + >>> import ansys.aedt.core + >>> app = ansys.aedt.core.Hfss() >>> oantenna1 = PyramidalRidged(app) >>> oantenna1.frequency = 12.0 >>> oantenna1.model_hfss() @@ -1095,8 +1095,8 @@ class Corrugated(CommonHorn): Examples -------- >>> from ansys.aedt.toolkits.antenna.backend.antenna_models.horn import Corrugated - >>> import pyaedt - >>> app = pyaedt.Hfss() + >>> import ansys.aedt.core + >>> app = ansys.aedt.core.Hfss() >>> oantenna1 = Corrugated(app) >>> oantenna1.frequency = 12.0 >>> oantenna1.model_hfss() @@ -1373,8 +1373,8 @@ class Elliptical(CommonHorn): Examples -------- >>> from ansys.aedt.toolkits.antenna.backend.antenna_models.horn import PyramidalRidged - >>> import pyaedt - >>> app = pyaedt.Hfss() + >>> import ansys.aedt.core + >>> app = ansys.aedt.core.Hfss() >>> oantenna1 = Elliptical(app) >>> oantenna1.frequency = 12.0 >>> oantenna1.model_hfss() @@ -1660,8 +1660,8 @@ class EPlane(CommonHorn): Examples -------- >>> from ansys.aedt.toolkits.antenna.backend.antenna_models.horn import EPlane - >>> import pyaedt - >>> app = pyaedt.Hfss() + >>> import ansys.aedt.core + >>> app = ansys.aedt.core.Hfss() >>> oantenna1 = EPlane(app) >>> oantenna1.frequency = 12.0 >>> oantenna1.model_hfss() @@ -2036,8 +2036,8 @@ class HPlane(CommonHorn): Examples -------- >>> from ansys.aedt.toolkits.antenna.backend.antenna_models.horn import HPlane - >>> import pyaedt - >>> app = pyaedt.Hfss() + >>> import ansys.aedt.core + >>> app = ansys.aedt.core.Hfss() >>> oantenna1 = HPlane(app) >>> oantenna1.frequency = 12.0 >>> oantenna1.model_hfss() @@ -2398,8 +2398,8 @@ class Pyramidal(CommonHorn): Examples -------- >>> from ansys.aedt.toolkits.antenna.backend.antenna_models.horn import Pyramidal - >>> import pyaedt - >>> app = pyaedt.Hfss() + >>> import ansys.aedt.core + >>> app = ansys.aedt.core.Hfss() >>> oantenna1 = Pyramidal(app) >>> oantenna1.frequency = 12.0 >>> oantenna1.model_hfss() @@ -2768,8 +2768,8 @@ class QuadRidged(CommonHorn): Examples -------- >>> from ansys.aedt.toolkits.antenna.backend.antenna_models.horn import QuadRidged - >>> import pyaedt - >>> app = pyaedt.Hfss() + >>> import ansys.aedt.core + >>> app = ansys.aedt.core.Hfss() >>> oantenna1 = QuadRidged(app) >>> oantenna1.frequency = 12.0 >>> oantenna1.model_hfss() @@ -3341,10 +3341,10 @@ class Conical_Special(CommonHorn): Examples -------- >>> from ansys.aedt.toolkits.antenna.backend.antenna_models.horn import Conical - >>> import pyaedt + >>> import ansys.aedt.core >>> oantenna1 = Conical() >>> oantenna1.frequency = 12.0 - >>> app = pyaedt.Hfss() + >>> app = ansys.aedt.core.Hfss() >>> oantenna1 = Conical(app) >>> oantenna1.model_hfss() >>> oantenna1.setup_hfss() diff --git a/src/ansys/aedt/toolkits/antenna/backend/antenna_models/patch.py b/src/ansys/aedt/toolkits/antenna/backend/antenna_models/patch.py index cbfcd180b..63586614c 100644 --- a/src/ansys/aedt/toolkits/antenna/backend/antenna_models/patch.py +++ b/src/ansys/aedt/toolkits/antenna/backend/antenna_models/patch.py @@ -23,9 +23,9 @@ from collections import OrderedDict import math +import ansys.aedt.core.generic.constants as constants +from ansys.aedt.core.generic.general_methods import pyaedt_function_handler from ansys.aedt.toolkits.common.backend.logger_handler import logger -import pyaedt.generic.constants as constants -from pyaedt.generic.general_methods import pyaedt_function_handler from ansys.aedt.toolkits.antenna.backend.antenna_models.common import CommonAntenna from ansys.aedt.toolkits.antenna.backend.antenna_models.common import TransmissionLine @@ -149,8 +149,8 @@ class RectangularPatchProbe(CommonPatch): Examples -------- >>> from ansys.aedt.toolkits.antenna.backend.antenna_models.patch import RectangularPatchProbe - >>> import pyaedt - >>> app = pyaedt.Hfss() + >>> import ansys.aedt.core + >>> app = ansys.aedt.core.Hfss() >>> oantenna1 = RectangularPatchProbe(app) >>> oantenna1.frequency = 12.0 >>> oantenna1.model_hfss() @@ -487,8 +487,8 @@ class RectangularPatchInset(CommonPatch): Examples -------- >>> from ansys.aedt.toolkits.antenna.backend.antenna_models.patch import RectangularPatchInset - >>> import pyaedt - >>> app = pyaedt.Hfss() + >>> import ansys.aedt.core + >>> app = ansys.aedt.core.Hfss() >>> oantenna1 = RectangularPatchInset(app) >>> oantenna1.frequency = 12.0 >>> oantenna1.model_hfss() @@ -801,8 +801,8 @@ class RectangularPatchEdge(CommonPatch): Examples -------- >>> from ansys.aedt.toolkits.antenna.backend.antenna_models.patch import RectangularPatchEdge - >>> import pyaedt - >>> app = pyaedt.Hfss() + >>> import ansys.aedt.core + >>> app = ansys.aedt.core.Hfss() >>> oantenna1 = RectangularPatchEdge(app) >>> oantenna1.frequency = 12.0 >>> oantenna1.model_hfss() diff --git a/src/ansys/aedt/toolkits/antenna/backend/api.py b/src/ansys/aedt/toolkits/antenna/backend/api.py index 4b8a8f455..749be529f 100644 --- a/src/ansys/aedt/toolkits/antenna/backend/api.py +++ b/src/ansys/aedt/toolkits/antenna/backend/api.py @@ -30,10 +30,10 @@ # isort: on +from ansys.aedt.core import generate_unique_name +from ansys.aedt.core.generic.touchstone_parser import find_touchstone_files from ansys.aedt.toolkits.common.backend.api import AEDTCommon from ansys.aedt.toolkits.common.backend.logger_handler import logger -import pyaedt -from pyaedt.generic.touchstone_parser import find_touchstone_files from ansys.aedt.toolkits.antenna.backend import antenna_models @@ -150,7 +150,7 @@ def get_antenna(self, antenna, synth_only=False): if not synth_only and not self.properties.antenna.is_created: if not self.oantenna.object_list: if not self.oantenna.name: - self.oantenna.name = pyaedt.generate_unique_name(self.antenna_type) + self.oantenna.name = generate_unique_name(self.antenna_type) self.set_properties({"name": self.oantenna.name}) self.oantenna.init_model() self.oantenna.model_hfss() diff --git a/src/ansys/aedt/toolkits/antenna/ui/actions.py b/src/ansys/aedt/toolkits/antenna/ui/actions.py index b41b3e307..f936f1815 100644 --- a/src/ansys/aedt/toolkits/antenna/ui/actions.py +++ b/src/ansys/aedt/toolkits/antenna/ui/actions.py @@ -28,8 +28,8 @@ from PySide6.QtWidgets import QComboBox from PySide6.QtWidgets import QLabel from PySide6.QtWidgets import QLineEdit -from pyaedt.generic.farfield_visualization import FfdSolutionData -from pyaedt.generic.general_methods import read_json +from ansys.aedt.core.generic.farfield_visualization import FfdSolutionData +from ansys.aedt.core.generic.general_methods import read_json # isort: off @@ -39,7 +39,7 @@ # isort: on -from pyaedt.generic.general_methods import generate_unique_project_name +from ansys.aedt.core.generic.general_methods import generate_unique_project_name import requests number_pattern = re.compile(r"^[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?$") diff --git a/src/ansys/aedt/toolkits/antenna/ui/windows/antenna_results/antenna_results_menu.py b/src/ansys/aedt/toolkits/antenna/ui/windows/antenna_results/antenna_results_menu.py index 4119f0a6f..219a9c1c9 100644 --- a/src/ansys/aedt/toolkits/antenna/ui/windows/antenna_results/antenna_results_menu.py +++ b/src/ansys/aedt/toolkits/antenna/ui/windows/antenna_results/antenna_results_menu.py @@ -50,9 +50,6 @@ from windows.antenna_results.antenna_results_column import Ui_LeftColumn import os -import sys - -from pyaedt.generic.farfield_visualization import FfdSolutionData class GetResultsThread(QThread): diff --git a/tests/backend/conftest.py b/tests/backend/conftest.py index d930f29a8..866b2f98c 100644 --- a/tests/backend/conftest.py +++ b/tests/backend/conftest.py @@ -41,11 +41,10 @@ import logging from logging import Logger import os -import pathlib import shutil from typing import Optional -from pyaedt import settings +from ansys.aedt.core import settings import pytest DEFAULT_CONFIG = { diff --git a/tests/backend/test_antenna_models_api/conftest.py b/tests/backend/test_antenna_models_api/conftest.py index d8438432a..48705da36 100644 --- a/tests/backend/test_antenna_models_api/conftest.py +++ b/tests/backend/test_antenna_models_api/conftest.py @@ -40,10 +40,9 @@ You can enable the API log file in the backend_properties.json. """ -import os.path import pytest -from pyaedt import generate_unique_project_name +from ansys.aedt.core import generate_unique_project_name from ansys.aedt.toolkits.common.backend.api import AEDTCommon from ansys.aedt.toolkits.common.backend.models import Properties from tests.backend.conftest import read_local_config, setup_aedt_settings, DEFAULT_CONFIG, PROJECT_NAME diff --git a/tests/backend/test_antenna_models_api/test_00_common.py b/tests/backend/test_antenna_models_api/test_00_common.py index 00d13ee2f..514246e21 100644 --- a/tests/backend/test_antenna_models_api/test_00_common.py +++ b/tests/backend/test_antenna_models_api/test_00_common.py @@ -20,7 +20,6 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -import os import pytest from tests.backend.conftest import PROJECT_NAME @@ -38,6 +37,7 @@ class TestClass: """Class defining a workflow to test antenna models common.""" + def test_01_microstrip_calculator(self): w1 = tl_calc.microstrip_calculator(substrate_height=0.15, permittivity=4.4) assert w1[0] - 30.8173 < 1e-6 diff --git a/tests/backend/test_antenna_models_api/test_01_patch.py b/tests/backend/test_antenna_models_api/test_01_patch.py index 0533cdde8..70b89dcf5 100644 --- a/tests/backend/test_antenna_models_api/test_01_patch.py +++ b/tests/backend/test_antenna_models_api/test_01_patch.py @@ -20,15 +20,14 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -import os import pytest from tests.backend.conftest import PROJECT_NAME pytestmark = [pytest.mark.antenna_models_api] -from pyaedt.modeler.cad.object3d import Object3d -from pyaedt.modeler.geometry_operators import GeometryOperators +from ansys.aedt.core.modeler.cad.object_3d import Object3d +from ansys.aedt.core.modeler.geometry_operators import GeometryOperators from ansys.aedt.toolkits.antenna.backend import antenna_models diff --git a/tests/backend/test_antenna_models_api/test_02_horn.py b/tests/backend/test_antenna_models_api/test_02_horn.py index 3ba8ed21c..87cb9639a 100644 --- a/tests/backend/test_antenna_models_api/test_02_horn.py +++ b/tests/backend/test_antenna_models_api/test_02_horn.py @@ -20,15 +20,12 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -import os import pytest -from tests.backend.conftest import PROJECT_NAME - pytestmark = [pytest.mark.antenna_models_api] -from pyaedt.modeler.cad.object3d import Object3d -from pyaedt.modeler.geometry_operators import GeometryOperators +from ansys.aedt.core.modeler.cad.object_3d import Object3d +from ansys.aedt.core.modeler.geometry_operators import GeometryOperators from ansys.aedt.toolkits.antenna.backend import antenna_models diff --git a/tests/backend/test_antenna_models_api/test_03_helix.py b/tests/backend/test_antenna_models_api/test_03_helix.py index ee3942719..7a086c89e 100644 --- a/tests/backend/test_antenna_models_api/test_03_helix.py +++ b/tests/backend/test_antenna_models_api/test_03_helix.py @@ -20,15 +20,11 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -import os import pytest -from tests.backend.conftest import PROJECT_NAME - pytestmark = [pytest.mark.antenna_models_api] -from pyaedt.modeler.cad.object3d import Object3d -from pyaedt.modeler.geometry_operators import GeometryOperators +from ansys.aedt.core.modeler.cad.object_3d import Object3d from ansys.aedt.toolkits.antenna.backend import antenna_models diff --git a/tests/backend/test_antenna_models_api/test_04_bowtie.py b/tests/backend/test_antenna_models_api/test_04_bowtie.py index d626acae9..b22b082cc 100644 --- a/tests/backend/test_antenna_models_api/test_04_bowtie.py +++ b/tests/backend/test_antenna_models_api/test_04_bowtie.py @@ -20,15 +20,11 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -import os import pytest -from tests.backend.conftest import PROJECT_NAME - pytestmark = [pytest.mark.antenna_models_api] -from pyaedt.modeler.cad.object3d import Object3d -from pyaedt.modeler.geometry_operators import GeometryOperators +from ansys.aedt.core.modeler.cad.object_3d import Object3d from ansys.aedt.toolkits.antenna.backend import antenna_models diff --git a/tests/backend/test_antenna_models_api/test_05_conical_spiral.py b/tests/backend/test_antenna_models_api/test_05_conical_spiral.py index 13ea04348..b3b0ce552 100644 --- a/tests/backend/test_antenna_models_api/test_05_conical_spiral.py +++ b/tests/backend/test_antenna_models_api/test_05_conical_spiral.py @@ -27,8 +27,7 @@ pytestmark = [pytest.mark.antenna_models_api] -from pyaedt.modeler.cad.object3d import Object3d -from pyaedt.modeler.geometry_operators import GeometryOperators +from ansys.aedt.core.modeler.cad.object_3d import Object3d from ansys.aedt.toolkits.antenna.backend import antenna_models diff --git a/tests/backend/tests_toolkit_api/conftest.py b/tests/backend/tests_toolkit_api/conftest.py index e2615804b..82f66a134 100644 --- a/tests/backend/tests_toolkit_api/conftest.py +++ b/tests/backend/tests_toolkit_api/conftest.py @@ -43,7 +43,7 @@ import os.path import pytest -from pyaedt import generate_unique_project_name +from ansys.aedt.core import generate_unique_project_name from ansys.aedt.toolkits.antenna.backend.api import ToolkitBackend from ansys.aedt.toolkits.antenna.backend.models import properties from tests.backend.conftest import read_local_config, setup_aedt_settings, DEFAULT_CONFIG, PROJECT_NAME diff --git a/tests/backend/tests_toolkit_api/test_backend_toolkit.py b/tests/backend/tests_toolkit_api/test_backend_toolkit.py index b6ef4584a..dd8373a36 100644 --- a/tests/backend/tests_toolkit_api/test_backend_toolkit.py +++ b/tests/backend/tests_toolkit_api/test_backend_toolkit.py @@ -20,19 +20,11 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -import os import pytest -from pyaedt import is_linux - -from tests.backend.conftest import PROJECT_NAME +from ansys.aedt.core import is_linux pytestmark = [pytest.mark.antenna_toolkit_api] -from pyaedt.modeler.cad.object3d import Object3d -from pyaedt.modeler.geometry_operators import GeometryOperators - -from ansys.aedt.toolkits.antenna.backend import antenna_models - class TestClass: """Class defining a workflow to test antenna toolkit.""" diff --git a/tests/backend/tests_toolkit_rest_api/conftest.py b/tests/backend/tests_toolkit_rest_api/conftest.py index 9205c3140..32f0723cb 100644 --- a/tests/backend/tests_toolkit_rest_api/conftest.py +++ b/tests/backend/tests_toolkit_rest_api/conftest.py @@ -45,7 +45,7 @@ import pytest import sys -from pyaedt import generate_unique_project_name +from ansys.aedt.core import generate_unique_project_name from tests.backend.conftest import read_local_config, setup_aedt_settings, DEFAULT_CONFIG, PROJECT_NAME diff --git a/tests/backend/tests_toolkit_rest_api/test_rest_api_toolkit.py b/tests/backend/tests_toolkit_rest_api/test_rest_api_toolkit.py index 48f648c5c..7138f4bcf 100644 --- a/tests/backend/tests_toolkit_rest_api/test_rest_api_toolkit.py +++ b/tests/backend/tests_toolkit_rest_api/test_rest_api_toolkit.py @@ -20,23 +20,17 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -import os import pytest import json -from tests.backend.conftest import PROJECT_NAME - pytestmark = [pytest.mark.antenna_toolkit_rest_api] -from pyaedt import is_linux -from pyaedt.modeler.cad.object3d import Object3d -from pyaedt.modeler.geometry_operators import GeometryOperators - -from ansys.aedt.toolkits.antenna.backend import antenna_models +from ansys.aedt.core import is_linux class TestClass: """Class defining a workflow to test rest api toolkit.""" + def test_01_get_antenna(self, client): new_properties = { "model": "RectangularPatchProbe", diff --git a/tests/conftest.py b/tests/conftest.py index 260303d23..009e21aea 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -23,9 +23,6 @@ """ Common conftest """ -import os -from pathlib import Path -import shutil import pytest