From 46582b1fc3de7dad11c8a6aeb5c2d9e965378156 Mon Sep 17 00:00:00 2001
From: Paul McCarthy <pauld.mccarthy@gmail.com>
Date: Fri, 4 Nov 2016 14:49:40 +0000
Subject: [PATCH] Full model fits are no longer de/re-meand.

---
 fsl/data/featimage.py | 31 ++++++++++---------------------
 1 file changed, 10 insertions(+), 21 deletions(-)

diff --git a/fsl/data/featimage.py b/fsl/data/featimage.py
index d5857d50a..27a10f28f 100644
--- a/fsl/data/featimage.py
+++ b/fsl/data/featimage.py
@@ -294,23 +294,15 @@ class FEATImage(fslimage.Image):
         return self.__clustMasks[con] 
             
 
-    def fit(self, contrast, xyz, fullModel=False):
+    def fit(self, contrast, xyz):
         """Calculates the model fit for the given contrast vector
         at the given voxel.
 
-        Passing in a contrast of all 1s, and ``fullModel=True`` will
-        get you the full model fit. Pass in ``fullModel=False`` for
-        all other contrasts, otherwise the model fit values will not
-        be scaled correctly.
-
         :arg contrast:  The contrast vector (pass all 1s for a full model
                         fit).
 
         :arg xyz:       Coordinates of the voxel to calculate the model fit
                         for.
-
-        :arg fullModel: Set to ``True`` for a full model fit, ``False``
-                        otherwise.
         """
 
         if self.__design is None:
@@ -356,19 +348,16 @@ class FEATImage(fslimage.Image):
             pe        = self.getPE(i)[x, y, z]
             modelfit += ev * pe * contrast[i]
 
-        # Make sure the model fit has an appropriate mean.
-        # 
-        # Full model fits should, but won't necessarily,
-        # have the same mean as the data.
-        #
-        # The data in first level analyses is demeaned before
-        # model fitting, so we need to add it back in.
-        if   fullModel:  return modelfit - modelfit.mean() + data.mean()
-        elif firstLevel: return modelfit - modelfit.mean() + data.mean()
-        else:            return modelfit
+        # Make sure the model fit has an
+        # appropriate mean.  The data in
+        # first level analyses is demeaned
+        # before model fitting, so we need
+        # to add it back in.
+        if firstLevel: return modelfit + data.mean()
+        else:          return modelfit
 
 
-    def partialFit(self, contrast, xyz, fullModel=False):
+    def partialFit(self, contrast, xyz):
         """Calculates and returns the partial model fit for the specified
         contrast vector at the specified voxel.
 
@@ -377,6 +366,6 @@ class FEATImage(fslimage.Image):
 
         x, y, z   = xyz
         residuals = self.getResiduals()[x, y, z, :]
-        modelfit  = self.fit(contrast, xyz, fullModel=fullModel)
+        modelfit  = self.fit(contrast, xyz)
 
         return residuals + modelfit
-- 
GitLab