From 507aafce331a3090b883e9dbcc3475c2d91a208e Mon Sep 17 00:00:00 2001 From: hstojic Date: Thu, 31 Jan 2019 20:26:35 +0000 Subject: [PATCH 1/3] adding SPM orth argument to the SpecifyModel class --- nipype/algorithms/modelgen.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/nipype/algorithms/modelgen.py b/nipype/algorithms/modelgen.py index 9a0984c885..1d58f5de6e 100644 --- a/nipype/algorithms/modelgen.py +++ b/nipype/algorithms/modelgen.py @@ -331,8 +331,7 @@ class SpecifyModel(BaseInterface): - amplitudes : lists of amplitudes for each event. This will be ignored by SPM's Level1Design. - The following two (tmod, pmod) will be ignored by any Level1Design class - other than SPM: + The following three (tmod, pmod, orth) will be ignored by any Level1Design class other than SPM: - tmod : lists of conditions that should be temporally modulated. Should default to None if not being used. @@ -340,6 +339,11 @@ class SpecifyModel(BaseInterface): - name : name of parametric modulator - param : values of the modulator - poly : degree of modulation + - orth : lists of instructions to orthogonolise parametric regressors or + not. Same as in SPM, use 'Yes' to indicate orthogonalisation, and 'No' + to explicitly prevent it. Use None for conditions where it is not being + used. Note that by default SPM will orthogonalise parametric regressors + in the order in which they are entered. Alternatively, you can provide information through event files. @@ -369,7 +373,7 @@ class SpecifyModel(BaseInterface): None]) >>> evs_run3 = Bunch(conditions=['cond1', 'cond2'], onsets=[[20, 120], [80, 160]], \ durations=[[0], [0]], pmod=[Bunch(name=['amp'], poly=[2], param=[[1, 2]]), \ -None]) +None], orth=['No', None]) >>> s.inputs.subject_info = [evs_run2, evs_run3] """ @@ -414,6 +418,12 @@ def _generate_standard_design(self, if hasattr(info, 'tmod') and info.tmod and \ len(info.tmod) > cid: sessinfo[i]['cond'][cid]['tmod'] = info.tmod[cid] + + if hasattr(info, 'orth') and info.orth: + if info.orth[cid] == 'Yes': + sessinfo[i]['cond'][cid]['orth'] = 1 + elif info.orth[cid] == 'No': + sessinfo[i]['cond'][cid]['orth'] = 0 if hasattr(info, 'pmod') and info.pmod and \ len(info.pmod) > cid: From 3d8c80dc02da78a4f25f6d411bb1b9e47987833d Mon Sep 17 00:00:00 2001 From: hstojic Date: Thu, 21 Feb 2019 12:45:12 +0000 Subject: [PATCH 2/3] removed whitespaces, added ValueError if orth not None --- nipype/algorithms/modelgen.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/nipype/algorithms/modelgen.py b/nipype/algorithms/modelgen.py index 1d58f5de6e..05a9193053 100644 --- a/nipype/algorithms/modelgen.py +++ b/nipype/algorithms/modelgen.py @@ -339,10 +339,10 @@ class SpecifyModel(BaseInterface): - name : name of parametric modulator - param : values of the modulator - poly : degree of modulation - - orth : lists of instructions to orthogonolise parametric regressors or - not. Same as in SPM, use 'Yes' to indicate orthogonalisation, and 'No' - to explicitly prevent it. Use None for conditions where it is not being - used. Note that by default SPM will orthogonalise parametric regressors + - orth : lists of instructions to orthogonolise parametric regressors or + not. Same as in SPM, use 'Yes' to indicate orthogonalisation, and 'No' + to explicitly prevent it. Use None for conditions where it is not being + used. Note that by default SPM will orthogonalise parametric regressors in the order in which they are entered. Alternatively, you can provide information through event files. @@ -419,11 +419,14 @@ def _generate_standard_design(self, len(info.tmod) > cid: sessinfo[i]['cond'][cid]['tmod'] = info.tmod[cid] - if hasattr(info, 'orth') and info.orth: + if hasattr(info, 'orth') and info.orth and\ + len(info.orth) > cid: if info.orth[cid] == 'Yes': sessinfo[i]['cond'][cid]['orth'] = 1 elif info.orth[cid] == 'No': sessinfo[i]['cond'][cid]['orth'] = 0 + elif info.orth[cid] is not None: + raise ValueError("Unknown orthogonalization option {0}. Must be one of 'Yes', 'No', or None.".format(info.orth[cid])) if hasattr(info, 'pmod') and info.pmod and \ len(info.pmod) > cid: From d3ec0aa26dbdf6a5637fe00f8ed7aea18efbaf6d Mon Sep 17 00:00:00 2001 From: hstojic Date: Sat, 23 Feb 2019 11:37:10 +0000 Subject: [PATCH 3/3] removed trailing whitespaces --- nipype/algorithms/modelgen.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nipype/algorithms/modelgen.py b/nipype/algorithms/modelgen.py index 05a9193053..3e2e4b9f11 100644 --- a/nipype/algorithms/modelgen.py +++ b/nipype/algorithms/modelgen.py @@ -418,7 +418,7 @@ def _generate_standard_design(self, if hasattr(info, 'tmod') and info.tmod and \ len(info.tmod) > cid: sessinfo[i]['cond'][cid]['tmod'] = info.tmod[cid] - + if hasattr(info, 'orth') and info.orth and\ len(info.orth) > cid: if info.orth[cid] == 'Yes':