Skip to content

Commit

Permalink
Replace use of deprecated np.bool with dtype alias np.bool_
Browse files Browse the repository at this point in the history
  • Loading branch information
DiamondJoseph committed Oct 18, 2024
1 parent 6291ec7 commit 288680b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/scanspec/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
C = TypeVar("C")
T = TypeVar("T")

GapArray = npt.NDArray[np.bool]
GapArray = npt.NDArray[np.bool_]


def discriminated_union_of_subclasses(
Expand Down
8 changes: 4 additions & 4 deletions src/scanspec/regions.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"find_regions",
]

NpMask = npt.NDArray[np.bool]
NpMask = npt.NDArray[np.bool_]


@discriminated_union_of_subclasses
Expand Down Expand Up @@ -96,7 +96,7 @@ def get_mask(region: Region[Axis], points: AxesPoints[Axis]) -> NpMask:
if needs_mask:
return region.mask(points)
else:
return np.ones(len(list(points.values())[0]), dtype=np.bool)
return np.ones(len(list(points.values())[0]), dtype=np.bool_)


def _merge_axis_sets(axis_sets: list[set[Axis]]) -> Iterator[set[Axis]]:
Expand Down Expand Up @@ -287,11 +287,11 @@ def mask(self, points: AxesPoints[Axis]) -> NpMask: # noqa: D102
x = points[self.x_axis]
y = points[self.y_axis]
v1x, v1y = self.x_verts[-1], self.y_verts[-1]
mask = np.full(len(x), False, dtype=np.bool)
mask = np.full(len(x), False, dtype=np.bool_)
for v2x, v2y in zip(self.x_verts, self.y_verts, strict=False):
# skip horizontal edges
if v2y != v1y:
vmask = np.full(len(x), False, dtype=np.bool)
vmask = np.full(len(x), False, dtype=np.bool_)
vmask |= (y < v2y) & (y >= v1y)
vmask |= (y < v1y) & (y >= v2y)
t = (y - v1y) / (v2y - v1y)
Expand Down

0 comments on commit 288680b

Please sign in to comment.