From 4640478d2284e7c3bdffd1a939872f2914c34d9b Mon Sep 17 00:00:00 2001 From: jokedurnez Date: Tue, 13 Jun 2017 12:19:18 -0700 Subject: [PATCH 1/2] debug orthogonalisation --- nipype/interfaces/fsl/model.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nipype/interfaces/fsl/model.py b/nipype/interfaces/fsl/model.py index 871fc558c9..ac80e25701 100644 --- a/nipype/interfaces/fsl/model.py +++ b/nipype/interfaces/fsl/model.py @@ -222,6 +222,9 @@ def _create_ev_files(self, cwd, runinfo, runidx, ev_parameters, orthogonal = int(orthogonalization[i][j]) except (KeyError, TypeError, ValueError, IndexError): orthogonal = 0 + if orthogonal = 1 and not ev_ortho.substitute(c0=i,c1=0,orthogonal=1) in ev_txt: + ev_txt += ev_ortho.substitute(c0=i,c1=0,orthogonal=1) + ev_txt += "\n" ev_txt += ev_ortho.substitute( c0=i, c1=j, orthogonal=orthogonal) ev_txt += "\n" From 22fd9ff338afea06f51d563e711ca04ff91c8172 Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Sat, 31 Mar 2018 20:01:11 -0400 Subject: [PATCH 2/2] RF: Perform substitution once --- nipype/interfaces/fsl/model.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/nipype/interfaces/fsl/model.py b/nipype/interfaces/fsl/model.py index ac80e25701..1d6a2e1fee 100644 --- a/nipype/interfaces/fsl/model.py +++ b/nipype/interfaces/fsl/model.py @@ -217,16 +217,16 @@ def _create_ev_files(self, cwd, runinfo, runidx, ev_parameters, self._create_ev_file(evfname, evinfo) # add ev orthogonalization for i in range(1, num_evs[0] + 1): + initial = ev_ortho.substitute(c0=i, c1=0, orthogonal=1) for j in range(0, num_evs[0] + 1): try: orthogonal = int(orthogonalization[i][j]) except (KeyError, TypeError, ValueError, IndexError): orthogonal = 0 - if orthogonal = 1 and not ev_ortho.substitute(c0=i,c1=0,orthogonal=1) in ev_txt: - ev_txt += ev_ortho.substitute(c0=i,c1=0,orthogonal=1) - ev_txt += "\n" - ev_txt += ev_ortho.substitute( - c0=i, c1=j, orthogonal=orthogonal) + if orthogonal == 1 and initial not in ev_txt: + ev_txt += initial + "\n" + ev_txt += ev_ortho.substitute(c0=i, c1=j, + orthogonal=orthogonal) ev_txt += "\n" # add contrast info to fsf file if isdefined(contrasts):