From 5911736c939f87faf97134cd5902fe4843764e16 Mon Sep 17 00:00:00 2001 From: Hannu Parviainen Date: Fri, 28 Feb 2025 15:18:01 +0000 Subject: [PATCH] Fixed a minor codestyle issue. --- specreduce/core.py | 6 +++--- specreduce/tests/test_mask_treatment.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/specreduce/core.py b/specreduce/core.py index 0429b4a..4ec9f00 100644 --- a/specreduce/core.py +++ b/specreduce/core.py @@ -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": @@ -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.") diff --git a/specreduce/tests/test_mask_treatment.py b/specreduce/tests/test_mask_treatment.py index 5ac1237..38f4c19 100644 --- a/specreduce/tests/test_mask_treatment.py +++ b/specreduce/tests/test_mask_treatment.py @@ -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")