Skip to content

Commit 8b8712e

Browse files
committed
fix doctests
1 parent ab3aa0c commit 8b8712e

16 files changed

+233
-36
lines changed

nipype/interfaces/base.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1349,9 +1349,9 @@ def _terminal_output_update(self):
13491349
def set_default_terminal_output(cls, output_type):
13501350
"""Set the default terminal output for CommandLine Interfaces.
13511351
1352-
This method is used to set default terminal output for
1353-
CommandLine Interfaces. However, setting this will not
1354-
update the output type for any existing instances. For these,
1352+
This method is used to set default terminal output for
1353+
CommandLine Interfaces. However, setting this will not
1354+
update the output type for any existing instances. For these,
13551355
assign the <instance>.inputs.terminal_output.
13561356
"""
13571357

nipype/interfaces/dipy/base.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
# -*- coding: utf-8 -*-
2+
from nipype.interfaces.base import (traits, File, isdefined,
3+
BaseInterface, BaseInterfaceInputSpec)
24

35

46
class DipyBaseInterfaceInputSpec(BaseInterfaceInputSpec):

nipype/interfaces/dipy/reconstruction.py

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
traits)
1616
from nipype.utils.filemanip import split_filename, fname_presuffix
1717

18-
from .base import DipyBaseInterface
18+
from .base import DipyBaseInterface, DipyBaseInterfaceInputSpec
1919

2020
from nipype import logging
2121
iflogger = logging.getLogger('interface')
@@ -39,7 +39,6 @@ class RESTOREOutputSpec(TraitedSpec):
3939
'fitted DTI'))
4040
evals = File(desc=('output the eigenvalues of the fitted DTI'))
4141
evecs = File(desc=('output the eigenvectors of the fitted DTI'))
42-
# out_dti = File(desc=('output DTI file'))
4342

4443

4544
class RESTORE(DipyBaseInterface):
@@ -60,9 +59,9 @@ class RESTORE(DipyBaseInterface):
6059
6160
>>> import pysdcev.interfaces.reconstruction as pir
6261
>>> dti = pir.RESTORE()
63-
>>> dti.inputs.in_file = 'dwi.nii'
64-
>>> dti.inputs.in_bval = 'bval.txt'
65-
>>> dti.inputs.in_bvec = 'bvec.txt'
62+
>>> dti.inputs.in_file = '4d_dwi.nii'
63+
>>> dti.inputs.in_bval = 'bvals'
64+
>>> dti.inputs.in_bvec = 'bvecs'
6665
>>> res = dti.run() # doctest: +SKIP
6766
6867
@@ -188,9 +187,9 @@ class EstimateResponseSH(DipyBaseInterface):
188187
189188
>>> import pysdcev.interfaces.reconstruction as pir
190189
>>> dti = pir.EstimateResponseSH()
191-
>>> dti.inputs.in_file = 'dwi.nii'
192-
>>> dti.inputs.in_bval = 'bval.txt'
193-
>>> dti.inputs.in_bvec = 'bvec.txt'
190+
>>> dti.inputs.in_file = '4d_dwi.nii'
191+
>>> dti.inputs.in_bval = 'bvals'
192+
>>> dti.inputs.in_bvec = 'bvecs'
194193
>>> dti.inputs.in_evals = 'dwi_evals.nii'
195194
>>> res = dti.run() # doctest: +SKIP
196195
@@ -307,9 +306,9 @@ class CSD(DipyBaseInterface):
307306
308307
>>> import pysdcev.interfaces.reconstruction as pir
309308
>>> csd = pir.CSD()
310-
>>> csd.inputs.in_file = 'dwi.nii'
311-
>>> csd.inputs.in_bval = 'bval.txt'
312-
>>> csd.inputs.in_bvec = 'bvec.txt'
309+
>>> csd.inputs.in_file = '4d_dwi.nii'
310+
>>> csd.inputs.in_bval = 'bvals'
311+
>>> csd.inputs.in_bvec = 'bvecs'
313312
>>> res = csd.run() # doctest: +SKIP
314313
"""
315314
input_spec = CSDInputSpec
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
2+
from nipype.testing import assert_equal
3+
from nipype.interfaces.dipy.reconstruction import CSD
4+
5+
def test_CSD_inputs():
6+
input_map = dict(ignore_exception=dict(nohash=True,
7+
usedefault=True,
8+
),
9+
in_bval=dict(mandatory=True,
10+
),
11+
in_bvec=dict(mandatory=True,
12+
),
13+
in_file=dict(mandatory=True,
14+
),
15+
in_mask=dict(),
16+
out_fods=dict(),
17+
out_prefix=dict(),
18+
response=dict(),
19+
save_fods=dict(exists=True,
20+
usedefault=True,
21+
),
22+
sh_order=dict(exists=True,
23+
usedefault=True,
24+
),
25+
)
26+
inputs = CSD.input_spec()
27+
28+
for key, metadata in input_map.items():
29+
for metakey, value in metadata.items():
30+
yield assert_equal, getattr(inputs.traits()[key], metakey), value
31+
32+
def test_CSD_outputs():
33+
output_map = dict(model=dict(),
34+
out_fods=dict(),
35+
)
36+
outputs = CSD.output_spec()
37+
38+
for key, metadata in output_map.items():
39+
for metakey, value in metadata.items():
40+
yield assert_equal, getattr(outputs.traits()[key], metakey), value
41+
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
2+
from nipype.testing import assert_equal
3+
from nipype.interfaces.dipy.base import DipyBaseInterface
4+
5+
def test_DipyBaseInterface_inputs():
6+
input_map = dict(ignore_exception=dict(nohash=True,
7+
usedefault=True,
8+
),
9+
in_bval=dict(mandatory=True,
10+
),
11+
in_bvec=dict(mandatory=True,
12+
),
13+
in_file=dict(mandatory=True,
14+
),
15+
out_prefix=dict(),
16+
)
17+
inputs = DipyBaseInterface.input_spec()
18+
19+
for key, metadata in input_map.items():
20+
for metakey, value in metadata.items():
21+
yield assert_equal, getattr(inputs.traits()[key], metakey), value
22+
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
2+
from nipype.testing import assert_equal
3+
from nipype.interfaces.dipy.reconstruction import EstimateResponseSH
4+
5+
def test_EstimateResponseSH_inputs():
6+
input_map = dict(fa_thresh=dict(usedefault=True,
7+
),
8+
ignore_exception=dict(nohash=True,
9+
usedefault=True,
10+
),
11+
in_bval=dict(mandatory=True,
12+
),
13+
in_bvec=dict(mandatory=True,
14+
),
15+
in_evals=dict(mandatory=True,
16+
),
17+
in_file=dict(mandatory=True,
18+
),
19+
in_mask=dict(),
20+
out_prefix=dict(),
21+
response=dict(),
22+
save_glyph=dict(mandatory=True,
23+
usedefault=True,
24+
),
25+
)
26+
inputs = EstimateResponseSH.input_spec()
27+
28+
for key, metadata in input_map.items():
29+
for metakey, value in metadata.items():
30+
yield assert_equal, getattr(inputs.traits()[key], metakey), value
31+
32+
def test_EstimateResponseSH_outputs():
33+
output_map = dict(glyph_file=dict(),
34+
response=dict(),
35+
)
36+
outputs = EstimateResponseSH.output_spec()
37+
38+
for key, metadata in output_map.items():
39+
for metakey, value in metadata.items():
40+
yield assert_equal, getattr(outputs.traits()[key], metakey), value
41+
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
2+
from nipype.testing import assert_equal
3+
from nipype.interfaces.dipy.reconstruction import RESTORE
4+
5+
def test_RESTORE_inputs():
6+
input_map = dict(ignore_exception=dict(nohash=True,
7+
usedefault=True,
8+
),
9+
in_bval=dict(mandatory=True,
10+
),
11+
in_bvec=dict(mandatory=True,
12+
),
13+
in_file=dict(mandatory=True,
14+
),
15+
in_mask=dict(),
16+
noise_mask=dict(),
17+
out_prefix=dict(),
18+
)
19+
inputs = RESTORE.input_spec()
20+
21+
for key, metadata in input_map.items():
22+
for metakey, value in metadata.items():
23+
yield assert_equal, getattr(inputs.traits()[key], metakey), value
24+
25+
def test_RESTORE_outputs():
26+
output_map = dict(evals=dict(),
27+
evecs=dict(),
28+
fa=dict(),
29+
md=dict(),
30+
mode=dict(),
31+
rd=dict(),
32+
trace=dict(),
33+
)
34+
outputs = RESTORE.output_spec()
35+
36+
for key, metadata in output_map.items():
37+
for metakey, value in metadata.items():
38+
yield assert_equal, getattr(outputs.traits()[key], metakey), value
39+
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
2+
from nipype.testing import assert_equal
3+
from nipype.interfaces.dipy.tracks import StreamlineTractography
4+
5+
def test_StreamlineTractography_inputs():
6+
input_map = dict(gfa_thresh=dict(mandatory=True,
7+
usedefault=True,
8+
),
9+
ignore_exception=dict(nohash=True,
10+
usedefault=True,
11+
),
12+
in_file=dict(mandatory=True,
13+
),
14+
in_model=dict(),
15+
in_peaks=dict(),
16+
min_angle=dict(mandatory=True,
17+
usedefault=True,
18+
),
19+
multiprocess=dict(mandatory=True,
20+
usedefault=True,
21+
),
22+
num_seeds=dict(mandatory=True,
23+
usedefault=True,
24+
),
25+
out_prefix=dict(),
26+
peak_threshold=dict(mandatory=True,
27+
usedefault=True,
28+
),
29+
save_seeds=dict(mandatory=True,
30+
usedefault=True,
31+
),
32+
seed_coord=dict(),
33+
seed_mask=dict(),
34+
tracking_mask=dict(),
35+
)
36+
inputs = StreamlineTractography.input_spec()
37+
38+
for key, metadata in input_map.items():
39+
for metakey, value in metadata.items():
40+
yield assert_equal, getattr(inputs.traits()[key], metakey), value
41+
42+
def test_StreamlineTractography_outputs():
43+
output_map = dict(gfa=dict(),
44+
odf_peaks=dict(),
45+
out_seeds=dict(),
46+
tracks=dict(),
47+
)
48+
outputs = StreamlineTractography.output_spec()
49+
50+
for key, metadata in output_map.items():
51+
for metakey, value in metadata.items():
52+
yield assert_equal, getattr(outputs.traits()[key], metakey), value
53+

nipype/interfaces/dipy/tracks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ class StreamlineTractography(BaseInterface):
141141
142142
>>> import pysdcev.interfaces.reconstruction as pir
143143
>>> track = pir.StreamlineTractography()
144-
>>> track.inputs.in_file = 'dwi.nii'
144+
>>> track.inputs.in_file = '4d_dwi.nii'
145145
>>> track.inputs.in_model = 'model.pklz'
146146
>>> track.inputs.tracking_mask = 'dilated_wm_mask.nii'
147147
>>> res = track.run() # doctest: +SKIP

nipype/testing/data/dilated_wm_mask.nii

Whitespace-only changes.

0 commit comments

Comments
 (0)