diff --git a/tests/test_components/test_parameter_perturbation.py b/tests/test_components/test_parameter_perturbation.py index 819a0aebb4..2f6d850f6e 100644 --- a/tests/test_components/test_parameter_perturbation.py +++ b/tests/test_components/test_parameter_perturbation.py @@ -6,10 +6,7 @@ import pytest import tidy3d as td -from ..utils import cartesian_to_unstructured - -from ..utils import assert_log_level, AssertLogLevel -from ..utils import log_capture # noqa: F401 +from ..utils import cartesian_to_unstructured, AssertLogLevel sp_arr = td.SpatialDataArray(300 * np.ones((2, 2, 2)), coords=dict(x=[1, 2], y=[3, 4], z=[5, 6])) sp_arr_u = cartesian_to_unstructured(sp_arr) diff --git a/tests/test_components/test_perturbation_medium.py b/tests/test_components/test_perturbation_medium.py index b83d6af5b4..34f6f60527 100644 --- a/tests/test_components/test_perturbation_medium.py +++ b/tests/test_components/test_perturbation_medium.py @@ -5,7 +5,6 @@ import pydantic.v1 as pydantic import tidy3d as td from ..utils import AssertLogLevel, cartesian_to_unstructured -from ..utils import log_capture # noqa: F401 @pytest.mark.parametrize("unstructured", [False, True]) diff --git a/tidy3d/__init__.py b/tidy3d/__init__.py index 264a83ac15..a527535740 100644 --- a/tidy3d/__init__.py +++ b/tidy3d/__init__.py @@ -190,11 +190,11 @@ from .components.parameter_perturbation import ( CustomChargePerturbation, CustomHeatPerturbation, + IndexPerturbation, LinearChargePerturbation, LinearHeatPerturbation, ParameterPerturbation, PermittivityPerturbation, - IndexPerturbation, ) # run time spec diff --git a/tidy3d/components/medium.py b/tidy3d/components/medium.py index 18514abe3e..e3d7996ac7 100644 --- a/tidy3d/components/medium.py +++ b/tidy3d/components/medium.py @@ -49,7 +49,11 @@ from .geometry.base import Geometry from .grid.grid import Coords, Grid from .heat_spec import HeatSpecType -from .parameter_perturbation import ParameterPerturbation, PermittivityPerturbation, IndexPerturbation +from .parameter_perturbation import ( + IndexPerturbation, + ParameterPerturbation, + PermittivityPerturbation, +) from .time_modulation import ModulationSpec from .transformation import RotationType from .types import ( @@ -65,7 +69,7 @@ PoleAndResidue, TensorReal, ) -from .validators import validate_name_str, validate_parameter_perturbation +from .validators import _warn_potential_error, validate_name_str, validate_parameter_perturbation from .viz import add_ax_if_none # evaluate frequency as this number (Hz) if inf diff --git a/tidy3d/components/parameter_perturbation.py b/tidy3d/components/parameter_perturbation.py index 953ae3a938..e68c1f64dc 100644 --- a/tidy3d/components/parameter_perturbation.py +++ b/tidy3d/components/parameter_perturbation.py @@ -4,7 +4,7 @@ import functools from abc import ABC, abstractmethod -from typing import Callable, List, Tuple, Union, Optional +from typing import Callable, List, Optional, Tuple, Union import matplotlib.pyplot as plt import numpy as np @@ -13,7 +13,7 @@ from ..components.data.validators import validate_no_nans from ..components.types import TYPE_TAG_STR, ArrayLike, Ax, Complex, FieldVal, InterpMethod from ..components.viz import add_ax_if_none -from ..constants import CMCUBE, KELVIN, PERCMCUBE, inf +from ..constants import CMCUBE, EPSILON_0, KELVIN, PERCMCUBE, inf from ..exceptions import DataError from ..log import log from .base import Tidy3dBaseModel, cached_property