Skip to content

Commit 17809b0

Browse files
committed
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
1 parent d18022d commit 17809b0

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

nibabel/brikhead.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ def get_affine(self):
391391
# AFNI default is RAI- == LPS+ == DICOM order. We need to flip RA sign
392392
# to align with nibabel RAS+ system
393393
affine = np.asarray(self.info['IJK_TO_DICOM_REAL']).reshape(3, 4)
394-
affine = np.row_stack((affine * [[-1], [-1], [1]], [0, 0, 0, 1]))
394+
affine = np.vstack((affine * [[-1], [-1], [1]], [0, 0, 0, 1]))
395395
return affine
396396

397397
def get_data_scaling(self):

nibabel/ecat.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ def read_mlist(fileobj, endianness):
390390
mlist_index += n_rows
391391
if mlist_block_no <= 2: # should block_no in (1, 2) be an error?
392392
break
393-
return np.row_stack(mlists)
393+
return np.vstack(mlists)
394394

395395

396396
def get_frame_order(mlist):

0 commit comments

Comments
 (0)