Skip to content

Commit 4977b45

Browse files
committed
RF: Circumvents a deprecation warning from np.fromstring
``` /Users/arokem/.virtualenvs/afq/lib/python3.7/site-packages/nibabel/streamlines/trk.py:562: DeprecationWarning: The binary mode of fromstring is deprecated, as it behaves surprisingly on unicode inputs. Use frombuffer instead header_rec = np.fromstring(string=header_str, dtype=header_2_dtype) ```
1 parent a960b92 commit 4977b45

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

nibabel/streamlines/trk.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -559,8 +559,8 @@ def _read_header(fileobj):
559559

560560
# Read the header in one block.
561561
header_str = f.read(header_2_dtype.itemsize)
562-
header_rec = np.fromstring(string=header_str, dtype=header_2_dtype)
563-
562+
header_rec = np.frombuffer(buffer=header_str, dtype=header_2_dtype)
563+
header_rec.setflags(write=1)
564564
# Check endianness
565565
endianness = native_code
566566
if header_rec['hdr_size'] != TrkFile.HEADER_SIZE:

0 commit comments

Comments
 (0)