Skip to content

Commit 83a8b65

Browse files
authored
Merge pull request #301 from jhlegarreta/doc/fix-getitem-extras-docstring
DOC: Fix extras docstring in base data class `__getitem__`
2 parents 77dc381 + a50bfed commit 83a8b65

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

src/nifreeze/data/base.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -135,13 +135,16 @@ def __getitem__(
135135
otherwise it may have shape ``(X, Y, Z, k)``.
136136
affine : :obj:`~numpy.ndarray` or ``None``
137137
The corresponding per-volume motion affine(s) or ``None`` if identity transform(s).
138-
:obj:`tuple`
139-
A variable-length tuple of additional per-volume fields. The precise
140-
number, order, and types of elements in this tuple are determined by
141-
the type variables :obj:`~nifreeze.data.base.Ts`. Subclasses provide
142-
these values by implementing :meth:`_getextra`. If no extra fields
143-
are defined, this will be an empty tuple. When a single extra field
144-
is present, it appears as a one-element tuple.
138+
Unpack[:obj:`~nifreeze.data.base.Ts`]
139+
Zero or more additional per-volume fields returned as unpacked
140+
trailing elements. The exact number, order, and types of elements
141+
are determined by the type variables :obj:`~nifreeze.data.base.Ts`
142+
and by the values returned from :meth:`_getextra`. Subclasses
143+
provide these values by implementing :meth:`_getextra`. If no extra
144+
fields are defined, no element is returned.
145+
Example usages:
146+
- vols, aff, *extras = dataset[0:10]
147+
- vol, aff, bvecs, bvals = dataset[0] # when two extras are present
145148
146149
"""
147150

0 commit comments

Comments
 (0)