diff --git a/photutils/aperture/mask.py b/photutils/aperture/mask.py index 70c6a2f8f..7a0240d8e 100644 --- a/photutils/aperture/mask.py +++ b/photutils/aperture/mask.py @@ -7,12 +7,9 @@ import astropy.units as u import numpy as np -from astropy.utils import minversion __all__ = ['ApertureMask'] -COPY_IF_NEEDED = False if not minversion(np, '2.0') else None - class ApertureMask: """ @@ -39,7 +36,7 @@ def __init__(self, data, bbox): self.bbox = bbox self._mask = (self.data == 0) - def __array__(self, dtype=None, copy=COPY_IF_NEEDED): + def __array__(self, dtype=None, copy=None): """ Array representation of the mask data array (e.g., for matplotlib). diff --git a/photutils/aperture/tests/test_mask.py b/photutils/aperture/tests/test_mask.py index 5fa4fc254..cf4ee1815 100644 --- a/photutils/aperture/tests/test_mask.py +++ b/photutils/aperture/tests/test_mask.py @@ -6,7 +6,6 @@ import astropy.units as u import numpy as np import pytest -from astropy.utils import minversion from numpy.testing import assert_allclose, assert_almost_equal from photutils.aperture.bounding_box import BoundingBox @@ -14,8 +13,6 @@ from photutils.aperture.mask import ApertureMask from photutils.aperture.rectangle import RectangularAnnulus -NUMPY_LT_2_0 = not minversion(np, '2.0') -COPY_IF_NEEDED = False if NUMPY_LT_2_0 else None POSITIONS = [(-20, -20), (-20, 20), (20, -20), (60, 60)] @@ -51,7 +48,7 @@ def test_mask_copy(): # no copy; copy=None returns a copy only if __array__ returns a copy # copy=None was introduced in NumPy 2.0 mask = ApertureMask(np.ones((10, 10)), bbox) - mask_copy = np.array(mask, copy=COPY_IF_NEEDED) + mask_copy = np.array(mask, copy=None) mask_copy[0, 0] = 100.0 assert mask.data[0, 0] == 100.0 diff --git a/photutils/psf/model_plotting.py b/photutils/psf/model_plotting.py index e7924fbfa..682da242b 100644 --- a/photutils/psf/model_plotting.py +++ b/photutils/psf/model_plotting.py @@ -3,9 +3,7 @@ Define tools to plot Gridded PSF models. """ -import astropy import numpy as np -from astropy.utils import minversion from astropy.visualization import simple_norm __all__ = [] @@ -142,21 +140,13 @@ def plot_grid(self, *, ax=None, vmax_scale=None, peak_norm=False, vmax_scale = 0.03 vmax = data.max() * vmax_scale vmin = -vmax - if minversion(astropy, '6.1'): - norm = simple_norm(data, 'linear', vmin=vmin, vmax=vmax) - else: - norm = simple_norm(data, 'linear', min_cut=vmin, max_cut=vmax) + norm = simple_norm(data, 'linear', vmin=vmin, vmax=vmax) else: if vmax_scale is None: vmax_scale = 1.0 vmax = data.max() * vmax_scale vmin = vmax / 1.0e4 - if minversion(astropy, '6.1'): - norm = simple_norm(data, 'log', vmin=vmin, vmax=vmax, - log_a=1.0e4) - else: - norm = simple_norm(data, 'log', min_cut=vmin, max_cut=vmax, - log_a=1.0e4) + norm = simple_norm(data, 'log', vmin=vmin, vmax=vmax, log_a=1.0e4) # Set up the coordinate axes to later set tick labels based on # detector ePSF coordinates. This sets up axes to have, behind the diff --git a/pyproject.toml b/pyproject.toml index 3bd4592ad..dcb2983b3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -242,6 +242,10 @@ exclude = [ # GL08: docstrings defined by a decorator '\.plot_grid$', + 'PSFPhotometry\.make_model_image$', + 'PSFPhotometry\.make_residual_image$', + 'IterativePSFPhotometry\.make_model_image$', + 'IterativePSFPhotometry\.make_residual_image$', # GL08: docstrings inherited from base classes '\.to_mask$',