From 49370882457d6dde3ee621d2991f023824623b93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Robert?= Date: Wed, 19 Jun 2024 11:21:31 +0200 Subject: [PATCH] BUG: adjust copy semantics for compatibility with numpy 2 --- specutils/utils/quantity_model.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/specutils/utils/quantity_model.py b/specutils/utils/quantity_model.py index 07ec57064..6645a0926 100644 --- a/specutils/utils/quantity_model.py +++ b/specutils/utils/quantity_model.py @@ -1,7 +1,10 @@ +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 +75,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)