Skip to content
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

Fix CI failures #155

Open
wants to merge 3 commits into
base: main
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
2 changes: 1 addition & 1 deletion schema.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions src/scanspec/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,9 +337,9 @@ def concat(self, other: Frames[Axis], gap: bool = False) -> Frames[Axis]:
{'x': array([1, 2, 3, 4, 5, 6]), 'y': array([6, 5, 4, 3, 2, 1])}

"""
assert set(self.axes()) == set(
other.axes()
), f"axes {self.axes()} != {other.axes()}"
assert set(self.axes()) == set(other.axes()), (
f"axes {self.axes()} != {other.axes()}"
)

def concat_dict(ds: Sequence[AxesPoints[Axis]]) -> AxesPoints[Axis]:
# Concat each array in midpoints, lower, upper. E.g.
Expand Down
6 changes: 3 additions & 3 deletions src/scanspec/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@
self._verts3d = xs, ys, zs

# Added here because of https://github.com/matplotlib/matplotlib/issues/21688
def do_3d_projection(self, renderer: Any = None):
def do_3d_projection(self, renderer: Any = None): # type: ignore
xs3d, ys3d, zs3d = self._verts3d
xs, ys, zs = proj3d.proj_transform(xs3d, ys3d, zs3d, self.axes.M) # type: ignore
self.set_positions((xs[0], ys[0]), (xs[1], ys[1]))
self.set_positions((xs[0], ys[0]), (xs[1], ys[1])) # type: ignore

Check warning on line 50 in src/scanspec/plot.py

View check run for this annotation

Codecov / codecov/patch

src/scanspec/plot.py#L50

Added line #L50 was not covered by tests

return np.min(zs)
return np.min(zs) # type: ignore

Check warning on line 52 in src/scanspec/plot.py

View check run for this annotation

Codecov / codecov/patch

src/scanspec/plot.py#L52

Added line #L52 was not covered by tests

@property
def verts3d(
Expand Down
2 changes: 1 addition & 1 deletion src/scanspec/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ def _sub_sample(frames: Frames[str], ratio: float) -> Frames[str]:
return frames.extract(indexes, calculate_gap=False)


def _calc_smallest_step(points: list[npt.NDArray[np.float64]]) -> float:
def _calc_smallest_step(points: list[npt.NDArray[np.number[Any]]]) -> float:
# Calc abs diffs of all axes, ignoring any zero values
absolute_diffs = [_abs_diffs(axis_midpoints) for axis_midpoints in points]
# Normalize and remove zeros
Expand Down
28 changes: 15 additions & 13 deletions src/scanspec/specs.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,9 +234,9 @@ def calculate( # noqa: D102
) -> list[Frames[Axis]]:
frames_left = self.left.calculate(bounds, nested)
frames_right = self.right.calculate(bounds, nested)
assert len(frames_left) >= len(
frames_right
), f"Zip requires len({self.left}) >= len({self.right})"
assert len(frames_left) >= len(frames_right), (
f"Zip requires len({self.left}) >= len({self.right})"
)

# Pad and expand the right to be the same size as left. Special case, if
# only one Frames object with size 1, expand to the right size
Expand All @@ -262,9 +262,9 @@ def calculate( # noqa: D102
combined = left
else:
combined = left.zip(right)
assert isinstance(
combined, Frames
), f"Padding went wrong {frames_left} {padded_right}"
assert isinstance(combined, Frames), (
f"Padding went wrong {frames_left} {padded_right}"
)
frames.append(combined)
return frames

Expand Down Expand Up @@ -450,7 +450,9 @@ def calculate( # noqa: D102


def _dimensions_from_indexes(
func: Callable[[npt.NDArray[np.float64]], dict[Axis, npt.NDArray[np.float64]]],
func: Callable[
[npt.NDArray[np.floating[Any]]], dict[Axis, npt.NDArray[np.floating[Any]]]
],
axes: list[Axis],
num: int,
bounds: bool,
Expand Down Expand Up @@ -496,8 +498,8 @@ def axes(self) -> list[Axis]: # noqa: D102
return [self.axis]

def _line_from_indexes(
self, indexes: npt.NDArray[np.float64]
) -> dict[Axis, npt.NDArray[np.float64]]:
self, indexes: npt.NDArray[np.floating[Any]]
) -> dict[Axis, npt.NDArray[np.floating[Any]]]:
if self.num == 1:
# Only one point, stop-start gives length of one point
step = self.stop - self.start
Expand Down Expand Up @@ -586,8 +588,8 @@ def axes(self) -> list[Axis]: # noqa: D102
return [self.axis]

def _repeats_from_indexes(
self, indexes: npt.NDArray[np.float64]
) -> dict[Axis, npt.NDArray[np.float64]]:
self, indexes: npt.NDArray[np.floating[Any]]
) -> dict[Axis, npt.NDArray[np.floating[Any]]]:
return {self.axis: np.full(len(indexes), self.value)}

def calculate( # noqa: D102
Expand Down Expand Up @@ -633,8 +635,8 @@ def axes(self) -> list[Axis]: # noqa: D102
return [self.y_axis, self.x_axis]

def _spiral_from_indexes(
self, indexes: npt.NDArray[np.float64]
) -> dict[Axis, npt.NDArray[np.float64]]:
self, indexes: npt.NDArray[np.floating[Any]]
) -> dict[Axis, npt.NDArray[np.floating[Any]]]:
# simplest spiral equation: r = phi
# we want point spacing across area to be the same as between rings
# so: sqrt(area / num) = ring_spacing
Expand Down
Loading