Skip to content

Commit 1d898b0

Browse files
committed
IMPR: forced ignore_exception=False in nipype nodes
1 parent 4680e01 commit 1d898b0

File tree

4 files changed

+61
-14
lines changed

4 files changed

+61
-14
lines changed

.travis.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ sudo: required
44

55
language: python
66

7+
env:
8+
global:
9+
- TEST_RUN_FOLDER="/tmp" # folder where the tests are run from
10+
711
matrix:
812
# Do not wait for the allowed_failures entry to finish before
913
# setting the status

Makefile

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,15 @@
55
PYTHON ?= python
66
CYTHON ?= cython
77
NOSETESTS ?= nosetests
8+
NOSETESTS_OPTIONS := $(shell pip list | grep nose-timer > /dev/null && \
9+
echo '--with-timer --timer-top-n 50')
810
CTAGS ?= ctags
911

10-
all: clean test
12+
all: clean test doc-noplot
1113

1214
clean-pyc:
1315
find . -name "*.pyc" | xargs rm -f
16+
find . -name "__pycache__" | xargs rm -rf
1417

1518
clean-so:
1619
find . -name "*.so" | xargs rm -f
@@ -29,14 +32,17 @@ inplace:
2932
$(PYTHON) setup.py build_ext -i
3033

3134
test-code:
32-
$(NOSETESTS) -s pypreprocess
35+
$(NOSETESTS) -s pypreprocess $(NOSETESTS_OPTIONS)
36+
test-doc:
37+
$(NOSETESTS) -s --with-doctest --doctest-tests --doctest-extension=rst \
38+
--doctest-extension=inc --doctest-fixtures=_fixture `find doc/ -name '*.rst'`
3339

3440
test-coverage:
3541
rm -rf coverage .coverage
3642
$(NOSETESTS) -s --with-coverage --cover-html --cover-html-dir=coverage \
3743
--cover-package=pypreprocess pypreprocess
3844

39-
test: test-code
45+
test: test-code test-doc
4046

4147
trailing-spaces:
4248
find . -name "*.py" | xargs perl -pi -e 's/[ \t]*$$//'
@@ -48,3 +54,15 @@ ctags:
4854
# make tags for symbol based navigation in emacs and vim
4955
# Install with: sudo apt-get install exuberant-ctags
5056
$(CTAGS) -R *
57+
58+
.PHONY : doc-plot
59+
doc-plot:
60+
make -C doc html
61+
62+
.PHONY : doc
63+
doc:
64+
make -C doc html-noplot
65+
66+
.PHONY : pdf
67+
pdf:
68+
make -C doc pdf
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import sys
2+
3+
DEPENDENCIES = ['numpy', 'scipy', 'sklearn', 'matplotlib', 'nibabel']
4+
5+
6+
def print_package_version(package_name, indent=' '):
7+
try:
8+
package = __import__(package_name)
9+
version = getattr(package, '__version__', None)
10+
package_file = getattr(package, '__file__', )
11+
provenance_info = '{0} from {1}'.format(version, package_file)
12+
except ImportError:
13+
provenance_info = 'not installed'
14+
15+
print('{0}{1}: {2}'.format(indent, package_name, provenance_info))
16+
17+
if __name__ == '__main__':
18+
print('=' * 120)
19+
print('Python %s' % str(sys.version))
20+
print('from: %s\n' % sys.executable)
21+
22+
print('Dependencies versions')
23+
for package_name in DEPENDENCIES:
24+
print_package_version(package_name)
25+
print('=' * 120)

pypreprocess/nipype_preproc_spm_utils.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ def _do_subject_slice_timing(subject_data, TR, TA=None, spm_dir=None,
196196
time_acquisition=TA, num_slices=nslices,
197197
ref_slice=ref_slice + 1,
198198
slice_order=list(slice_order + 1), # SPM
199-
ignore_exception=True
199+
ignore_exception=False
200200
)
201201
if stc_result.outputs is None:
202202
subject_data.failed = True
@@ -495,7 +495,7 @@ def _do_subject_coregister(subject_data, reslice=False, spm_dir=None,
495495
source=coreg_source,
496496
apply_to_files=apply_to_files,
497497
jobtype=jobtype,
498-
ignore_exception=True
498+
ignore_exception=False
499499
)
500500

501501
# failed node ?
@@ -633,7 +633,7 @@ def _do_subject_segment(subject_data, output_modulated_tpms=True, spm_dir=None,
633633
wm_output_type=gm_output_type,
634634
csf_output_type=csf_output_type,
635635
tissue_prob_maps=[GM_TEMPLATE, WM_TEMPLATE, CSF_TEMPLATE],
636-
ignore_exception=True
636+
ignore_exception=False
637637
)
638638

639639
# failed node
@@ -746,7 +746,7 @@ def _do_subject_normalize(subject_data, fwhm=0., anat_fwhm=0., caching=True,
746746
output_dir=subject_data.scratch)
747747
normalize_result = normalize(
748748
source=subject_data.anat, template=t1_template,
749-
write_preserve=False, ignore_exception=True)
749+
write_preserve=False, ignore_exception=False)
750750
parameter_file = normalize_result.outputs.normalization_parameters
751751
else:
752752
parameter_file = subject_data.nipype_results[
@@ -777,7 +777,7 @@ def _do_subject_normalize(subject_data, fwhm=0., anat_fwhm=0., caching=True,
777777
apply_to_files=apply_to_files,
778778
write_voxel_sizes=list(write_voxel_sizes),
779779
# write_bounding_box=[[-78, -112, -50], [78, 76, 85]],
780-
write_interp=1, jobtype='write', ignore_exception=True)
780+
write_interp=1, jobtype='write', ignore_exception=False)
781781

782782
# failed node ?
783783
if normalize_result.outputs is None:
@@ -808,7 +808,7 @@ def _do_subject_normalize(subject_data, fwhm=0., anat_fwhm=0., caching=True,
808808
write_wrap=[0, 0, 0],
809809
write_interp=1,
810810
jobtype='write',
811-
ignore_exception=True
811+
ignore_exception=False
812812
)
813813

814814
# failed node
@@ -933,7 +933,7 @@ def _do_subject_smooth(subject_data, fwhm, anat_fwhm=None, spm_dir=None,
933933
in_files = [getattr(subject_data, x) for x in anat_like]
934934

935935
smooth_result = smooth(
936-
in_files=in_files, fwhm=width, ignore_exception=True)
936+
in_files=in_files, fwhm=width, ignore_exception=False)
937937

938938
# failed node ?
939939
subject_data.nipype_results['smooth'][brain_name] = smooth_result
@@ -1025,7 +1025,7 @@ def _do_subject_dartelnorm2mni(subject_data,
10251025
flowfield_files=subject_data.dartel_flow_fields,
10261026
template_file=template_file,
10271027
modulate=output_modulated_tpms, # don't modulate
1028-
fwhm=anat_fwhm, ignore_exception=True, **tricky_kwargs)
1028+
fwhm=anat_fwhm, ignore_exception=False, **tricky_kwargs)
10291029
setattr(subject_data, "mw" + tissue,
10301030
dartelnorm2mni_result.outputs.normalized_files)
10311031

@@ -1034,7 +1034,7 @@ def _do_subject_dartelnorm2mni(subject_data,
10341034
apply_to_files=subject_data.anat,
10351035
flowfield_files=subject_data.dartel_flow_fields,
10361036
template_file=template_file,
1037-
ignore_exception=True,
1037+
ignore_exception=False,
10381038
modulate=output_modulated_tpms,
10391039
fwhm=anat_fwhm,
10401040
**tricky_kwargs
@@ -1049,7 +1049,7 @@ def _do_subject_dartelnorm2mni(subject_data,
10491049
createwarped_result = createwarped(
10501050
image_files=subject_data.func,
10511051
flowfield_files=subject_data.dartel_flow_fields,
1052-
ignore_exception=True
1052+
ignore_exception=False
10531053
)
10541054
subject_data.func = createwarped_result.outputs.warped_files
10551055

@@ -1408,7 +1408,7 @@ def _do_subjects_newsegment(
14081408
newsegment_result = newsegment(
14091409
channel_files=[subject_data.anat for subject_data in subjects],
14101410
tissues=TISSUES,
1411-
ignore_exception=True)
1411+
ignore_exception=False)
14121412
if newsegment_result.outputs is None:
14131413
return
14141414
else:

0 commit comments

Comments
 (0)