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

loadDesignMat now expects the path to the design matrix file, not to the FEAT

directory.
parent b2e804e6
No related branches found
No related tags found
No related merge requests found
...@@ -146,7 +146,7 @@ class FEATFSFDesign(object): ...@@ -146,7 +146,7 @@ class FEATFSFDesign(object):
# Get the design matrix, and some # Get the design matrix, and some
# information about the analysis # information about the analysis
designMatrix = loadDesignMat(featDir) designMatrix = loadDesignMat(op.join(featDir, 'design.mat'))
version = float(settings['version']) version = float(settings['version'])
level = int( settings['level']) level = int( settings['level'])
...@@ -407,7 +407,7 @@ def getFirstLevelEVs(featDir, settings, designMat): ...@@ -407,7 +407,7 @@ def getFirstLevelEVs(featDir, settings, designMat):
from its ``design.fsf`` file (see from its ``design.fsf`` file (see
:func:`.featanalysis.loadSettings`). :func:`.featanalysis.loadSettings`).
:arg designMat: The FEAT design matrix (a numpy array - see :arg designMat: The FEAT design matrix (a numpy array - see
:func:`.featanalysis.loadDesign`). :func:`loadDesignMat`).
:returns: A list of :class:`EV` instances, one for each column in the :returns: A list of :class:`EV` instances, one for each column in the
design matrix. design matrix.
...@@ -570,7 +570,7 @@ def getHigherLevelEVs(featDir, settings, designMat): ...@@ -570,7 +570,7 @@ def getHigherLevelEVs(featDir, settings, designMat):
from its ``design.fsf`` file (see from its ``design.fsf`` file (see
:func:`.featanalysis.loadSettings`). :func:`.featanalysis.loadSettings`).
:arg designMat: The FEAT design matrix (a numpy array - see :arg designMat: The FEAT design matrix (a numpy array - see
:func:`.featanalysis.loadDesign`). :func:`loadDesignMat`).
:returns: A list of :class:`EV` instances, one for each column in the :returns: A list of :class:`EV` instances, one for each column in the
design matrix. design matrix.
...@@ -619,17 +619,16 @@ def getHigherLevelEVs(featDir, settings, designMat): ...@@ -619,17 +619,16 @@ def getHigherLevelEVs(featDir, settings, designMat):
return evs return evs
def loadDesignMat(featdir): def loadDesignMat(designmat):
"""Loads the design matrix from a FEAT directory. """Loads the specified design matrix.
Returns a ``numpy`` array containing the design matrix data, where the Returns a ``numpy`` array containing the design matrix data, where the
first dimension corresponds to the data points, and the second to the EVs. first dimension corresponds to the data points, and the second to the EVs.
:arg featdir: A FEAT directory. :arg designmat: Path to the ``design.mat`` file.
""" """
matrix = None matrix = None
designmat = op.join(featdir, 'design.mat')
log.debug('Loading FEAT design matrix from {}'.format(designmat)) log.debug('Loading FEAT design matrix from {}'.format(designmat))
...@@ -637,6 +636,12 @@ def loadDesignMat(featdir): ...@@ -637,6 +636,12 @@ def loadDesignMat(featdir):
while True: while True:
line = f.readline() line = f.readline()
# readline returns an empty string at EOF
if line == '':
break
# Matrix data starts after "/Matrix"
if line.strip() == '/Matrix': if line.strip() == '/Matrix':
break break
......
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