Skip to content

Commit 0d0ece1

Browse files
committed
[DOC] mentioned that the file needs to be opened in binary mode if provided
1 parent bac044b commit 0d0ece1

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

nibabel/streamlines/tck.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,9 @@ def is_correct_format(cls, fileobj):
8484
Parameters
8585
----------
8686
fileobj : string or file-like object
87-
If string, a filename; otherwise an open file-like object
88-
pointing to TCK file (and ready to read from the beginning
89-
of the TCK header data). Note that calling this function
87+
If string, a filename; otherwise an open file-like object in
88+
binary mode pointing to TCK file (and ready to read from the
89+
beginning of the TCK header). Note that calling this function
9090
does not change the file position.
9191
9292
Returns
@@ -119,9 +119,9 @@ def load(cls, fileobj, lazy_load=False):
119119
Parameters
120120
----------
121121
fileobj : string or file-like object
122-
If string, a filename; otherwise an open file-like object
123-
pointing to TCK file (and ready to read from the beginning
124-
of the TCK header). Note that calling this function
122+
If string, a filename; otherwise an open file-like object in
123+
binary mode pointing to TCK file (and ready to read from the
124+
beginning of the TCK header). Note that calling this function
125125
does not change the file position.
126126
lazy_load : {False, True}, optional
127127
If True, load streamlines in a lazy manner i.e. they will not be
@@ -173,9 +173,9 @@ def save(self, fileobj):
173173
Parameters
174174
----------
175175
fileobj : string or file-like object
176-
If string, a filename; otherwise an open file-like object
177-
pointing to TCK file (and ready to write from the beginning
178-
of the TCK header data).
176+
If string, a filename; otherwise an open file-like object in
177+
binary mode pointing to TCK file (and ready to write from the
178+
beginning of the TCK header data).
179179
"""
180180
# Enforce float32 in little-endian byte order for data.
181181
dtype = np.dtype('<f4')
@@ -241,8 +241,8 @@ def _write_header(fileobj, header):
241241
Parameters
242242
----------
243243
fileobj : file-like object
244-
An open binary file object pointing to TCK file (and ready to
245-
write at the beginning of the TCK header).
244+
An open file-like object in binary mode pointing to TCK file (and
245+
ready to read from the beginning of the TCK header).
246246
"""
247247
# Fields to exclude
248248
exclude = [Field.MAGIC_NUMBER, # Handled separately.
@@ -295,9 +295,9 @@ def _read_header(fileobj):
295295
Parameters
296296
----------
297297
fileobj : string or file-like object
298-
If string, a filename; otherwise an open binary file-like object
299-
pointing to TCK file (and ready to read from the beginning
300-
of the TCK header). Note that calling this function
298+
If string, a filename; otherwise an open file-like object in
299+
binary mode pointing to TCK file (and ready to read from the
300+
beginning of the TCK header). Note that calling this function
301301
does not change the file position.
302302
303303
Returns
@@ -368,9 +368,9 @@ def _read(cls, fileobj, header, buffer_size=4):
368368
Parameters
369369
----------
370370
fileobj : string or file-like object
371-
If string, a filename; otherwise an open file-like object
372-
pointing to TCK file (and ready to read from the beginning
373-
of the TCK header). Note that calling this function
371+
If string, a filename; otherwise an open file-like object in
372+
binary mode pointing to TCK file (and ready to read from the
373+
beginning of the TCK header). Note that calling this function
374374
does not change the file position.
375375
header : dict
376376
Metadata associated with this tractogram file.

0 commit comments

Comments
 (0)