Skip to content

Commit 624612c

Browse files
committed
Update parrec.py
Split up operations in `get_data()` to avoid creation of unnecessary temporary arrays that consume too much memory.
1 parent 21a5fc5 commit 624612c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

nibabel/parrec.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,8 @@ def _data_from_rec(rec_fileobj, in_shape, dtype, slice_indices, out_shape,
498498
rec_data = rec_data.reshape(out_shape, order='F')
499499
if scalings is not None:
500500
# Don't do in-place b/c this goes int16 -> float64
501-
rec_data = rec_data * scalings[0] + scalings[1]
501+
rec_data = rec_data * scalings[0]
502+
rec_data += scalings[1]
502503
return rec_data
503504

504505

0 commit comments

Comments
 (0)