Skip to content

Commit

Permalink
Update to [email protected]
Browse files Browse the repository at this point in the history
  • Loading branch information
yaugenst-flex committed Jul 29, 2024
1 parent 85bc872 commit 3cf3300
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 35 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.4.8"
rev: "v0.5.5"
hooks:
- id: ruff
args: [ --fix ]
Expand Down
43 changes: 22 additions & 21 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ joblib = "*"
### Optional dependencies ###
# development core
bump-my-version = { version = "*", optional = true }
ruff = { version = "0.4.8", optional = true }
ruff = { version = "0.5.5", optional = true }
coverage = { version = "*", optional = true }
dill = { version = "*", optional = true }
ipython = { version = "*", optional = true }
Expand Down
2 changes: 1 addition & 1 deletion tests/test_data/test_sim_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ def test_to_hdf5(tmp_path):
sim_data.to_file(fname=FNAME)
# Make sure data is loaded as Tidy3dDataArray and not xarray DataArray
for data, data2 in zip(sim_data.data, sim_data2.data):
assert type(data) == type(data2)
assert type(data) is type(data2)
assert sim_data == sim_data2


Expand Down
2 changes: 1 addition & 1 deletion tidy3d/components/data/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -2898,7 +2898,7 @@ def _check_same_coordinates(
# we can have xarray.DataArray's of different types but still same coordinates
# we will deal with that case separately
both_xarrays = isinstance(a, xr.DataArray) and isinstance(b, xr.DataArray)
if (not both_xarrays) and type(a) != type(b):
if (not both_xarrays) and type(a) is type(b):
return False

if isinstance(a, UnstructuredGridDataset):
Expand Down
13 changes: 3 additions & 10 deletions tidy3d/components/field_projection.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from __future__ import annotations

from typing import Dict, List, Tuple, Union
from typing import List, Tuple, Union

import numpy as np
import pydantic.v1 as pydantic
Expand Down Expand Up @@ -91,13 +91,6 @@ class FieldProjector(Tidy3dBaseModel):
units=MICROMETER,
)

currents: Dict[str, xr.Dataset] = pydantic.Field(
None,
title="Surface current densities",
description="Dictionary mapping monitor name to an ``xarray.Dataset`` storing the "
"surface current densities.",
)

@cached_property
def is_2d_simulation(self) -> bool:
non_zero_dims = sum(1 for size in self.sim_data.simulation.size if size != 0)
Expand Down Expand Up @@ -362,7 +355,7 @@ def integrate_1d(
pts_u: np.ndarray,
):
"""Trapezoidal integration in two dimensions."""
return np.trapz(np.squeeze(function) * np.squeeze(phase), pts_u, axis=0)
return np.trapz(np.squeeze(function) * np.squeeze(phase), pts_u, axis=0) # noqa: NPY201

def integrate_2d(
self,
Expand All @@ -372,7 +365,7 @@ def integrate_2d(
pts_v: np.ndarray,
):
"""Trapezoidal integration in two dimensions."""
return np.trapz(np.trapz(np.squeeze(function) * phase, pts_u, axis=0), pts_v, axis=0)
return np.trapz(np.trapz(np.squeeze(function) * phase, pts_u, axis=0), pts_v, axis=0) # noqa: NPY201

def _far_fields_for_surface(
self,
Expand Down

0 comments on commit 3cf3300

Please sign in to comment.