Skip to content

Commit

Permalink
Fixed a minor codestyle issue.
Browse files Browse the repository at this point in the history
  • Loading branch information
hpparvi committed Feb 28, 2025
1 parent 0dc15ed commit 5911736
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions specreduce/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,12 +181,12 @@ def _mask_and_nonfinite_data_handling(
"""
if mask_treatment not in _ImageParser.implemented_mask_treatment_methods:
raise ValueError(
"`mask_treatment` must be one of "
"'mask_treatment' must be one of "
f"{_ImageParser.implemented_mask_treatment_methods}"
)

if mask is not None and (mask.dtype not in (bool, int)):
raise ValueError("`mask` must be a boolean or integer array.")
raise ValueError("'mask' must be a boolean or integer array.")

match mask_treatment:
case "apply":
Expand All @@ -210,7 +210,7 @@ def _mask_and_nonfinite_data_handling(
case "apply_nan_only":
mask = ~np.isfinite(image)
case "apply_mask_only":
mask = mask if mask is not None else np.zeros(image.shape, dtype=bool)
mask = mask.copy() if mask is not None else np.zeros(image.shape, dtype=bool)

if mask.all():
raise ValueError("Image is fully masked. Check for invalid values.")
Expand Down
2 changes: 1 addition & 1 deletion specreduce/tests/test_mask_treatment.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,4 +146,4 @@ def test_fully_masked():
image = mk_image()
image.mask[:] = 1
with pytest.raises(ValueError, match="Image is fully masked."):
parsed_image = _ImageParser()._parse_image(image, disp_axis=1, mask_treatment="apply")
_ImageParser()._parse_image(image, disp_axis=1, mask_treatment="apply")

0 comments on commit 5911736

Please sign in to comment.