diff --git a/CHANGES.rst b/CHANGES.rst index 0c8248dcb..d7d3344fe 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -10,6 +10,8 @@ Bug Fixes Other Changes and Additions ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +- Compatibility with numpy 2.0 and astropy 6.1. [#1130] + 1.13.0 (2024-02-19) ------------------- diff --git a/specutils/utils/quantity_model.py b/specutils/utils/quantity_model.py index 07ec57064..a25d661dd 100644 --- a/specutils/utils/quantity_model.py +++ b/specutils/utils/quantity_model.py @@ -1,6 +1,8 @@ +import numpy as np from astropy import units as u __all__ = ['QuantityModel'] +_NUMPY_COPY_IF_NEEDED = False if np.__version__.startswith("1.") else None class QuantityModel: @@ -72,4 +74,4 @@ def __repr__(self): def __call__(self, x, *args, **kwargs): unitlessx = x.to(self.input_units).value result = self.unitless_model(unitlessx, *args, **kwargs) - return u.Quantity(result, self.return_units, copy=False) + return u.Quantity(result, self.return_units, copy=_NUMPY_COPY_IF_NEEDED)