diff --git a/make_script.py b/make_script.py index 032dae024..0753cbecd 100644 --- a/make_script.py +++ b/make_script.py @@ -16,7 +16,6 @@ def main(args): - parser = argparse.ArgumentParser(description="Generate tidy3d script from a simulation file.") parser.add_argument( diff --git a/requirements/dev.txt b/requirements/dev.txt index 8f124aeef..ef22c5ff3 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -9,7 +9,7 @@ # required for development pre-commit -black==22.3.0 +black==23.12.1 ruff tox pytest diff --git a/tests/_test_local/_test_adjoint_performance.py b/tests/_test_local/_test_adjoint_performance.py index cf97ef17b..8d058f5a2 100644 --- a/tests/_test_local/_test_adjoint_performance.py +++ b/tests/_test_local/_test_adjoint_performance.py @@ -167,7 +167,6 @@ def f(eps_values): def test_time_custom_medium(use_emulated_run): - num_tests = 50 nxs = np.logspace(0, 2.0, num_tests) times_sec = np.zeros(num_tests) diff --git a/tests/_test_local/_test_data_performance.py b/tests/_test_local/_test_data_performance.py index 26bf6cd41..b7c500644 100644 --- a/tests/_test_local/_test_data_performance.py +++ b/tests/_test_local/_test_data_performance.py @@ -82,7 +82,6 @@ def test_memory_2_load(): def test_core_profile_small_1_save(): - Nx, Ny, Nz, Nt = 100, 100, 100, 10 x = np.arange(Nx) @@ -99,14 +98,12 @@ def test_core_profile_small_1_save(): def test_core_profile_small_2_load(): - with Profile(): print(f"file_size = {os.path.getsize(PATH):.2e} Bytes") data = td.FieldTimeData.from_file(PATH) def test_core_profile_large(): - sim_data = make_sim_data_1() with Profile(): @@ -120,7 +117,6 @@ def test_core_profile_large(): @profile def test_speed_many_datasets(): - Nx, Ny, Nz, Nf = 100, 100, 100, 1 x = np.arange(Nx) @@ -162,7 +158,6 @@ def make_field_data(num_index: int): ) with Profile(): - sim_data.to_file(PATH) sim_data2 = sim_data.from_file(PATH) diff --git a/tests/_test_local/_test_fit_web.py b/tests/_test_local/_test_fit_web.py index 7ef7b82f1..d60785a6f 100644 --- a/tests/_test_local/_test_fit_web.py +++ b/tests/_test_local/_test_fit_web.py @@ -39,7 +39,7 @@ def test_dispersion_lossless(): ) # a and c for each pole should be purely imaginary - for (a, c) in best_medium.poles: + for a, c in best_medium.poles: assert isclose(np.real(a), 0) assert isclose(np.real(c), 0) @@ -64,7 +64,6 @@ def test_dispersion_load_file(): def test_dispersion_load_url(): - url_csv = "https://refractiveindex.info/data_csv.php?datafile=data/main/Ag/Johnson.yml" fitter = StableDispersionFitter.from_url(url_csv) diff --git a/tests/test_components/test_apodization.py b/tests/test_components/test_apodization.py index e46738fa0..274e8b8c5 100644 --- a/tests/test_components/test_apodization.py +++ b/tests/test_components/test_apodization.py @@ -38,7 +38,6 @@ def test_negative_times(): def test_plot(): - run_time = 1.0e-13 times = [0, 2.0e-14, 4.0e-14, 6.0e-14, 8.0e-14, 1.0e-13] diff --git a/tests/test_components/test_base.py b/tests/test_components/test_base.py index 08099b4a9..cdca9b057 100644 --- a/tests/test_components/test_base.py +++ b/tests/test_components/test_base.py @@ -118,7 +118,6 @@ def test_updated_copy(): def test_equality(): - # test freqs / arraylike mnt1 = td.FluxMonitor(size=(1, 1, 0), freqs=np.array([1, 2, 3]) * 1e12, name="1") mnt2 = td.FluxMonitor(size=(1, 1, 0), freqs=np.array([1, 2, 3]) * 1e12, name="1") diff --git a/tests/test_components/test_custom.py b/tests/test_components/test_custom.py index e95731da0..443a1eec8 100644 --- a/tests/test_components/test_custom.py +++ b/tests/test_components/test_custom.py @@ -477,7 +477,7 @@ def verify_custom_dispersive_medium_methods(mat): poles_interp = mat.pole_residue.poles_on_grid(coord_interp) assert len(poles_interp) == len(mat.pole_residue.poles) coord_shape = tuple(len(grid) for grid in coord_interp.to_list) - for (a, c) in poles_interp: + for a, c in poles_interp: assert a.shape == coord_shape assert c.shape == coord_shape diff --git a/tests/test_components/test_geometry.py b/tests/test_components/test_geometry.py index ad0568213..294a2a16b 100644 --- a/tests/test_components/test_geometry.py +++ b/tests/test_components/test_geometry.py @@ -572,7 +572,6 @@ def test_geometry(): def test_geometry_sizes(): - # negative in size kwargs errors for size in (-1, 1, 1), (1, -1, 1), (1, 1, -1): with pytest.raises(pydantic.ValidationError): @@ -851,7 +850,6 @@ def test_custom_surface_geometry(tmp_path): def test_geo_group_sim(): - geo_grp = td.TriangleMesh.from_stl("tests/data/two_boxes_separate.stl") geos_orig = list(geo_grp.geometries) geo_grp_full = geo_grp.updated_copy(geometries=geos_orig + [td.Box(size=(1, 1, 1))]) diff --git a/tests/test_components/test_grid.py b/tests/test_components/test_grid.py index a7c254d24..08210e337 100644 --- a/tests/test_components/test_grid.py +++ b/tests/test_components/test_grid.py @@ -32,7 +32,6 @@ def test_field_grid(): def test_grid(): - boundaries_x = np.arange(-1, 2, 1) boundaries_y = np.arange(-2, 3, 1) boundaries_z = np.arange(-3, 4, 1) @@ -205,7 +204,6 @@ def test_sim_nonuniform_large(): def test_sim_grid(): - sim = td.Simulation( size=(4, 4, 4), grid_spec=td.GridSpec.uniform(1.0), @@ -252,7 +250,6 @@ def test_sim_symmetry_grid(): def test_sim_pml_grid(): - sim = td.Simulation( size=(4, 4, 4), grid_spec=td.GridSpec.uniform(1.0), @@ -271,7 +268,6 @@ def test_sim_pml_grid(): def test_sim_discretize_vol(): - sim = td.Simulation( size=(4, 4, 4), grid_spec=td.GridSpec.uniform(1.0), @@ -293,7 +289,6 @@ def test_sim_discretize_vol(): def test_sim_discretize_plane(): - sim = td.Simulation( size=(4, 4, 4), grid_spec=td.GridSpec.uniform(1.0), diff --git a/tests/test_components/test_grid_spec.py b/tests/test_components/test_grid_spec.py index 1f96eba6c..e9f75c870 100644 --- a/tests/test_components/test_grid_spec.py +++ b/tests/test_components/test_grid_spec.py @@ -48,7 +48,6 @@ def test_make_coords_2d(): def test_wvl_from_sources(): - # no sources with pytest.raises(SetupError): td.GridSpec.wavelength_from_sources(sources=[]) diff --git a/tests/test_components/test_heat.py b/tests/test_components/test_heat.py index c864703a6..b4de26501 100644 --- a/tests/test_components/test_heat.py +++ b/tests/test_components/test_heat.py @@ -340,7 +340,6 @@ def test_heat_sim_bounds(shift_amount, log_level, log_capture): CENTER_SHIFT = (-1.0, 1.0, 100.0) def place_box(center_offset): - shifted_center = tuple(c + s for (c, s) in zip(center_offset, CENTER_SHIFT)) _ = td.HeatSimulation( diff --git a/tests/test_components/test_medium.py b/tests/test_components/test_medium.py index 0637530a1..c3de5cbb4 100644 --- a/tests/test_components/test_medium.py +++ b/tests/test_components/test_medium.py @@ -50,7 +50,6 @@ def test_from_n_less_than_1(): def test_medium(): - # mediums error with unacceptable values with pytest.raises(pydantic.ValidationError): _ = td.Medium(permittivity=0.0) @@ -82,12 +81,10 @@ def test_medium_conversions(): def test_PEC(): - _ = td.Structure(geometry=td.Box(size=(1, 1, 1)), medium=td.PEC) def test_medium_dispersion(): - # construct media m_PR = td.PoleResidue(eps_inf=1.0, poles=[((-1 + 2j), (1 + 3j)), ((-2 + 4j), (1 + 5j))]) m_SM = td.Sellmeier(coeffs=[(2, 3), (2, 4)]) @@ -126,7 +123,6 @@ def test_medium_dispersion(): def test_medium_dispersion_conversion(): - m_PR = td.PoleResidue(eps_inf=1.0, poles=[((-1 + 2j), (1 + 3j)), ((-2 + 4j), (1 + 5j))]) m_SM = td.Sellmeier(coeffs=[(2, 3), (2, 4)]) m_LZ = td.Lorentz(eps_inf=1.0, coeffs=[(1, 3, 2), (2, 4, 1)]) @@ -142,7 +138,6 @@ def test_medium_dispersion_conversion(): def test_medium_dispersion_create(): - m_PR = td.PoleResidue(eps_inf=1.0, poles=[((-1 + 2j), (1 + 3j)), ((-2 + 4j), (1 + 5j))]) m_SM = td.Sellmeier(coeffs=[(2, 3), (2, 4)]) m_LZ = td.Lorentz(eps_inf=1.0, coeffs=[(1, 3, 2), (2, 4, 1)]) @@ -174,7 +169,6 @@ def test_sellmeier_from_dispersion(): def eps_compare(medium: td.Medium, expected: Dict, tol: float = 1e-5): - for freq, val in expected.items(): assert np.abs(medium.eps_model(freq) - val) < tol @@ -464,7 +458,6 @@ def test_fully_anisotropic_media(): def test_perturbation_medium(): - # Non-dispersive pp_real = td.ParameterPerturbation( heat=td.LinearHeatPerturbation( diff --git a/tests/test_components/test_meshgenerate.py b/tests/test_components/test_meshgenerate.py index 7b18a6f96..21a58b3b7 100644 --- a/tests/test_components/test_meshgenerate.py +++ b/tests/test_components/test_meshgenerate.py @@ -279,7 +279,6 @@ def test_grid_in_interval(): def test_grid_analytic_refinement(): - max_dl_list = np.array([0.5, 0.5, 0.4, 0.1, 0.4]) len_interval_list = np.array([2.0, 0.5, 0.2, 0.1, 0.3]) max_scale = 1.5 @@ -291,7 +290,6 @@ def test_grid_analytic_refinement(): def test_grid_refinement(): - max_dl_list = np.array([0.5, 0.4, 0.1, 0.4]) len_interval_list = np.array([0.5, 1.2, 0.1, 1.3]) max_scale = 1.5 @@ -698,7 +696,6 @@ def test_small_structure_size(log_capture): def test_shapely_strtree_warnings(): - with warnings.catch_warnings(): warnings.simplefilter("error") _ = GradedMesher().parse_structures( diff --git a/tests/test_components/test_mode.py b/tests/test_components/test_mode.py index 918985ee4..871952514 100644 --- a/tests/test_components/test_mode.py +++ b/tests/test_components/test_mode.py @@ -6,7 +6,6 @@ def test_modes(): - _ = td.ModeSpec(num_modes=2) _ = td.ModeSpec(num_modes=1, target_neff=1.0) diff --git a/tests/test_components/test_monitor.py b/tests/test_components/test_monitor.py index 22f68a412..632634e7a 100644 --- a/tests/test_components/test_monitor.py +++ b/tests/test_components/test_monitor.py @@ -53,7 +53,6 @@ def test_downsampled(): def test_excluded_surfaces_flat(): - with pytest.raises(pydantic.ValidationError): _ = td.FluxMonitor(size=(1, 1, 0), name="f", freqs=[1e12], exclude_surfaces=("x-",)) @@ -296,7 +295,6 @@ def test_monitor_num_modes(log_capture, num_modes, log_level): def test_diffraction_validators(): - # ensure error if boundaries are not periodic boundary_spec = td.BoundarySpec( x=td.Boundary.pml(), @@ -322,7 +320,6 @@ def test_diffraction_validators(): def test_monitor(): - size = (1, 2, 3) center = (1, 2, 3) @@ -357,7 +354,6 @@ def test_monitor(): def test_monitor_plane(): - # make sure flux, mode and diffraction monitors fail with non planar geometries for size in ((0, 0, 0), (1, 0, 0), (1, 1, 1)): with pytest.raises(pydantic.ValidationError): @@ -374,7 +370,6 @@ def _test_freqs_nonempty(): def test_monitor_surfaces_from_volume(): - center = (1, 2, 3) # make sure that monitors with zero volume raise an error (adapted from test_monitor_plane()) diff --git a/tests/test_components/test_parameter_perturbation.py b/tests/test_components/test_parameter_perturbation.py index e00acfa1d..911ece31f 100644 --- a/tests/test_components/test_parameter_perturbation.py +++ b/tests/test_components/test_parameter_perturbation.py @@ -7,7 +7,6 @@ def test_heat_perturbation(): - perturb = td.LinearHeatPerturbation( coeff=0.01, temperature_ref=300, @@ -61,7 +60,6 @@ def test_heat_perturbation(): perturb_data = td.HeatDataArray([1 + 1j, 3 + 1j, 1j], coords=dict(T=[200, 300, 400])) for interp_method in ["linear", "nearest"]: - perturb = td.CustomHeatPerturbation( perturbation_values=perturb_data, interp_method=interp_method ) @@ -110,7 +108,6 @@ def test_heat_perturbation(): def test_charge_perturbation(): - perturb = td.LinearChargePerturbation( electron_coeff=1e-21, electron_ref=0, @@ -216,7 +213,6 @@ def test_charge_perturbation(): ) for interp_method in ["linear", "nearest"]: - perturb = td.CustomChargePerturbation( perturbation_values=perturb_data, interp_method=interp_method ) @@ -306,7 +302,6 @@ def test_charge_perturbation(): def test_parameter_perturbation(): - heat = td.LinearHeatPerturbation( coeff=0.01, temperature_ref=300, diff --git a/tests/test_components/test_scene.py b/tests/test_components/test_scene.py index d54ba52fb..1f3e14f73 100644 --- a/tests/test_components/test_scene.py +++ b/tests/test_components/test_scene.py @@ -43,7 +43,6 @@ def test_scene_init(): def test_validate_components_none(): - assert SCENE._validate_num_mediums(val=None) is None @@ -169,7 +168,6 @@ def _test_names_default(): def test_names_unique(): - with pytest.raises(pd.ValidationError): _ = td.Scene( structures=[ @@ -188,7 +186,6 @@ def test_names_unique(): def test_perturbed_mediums_copy(): - # Non-dispersive pp_real = td.ParameterPerturbation( heat=td.LinearHeatPerturbation( diff --git a/tests/test_components/test_simulation.py b/tests/test_components/test_simulation.py index 034ce7305..da3458224 100644 --- a/tests/test_components/test_simulation.py +++ b/tests/test_components/test_simulation.py @@ -189,7 +189,6 @@ def test_sim_bounds(shift_amount, log_level, log_capture): CENTER_SHIFT = (-1.0, 1.0, 100.0) def place_box(center_offset): - shifted_center = tuple(c + s for (c, s) in zip(center_offset, CENTER_SHIFT)) _ = td.Simulation( @@ -229,7 +228,6 @@ def place_box(center_offset): def test_sim_size(): - # note dl may need to change if we change the maximum allowed number of cells mesh1d = td.UniformGrid(dl=2e-4) grid_spec = td.GridSpec(grid_x=mesh1d, grid_y=mesh1d, grid_z=mesh1d) @@ -262,7 +260,6 @@ def test_sim_size(): def _test_monitor_size(): - with pytest.raises(SetupError): s = td.Simulation( size=(1, 1, 1), @@ -460,7 +457,6 @@ def test_validate_plane_wave_boundaries(log_capture): def test_validate_zero_dim_boundaries(log_capture): - # zero-dim simulation with an absorbing boundary in that direction should error src = td.PlaneWave( source_time=td.GaussianPulse(freq0=2.5e14, fwidth=1e13), @@ -496,7 +492,6 @@ def test_validate_zero_dim_boundaries(log_capture): def test_validate_components_none(): - assert SIM._structures_not_at_edges(val=None, values=SIM.dict()) is None assert SIM._validate_num_sources(val=None) is None assert SIM._warn_monitor_mediums_frequency_range(val=None, values=SIM.dict()) is None @@ -527,7 +522,6 @@ def test_validate_size_spatial_and_time(monkeypatch): def test_validate_mnt_size(monkeypatch, log_capture): - # warning for monitor size monkeypatch.setattr(simulation, "WARN_MONITOR_DATA_SIZE_GB", 1 / 2**30) s = SIM.copy(update=dict(monitors=(td.FieldMonitor(name="f", freqs=[1e12], size=(1, 1, 1)),))) @@ -1405,7 +1399,6 @@ def _test_names_default(): def test_names_unique(): - with pytest.raises(pydantic.ValidationError): _ = td.Simulation( size=(2.0, 2.0, 2.0), @@ -1971,7 +1964,6 @@ def test_sim_volumetric_structures(log_capture, tmp_path): # plotting should not raise warning with AssertLogLevel(log_capture, None): - # check that plotting 2d material doesn't raise an error sim_data = run_emulated(sim) sim_data.plot_field(field_monitor_name="field_xz", field_name="Ex", val="real") @@ -2128,7 +2120,6 @@ def test_allow_gain(): def test_perturbed_mediums_copy(): - # Non-dispersive pp_real = td.ParameterPerturbation( heat=td.LinearHeatPerturbation( diff --git a/tests/test_components/test_source.py b/tests/test_components/test_source.py index 87fb1652b..e9b612643 100644 --- a/tests/test_components/test_source.py +++ b/tests/test_components/test_source.py @@ -16,7 +16,6 @@ def test_plot_source_time(): - for val in ("real", "imag", "abs"): ST.plot(times=[1e-15, 2e-15, 3e-15], val=val) ST.plot_spectrum(times=[1e-15, 2e-15, 3e-15], num_freqs=4, val=val) @@ -46,7 +45,6 @@ def test_dir_vector(): def test_UniformCurrentSource(): - g = td.GaussianPulse(freq0=1e12, fwidth=0.1e12) # test we can make generic UniformCurrentSource @@ -55,7 +53,6 @@ def test_UniformCurrentSource(): def test_source_times(): - # test we can make gaussian pulse g = td.GaussianPulse(freq0=1e12, fwidth=0.1e12) ts = np.linspace(0, 30, 1001) * 1e-12 @@ -79,7 +76,6 @@ def test_source_times(): def test_dipole(): - g = td.GaussianPulse(freq0=1e12, fwidth=0.1e12) _ = td.PointDipole(center=(1, 2, 3), source_time=g, polarization="Ex", interpolate=True) _ = td.PointDipole(center=(1, 2, 3), source_time=g, polarization="Ex", interpolate=False) @@ -150,11 +146,9 @@ def test_FieldSource(): def test_pol_arrow(): - g = td.GaussianPulse(freq0=1e12, fwidth=0.1e12) def get_pol_dir(axis, pol_angle=0, angle_theta=0, angle_phi=0): - size = [td.inf, td.inf, td.inf] size[axis] = 0 diff --git a/tests/test_components/test_types.py b/tests/test_components/test_types.py index 275f9ed7e..3332ddc8b 100644 --- a/tests/test_components/test_types.py +++ b/tests/test_components/test_types.py @@ -37,7 +37,6 @@ class S(Tidy3dBaseModel): def test_array_like(): class MyClass(Tidy3dBaseModel): - a: ArrayLike = None # can be any array-like thing b: constrained_array(ndim=2) = None # must be 2D c: constrained_array(dtype=float) = None # must be float-like @@ -64,7 +63,6 @@ class MyClass(Tidy3dBaseModel): def test_array_like_field_name(): class MyClass(Tidy3dBaseModel): - a: ArrayLike # can be any array-like thing b: constrained_array(ndim=2) # must be 2D c: constrained_array(dtype=float) # must be float-like @@ -88,7 +86,6 @@ def correct_field_display(field_name, display_name): def test_hash(): class MyClass(Tidy3dBaseModel): - a: ArrayLike b: constrained_array(ndim=1) c: Tuple[ArrayLike, ...] diff --git a/tests/test_data/test_datasets.py b/tests/test_data/test_datasets.py index 65ad2b4e3..e40fc4460 100644 --- a/tests/test_data/test_datasets.py +++ b/tests/test_data/test_datasets.py @@ -10,7 +10,6 @@ @pytest.mark.parametrize("ds_name", ["test123", None]) def test_triangular_dataset(tmp_path, ds_name): - import tidy3d as td from tidy3d.components.types import vtk from tidy3d.exceptions import DataError, Tidy3dImportError @@ -45,7 +44,6 @@ def test_triangular_dataset(tmp_path, ds_name): # wrong points dimensionality with pytest.raises(pd.ValidationError): - tri_grid_points_bad = td.PointDataArray( np.random.random((4, 3)), coords=dict(index=np.arange(4), axis=np.arange(3)), @@ -75,7 +73,6 @@ def test_triangular_dataset(tmp_path, ds_name): # invalid cell connections with pytest.raises(pd.ValidationError): - tri_grid_cells_bad = td.CellDataArray( [[0, 1, 2, 3]], coords=dict(cell_index=np.arange(1), vertex_index=np.arange(4)), @@ -90,7 +87,6 @@ def test_triangular_dataset(tmp_path, ds_name): ) with pytest.raises(pd.ValidationError): - tri_grid_cells_bad = td.CellDataArray( [[0, 1, 5], [1, 2, 3]], coords=dict(cell_index=np.arange(2), vertex_index=np.arange(3)), @@ -106,7 +102,6 @@ def test_triangular_dataset(tmp_path, ds_name): # wrong number of values with pytest.raises(pd.ValidationError): - tri_grid_values_bad = td.IndexedDataArray( [1.0, 2.0, 3.0], coords=dict(index=np.arange(3)), @@ -262,7 +257,6 @@ def operation(arr): @pytest.mark.parametrize("ds_name", ["test123", None]) def test_tetrahedral_dataset(tmp_path, ds_name): - import tidy3d as td from tidy3d.components.types import vtk from tidy3d.exceptions import DataError, Tidy3dImportError @@ -292,7 +286,6 @@ def test_tetrahedral_dataset(tmp_path, ds_name): # wrong points dimensionality with pytest.raises(pd.ValidationError): - tet_grid_points_bad = td.PointDataArray( np.random.random((5, 2)), coords=dict(index=np.arange(5), axis=np.arange(2)), @@ -318,7 +311,6 @@ def test_tetrahedral_dataset(tmp_path, ds_name): # invalid cell connections with pytest.raises(pd.ValidationError): - tet_grid_cells_bad = td.CellDataArray( [[0, 1, 2], [1, 2, 3]], coords=dict(cell_index=np.arange(2), vertex_index=np.arange(3)), @@ -331,7 +323,6 @@ def test_tetrahedral_dataset(tmp_path, ds_name): ) with pytest.raises(pd.ValidationError): - tet_grid_cells_bad = td.CellDataArray( [[0, 1, 2, 6], [1, 2, 3, 4]], coords=dict(cell_index=np.arange(2), vertex_index=np.arange(4)), @@ -345,7 +336,6 @@ def test_tetrahedral_dataset(tmp_path, ds_name): # wrong number of values with pytest.raises(pd.ValidationError): - tet_grid_values_bad = td.IndexedDataArray( [1.0, 2.0, 3.0], coords=dict(index=np.arange(3)), diff --git a/tests/test_data/test_monitor_data.py b/tests/test_data/test_monitor_data.py index 09e30949c..b18dc5c0b 100644 --- a/tests/test_data/test_monitor_data.py +++ b/tests/test_data/test_monitor_data.py @@ -415,7 +415,6 @@ def test_mode_solver_plot_field(): def test_field_data_symmetry_present(): - coords = {"x": np.arange(10), "y": np.arange(10), "z": np.arange(10), "t": []} fields = {"Ex": td.ScalarFieldTimeDataArray(np.random.rand(10, 10, 10, 0), coords=coords)} monitor = td.FieldTimeMonitor(size=(1, 1, 1), name="test", fields=["Ex"]) diff --git a/tests/test_data/test_sim_data.py b/tests/test_data/test_sim_data.py index 52a3cfcdb..bad439ef6 100644 --- a/tests/test_data/test_sim_data.py +++ b/tests/test_data/test_sim_data.py @@ -314,7 +314,6 @@ def test_empty_io(tmp_path): def test_run_time_lt_start(tmp_path): - # Point source inside a box box = td.Structure( geometry=td.Box(center=(0, 0, 0), size=(1, 1, 1)), diff --git a/tests/test_package/test_log.py b/tests/test_package/test_log.py index 35b538ba3..594b4869a 100644 --- a/tests/test_package/test_log.py +++ b/tests/test_package/test_log.py @@ -231,7 +231,6 @@ def test_logging_warning_capture(): # for sim_dict in [sim_dict_no_source, sim_dict_large_mnt]: for sim_dict in [sim_dict_no_source]: - try: sim = td.Simulation.parse_obj(sim_dict) sim.validate_pre_upload() diff --git a/tests/test_package/test_make_script.py b/tests/test_package/test_make_script.py index 05f12d0a5..57ffb9bb6 100644 --- a/tests/test_package/test_make_script.py +++ b/tests/test_package/test_make_script.py @@ -4,7 +4,6 @@ def test_make_script(tmp_path): - # make a sim simulation = td.Simulation( size=(1, 1, 1), diff --git a/tests/test_plugins/test_adjoint.py b/tests/test_plugins/test_adjoint.py index a64627eab..dae98f341 100644 --- a/tests/test_plugins/test_adjoint.py +++ b/tests/test_plugins/test_adjoint.py @@ -64,6 +64,7 @@ polarization="Ex", ) + # Emulated forward and backward run functions def run_emulated_fwd( simulation: td.Simulation, @@ -435,7 +436,6 @@ def make_components(eps, size, vertices, base_eps_val): # whether to run the flux pipeline through jax (True) or regular tidy3d (False) use_jax = True if not use_jax: - td_field_components = {} for fld, jax_data_array in mnt_data.field_components.items(): data_array = td.ScalarFieldDataArray( @@ -446,7 +446,6 @@ def make_components(eps, size, vertices, base_eps_val): mnt_data = td.FieldData(monitor=mnt_data.monitor, **td_field_components) def get_flux(x): - fld_components = {} for fld, fld_component in mnt_data.field_components.items(): new_values = x * fld_component.values @@ -492,7 +491,6 @@ def f(permittivity, size, vertices, base_eps_val): @pytest.mark.parametrize("local", (True, False)) def test_adjoint_pipeline_2d(local, use_emulated_run): - run_fn = run_local if local else run sim = make_sim(permittivity=EPS, size=SIZE, vertices=VERTICES, base_eps_val=BASE_EPS_VAL) @@ -934,12 +932,10 @@ def _test_polyslab_box(use_emulated_run): np.random.seed(0) def f(size, center, is_box=True): - jax_med = JaxMedium(permittivity=2.0) POLYSLAB_AXIS = 2 if is_box: - size = list(size) size[POLYSLAB_AXIS] = jax.lax.stop_gradient(size[POLYSLAB_AXIS]) center = list(center) @@ -950,7 +946,6 @@ def f(size, center, is_box=True): jax_struct = JaxStructure(geometry=jax_box, medium=jax_med) else: - size_axis, (size_1, size_2) = JaxPolySlab.pop_axis(size, axis=POLYSLAB_AXIS) cent_axis, (cent_1, cent_2) = JaxPolySlab.pop_axis(center, axis=POLYSLAB_AXIS) @@ -1034,7 +1029,6 @@ def test_polyslab_2d(sim_size_axis, use_emulated_run): np.random.seed(0) def f(size, center): - jax_med = JaxMedium(permittivity=2.0) POLYSLAB_AXIS = 2 @@ -1149,7 +1143,6 @@ def f(x): @pytest.mark.parametrize("axis", (0, 1, 2)) def test_diff_data_angles(axis): - center = td.DiffractionMonitor.unpop_axis(2, (0, 0), axis) size = td.DiffractionMonitor.unpop_axis(0, (td.inf, td.inf), axis) @@ -1255,7 +1248,6 @@ def _test_polyslab_scale(use_emulated_run): start_time = time.time() def f(scale=1.0): - jax_med = JaxMedium(permittivity=2.0) POLYSLAB_AXIS = 2 @@ -1342,7 +1334,6 @@ def _test_custom_medium_3D(use_emulated_run): jax_box = JaxBox(size=(1, 1, 1), center=(0, 0, 0)) def make_custom_medium(Nx: int, Ny: int, Nz: int) -> JaxCustomMedium: - # custom medium (xmin, ymin, zmin), (xmax, ymax, zmax) = jax_box.bounds coords = dict( @@ -1375,7 +1366,6 @@ def test_custom_medium_size(use_emulated_run): jax_box = JaxBox(size=(1, 1, 1), center=(0, 0, 0)) def make_custom_medium(num_cells: int) -> JaxCustomMedium: - Nx = num_cells Ny = Nz = 1 @@ -1401,11 +1391,9 @@ def make_custom_medium(num_cells: int) -> JaxCustomMedium: def test_jax_sim_io(tmp_path): - jax_box = JaxBox(size=(1, 1, 1), center=(0, 0, 0)) def make_custom_medium(num_cells: int) -> JaxCustomMedium: - n = int(np.sqrt(num_cells)) Nx = n Ny = n @@ -1452,7 +1440,6 @@ def test_num_input_structures(): """Assert proper error is raised if number of input structures is too large.""" def make_sim_(num_input_structures: int) -> JaxSimulation: - sim = make_sim(permittivity=EPS, size=SIZE, vertices=VERTICES, base_eps_val=BASE_EPS_VAL) struct = sim.input_structures[0] return sim.updated_copy(input_structures=num_input_structures * [struct]) @@ -1557,7 +1544,6 @@ def test_pytreedef_errors(use_emulated_run): mnt = td.ModeMonitor(size=(1, 1, 0), freqs=[1e14], name="test", mode_spec=td.ModeSpec()) def f(x): - jb = JaxBox(size=(x, x, x), center=(0, 0, 0)) js = JaxStructure(geometry=jb, medium=JaxMedium(permittivity=2.0)) @@ -1588,7 +1574,6 @@ def f(x): @pytest.mark.parametrize("fwidth, run_time, run_time_expected", fwidth_run_time_expected) def test_adjoint_run_time(use_emulated_run, tmp_path, fwidth, run_time, run_time_expected): - sim = make_sim(permittivity=EPS, size=SIZE, vertices=VERTICES, base_eps_val=BASE_EPS_VAL) sim = sim.updated_copy(run_time_adjoint=run_time, fwidth_adjoint=fwidth) diff --git a/tests/test_plugins/test_component_modeler.py b/tests/test_plugins/test_component_modeler.py index c65a74514..d05066d31 100644 --- a/tests/test_plugins/test_component_modeler.py +++ b/tests/test_plugins/test_component_modeler.py @@ -137,7 +137,6 @@ def make_coupler( def make_ports(): - sim = make_coupler() # source src_pos = sim.size[0] / 2 - straight_wg_length / 2 @@ -276,10 +275,8 @@ def test_run_component_modeler(monkeypatch, tmp_path): for port_in in modeler.ports: for mode_index_in in range(port_in.mode_spec.num_modes): - for port_out in modeler.ports: for mode_index_out in range(port_out.mode_spec.num_modes): - coords_in = dict(port_in=port_in.name, mode_index_in=mode_index_in) coords_out = dict(port_out=port_out.name, mode_index_out=mode_index_out) @@ -312,7 +309,6 @@ def test_component_modeler_run_only(monkeypatch): def _test_mappings(element_mappings, s_matrix): """Makes sure the mappings are reflected in a given S matrix.""" for (i, j), (k, l), mult_by in element_mappings: - (port_out_from, mode_index_out_from) = i (port_in_from, mode_index_in_from) = j (port_out_to, mode_index_out_to) = k diff --git a/tests/test_plugins/test_mode_solver.py b/tests/test_plugins/test_mode_solver.py index 27796b82a..bb53478c9 100644 --- a/tests/test_plugins/test_mode_solver.py +++ b/tests/test_plugins/test_mode_solver.py @@ -161,7 +161,6 @@ def compare_colocation(ms): data_at_boundaries = ms_nocol.sim_data.at_boundaries(MODE_MONITOR_NAME) for key, field in data_col.field_components.items(): - # Check the colocated data is the same assert np.allclose(data_at_boundaries[key], field, atol=1e-7) diff --git a/tests/utils.py b/tests/utils.py index c9cd45ceb..7259cb2c1 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -735,14 +735,12 @@ class AssertLogLevel: contains_str: str = None def __enter__(self): - # record number of records going into this context self.num_records_before = len(self.records) return self def __exit__(self, exc_type, exc_value, traceback): - # only check NEW records recorded since __enter__ records_check = self.records[self.num_records_before :] assert_log_level( diff --git a/tidy3d/__main__.py b/tidy3d/__main__.py index 316b89d2a..b0ffe5e5d 100644 --- a/tidy3d/__main__.py +++ b/tidy3d/__main__.py @@ -109,5 +109,4 @@ def main(args): if __name__ == "__main__": - main(sys.argv[1:]) diff --git a/tidy3d/components/base.py b/tidy3d/components/base.py index f57a6428f..755a18543 100644 --- a/tidy3d/components/base.py +++ b/tidy3d/components/base.py @@ -523,7 +523,6 @@ def load_data_from_file(model_dict: dict, group_path: str = "") -> None: """For every DataArray item in dictionary, load path of hdf5 group as value.""" for key, value in model_dict.items(): - subpath = f"{group_path}/{key}" # apply custom validation to the key value pair and modify model_dict @@ -545,7 +544,6 @@ def load_data_from_file(model_dict: dict, group_path: str = "") -> None: # if a list, assign each element a unique key, recurse if isinstance(value, (list, tuple)): - value_dict = cls.tuple_to_dict(tuple_values=value) load_data_from_file(model_dict=value_dict, group_path=subpath) @@ -617,7 +615,6 @@ def to_hdf5(self, fname: str, custom_encoders: List[Callable] = None) -> None: """ with h5py.File(fname, "w") as f_handle: - json_str = self._json_string for ind in range(ceil(len(json_str) / MAX_STRING_LENGTH)): ind_start = int(ind * MAX_STRING_LENGTH) @@ -628,7 +625,6 @@ def add_data_to_file(data_dict: dict, group_path: str = "") -> None: """For every DataArray item in dictionary, write path of hdf5 group as value.""" for key, value in data_dict.items(): - # append the key to the path subpath = f"{group_path}/{key}" @@ -803,7 +799,6 @@ def check_equal(dict1: dict, dict2: dict) -> bool: # everything else else: - # note: this logic is because != is handled differently in DataArrays apparently if not val1 == val2: return False @@ -882,7 +877,6 @@ def generate_docstring(cls) -> str: # create the list of parameters (arguments) for the model doc += "\n\n Parameters\n ----------\n" for field_name, field in cls.__fields__.items(): - # ignore the type tag if field_name == TYPE_TAG_STR: continue diff --git a/tidy3d/components/base_sim/simulation.py b/tidy3d/components/base_sim/simulation.py index cc82734c0..bd817bb5e 100644 --- a/tidy3d/components/base_sim/simulation.py +++ b/tidy3d/components/base_sim/simulation.py @@ -114,7 +114,6 @@ def _structures_not_at_edges(cls, val, values): struct_bounds = list(struct_bound_min) + list(struct_bound_max) for sim_val, struct_val in zip(sim_bounds, struct_bounds): - if isclose(sim_val, struct_val): consolidated_logger.warning( f"Structure at 'structures[{istruct}]' has bounds that extend exactly " diff --git a/tidy3d/components/data/data_array.py b/tidy3d/components/data/data_array.py index e2e7c3eb7..edf9f36e1 100644 --- a/tidy3d/components/data/data_array.py +++ b/tidy3d/components/data/data_array.py @@ -275,17 +275,14 @@ def sel_inside(self, bounds: Bound) -> SpatialDataArray: inds_list = [] for coord, smin, smax in zip(self.coords.values(), bounds[0], bounds[1]): - length = len(coord) # if data does not cover structure at all take the closest index if smax < coord[0]: # structure is completely on the left side - # take 2 if possible, so that linear iterpolation is possible comp_inds = np.arange(0, max(2, length)) elif smin > coord[-1]: # structure is completely on the right side - # take 2 if possible, so that linear iterpolation is possible comp_inds = np.arange(min(0, length - 2), length) diff --git a/tidy3d/components/data/dataset.py b/tidy3d/components/data/dataset.py index 9e5849b1c..f99ccd175 100644 --- a/tidy3d/components/data/dataset.py +++ b/tidy3d/components/data/dataset.py @@ -111,7 +111,6 @@ def colocate(self, x=None, y=None, z=None) -> xr.Dataset: # loop through field components for field_name, field_data in self.field_components.items(): - # loop through x, y, z dimensions and raise an error if only one element along dim for coord_name, coords_supplied in supplied_coord_map.items(): coord_data = np.array(field_data.coords[coord_name]) diff --git a/tidy3d/components/data/monitor_data.py b/tidy3d/components/data/monitor_data.py index afd62f7df..efd4d2af0 100644 --- a/tidy3d/components/data/monitor_data.py +++ b/tidy3d/components/data/monitor_data.py @@ -157,14 +157,12 @@ def _symmetry_update_dict(self) -> Dict: update_dict = {} for field_name, scalar_data in self.field_components.items(): - eigenval_fn = self.symmetry_eigenvalues[field_name] # get grid locations for this field component on the expanded grid field_coords = self._expanded_grid_field_coords(field_name) for sym_dim, (sym_val, sym_loc) in enumerate(zip(self.symmetry, self.symmetry_center)): - dim_name = "xyz"[sym_dim] # Continue if no symmetry along this dimension @@ -978,13 +976,11 @@ def overlap_sort( # Sort in two directions from the base frequency for step, last_ind in zip([-1, 1], [-1, num_freqs]): - # Start with the base frequency data_template = self._isel(f=[f0_ind]) # March to lower/higher frequencies for freq_id in range(f0_ind + step, last_ind, step): - # Get next frequency to sort data_to_sort = self._isel(f=[freq_id]) @@ -1060,7 +1056,6 @@ def _find_ordering_one_freq( data_template_reduced = self._isel(mode_index=modes_to_sort) for i, mode_index in enumerate(modes_to_sort): - # Get one mode from data_to_sort one_mode = data_to_sort._isel(mode_index=[mode_index]) @@ -1113,7 +1108,6 @@ def _reorder_modes( # Create new dict with rearranged field components update_dict = {} for field_name, field in self.field_components.items(): - field_sorted = field.copy() # Rearrange modes diff --git a/tidy3d/components/data/sim_data.py b/tidy3d/components/data/sim_data.py index 101c840c2..b1504137c 100644 --- a/tidy3d/components/data/sim_data.py +++ b/tidy3d/components/data/sim_data.py @@ -412,13 +412,11 @@ def mnt_data_from_file(cls, fname: str, mnt_name: str, **parse_obj_kwargs) -> Mo # loop through data for monitor_index_str, _mnt_data in f_handle["data"].items(): - # grab the monitor data for this data element monitor_dict = monitor_list[int(monitor_index_str)] # if a match on the monitor name if monitor_dict["name"] == mnt_name: - # try to grab the monitor data type monitor_type_str = monitor_dict["type"] if monitor_type_str not in DATA_TYPE_NAME_MAP: diff --git a/tidy3d/components/field_projection.py b/tidy3d/components/field_projection.py index 1f4819f30..eba4c114a 100644 --- a/tidy3d/components/field_projection.py +++ b/tidy3d/components/field_projection.py @@ -141,7 +141,6 @@ def from_near_field_monitors( @cached_property def currents(self): - """Sets the surface currents.""" sim_data = self.sim_data surfaces = self.surfaces @@ -296,7 +295,6 @@ def _resample_surface_currents( _, idx_uv = surface.monitor.pop_axis((0, 1, 2), axis=surface.axis) for idx in idx_uv: - # pick sample points on the monitor and handle the possibility of an "infinite" monitor start = np.maximum( surface.monitor.center[idx] - surface.monitor.size[idx] / 2.0, @@ -403,7 +401,6 @@ def integrate_for_one_theta(i_th: int): """Perform integration for a given theta angle index""" for j_ph in np.arange(len(phi)): - phase[0] = np.exp(propagation_factor * pts[0] * sin_theta[i_th] * cos_phi[j_ph]) phase[1] = np.exp(propagation_factor * pts[1] * sin_theta[i_th] * sin_phi[j_ph]) phase[2] = np.exp(propagation_factor * pts[2] * cos_theta[i_th]) @@ -556,7 +553,6 @@ def _project_fields_angular( ) for surface in self.surfaces: - # apply windowing to currents currents = self.apply_window_to_currents(monitor, self.currents[surface.monitor.name]) @@ -647,7 +643,6 @@ def _project_fields_cartesian( ) for surface in self.surfaces: - # apply windowing to currents currents = self.apply_window_to_currents( monitor, self.currents[surface.monitor.name] @@ -720,7 +715,6 @@ def _project_fields_kspace( theta, phi = monitor.kspace_2_sph(_ux, _uy, monitor.proj_axis) for surface in self.surfaces: - # apply windowing to currents currents = self.apply_window_to_currents( monitor, self.currents[surface.monitor.name] diff --git a/tidy3d/components/geometry/base.py b/tidy3d/components/geometry/base.py index 5592402c5..f5ef32560 100644 --- a/tidy3d/components/geometry/base.py +++ b/tidy3d/components/geometry/base.py @@ -1726,7 +1726,6 @@ def surfaces(cls, size: Size, center: Coordinate, **kwargs): surface_index = 0 for dim_index in range(3): for min_max_index in range(2): - new_center = centers[surface_index] new_size = sizes[surface_index] @@ -1769,7 +1768,6 @@ def del_items(items, indices): surfaces = [] for _cent, _size, _name, _normal_dir in zip(centers, sizes, names, normal_dirs): - if "normal_dir" in cls.__dict__["__fields__"]: kwargs["normal_dir"] = _normal_dir diff --git a/tidy3d/components/heat/data/monitor_data.py b/tidy3d/components/heat/data/monitor_data.py index 1120f3be9..1279c95c7 100644 --- a/tidy3d/components/heat/data/monitor_data.py +++ b/tidy3d/components/heat/data/monitor_data.py @@ -105,7 +105,6 @@ def symmetry_expanded_copy(self) -> TemperatureData: # do not expand monitor with zero size along symmetry direction # this is done because 2d unstructured data does not support this if self.symmetry[dim] == 1 and self.monitor.size[dim] != 0: - new_temp = new_temp.reflect(axis=dim, center=self.symmetry_center[dim]) return self.updated_copy(temperature=new_temp, symmetry=(0, 0, 0)) diff --git a/tidy3d/components/heat/data/sim_data.py b/tidy3d/components/heat/data/sim_data.py index e0f5a5305..7ae5957b0 100644 --- a/tidy3d/components/heat/data/sim_data.py +++ b/tidy3d/components/heat/data/sim_data.py @@ -162,7 +162,6 @@ def plot_field( ) if isinstance(field_data, TriangularGridDataset): - field_data.plot( ax=ax, cmap=cmap, @@ -184,7 +183,6 @@ def plot_field( max_bounds.pop(axis) if isinstance(field_data, SpatialDataArray): - # interp out any monitor.size==0 dimensions monitor = self.simulation.get_monitor_by_name(monitor_name) thin_dims = { diff --git a/tidy3d/components/heat/simulation.py b/tidy3d/components/heat/simulation.py index 50431b2aa..f5ec249ed 100644 --- a/tidy3d/components/heat/simulation.py +++ b/tidy3d/components/heat/simulation.py @@ -324,7 +324,7 @@ def plot_boundaries( ) # plot boundary conditions - for (bc_spec, shape) in boundaries: + for bc_spec, shape in boundaries: ax = self._plot_boundary_condition(shape=shape, boundary_spec=bc_spec, ax=ax) # clean up the axis display @@ -431,10 +431,8 @@ def _construct_forward_boundaries( boundaries = [] # bc_spec, structure name, shape, bounds background_shapes = [] for name, medium, shape, bounds in shapes: - # intersect existing boundaries (both structure based and medium based) for index, (_bc_spec, _name, _bdry, _bounds) in enumerate(boundaries): - # simulation bc is overriden only by StructureSimulationBoundary if isinstance(_bc_spec.placement, SimulationBoundary): if name not in struct_to_bc_spec: @@ -456,7 +454,6 @@ def _construct_forward_boundaries( if name in struct_to_bc_spec: for bc_spec in struct_to_bc_spec[name]: - if isinstance(bc_spec.placement, StructureBoundary): bdry = shape.exterior bdry = bdry.intersection(background_structure_shape) @@ -476,7 +473,6 @@ def _construct_forward_boundaries( # this is similar to _filter_structures_plane but only mediums participating in BCs # are tracked for index, (_medium, _shape, _bounds) in enumerate(background_shapes): - if Box._do_not_intersect(bounds, _bounds, shape, _shape): continue @@ -533,16 +529,13 @@ def _construct_reverse_boundaries( boundaries_reverse = [] for name, _, shape, bounds in shapes[:0:-1]: - minx, miny, maxx, maxy = bounds # intersect existing boundaries for index, (_bc_spec, _name, _bdry, _bounds, _completed) in enumerate( boundaries_reverse ): - if not _completed: - if Box._do_not_intersect(bounds, _bounds, shape, _bdry): continue @@ -610,7 +603,6 @@ def _construct_heat_boundaries( # get structures in the plane and present named structures and media shapes = [] # structure name, structure medium, shape, bounds for structure in structures: - # get list of Shapely shapes that intersect at the plane shapes_plane = plane.intersections_with(structure.geometry) @@ -715,7 +707,7 @@ def plot_sources( ) source_min, source_max = self.source_bounds - for (source, shape) in source_shapes: + for source, shape in source_shapes: if source is not None: ax = self._plot_shape_structure_source( alpha=alpha, diff --git a/tidy3d/components/medium.py b/tidy3d/components/medium.py index 6a53719d1..7c603d990 100644 --- a/tidy3d/components/medium.py +++ b/tidy3d/components/medium.py @@ -1534,7 +1534,6 @@ def get_eps_sigma(eps_complex: SpatialDataArray, freq: float) -> tuple: # isotropic, but with `eps_dataset` if self.is_isotropic: - eps_complex = self.eps_dataset.eps_xx eps_real, sigma = get_eps_sigma(eps_complex, freq=self.freqs[0]) @@ -2116,7 +2115,7 @@ def lo_to_eps_model( """ omega = 2 * np.pi * frequency eps = eps_inf - for (omega_lo, gamma_lo, omega_to, gamma_to) in poles: + for omega_lo, gamma_lo, omega_to, gamma_to in poles: eps *= omega_lo**2 - omega**2 - 1j * omega * gamma_lo eps /= omega_to**2 - omega**2 - 1j * omega * gamma_to return eps diff --git a/tidy3d/components/parameter_perturbation.py b/tidy3d/components/parameter_perturbation.py index 95f541e5a..17bbb4e95 100644 --- a/tidy3d/components/parameter_perturbation.py +++ b/tidy3d/components/parameter_perturbation.py @@ -637,7 +637,6 @@ def sample( e_type, h_type = self._get_eh_types(electron_density, hole_density) if e_type == "array" and h_type == "array": - e_mesh, h_mesh = np.meshgrid(electron_density, hole_density, indexing="ij") return self.electron_coeff * (e_mesh - self.electron_ref) + self.hole_coeff * ( @@ -913,7 +912,6 @@ def apply_data( result = result + self.heat.sample(temperature) if (electron_density is not None or hole_density is not None) and self.charge is not None: - if electron_density is None: electron_density = 0 diff --git a/tidy3d/components/scene.py b/tidy3d/components/scene.py index 55a2efec6..be136c44d 100644 --- a/tidy3d/components/scene.py +++ b/tidy3d/components/scene.py @@ -289,7 +289,6 @@ def _get_plot_lims( hlim: Tuple[float, float] = None, vlim: Tuple[float, float] = None, ) -> Tuple[Tuple[float, float], Tuple[float, float]]: - # if no hlim and/or vlim given, the bounds will then be the usual pml bounds axis, _ = Box.parse_xyz_kwargs(x=x, y=y, z=z) _, (hmin, vmin) = Box.pop_axis(bounds[0], axis=axis) @@ -387,7 +386,7 @@ def plot_structures( structures=self.structures, x=x, y=y, z=z, hlim=hlim, vlim=vlim ) medium_map = self.medium_map - for (medium, shape) in medium_shapes: + for medium, shape in medium_shapes: mat_index = medium_map[medium] ax = self._plot_shape_structure(medium=medium, mat_index=mat_index, shape=shape, ax=ax) ax = self._set_plot_bounds(bounds=self.bounds, ax=ax, x=x, y=y, z=z, hlim=hlim, vlim=vlim) @@ -596,7 +595,6 @@ def _filter_structures_plane( shapes = [] for structure, prop in zip(structures, property_list): - # get list of Shapely shapes that intersect at the plane shapes_plane = plane.intersections_with(structure.geometry) @@ -606,12 +604,10 @@ def _filter_structures_plane( background_shapes = [] for prop, shape, bounds in shapes: - minx, miny, maxx, maxy = bounds # loop through background_shapes (note: all background are non-intersecting or merged) for index, (_prop, _shape, _bounds) in enumerate(background_shapes): - _minx, _miny, _maxx, _maxy = _bounds # do a bounding box check to see if any intersection to do anything about @@ -773,7 +769,6 @@ def plot_structures_eps( eps_min, eps_max = eps_lim if eps_min is None or eps_max is None: - eps_min_sim, eps_max_sim = self.eps_bounds(freq=freq) if eps_min is None: @@ -782,7 +777,7 @@ def plot_structures_eps( if eps_max is None: eps_max = eps_max_sim - for (medium, shape) in medium_shapes: + for medium, shape in medium_shapes: # if the background medium is custom medium, it needs to be rendered separately if medium == self.medium and alpha < 1 and not isinstance(medium, AbstractCustomMedium): continue @@ -1141,7 +1136,7 @@ def plot_structures_heat_conductivity( ) heat_cond_min, heat_cond_max = self.heat_conductivity_bounds() - for (medium, shape) in medium_shapes: + for medium, shape in medium_shapes: ax = self._plot_shape_structure_heat_cond( alpha=alpha, medium=medium, @@ -1320,7 +1315,6 @@ def perturbed_mediums_copy( # do the same for background medium if it a medium with perturbation models. med = self.medium if isinstance(med, AbstractPerturbationMedium): - # get scene's bounding box bounds = scene_bounds diff --git a/tidy3d/components/simulation.py b/tidy3d/components/simulation.py index b818825c5..a0e40a067 100644 --- a/tidy3d/components/simulation.py +++ b/tidy3d/components/simulation.py @@ -399,7 +399,6 @@ def boundaries_for_zero_dims(cls, val, values): axis_names = "xyz" for dim, (boundary, symmetry_dim, size_dim) in enumerate(zip(boundaries, symmetry, size)): - if size_dim == 0: axis = axis_names[dim] num_absorbing_bdries = sum(isinstance(bnd, AbsorberSpec) for bnd in boundary) @@ -480,7 +479,6 @@ def _structures_not_close_pml(cls, val, values): sources = values.get("sources") if (not structures) or (not sources): - return val with log as consolidated_logger: @@ -549,7 +547,6 @@ def _warn_monitor_mediums_frequency_range(cls, val, values): fmin_mon = freqs.min() fmax_mon = freqs.max() for medium_index, medium in enumerate(mediums): - # skip mediums that have no freq range (all freqs valid) if medium.frequency_range is None: continue @@ -847,7 +844,6 @@ def _warn_grid_size_too_small(cls, val, values): freq0 = source.source_time.freq0 for medium_index, medium in enumerate(mediums): - # min wavelength in PEC is meaningless and we'll get divide by inf errors if medium.is_pec: continue @@ -2360,7 +2356,6 @@ def _grid_corrections_2dmaterials(self, grid: Grid) -> Grid: with log as consolidated_logger: for structure in self.structures: if isinstance(structure.medium, Medium2D): - normal = structure.geometry._normal_2dmaterial grid_axes[normal] = True for axis, grid_axis in enumerate( @@ -2977,7 +2972,6 @@ def perturbed_mediums_copy( # do the same for background medium if it a medium with perturbation models. med = self.medium if isinstance(med, AbstractPerturbationMedium): - # get simulation's bounding box bounds = sim_bounds diff --git a/tidy3d/components/source.py b/tidy3d/components/source.py index 695fd6de9..f03bd5701 100644 --- a/tidy3d/components/source.py +++ b/tidy3d/components/source.py @@ -952,7 +952,6 @@ def plot( # pylint:disable=too-many-arguments ax: Ax = None, **patch_kwargs, ) -> Ax: - # call Source.plot but with the base of the arrow centered on the injection plane patch_kwargs["arrow_base"] = self.injection_plane_center ax = Source.plot(self, x=x, y=y, z=z, ax=ax, **patch_kwargs) diff --git a/tidy3d/components/validators.py b/tidy3d/components/validators.py index 9479265c1..997bfec78 100644 --- a/tidy3d/components/validators.py +++ b/tidy3d/components/validators.py @@ -162,7 +162,6 @@ def objects_in_sim_bounds(cls, val, values): for position_index, geometric_object in enumerate(val): if not sim_box.intersects(geometric_object.geometry): - message = ( f"'{geometric_object}' (at `simulation.{field_name}[{position_index}]`) " "is completely outside of simulation domain." @@ -288,7 +287,6 @@ def _warn_perturbed_val_range(cls, val, values): ) ): if perturb is not None: - # check real/complex type if perturb.is_complex and not allowed_complex: raise SetupError( @@ -307,7 +305,6 @@ def _warn_perturbed_val_range(cls, val, values): [real_range, imag_range], [np.real, np.imag], ["Re", "Im"] ): if part_range is not None: - min_allowed, max_allowed = part_range if min_allowed is not None and part_func(min_val) < min_allowed: diff --git a/tidy3d/components/viz.py b/tidy3d/components/viz.py index 3f7ea4abd..f5eb8ae4f 100644 --- a/tidy3d/components/viz.py +++ b/tidy3d/components/viz.py @@ -234,7 +234,6 @@ def plot_sim_3d(sim, width=800, height=800) -> None: """Make 3D display of simulation in ipyython notebook.""" try: - from IPython.display import display, HTML except ImportError as e: raise SetupError( diff --git a/tidy3d/log.py b/tidy3d/log.py index c98e0c10f..6dad2809f 100644 --- a/tidy3d/log.py +++ b/tidy3d/log.py @@ -378,7 +378,6 @@ def set_logging_file( del log.handlers["file"] try: - file = open(fname, filemode) except Exception: # TODO: catch specific exception log.error(f"File {fname} could not be opened") diff --git a/tidy3d/material_library/parametric_materials.py b/tidy3d/material_library/parametric_materials.py index 99c448b84..601199958 100644 --- a/tidy3d/material_library/parametric_materials.py +++ b/tidy3d/material_library/parametric_materials.py @@ -257,7 +257,6 @@ def integrand(E: float, omega: float) -> float: integration_min = GRAPHENE_INT_MIN integration_max = GRAPHENE_INT_MAX for i, omega in enumerate(omegas): - integral, _ = integrate.quad( integrand, integration_min, integration_max, args=(omega,), epsabs=GRAPHENE_INT_TOL ) @@ -299,7 +298,7 @@ def evaluate_coeffslist(omega: List[float], coeffslist: List[List[float]]) -> Li Each item in ``coeffslist`` is a list of four coefficients corresponding to a single Pade term.""" res = np.zeros(len(omega), dtype=complex) - for (alpha0, alpha1, beta1, beta2) in coeffslist: + for alpha0, alpha1, beta1, beta2 in coeffslist: res += (alpha0 + alpha1 * 1j * omega) / ( 1 + beta1 * 1j * omega + beta2 * (1j * omega) ** 2 ) @@ -347,7 +346,7 @@ def optimize( def get_pole_residue(coeffslist: List[List[float]]) -> PoleResidue: """Convert a list of Pade coefficients into a :class:`.PoleResidue` model.""" poles = [] - for (alpha0, alpha1, beta1, beta2) in coeffslist: + for alpha0, alpha1, beta1, beta2 in coeffslist: disc = beta1**2 - 4 * beta2 root1 = (beta1 + np.sqrt(complex(disc))) / (2 * beta2) root2 = (beta1 - np.sqrt(complex(disc))) / (2 * beta2) @@ -355,13 +354,13 @@ def get_pole_residue(coeffslist: List[List[float]]) -> PoleResidue: res2 = alpha1 / beta2 - res1 if disc > 0: - for (root, res) in zip([root1, root2], [res1, res2]): + for root, res in zip([root1, root2], [res1, res2]): poles.append((root, res / 2)) else: poles.append((root1, res1)) flipped_poles = [] - for (a, c) in poles: + for a, c in poles: if np.real(a) > 0: flipped_poles += [(-1j * np.conj(1j * a), c)] else: @@ -388,7 +387,7 @@ def _filter_poles(self, medium: PoleResidue) -> PoleResidue: """Clean up poles, merging poles at zero frequency.""" zero_res = 0 poles = [] - for (a, c) in medium.poles: + for a, c in medium.poles: if a == 0: zero_res += c elif abs(a) > 1e17: diff --git a/tidy3d/plugins/adjoint/components/base.py b/tidy3d/plugins/adjoint/components/base.py index f45d6bc98..350ebb7d6 100644 --- a/tidy3d/plugins/adjoint/components/base.py +++ b/tidy3d/plugins/adjoint/components/base.py @@ -103,7 +103,6 @@ def strip_data_array(sub_dict: dict) -> None: """Strip any elements of the dictionary with type "JaxDataArray", replace with tag.""" for key, val in sub_dict.items(): - if isinstance(val, dict): if "type" in val and val["type"] == "JaxDataArray": sub_dict[key] = JAX_DATA_ARRAY_TAG diff --git a/tidy3d/plugins/adjoint/components/data/data_array.py b/tidy3d/plugins/adjoint/components/data/data_array.py index 280b2e61f..c7df515df 100644 --- a/tidy3d/plugins/adjoint/components/data/data_array.py +++ b/tidy3d/plugins/adjoint/components/data/data_array.py @@ -190,7 +190,6 @@ def __mul__(self, other: JaxDataArray) -> JaxDataArray: if isinstance(other, JaxDataArray): new_values = self.as_jnp_array * other.as_jnp_array elif isinstance(other, xr.DataArray): - # handle case where other is missing dims present in self new_shape = list(self.shape) for dim_index, dim in enumerate(self.coords.keys()): @@ -274,7 +273,6 @@ def isel_single(self, coord_name: str, coord_index: int) -> JaxDataArray: # return just the values if no coordinate remain if not new_coords: - if new_values.shape: raise AdjointError( "All coordinates selected out, but raw data values are still multi-dimensional." diff --git a/tidy3d/plugins/adjoint/components/data/monitor_data.py b/tidy3d/plugins/adjoint/components/data/monitor_data.py index f9cb0491d..0bc1bf4da 100644 --- a/tidy3d/plugins/adjoint/components/data/monitor_data.py +++ b/tidy3d/plugins/adjoint/components/data/monitor_data.py @@ -86,7 +86,6 @@ def to_adjoint_sources(self, fwidth: float) -> List[ModeSource]: adjoint_sources = [] for amp, direction, freq, mode_index in zip(amps, directions, freqs, mode_indices): - # TODO: figure out where this factor comes from k0 = 2 * np.pi * freq / C_0 grad_const = k0 / 4 / ETA_0 @@ -235,12 +234,10 @@ def to_adjoint_sources(self, fwidth: float) -> List[CustomFieldSource]: if np.allclose(np.array(self.monitor.size), np.zeros(3)): for polarization, field_component in self.field_components.items(): - if field_component is None: continue for freq0 in field_component.coords["f"]: - omega0 = 2 * np.pi * freq0 scaling_factor = 1 / (MU_0 * omega0) @@ -261,7 +258,6 @@ def to_adjoint_sources(self, fwidth: float) -> List[CustomFieldSource]: sources.append(src_adj) else: - # Define source geometry based on coordinates in the data data_mins = [] data_maxs = [] @@ -287,7 +283,6 @@ def shift_value(coords) -> float: # Offset coordinates by source center since local coords are assumed in CustomCurrentSource for freq0 in tuple(self.field_components.values())[0].coords["f"]: - src_field_components = {} for name, field_component in self.field_components.items(): field_component = field_component.sel(f=freq0) @@ -412,7 +407,6 @@ def to_adjoint_sources(self, fwidth: float) -> List[PlaneWave]: adjoint_sources = [] for amp, order_x, order_y, freq, pol in zip(amp_vals, orders_x, orders_y, freqs, pols): - # select the propagation angles from the data angle_sel_kwargs = dict(orders_x=int(order_x), orders_y=int(order_y), f=float(freq)) angle_theta = float(theta_data.sel(**angle_sel_kwargs)) diff --git a/tidy3d/plugins/adjoint/components/geometry.py b/tidy3d/plugins/adjoint/components/geometry.py index 78a061657..29847520a 100644 --- a/tidy3d/plugins/adjoint/components/geometry.py +++ b/tidy3d/plugins/adjoint/components/geometry.py @@ -106,7 +106,6 @@ def compute_dotted_e_d_fields( d_mult_xyz = {} for dim in "xyz": - # grab the E field components e_fld_key = f"E{dim}" e_fwd = grad_data_fwd.field_components[e_fld_key] @@ -187,9 +186,7 @@ def store_vjp( # loop through all 6 surfaces (x,y,z) & (-, +) for dim_index, dim_normal in enumerate("xyz"): - for min_max_index, min_max_val in enumerate(bounds_intersect): - # get the normal coordinate of this surface normal_coord = {dim_normal: min_max_val[dim_index]} @@ -210,7 +207,6 @@ def store_vjp( d_area = 1.0 area_coords = {} for dim_plane, min_edge, max_edge in zip(dims_plane, mins_plane, maxs_plane): - # if there is no thickness along this dimension, skip it length_edge = max_edge - min_edge if length_edge == 0: @@ -230,7 +226,6 @@ def store_vjp( # for each field component for field_cmp_dim in "xyz": - # select the permittivity data eps_field_name = f"eps_{field_cmp_dim}{field_cmp_dim}" eps_data = grad_data_eps.field_components[eps_field_name] @@ -255,7 +250,6 @@ def store_vjp( # get gradient contribution for normal component using normal D field if field_cmp_dim == dim_normal: - # construct normal D fields, dotted together at surface d_normal = d_mult_xyz[field_cmp_dim] d_normal = d_normal.interp(**normal_coord, assume_sorted=True) @@ -268,7 +262,6 @@ def store_vjp( # get gradient contribution for parallel components using parallel E fields else: - # measure parallel E fields, dotted together at surface e_parallel = e_mult_xyz[field_cmp_dim] e_parallel = e_parallel.interp(**normal_coord, assume_sorted=True) diff --git a/tidy3d/plugins/adjoint/components/medium.py b/tidy3d/plugins/adjoint/components/medium.py index dc6826e7d..c967b3c7c 100644 --- a/tidy3d/plugins/adjoint/components/medium.py +++ b/tidy3d/plugins/adjoint/components/medium.py @@ -55,7 +55,6 @@ def _get_volume_disc( d_vol = 1.0 vol_coords = {} for coord_name, min_edge, max_edge in zip("xyz", rmin, rmax): - size = max_edge - min_edge # don't discretize this dimension if there is no thickness along it @@ -471,7 +470,6 @@ def store_vjp( vjp_field_components = {} for dim in "xyz": - eps_field_name = f"eps_{dim}{dim}" # grab the original data and its coordinatess @@ -488,7 +486,6 @@ def store_vjp( sum_axes = [] for dim_index, dim_pt in enumerate("xyz"): - coord_dim = coords[dim_pt] # if it's uniform / single pixel along this dim @@ -504,7 +501,6 @@ def store_vjp( # compute the length element along the dim, handling case of sim.size=0 if size > 0: - # discretize according to PTS_PER_WVL num_cells_dim = int(size * PTS_PER_WVL_INTEGRATION / wvl_mat) + 1 d_len = size / num_cells_dim @@ -513,7 +509,6 @@ def store_vjp( ) else: - # just interpolate at the single position, dL=1 to normalize out d_len = 1.0 coords_interp = np.array([(r_min + r_max) / 2.0]) diff --git a/tidy3d/plugins/adjoint/components/simulation.py b/tidy3d/plugins/adjoint/components/simulation.py index bdcedbf3d..4b3601a3f 100644 --- a/tidy3d/plugins/adjoint/components/simulation.py +++ b/tidy3d/plugins/adjoint/components/simulation.py @@ -352,7 +352,6 @@ def _run_time_adjoint(self: float) -> float: run_time_adjoint = RUN_TIME_FACTOR / self._fwidth_adjoint if self._is_multi_freq: - log.warning( f"{len(self.freqs_adjoint)} unique frequencies detected in the output monitors " f"with a minimum spacing of {self._min_delta_freq:.3e} (Hz). " diff --git a/tidy3d/plugins/adjoint/utils/filter.py b/tidy3d/plugins/adjoint/utils/filter.py index dc81f66a2..2a91fa04c 100644 --- a/tidy3d/plugins/adjoint/utils/filter.py +++ b/tidy3d/plugins/adjoint/utils/filter.py @@ -68,7 +68,6 @@ def _check_kernel_size(kernel: jnp.array, signal_in: jnp.array) -> jnp.array: input_shape = signal_in.shape if any((k_shape > in_shape for k_shape, in_shape in zip(kernel_shape, input_shape))): - # remove some pixels from the kernel to make things right new_kernel = kernel.copy() for axis, (len_kernel, len_input) in enumerate(zip(kernel_shape, input_shape)): diff --git a/tidy3d/plugins/adjoint/web.py b/tidy3d/plugins/adjoint/web.py index 87dd5401b..225ce1ac4 100644 --- a/tidy3d/plugins/adjoint/web.py +++ b/tidy3d/plugins/adjoint/web.py @@ -808,7 +808,6 @@ def run_async_local_fwd( sims_fwd = [] for simulation in simulations: - grad_mnts = simulation.get_grad_monitors( input_structures=simulation.input_structures, freqs_adjoint=simulation.freqs_adjoint ) @@ -880,7 +879,6 @@ def run_async_local_bwd( sims_vjp = [] for i, (sim_data_fwd, sim_data_adj) in enumerate(zip(batch_data_fwd, batch_data_adj)): - sim_data_adj = sim_data_adj.normalize_adjoint_fields() grad_data_fwd = sim_data_fwd.grad_data_symmetry diff --git a/tidy3d/plugins/dispersion/fit.py b/tidy3d/plugins/dispersion/fit.py index 2a0b79e73..7340d28f3 100644 --- a/tidy3d/plugins/dispersion/fit.py +++ b/tidy3d/plugins/dispersion/fit.py @@ -286,13 +286,11 @@ def fit( best_rms = np.inf with Progress(console=get_logging_console()) as progress: - task = progress.add_task( f"Fitting with {num_poles} to RMS of {tolerance_rms}...", total=num_tries ) while not progress.finished: - # if guess is provided use it in the first optimization run if guess is not None and progress.tasks[0].completed == 0: medium, rms_error = self._fit_single(num_poles=num_poles, guess=guess) diff --git a/tidy3d/plugins/dispersion/fit_fast.py b/tidy3d/plugins/dispersion/fit_fast.py index 7e3ee754c..72ea60fb5 100644 --- a/tidy3d/plugins/dispersion/fit_fast.py +++ b/tidy3d/plugins/dispersion/fit_fast.py @@ -292,7 +292,7 @@ def pole_residue(self) -> PoleResidue: def evaluate(self, omega: float) -> complex: """Evaluate model at omega in eV.""" eps = self.eps_inf - for (pole, res) in zip(self.poles, self.residues): + for pole, res in zip(self.poles, self.residues): eps += -res / (1j * omega + pole) - np.conj(res) / (1j * omega + np.conj(pole)) return eps @@ -616,7 +616,6 @@ def fit_non_passive(model: FastFitterData) -> FastFitterData: and len(model.poles) <= num_poles_range[1] and model.rms_error < best_model.rms_error ): - best_model = model return best_model @@ -718,7 +717,6 @@ def make_configs(): configs = make_configs() with Progress(console=get_logging_console()) as progress: - task = progress.add_task( f"Fitting to weighted RMS of {tolerance_rms}...", total=len(configs), @@ -726,7 +724,6 @@ def make_configs(): ) while not progress.finished: - # try different initial pole configurations for num_poles, relaxed, smooth, logspacing, optimize_eps_inf in configs: model = init_model.updated_copy( diff --git a/tidy3d/plugins/mode/solver.py b/tidy3d/plugins/mode/solver.py index 4e68f0d75..e09bd24a6 100644 --- a/tidy3d/plugins/mode/solver.py +++ b/tidy3d/plugins/mode/solver.py @@ -287,7 +287,6 @@ def conductivity_model_for_pec(eps, threshold=0.9 * pec_val): is_eps_complex = cls.isinstance_complex(eps_tensor) if not is_tensorial: - eps_spec = "diagonal" E, H, neff, keff = cls.solver_diagonal(**kwargs) if direction == "-": @@ -296,7 +295,6 @@ def conductivity_model_for_pec(eps, threshold=0.9 * pec_val): E[2] *= -1 elif not is_eps_complex: - eps_spec = "tensorial_real" E, H, neff, keff = cls.solver_tensorial(**kwargs, direction="+") if direction == "-": @@ -304,7 +302,6 @@ def conductivity_model_for_pec(eps, threshold=0.9 * pec_val): H = -np.conj(H) else: - eps_spec = "tensorial_complex" E, H, neff, keff = cls.solver_tensorial(**kwargs, direction=direction) diff --git a/tidy3d/plugins/resonance/resonance.py b/tidy3d/plugins/resonance/resonance.py index 20127b4e7..5cd4da93f 100644 --- a/tidy3d/plugins/resonance/resonance.py +++ b/tidy3d/plugins/resonance/resonance.py @@ -316,7 +316,6 @@ def _evaluate_matrices(self, signal: ArrayComplex1D, eigvals: ArrayComplex1D) -> u_matrices = np.zeros((3, nfreqs, nfreqs), dtype=complex) for pval in range(3): - u_matrices[pval, :, :] = prefactor * ( np.outer(zvals, zinvl[:, : half_len + 1] @ signal[pval:][: half_len + 1]) + np.outer( diff --git a/tidy3d/plugins/smatrix/smatrix.py b/tidy3d/plugins/smatrix/smatrix.py index ad98aa2de..56f5830cf 100644 --- a/tidy3d/plugins/smatrix/smatrix.py +++ b/tidy3d/plugins/smatrix/smatrix.py @@ -155,8 +155,7 @@ def sim_dict(self) -> Dict[str, Simulation]: sim_dict = {} mode_monitors = [self.to_monitor(port=port) for port in self.ports] - for (port_name, mode_index) in self.matrix_indices_run_sim: - + for port_name, mode_index in self.matrix_indices_run_sim: port = self.get_port_by_name(port_name=port_name) port_source = self.shift_port(port=port) @@ -197,7 +196,6 @@ def matrix_indices_run_sim(self) -> Tuple[MatrixIndex, ...]: # loop through rows of the full s matrix and record rows that still need running. source_indices_needed = [] for col_index in self.matrix_indices_source: - # loop through columns and keep track of whether each element is covered by mapping. matrix_elements_covered = [] for row_index in self.matrix_indices_monitor: @@ -442,14 +440,12 @@ def _construct_smatrix(self, batch_data: BatchData) -> SMatrixDataArray: # loop through source ports for col_index in self.matrix_indices_run_sim: - port_name_in, mode_index_in = col_index port_in = self.get_port_by_name(port_name=port_name_in) sim_data = batch_data[self._task_name(port=port_in, mode_index=mode_index_in)] for row_index in self.matrix_indices_monitor: - port_name_out, mode_index_out = row_index port_out = self.get_port_by_name(port_name=port_name_out) @@ -471,8 +467,7 @@ def _construct_smatrix(self, batch_data: BatchData) -> SMatrixDataArray: ] = s_matrix_elements # element can be determined by user-defined mapping - for ((row_in, col_in), (row_out, col_out), mult_by) in self.element_mappings: - + for (row_in, col_in), (row_out, col_out), mult_by in self.element_mappings: port_out_from, mode_index_out_from = row_in port_in_from, mode_index_in_from = col_in coords_from = dict( diff --git a/tidy3d/web/api/container.py b/tidy3d/web/api/container.py index 58229d6ff..2d0c921ed 100644 --- a/tidy3d/web/api/container.py +++ b/tidy3d/web/api/container.py @@ -405,7 +405,6 @@ def _upload(cls, val, values) -> None: solver_version = values.get("solver_version") jobs = {} for task_name, simulation in values.get("simulations").items(): - upload_kwargs = {key: values.get(key) for key in JobType._upload_fields} upload_kwargs["task_name"] = task_name upload_kwargs["simulation"] = simulation diff --git a/tidy3d/web/api/tidy3d_stub.py b/tidy3d/web/api/tidy3d_stub.py index 54d6922e8..2a9561b1a 100644 --- a/tidy3d/web/api/tidy3d_stub.py +++ b/tidy3d/web/api/tidy3d_stub.py @@ -28,7 +28,6 @@ class Tidy3dStub(BaseModel, TaskStub): - simulation: SimulationType = pd.Field(discriminator="type") @classmethod diff --git a/tidy3d/web/api/webapi.py b/tidy3d/web/api/webapi.py index 9b7a796ce..fedbba82e 100644 --- a/tidy3d/web/api/webapi.py +++ b/tidy3d/web/api/webapi.py @@ -285,7 +285,6 @@ def monitor(task_id: TaskId, verbose: bool = True) -> None: task_info = get_info(task_id) if task_info.taskType in ("MODE_SOLVER", "HEAT"): - log_level = "DEBUG" if verbose else "INFO" solver_name = "Mode" if task_info.taskType == "MODE_SOLVER" else "Heat" @@ -313,7 +312,6 @@ def monitor(task_id: TaskId, verbose: bool = True) -> None: return None elif task_info.taskType == "FDTD": - task_name = task_info.taskName break_statuses = ("success", "error", "diverged", "deleted", "draft", "abort")