Skip to content
Snippets Groups Projects
Commit 46582b1f authored by Paul McCarthy's avatar Paul McCarthy
Browse files

Full model fits are no longer de/re-meand.

parent bb6e10a8
No related branches found
No related tags found
No related merge requests found
......@@ -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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment