Skip to content

Commit

Permalink
RF: Make sure that ASCII-encoded DataArrays are returned with expecte…
Browse files Browse the repository at this point in the history
…d shape
  • Loading branch information
manifest-rules committed Feb 23, 2024
1 parent 79792de commit 6ffeeac
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions nibabel/gifti/parse_gifti_fast.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ def read_data_block(darray, fname, data, mmap):
# GIFTI_ENCODING_ASCII
c = StringIO(data)
da = np.loadtxt(c, dtype=dtype)
# Reshape to dims specified in GiftiDataArray attributes, but preserve
# existing behaviour of loading as 1D for arrays with a dimension of
# length 1
da = da.reshape(darray.dims).squeeze()
return da # independent of the endianness
elif enclabel not in ('B64BIN', 'B64GZ', 'External'):
return 0
Expand Down

0 comments on commit 6ffeeac

Please sign in to comment.