From 2bad8cce331976af3e8b42cecaed76bb075ee8b3 Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Tue, 5 Mar 2024 08:16:05 -0500 Subject: [PATCH] FIX: Use np.asarray instead of np.array(..., copy=False) --- nibabel/affines.py | 2 +- nibabel/casting.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/nibabel/affines.py b/nibabel/affines.py index 05fdd7bb5..1478fd2dc 100644 --- a/nibabel/affines.py +++ b/nibabel/affines.py @@ -365,7 +365,7 @@ def rescale_affine(affine, shape, zooms, new_shape=None): A new affine transform with the specified voxel sizes """ - shape = np.array(shape, copy=False) + shape = np.asarray(shape) new_shape = np.array(new_shape if new_shape is not None else shape) s = voxel_sizes(affine) diff --git a/nibabel/casting.py b/nibabel/casting.py index f3e04f30f..09015135f 100644 --- a/nibabel/casting.py +++ b/nibabel/casting.py @@ -611,7 +611,7 @@ def int_abs(arr): >>> int_abs(np.array([-128, 127], dtype=np.float32)) array([128., 127.], dtype=float32) """ - arr = np.array(arr, copy=False) + arr = np.asarray(arr) dt = arr.dtype if dt.kind == 'u': return arr