Skip to content

Commit 51ff298

Browse files
committed
Correct more formatting usses
1 parent 18501c4 commit 51ff298

File tree

1 file changed

+29
-46
lines changed

1 file changed

+29
-46
lines changed

nibabel/gifti/gifti.py

Lines changed: 29 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -685,7 +685,7 @@ def agg_data(self, intent_code=None):
685685
In the general case, the numpy data array is extracted from each ``GiftiDataArray``
686686
object and returned in a ``tuple``, in the order they are found in the GIFTI image.
687687
688-
If all ``GiftiDataArray``s have ``intent`` of 2001 (``NIFTI_INTENT_TIME_SERIES``),
688+
If all ``GiftiDataArray`` s have ``intent`` of 2001 (``NIFTI_INTENT_TIME_SERIES``),
689689
then the data arrays are concatenated as columns, producing a vertex-by-time array.
690690
If an ``intent_code`` is passed, data arrays are filtered by the selected intents,
691691
before being aggregated.
@@ -695,7 +695,21 @@ def agg_data(self, intent_code=None):
695695
``agg_data`` for each element, in order.
696696
This may be useful for ensuring that expected data arrives in a consistent order.
697697
698-
Examples:
698+
Parameters
699+
----------
700+
intent_code : None, string, integer or tuple of strings or integers, optional
701+
code(s) specifying nifti intent
702+
703+
Returns
704+
-------
705+
tuple of ndarrays or ndarray
706+
If the input is a tuple, the returned tuple will match the order.
707+
708+
Examples
709+
--------
710+
711+
Load two kinds of Gifti files: a surface file containing two types of intent code;
712+
a functional file storing time series data only.
699713
700714
>>> import nibabel as nib
701715
>>> from nibabel.testing import test_data
@@ -704,85 +718,54 @@ def agg_data(self, intent_code=None):
704718
>>> func_gii_fname = test_data('gifti', 'sub-01_task-rhymejudgment_space-xformspaceverage3_hemi-L.func.gii')
705719
>>> func_gii_img = nib.load(func_gii_fname)
706720
707-
When not passing anything to``intent_code``
721+
When not passing anything to ``intent_code``
708722
709723
>>> surf_gii_img.agg_data() # surface file
710724
(array([[-16.07201 , -66.187515, 21.266994],
711725
[-16.705893, -66.05434 , 21.232786],
712726
[-17.61435 , -65.40164 , 21.071466]], dtype=float32),
713727
array([0, 1, 2], dtype=int32))
714-
715728
>>> func_gii_img.agg_data() # functional file
716729
array([[545.4326 , 535.8471 , 537.5014 , ..., 540.2762 , 539.53827 ,
717-
541.3617 ],
718-
[640.0118 , 634.727 , 630.03784 , ..., 635.21936 , 641.19586 ,
719-
638.7647 ],
720-
[612.9056 , 607.3228 , 606.1355 , ..., 608.2441 , 615.8239 ,
721-
613.0585 ],
722-
...,
723-
[101.28482 , 101.41192 , 99.21213 , ..., 100.47232 , 99.258316,
724-
99.440796],
725-
[371.81592 , 367.02896 , 363.90207 , ..., 365.52597 , 363.44937 ,
726-
363.10278 ],
727-
[268.6521 , 262.0212 , 259.06717 , ..., 262.5381 , 257.8245 ,
730+
...,
731+
[268.6521 , 262.0212 , 259.06717 , ..., 262.5381 , 257.8245 ,
728732
259.7127 ]], dtype=float32)
729733
730-
731734
When passig matching intend codes ``intent_code``
732735
733-
>>> surf_gii_img.agg_data('pointset') # surface file
736+
>>> surf_gii_img.agg_data('pointset') # surface pointset
734737
array([[-16.07201 , -66.187515, 21.266994],
735738
[-16.705893, -66.05434 , 21.232786],
736739
[-17.61435 , -65.40164 , 21.071466]], dtype=float32)
737-
740+
>>> surf_gii_img.agg_data('triangle') # surface triangle
741+
array([0, 1, 2], dtype=int32)
738742
>>> func_gii_img.agg_data('time series') # functional file
739743
array([[545.4326 , 535.8471 , 537.5014 , ..., 540.2762 , 539.53827 ,
740744
541.3617 ],
741-
[640.0118 , 634.727 , 630.03784 , ..., 635.21936 , 641.19586 ,
742-
638.7647 ],
743-
[612.9056 , 607.3228 , 606.1355 , ..., 608.2441 , 615.8239 ,
744-
613.0585 ],
745-
...,
746-
[101.28482 , 101.41192 , 99.21213 , ..., 100.47232 , 99.258316,
747-
99.440796],
748-
[371.81592 , 367.02896 , 363.90207 , ..., 365.52597 , 363.44937 ,
749-
363.10278 ],
750-
[268.6521 , 262.0212 , 259.06717 , ..., 262.5381 , 257.8245 ,
745+
...,
746+
[268.6521 , 262.0212 , 259.06717 , ..., 262.5381 , 257.8245 ,
751747
259.7127 ]], dtype=float32)
752748
753-
>>> surf_gii_img.agg_data('triangle')
754-
array([0, 1, 2], dtype=int32)
755749
756-
When passing mismatching intent codes ``intent_code``
750+
When passing mismatching ``intent_code``, the function return a empty ``tuple``
757751
758752
>>> surf_gii_img.agg_data('time series')
759-
() # return a empty ``tuple``
760-
753+
()
761754
>>> func_gii_img.agg_data('triangle')
762-
() # return a empty ``tuple``
755+
()
763756
764-
When passing tuple ``intent_code``
757+
When passing tuple ``intent_code``, the output will follow
758+
the order of ``intent_code`` in the tuple
765759
766760
>>> surf_gii_img.agg_data(('pointset', 'triangle'))
767761
(array([[-16.07201 , -66.187515, 21.266994],
768762
[-16.705893, -66.05434 , 21.232786],
769763
[-17.61435 , -65.40164 , 21.071466]], dtype=float32),
770764
array([0, 1, 2], dtype=int32))
771-
772765
>>> surf_gii_img.agg_data(('triangle', 'pointset'))
773766
(array([0, 1, 2], dtype=int32), array([[-16.07201 , -66.187515, 21.266994],
774767
[-16.705893, -66.05434 , 21.232786],
775768
[-17.61435 , -65.40164 , 21.071466]], dtype=float32))
776-
777-
Parameters
778-
----------
779-
intent_code : None, string, integer or tuple of strings or integers, optional
780-
code(s) specifying nifti intent
781-
782-
Returns
783-
-------
784-
tuple of ndarrays or ndarray
785-
If the input is a tuple, the returned tuple will match the order.
786769
"""
787770

788771
# Allow multiple intents to specify the order

0 commit comments

Comments
 (0)