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

Various fixes to featanalysis module

parent a23e2003
No related branches found
No related tags found
No related merge requests found
...@@ -62,9 +62,11 @@ def isFEATImage(path): ...@@ -62,9 +62,11 @@ def isFEATImage(path):
a FEAT analysis, ``False`` otherwise. a FEAT analysis, ``False`` otherwise.
""" """
dirname = op.dirname( path) dirname = op.dirname( path)
filename = op.basename(path) filename = op.basename(path)
return filename.startswith('filtered_func_data') and isFEATDir(dirname) return filename.startswith('filtered_func_data') and \
fslimage.looksLikeImage(filename) and \
isFEATDir(dirname)
def isFEATDir(path): def isFEATDir(path):
...@@ -90,7 +92,7 @@ def isFEATDir(path): ...@@ -90,7 +92,7 @@ def isFEATDir(path):
return False return False
try: try:
fslimage.addExt(op.join(path, 'filtered_func_data'), mustExist=True) fslimage.addExt(op.join(dirname, 'filtered_func_data'), mustExist=True)
except fslimage.PathError: except fslimage.PathError:
return False return False
...@@ -124,7 +126,7 @@ def getAnalysisDir(path): ...@@ -124,7 +126,7 @@ def getAnalysisDir(path):
"""If the given path is contained within a FEAT directory, the path """If the given path is contained within a FEAT directory, the path
to that FEAT directory is returned. Otherwise, ``None`` is returned. to that FEAT directory is returned. Otherwise, ``None`` is returned.
""" """
featdir = fslpath.deepest(path, ['.feat', '.gfeat']) featdir = fslpath.deepest(path, ['.feat'])
if featdir is not None and isFEATDir(featdir): if featdir is not None and isFEATDir(featdir):
return featdir return featdir
...@@ -153,8 +155,7 @@ def getReportFile(featdir): ...@@ -153,8 +155,7 @@ def getReportFile(featdir):
def loadContrasts(featdir): def loadContrasts(featdir):
"""Loads the contrasts from a FEAT directory. Returns a tuple containing: """Loads the contrasts from a FEAT directory. Returns a tuple containing:
- A dictionary of ``{contrastnum : name}`` mappings (the ``contrastnum`` - A list of names, one for each contrast.
values are 1-indexed).
- A list of contrast vectors (each of which is a list itself). - A list of contrast vectors (each of which is a list itself).
...@@ -274,10 +275,13 @@ def getThresholds(settings): ...@@ -274,10 +275,13 @@ def getThresholds(settings):
:arg settings: A FEAT settings dictionary (see :func:`loadSettings`). :arg settings: A FEAT settings dictionary (see :func:`loadSettings`).
""" """
return { p = settings.get('prob_thresh', None)
'p' : settings.get('prob_thresh', None), z = settings.get('z_thresh', None)
'z' : settings.get('z_thresh', None)
} if p is not None: p = float(p)
if z is not None: z = float(z)
return {'p' : p, 'z' : z}
def isFirstLevelAnalysis(settings): def isFirstLevelAnalysis(settings):
...@@ -432,10 +436,6 @@ def loadClusterResults(featdir, settings, contrast): ...@@ -432,10 +436,6 @@ def loadClusterResults(featdir, settings, contrast):
colNames = colNames.split('\t') colNames = colNames.split('\t')
clusterLines = [cl .split('\t') for cl in clusterLines] clusterLines = [cl .split('\t') for cl in clusterLines]
# No clusters
if len(clusterLines) == 0:
return None
# Turn each cluster line into a # Turn each cluster line into a
# Cluster instance. An error will # Cluster instance. An error will
# be raised if the columm names # be raised if the columm names
......
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