Skip to content

Commit b16584e

Browse files
author
CindeeM
committed
BF - fixed doctests in ecat
1 parent c40276f commit b16584e

File tree

2 files changed

+10
-13
lines changed

2 files changed

+10
-13
lines changed

nibabel/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
from . import spm2analyze as spm2
4141
from . import nifti1 as ni1
4242
from . import minc
43+
from . import ecat
4344
# object imports
4445
from .fileholders import FileHolder, FileHolderError
4546
from .loadsave import load, save

nibabel/ecat.py

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ def __getitem__(self, item):
345345
>>> hdr['magic_number'] == 'MATRIX72'
346346
True
347347
'''
348-
return self._header_data[item]
348+
return self._header_data[item].item()
349349

350350
def __setitem__(self, item, value):
351351
''' Set values in header data
@@ -462,17 +462,12 @@ def get_frame_order(self):
462462
463463
Examples
464464
--------
465-
>>> img = ecat.load('singleframe.v')
466-
>>> mlist = img._mlist
465+
>>> from nibabel import ecat
466+
>>> img = ecat.load('nibabel/tests/data/tinypet.v')
467+
>>> mlist = img.get_mlist()
467468
>>> mlist.get_frame_order()
468469
{0: [0, 16842758.0]}
469-
>>> img2 = ecat.load('multiframe.v')
470-
>>> mlist2 = img2._mlist
471-
>>> mlist2.get_frame_order()
472-
{0: [0, 16842754.0],
473-
1: [1, 16842755.0],
474-
2: [2, 16842756.0],
475-
3: [3, 16842757.0]}
470+
476471
"""
477472
mlist = self._mlist
478473
ind = mlist[:,0] > 0
@@ -701,13 +696,14 @@ def __init__(self, data, affine, header,
701696
702697
Examples
703698
--------
704-
>>> img = ecat.load('multiframe.v')
699+
>>> from nibabel import ecat
700+
>>> img = ecat.load('nibabel/tests/data/tinypet.v')
705701
>>> frame0 = img.get_frame(0)
706702
>>> frame0.shape
707-
(128,128,47)
703+
(10, 10, 3)
708704
>>> data4d = img.get_data()
709705
>>> data4d.shape
710-
(128,128,47,6)
706+
(10, 10, 3, 1)
711707
712708
"""
713709
self._subheader = subheader

0 commit comments

Comments
 (0)