Skip to content

📡 RF modular restructure v1 #2567

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

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from
Open
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,946 changes: 1,147 additions & 799 deletions poetry.lock

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,16 @@ dev = [
'cma',
'diff-cover'
]
tests-only = [
'pytest',
'pytest-timeout',
'pytest-xdist',
'pytest-env',
'pytest-cov',
'psutil',
'ruff',
'diff-cover'
]
docs = [
"jupyter",
"jinja2",
Expand Down
2 changes: 1 addition & 1 deletion tests/test_components/test_lumped_element.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import pytest

import tidy3d as td
from tidy3d.components.lumped_element import NetworkConversions
from tidy3d.em.microwave.lumped_element import NetworkConversions


def test_lumped_resistor():
Expand Down
6 changes: 3 additions & 3 deletions tests/test_components/test_microwave.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
import xarray as xr

from tidy3d.components.data.monitor_data import FreqDataArray
from tidy3d.components.microwave.data.monitor_data import AntennaMetricsData
from tidy3d.components.microwave.formulas.circuit_parameters import (
from tidy3d.constants import EPSILON_0
from tidy3d.em.microwave.data.monitor_data import AntennaMetricsData
from tidy3d.em.microwave.formulas.circuit_parameters import (
capacitance_colinear_cylindrical_wire_segments,
capacitance_rectangular_sheets,
inductance_straight_rectangular_wire,
mutual_inductance_colinear_wire_segments,
total_inductance_colinear_rectangular_wire_segments,
)
from tidy3d.constants import EPSILON_0

from ..test_data.test_monitor_data import make_directivity_data

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import tidy3d as td
from tidy3d.components.data.data_array import FreqDataArray
from tidy3d.em.microwave.ports.base_lumped import AbstractLumpedPort
from tidy3d.exceptions import SetupError, Tidy3dError, Tidy3dKeyError
from tidy3d.plugins.microwave import (
CurrentIntegralAxisAligned,
Expand All @@ -23,7 +24,6 @@
TerminalPortDataArray,
WavePort,
)
from tidy3d.plugins.smatrix.ports.base_lumped import AbstractLumpedPort

from ...utils import run_emulated
from .terminal_component_modeler_def import make_coaxial_component_modeler, make_component_modeler
Expand Down
25 changes: 11 additions & 14 deletions tidy3d/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@
SolidMedium,
SolidSpec,
)
from tidy3d.components.microwave.data.monitor_data import (
AntennaMetricsData,
)
from tidy3d.components.spice.analysis.dc import (
ChargeToleranceSpec,
IsothermalSteadyChargeDCAnalysis,
Expand Down Expand Up @@ -79,6 +76,17 @@
VoltageBC,
)

# lumped elements
from tidy3d.em.microwave.lumped_element import (
AdmittanceNetwork,
CoaxialLumpedResistor,
LinearLumpedElement,
LumpedElement,
LumpedResistor,
RectangularLumpedElement,
RLCNetwork,
)

from .components.apodization import ApodizationSpec

# boundary placement for other solvers
Expand Down Expand Up @@ -225,17 +233,6 @@
UniformGrid,
)

# lumped elements
from .components.lumped_element import (
AdmittanceNetwork,
CoaxialLumpedResistor,
LinearLumpedElement,
LumpedElement,
LumpedResistor,
RectangularLumpedElement,
RLCNetwork,
)

# medium
# for docs
from .components.medium import (
Expand Down
2 changes: 1 addition & 1 deletion tidy3d/components/grid/grid_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

from tidy3d.components.base import Tidy3dBaseModel, cached_property, skip_if_fields_missing
from tidy3d.components.geometry.base import Box, ClipOperation
from tidy3d.components.lumped_element import LumpedElementType
from tidy3d.components.source.utils import SourceType
from tidy3d.components.structure import MeshOverrideStructure, Structure, StructureType
from tidy3d.components.types import (
Expand All @@ -25,6 +24,7 @@
annotate_type,
)
from tidy3d.constants import C_0, MICROMETER, dp_eps, inf
from tidy3d.em.microwave.lumped_element import LumpedElementType
from tidy3d.exceptions import SetupError
from tidy3d.log import log

Expand Down
2 changes: 1 addition & 1 deletion tidy3d/components/simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import xarray as xr

from tidy3d.constants import C_0, SECOND, fp_eps, inf
from tidy3d.em.microwave.lumped_element import LumpedElementType
from tidy3d.exceptions import SetupError, Tidy3dError, Tidy3dImportError, ValidationError
from tidy3d.log import log
from tidy3d.packaging import supports_local_subpixel, tidy3d_extras
Expand Down Expand Up @@ -53,7 +54,6 @@
from .geometry.utils_2d import get_bounds, get_thickened_geom, snap_coordinate_to_grid, subdivide
from .grid.grid import Coords, Coords1D, Grid
from .grid.grid_spec import AutoGrid, GridSpec, UniformGrid
from .lumped_element import LumpedElementType
from .medium import (
AbstractCustomMedium,
AbstractMedium,
Expand Down
1 change: 1 addition & 0 deletions tidy3d/em/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# All Electromagnetic-Related API Here
42 changes: 42 additions & 0 deletions tidy3d/em/microwave/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
"""Imports from microwave plugin."""

from __future__ import annotations

from tidy3d.em.microwave import models
from tidy3d.em.microwave.array_factor import (
RectangularAntennaArrayCalculator,
)
from tidy3d.em.microwave.auto_path_integrals import path_integrals_from_lumped_element
from tidy3d.em.microwave.custom_path_integrals import (
CustomCurrentIntegral2D,
CustomPathIntegral2D,
CustomVoltageIntegral2D,
)
from tidy3d.em.microwave.impedance_calculator import (
CurrentIntegralTypes,
ImpedanceCalculator,
VoltageIntegralTypes,
)
from tidy3d.em.microwave.lobe_measurer import LobeMeasurer
from tidy3d.em.microwave.path_integrals import (
AxisAlignedPathIntegral,
CurrentIntegralAxisAligned,
VoltageIntegralAxisAligned,
)

__all__ = [
"AxisAlignedPathIntegral",
"CurrentIntegralAxisAligned",
"CurrentIntegralTypes",
"CustomCurrentIntegral2D",
"CustomPathIntegral2D",
"CustomVoltageIntegral2D",
"ImpedanceCalculator",
"LobeMeasurer",
"RectangularAntennaArrayCalculator",
"VoltageIntegralAxisAligned",
"VoltageIntegralTypes",
"models",
"path_integrals_from_lumped_element",
"rf_material_library",
]
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@
from tidy3d.components.data.sim_data import SimulationData
from tidy3d.components.geometry.base import Box, Geometry
from tidy3d.components.grid.grid_spec import GridSpec, LayerRefinementSpec
from tidy3d.components.lumped_element import LumpedElement
from tidy3d.components.medium import Medium, MediumType3D
from tidy3d.components.monitor import AbstractFieldProjectionMonitor, MonitorType
from tidy3d.components.simulation import Simulation
from tidy3d.components.source.utils import SourceType
from tidy3d.components.structure import MeshOverrideStructure, Structure
from tidy3d.components.types import ArrayLike, Axis, Bound, Undefined
from tidy3d.constants import C_0, inf
from tidy3d.em.microwave.lumped_element import LumpedElement
from tidy3d.log import log


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
snap_box_to_grid,
)
from tidy3d.components.grid.grid import Grid
from tidy3d.components.lumped_element import LinearLumpedElement
from tidy3d.components.types import Direction
from tidy3d.em.microwave.lumped_element import LinearLumpedElement

from .path_integrals import (
CurrentIntegralAxisAligned,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@
from tidy3d.components.types import FreqArray
from tidy3d.config import config
from tidy3d.constants import HERTZ
from tidy3d.em.microwave.ports.coaxial_lumped import CoaxialLumpedPort
from tidy3d.em.microwave.ports.modal import Port
from tidy3d.em.microwave.ports.rectangular_lumped import LumpedPort
from tidy3d.em.microwave.ports.wave import WavePort
from tidy3d.exceptions import SetupError, Tidy3dKeyError
from tidy3d.log import log
from tidy3d.plugins.smatrix.ports.coaxial_lumped import CoaxialLumpedPort
from tidy3d.plugins.smatrix.ports.modal import Port
from tidy3d.plugins.smatrix.ports.rectangular_lumped import LumpedPort
from tidy3d.plugins.smatrix.ports.wave import WavePort
from tidy3d.web.api.container import Batch, BatchData

# fwidth of gaussian pulse in units of central frequency
FWIDTH_FRAC = 1.0 / 10
DEFAULT_DATA_DIR = "."
DEFAULT_DATA_DIR = ""

LumpedPortType = Union[LumpedPort, CoaxialLumpedPort]
TerminalPortType = Union[LumpedPortType, WavePort]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
from tidy3d.components.source.time import GaussianPulse
from tidy3d.components.types import Ax, Complex
from tidy3d.components.viz import add_ax_if_none, equal_aspect
from tidy3d.em.microwave.ports.modal import ModalPortDataArray, Port
from tidy3d.exceptions import SetupError
from tidy3d.plugins.smatrix.ports.modal import ModalPortDataArray, Port
from tidy3d.web.api.container import BatchData

from .base import FWIDTH_FRAC, AbstractComponentModeler
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,20 @@
from tidy3d.components.data.monitor_data import MonitorData
from tidy3d.components.data.sim_data import SimulationData
from tidy3d.components.geometry.utils_2d import snap_coordinate_to_grid
from tidy3d.components.microwave.data.monitor_data import AntennaMetricsData
from tidy3d.components.monitor import DirectivityMonitor
from tidy3d.components.simulation import Simulation
from tidy3d.components.source.time import GaussianPulse
from tidy3d.components.types import Ax
from tidy3d.components.viz import add_ax_if_none, equal_aspect
from tidy3d.constants import C_0, OHM
from tidy3d.em.microwave.data.monitor_data import AntennaMetricsData
from tidy3d.em.microwave.data.terminal import PortDataArray, TerminalPortDataArray
from tidy3d.em.microwave.ports.base_lumped import AbstractLumpedPort
from tidy3d.em.microwave.ports.coaxial_lumped import CoaxialLumpedPort
from tidy3d.em.microwave.ports.rectangular_lumped import LumpedPort
from tidy3d.em.microwave.ports.wave import WavePort
from tidy3d.exceptions import SetupError, Tidy3dError, Tidy3dKeyError, ValidationError
from tidy3d.log import log
from tidy3d.plugins.smatrix.data.terminal import PortDataArray, TerminalPortDataArray
from tidy3d.plugins.smatrix.ports.base_lumped import AbstractLumpedPort
from tidy3d.plugins.smatrix.ports.coaxial_lumped import CoaxialLumpedPort
from tidy3d.plugins.smatrix.ports.rectangular_lumped import LumpedPort
from tidy3d.plugins.smatrix.ports.wave import WavePort
from tidy3d.web.api.container import BatchData

from .base import AbstractComponentModeler, TerminalPortType
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,33 +9,22 @@
import numpy as np
import pydantic.v1 as pd

from tidy3d.components.grid.grid import Grid
from tidy3d.components.medium import PEC2D, Debye, Drude, Lorentz, Medium, Medium2D, PoleResidue
from tidy3d.components.monitor import FieldMonitor
from tidy3d.components.structure import MeshOverrideStructure, Structure
from tidy3d.components.validators import assert_line_or_plane, assert_plane, validate_name_str
from tidy3d.constants import EPSILON_0, FARAD, HENRY, MICROMETER, OHM, fp_eps
from tidy3d.exceptions import ValidationError
from tidy3d.log import log

from .base import Tidy3dBaseModel, cached_property, skip_if_fields_missing
from .geometry.base import Box, ClipOperation, Geometry, GeometryGroup
from .geometry.primitives import Cylinder
from .geometry.utils import (
from tidy3d.components.base import Tidy3dBaseModel, cached_property, skip_if_fields_missing
from tidy3d.components.geometry.base import Box, ClipOperation, Geometry, GeometryGroup
from tidy3d.components.geometry.primitives import Cylinder
from tidy3d.components.geometry.utils import (
SnapBehavior,
SnapLocation,
SnappingSpec,
snap_box_to_grid,
snap_point_to_grid,
)
from .geometry.utils_2d import increment_float
from .microwave.formulas.circuit_parameters import (
capacitance_colinear_cylindrical_wire_segments,
capacitance_rectangular_sheets,
inductance_straight_rectangular_wire,
total_inductance_colinear_rectangular_wire_segments,
)
from .types import (
from tidy3d.components.geometry.utils_2d import increment_float
from tidy3d.components.grid.grid import Grid
from tidy3d.components.medium import PEC2D, Debye, Drude, Lorentz, Medium, Medium2D, PoleResidue
from tidy3d.components.monitor import FieldMonitor
from tidy3d.components.structure import MeshOverrideStructure, Structure
from tidy3d.components.types import (
TYPE_TAG_STR,
Axis,
Axis2D,
Expand All @@ -44,7 +33,17 @@
FreqArray,
LumpDistType,
)
from .viz import PlotParams, plot_params_lumped_element
from tidy3d.components.validators import assert_line_or_plane, assert_plane, validate_name_str
from tidy3d.components.viz import PlotParams, plot_params_lumped_element
from tidy3d.constants import EPSILON_0, FARAD, HENRY, MICROMETER, OHM, fp_eps
from tidy3d.em.microwave.formulas.circuit_parameters import (
capacitance_colinear_cylindrical_wire_segments,
capacitance_rectangular_sheets,
inductance_straight_rectangular_wire,
total_inductance_colinear_rectangular_wire_segments,
)
from tidy3d.exceptions import ValidationError
from tidy3d.log import log

DEFAULT_LUMPED_ELEMENT_NUM_CELLS = 1
LOSS_FACTOR_INDUCTOR = 1e6
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
from tidy3d.components.base import cached_property
from tidy3d.components.geometry.utils_2d import snap_coordinate_to_grid
from tidy3d.components.grid.grid import Grid, YeeGrid
from tidy3d.components.lumped_element import LumpedElementType
from tidy3d.components.monitor import FieldMonitor
from tidy3d.components.types import Complex, Coordinate, FreqArray
from tidy3d.constants import OHM
from tidy3d.em.microwave.lumped_element import LumpedElementType

from .base_terminal import AbstractTerminalPort

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@
from tidy3d.components.geometry.base import Box, Geometry
from tidy3d.components.geometry.utils_2d import increment_float
from tidy3d.components.grid.grid import Grid, YeeGrid
from tidy3d.components.lumped_element import CoaxialLumpedResistor
from tidy3d.components.monitor import FieldMonitor
from tidy3d.components.source.current import CustomCurrentSource
from tidy3d.components.source.time import GaussianPulse
from tidy3d.components.types import Axis, Coordinate, Direction, FreqArray, Size
from tidy3d.components.validators import skip_if_fields_missing
from tidy3d.constants import MICROMETER
from tidy3d.em.microwave.lumped_element import CoaxialLumpedResistor
from tidy3d.em.microwave.path_integrals import AbstractAxesRH
from tidy3d.exceptions import SetupError, ValidationError
from tidy3d.plugins.microwave import CustomCurrentIntegral2D, VoltageIntegralAxisAligned
from tidy3d.plugins.microwave.path_integrals import AbstractAxesRH

from .base_lumped import AbstractLumpedPort

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
)
from tidy3d.components.geometry.utils_2d import increment_float
from tidy3d.components.grid.grid import Grid, YeeGrid
from tidy3d.components.lumped_element import LinearLumpedElement, LumpedResistor, RLCNetwork
from tidy3d.components.monitor import FieldMonitor
from tidy3d.components.source.current import UniformCurrentSource
from tidy3d.components.source.time import GaussianPulse
from tidy3d.components.types import Axis, FreqArray, LumpDistType
from tidy3d.components.validators import assert_line_or_plane
from tidy3d.em.microwave.lumped_element import LinearLumpedElement, LumpedResistor, RLCNetwork
from tidy3d.exceptions import SetupError, ValidationError
from tidy3d.plugins.microwave import CurrentIntegralAxisAligned, VoltageIntegralAxisAligned

Expand Down
File renamed without changes.
File renamed without changes.
Loading