Skip to content

Commit ec90b0a

Browse files
committed
RF: docstring rewrite; a PEP8 fix
Suggested by Eric L from PR review.
1 parent a8e5b82 commit ec90b0a

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

nibabel/spatialimages.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,12 @@ def get_data(self, caching='fill'):
456456
store in an internal cache. Future calls to ``get_data`` will return
457457
the cached copy.
458458
459+
Once the data has been cached and returned from a proxy array, the
460+
cached array can be modified by modifying the returned array, because
461+
the returned array is a reference to the array in the cache. Regardless
462+
of the `caching` flag, this is always true of an in-memory image (where
463+
the image data is an array rather than an array proxy).
464+
459465
Parameters
460466
----------
461467
caching : {'fill', 'unchanged'}, optional
@@ -464,16 +470,17 @@ def get_data(self, caching='fill'):
464470
is an array proxy, and the image data has not yet been cached, then
465471
'fill' (the default) will read the data from the array proxy, and
466472
store in an internal cache, so that future calls to ``get_data``
467-
will return the cached copy. If 'unchanged' then leave the cache
468-
unchanged; return the cached copy if it exists, if not, load the
469-
data from disk and return that, but without filling the cache.
473+
will return the cached copy. If 'unchanged' then leave the current
474+
state of caching unchanged; return the cached copy if it exists, if
475+
not, load the data from disk and return that, but without filling
476+
the cache.
470477
471478
Returns
472479
-------
473480
data : array
474481
array of image data
475482
"""
476-
if not caching in ('fill', 'unchanged'):
483+
if caching not in ('fill', 'unchanged'):
477484
raise ValueError('caching value should be "fill" or "unchanged"')
478485
if self._data_cache is not None:
479486
return self._data_cache

0 commit comments

Comments
 (0)