diff --git a/astromodels/functions/function.py b/astromodels/functions/function.py index d58757a1..3ab23b3e 100644 --- a/astromodels/functions/function.py +++ b/astromodels/functions/function.py @@ -1479,7 +1479,7 @@ def __call__(self, x): # Transform the input to an array of floats. If x is a single number, this will be an array of size 1 - new_input = np.array(x, dtype=float, ndmin=1, copy=False) + new_input = np.asarray(x, dtype=float) # Compute the function @@ -1705,8 +1705,8 @@ def __call__(self, x, y, *args, **kwargs): # Transform the input to an array of floats - new_x = np.array(x, dtype=float, ndmin=1, copy=False) - new_y = np.array(y, dtype=float, ndmin=1, copy=False) + new_x = np.asarray(x, dtype=float) + new_y = np.asarray(y, dtype=float) # Compute the function @@ -1876,9 +1876,9 @@ def __call__(self, x, y, z): # This is either a single number or a list # Transform the input to an array of floats - new_x = np.array(x, dtype=float, ndmin=1, copy=False) - new_y = np.array(y, dtype=float, ndmin=1, copy=False) - new_z = np.array(z, dtype=float, ndmin=1, copy=False) + new_x = np.asarray(x, dtype=float) + new_y = np.asarray(y, dtype=float) + new_z = np.asarray(z, dtype=float) # Compute the function diff --git a/astromodels/functions/functions_1D/extinction.py b/astromodels/functions/functions_1D/extinction.py index 3c55d5c6..0be335fd 100644 --- a/astromodels/functions/functions_1D/extinction.py +++ b/astromodels/functions/functions_1D/extinction.py @@ -89,7 +89,7 @@ def evaluate(self, x, e_bmv, rv, redshift): if isinstance(x, astropy_units.Quantity): - _x = np.array(x.to("keV").value, ndmin=1, copy=False, dtype=float) + _x = np.asarray(x.to("keV").value, dtype=float) _unit = astropy_units.cm**2 _y_unit = astropy_units.dimensionless_unscaled diff --git a/astromodels/functions/template_model.py b/astromodels/functions/template_model.py index 5861da0f..e351e384 100644 --- a/astromodels/functions/template_model.py +++ b/astromodels/functions/template_model.py @@ -760,8 +760,8 @@ def _interpolate(self, energies, scale, parameters_values): # a dimensionless quantity (actually we take the .value property) because otherwise # the logarithm below will fail. - energies = np.array( - energies.to("keV").value, ndmin=1, copy=False, dtype=float + energies = np.asarray( + energies.to("keV").value, dtype=float ) # Same for the scale diff --git a/astromodels/xspec/factory.py b/astromodels/xspec/factory.py index edef7d3e..405be7f0 100644 --- a/astromodels/xspec/factory.py +++ b/astromodels/xspec/factory.py @@ -486,7 +486,7 @@ def evaluate(self, x, $PARAMETERS_NAMES$): if isinstance(x, u.Quantity): - x = np.array(x.to('keV').value, ndmin=1, copy=False, dtype=float) + x = np.asarray(x.to('keV').value, dtype=float) quantity = True