From 9e13d6a05312f2896ccc78a4592b300768ad7119 Mon Sep 17 00:00:00 2001 From: oesteban Date: Wed, 11 Jan 2017 12:57:27 -0800 Subject: [PATCH] Cast DVARS float outputs to avoid memmap error When the input files are not compressed, numpy wraps memmap around the dtype. This makes the traits.Float validation to fail. An more robust way would be overloading traits.Float to validate also these memmap objects. But this is probably overkilling the problem. For now, this casting is the easiest and safest solution. --- nipype/algorithms/confounds.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nipype/algorithms/confounds.py b/nipype/algorithms/confounds.py index 2905da0fd9..087b273190 100644 --- a/nipype/algorithms/confounds.py +++ b/nipype/algorithms/confounds.py @@ -127,9 +127,9 @@ def _run_interface(self, runtime): dvars = compute_dvars(self.inputs.in_file, self.inputs.in_mask, remove_zerovariance=self.inputs.remove_zerovariance) - self._results['avg_std'] = dvars[0].mean() - self._results['avg_nstd'] = dvars[1].mean() - self._results['avg_vxstd'] = dvars[2].mean() + self._results['avg_std'] = float(dvars[0].mean()) + self._results['avg_nstd'] = float(dvars[1].mean()) + self._results['avg_vxstd'] = float(dvars[2].mean()) tr = None if isdefined(self.inputs.series_tr):