Skip to content

Commit 02149fc

Browse files
authored
Merge pull request #270 from oesteban/fix/upstreamed-read-crashfiles
[FIX] ``read_crashfile`` stopped working after migration
2 parents 3e19c35 + 30a574b commit 02149fc

File tree

3 files changed

+49
-3
lines changed

3 files changed

+49
-3
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
Node: fmriprep_wf.single_subject_100185_wf.func_preproc_task_machinegame_run_02_wf.carpetplot_wf.conf_plot
2+
Working directory: /home/oesteban/tmp/fmriprep-ds005/work/fmriprep_wf/single_subject_100185_wf/func_preproc_task_machinegame_run_02_wf/carpetplot_wf/conf_plot
3+
4+
Node inputs:
5+
6+
confounds_file = /home/oesteban/tmp/fmriprep-ds005/work/fmriprep_wf/single_subject_100185_wf/func_preproc_task_machinegame_run_02_wf/bold_confounds_wf/concat/confounds.tsv
7+
confounds_list = [('global_signal', None, 'GS'), ('csf', None, 'GSCSF'), ('white_matter', None, 'GSWM'), ('std_dvars', None, 'DVARS'), ('framewise_displacement', 'mm', 'FD')]
8+
in_func = /home/oesteban/tmp/fmriprep-ds005/work/fmriprep_wf/single_subject_100185_wf/func_preproc_task_machinegame_run_02_wf/bold_bold_trans_wf/merge/vol0000_xform-00000_merged.nii.gz
9+
in_mask = /home/oesteban/tmp/fmriprep-ds005/work/fmriprep_wf/single_subject_100185_wf/func_preproc_task_machinegame_run_02_wf/bold_bold_trans_wf/bold_reference_wf/enhance_and_skullstrip_bold_wf/combine_masks/ref_image_valid_corrected_brain_mask_maths.nii.gz
10+
in_segm = /home/oesteban/tmp/fmriprep-ds005/work/fmriprep_wf/single_subject_100185_wf/func_preproc_task_machinegame_run_02_wf/carpetplot_wf/resample_parc/tpl-MNI152NLin2009cAsym_space-MNI_res-01_label-carpet_atlas_trans.nii.gz
11+
str_or_tuple = <undefined>
12+
tr = 1.0
13+
14+
Traceback (most recent call last):
15+
File "/home/oesteban/workspace/nipype/nipype/pipeline/plugins/multiproc.py", line 69, in run_node
16+
result['result'] = node.run(updatehash=updatehash)
17+
File "/home/oesteban/workspace/nipype/nipype/pipeline/engine/nodes.py", line 473, in run
18+
result = self._run_interface(execute=True)
19+
File "/home/oesteban/workspace/nipype/nipype/pipeline/engine/nodes.py", line 557, in _run_interface
20+
return self._run_command(execute)
21+
File "/home/oesteban/workspace/nipype/nipype/pipeline/engine/nodes.py", line 637, in _run_command
22+
result = self._interface.run(cwd=outdir)
23+
File "/home/oesteban/workspace/nipype/nipype/interfaces/base/core.py", line 511, in run
24+
runtime = self._run_interface(runtime)
25+
File "/home/oesteban/workspace/fmriprep/fmriprep/interfaces/confounds.py", line 342, in _run_interface
26+
units=units,
27+
File "/home/oesteban/workspace/niworkflows/niworkflows/viz/plots.py", line 101, in plot
28+
name=name, **kwargs)
29+
File "/home/oesteban/workspace/niworkflows/niworkflows/viz/plots.py", line 483, in confoundplot
30+
def_ylims = [nonnan.min() - 0.1 * abs(nonnan.min()), 1.1 * nonnan.max()]
31+
File "/home/oesteban/.anaconda3/lib/python3.7/site-packages/numpy/core/_methods.py", line 32, in _amin
32+
return umr_minimum(a, axis, None, out, keepdims, initial)
33+
ValueError: zero-size array to reduction operation minimum which has no identity

niworkflows/utils/misc.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,20 @@ def _read_pkl(path):
6868

6969

7070
def _read_txt(path):
71+
"""Read a txt crashfile
72+
73+
>>> new_path = Path(__file__).resolve().parent.parent
74+
>>> test_data_path = new_path / 'data' / 'tests'
75+
>>> info = _read_txt(test_data_path / 'crashfile.txt')
76+
>>> info['node'] # doctest: +ELLIPSIS
77+
'...func_preproc_task_machinegame_run_02_wf.carpetplot_wf.conf_plot'
78+
>>> info['traceback'] # doctest: +ELLIPSIS
79+
'...ValueError: zero-size array to reduction operation minimum which has no identity'
80+
81+
"""
7182
from pathlib import Path
7283
lines = Path(path).read_text().splitlines()
73-
data = {'file': path}
84+
data = {'file': str(path)}
7485
traceback_start = 0
7586
if lines[0].startswith('Node'):
7687
data['node'] = lines[0].split(': ', 1)[1].strip()
@@ -79,6 +90,9 @@ def _read_txt(path):
7990
cur_key = ''
8091
cur_val = ''
8192
for i, line in enumerate(lines[5:]):
93+
if not line.strip():
94+
continue
95+
8296
if line[0].isspace():
8397
cur_val += line
8498
continue
@@ -95,7 +109,7 @@ def _read_txt(path):
95109
data['inputs'] = sorted(inputs)
96110
else:
97111
data['node_dir'] = "Node crashed before execution"
98-
data['traceback'] = ''.join(lines[traceback_start:]).strip()
112+
data['traceback'] = '\n'.join(lines[traceback_start:]).strip()
99113
return data
100114

101115

niworkflows/viz/plots.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,6 @@ def confoundplot(tseries, gs_ts, gs_dist=None, name=None,
473473
ax_ts.spines["left"].set_visible(False)
474474
# ax_ts.yaxis.set_ticks_position('left')
475475

476-
477476
ax_ts.set_yticks([])
478477
ax_ts.set_yticklabels([])
479478

0 commit comments

Comments
 (0)