diff --git a/nibabel/gifti/parse_gifti_fast.py b/nibabel/gifti/parse_gifti_fast.py index 4cdbd3d768..de02f4c76b 100644 --- a/nibabel/gifti/parse_gifti_fast.py +++ b/nibabel/gifti/parse_gifti_fast.py @@ -47,7 +47,7 @@ def read_data_block(encoding, endian, ordering, datatype, shape, data): dec = base64.b64decode(data.encode('ascii')) dt = data_type_codes.type[datatype] sh = tuple(shape) - newarr = np.fromstring(dec, dtype=dt) + newarr = np.frombuffer(dec, dtype=dt) if len(newarr.shape) != len(sh): newarr = newarr.reshape(sh, order=ord) @@ -59,7 +59,7 @@ def read_data_block(encoding, endian, ordering, datatype, shape, data): zdec = zlib.decompress(dec) dt = data_type_codes.type[datatype] sh = tuple(shape) - newarr = np.fromstring(zdec, dtype=dt) + newarr = np.frombuffer(zdec, dtype=dt) if len(newarr.shape) != len(sh): newarr = newarr.reshape(sh, order=ord) diff --git a/nibabel/nifti1.py b/nibabel/nifti1.py index 60ff818e57..84cfed956a 100644 --- a/nibabel/nifti1.py +++ b/nibabel/nifti1.py @@ -579,7 +579,7 @@ def from_fileobj(klass, fileobj, size, byteswap): # otherwise there should be a full extension header if not len(ext_def) == 8: raise HeaderDataError('failed to read extension header') - ext_def = np.fromstring(ext_def, dtype=np.int32) + ext_def = np.frombuffer(ext_def, dtype=np.int32) if byteswap: ext_def = ext_def.byteswap() # be extra verbose diff --git a/nibabel/parrec.py b/nibabel/parrec.py index 1dfa998394..5c27ca9c04 100644 --- a/nibabel/parrec.py +++ b/nibabel/parrec.py @@ -341,7 +341,7 @@ def _process_gen_dict(gen_dict): value = props[1](value) elif len(props) == 3: # array with dtype and shape - value = np.fromstring(value, props[1], sep=' ') + value = np.frombuffer(value, props[1], sep=' ') # if shape is None, allow arbitrary length if props[2] is not None: value.shape = props[2] diff --git a/nibabel/streamlines/trk.py b/nibabel/streamlines/trk.py index 36a605d53f..3b633500bd 100644 --- a/nibabel/streamlines/trk.py +++ b/nibabel/streamlines/trk.py @@ -559,7 +559,7 @@ def _read_header(fileobj): # Read the header in one block. header_str = f.read(header_2_dtype.itemsize) - header_rec = np.fromstring(string=header_str, dtype=header_2_dtype) + header_rec = np.frombuffer(string=header_str, dtype=header_2_dtype) # Check endianness endianness = native_code