From 17809b067ddd22de438b9b49b116c2c496b7a752 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=20Haitz=20Legarreta=20Gorro=C3=B1o?= Date: Wed, 26 Jun 2024 19:51:43 -0400 Subject: [PATCH] RF: Prefer using `np.vstack` instead of `np.row_stack` Prefer using `np.vstack` instead of `np.row_stack`. Fixes: ``` nibabel/ecat.py: 3 warnings /home/runner/work/nibabel/nibabel/nibabel/ecat.py:393: DeprecationWarning: `row_stack` alias is deprecated. Use `np.vstack` directly. return np.row_stack(mlists) ``` and similar warnings. Raised for example at: https://github.com/nipy/nibabel/actions/runs/9637811213/job/26577586721#step:7:186 Documentation: https://numpy.org/doc/1.26/reference/generated/numpy.row_stack.html This helps preparing for full Numpy 2.0 compatibility. Documentation: https://numpy.org/doc/stable/numpy_2_0_migration_guide.html#main-namespace --- nibabel/brikhead.py | 2 +- nibabel/ecat.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/nibabel/brikhead.py b/nibabel/brikhead.py index 3a3cfd087..da8692efd 100644 --- a/nibabel/brikhead.py +++ b/nibabel/brikhead.py @@ -391,7 +391,7 @@ def get_affine(self): # AFNI default is RAI- == LPS+ == DICOM order. We need to flip RA sign # to align with nibabel RAS+ system affine = np.asarray(self.info['IJK_TO_DICOM_REAL']).reshape(3, 4) - affine = np.row_stack((affine * [[-1], [-1], [1]], [0, 0, 0, 1])) + affine = np.vstack((affine * [[-1], [-1], [1]], [0, 0, 0, 1])) return affine def get_data_scaling(self): diff --git a/nibabel/ecat.py b/nibabel/ecat.py index 03a4c72b9..34ff06323 100644 --- a/nibabel/ecat.py +++ b/nibabel/ecat.py @@ -390,7 +390,7 @@ def read_mlist(fileobj, endianness): mlist_index += n_rows if mlist_block_no <= 2: # should block_no in (1, 2) be an error? break - return np.row_stack(mlists) + return np.vstack(mlists) def get_frame_order(mlist):