Skip to content

Commit

Permalink
BUG: adjust copy semantics for compatibility with numpy 2
Browse files Browse the repository at this point in the history
  • Loading branch information
neutrinoceros committed Jun 19, 2024
1 parent fb5bd08 commit 4937088
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion specutils/utils/quantity_model.py
Original file line number Diff line number Diff line change
@@ -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:
"""
Expand Down Expand Up @@ -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)

0 comments on commit 4937088

Please # to comment.