NIPY logo

Site Navigation

NIPY Community

Table Of Contents

Previous topic

modalities.fmri.design

This Page

modalities.fmri.design_matrix

Module: modalities.fmri.design_matrix

Inheritance diagram for nipy.modalities.fmri.design_matrix:

This module implements fMRI Design Matrix creation. The DesignMatrix object is just a container that represents the design matrix. Computations of the different parts of the design matrix are confined to the make_dmtx() function, that instantiates the DesignMatrix object. All the remainder are just ancillary functions.

Design matrices contain three different types of regressors: 1. Task-related regressors, that result from the convolution of the experimental paradigm regressors with hemodynamic models 2. User-specified regressors, that represent information available on the data, e.g. motion parameters, physiological data resampled at the acquisition rate, or sinusoidal regressors that model the signal at a frequency of interest. 3. Drift regressors, that represent low_frequency phenomena of no interest in the data; they need to be included to reduce variance estimates.

Author: Bertrand Thirion, 2009-2011

Class

DesignMatrix

class nipy.modalities.fmri.design_matrix.DesignMatrix(matrix, names, frametimes=None)

This is a container for a light-weight class for design matrices This class is only used to make IO and visualization

Methods

show([rescale, ax]) Visualization of a design matrix
write_csv(path) write self.matrix as a csv file with appropriate column names
__init__(matrix, names, frametimes=None)
show(rescale=True, ax=None)

Visualization of a design matrix

Parameters :

rescale: bool, optional :

rescale columns magnitude for visualization or not

ax: figure handle, optional :

Returns :

ax, figure handle :

write_csv(path)

write self.matrix as a csv file with appropriate column names

Parameters :path: string, path of the resulting csv file :

Functions

nipy.modalities.fmri.design_matrix.dmtx_from_csv(path, frametimes=None)

Return a DesignMatrix instance from a csv file

Parameters :path: string, path of the .csv file :
Returns :A DesignMatrix instance :
nipy.modalities.fmri.design_matrix.dmtx_light(frametimes, paradigm=None, hrf_model='Canonical', drift_model='Cosine', hfcut=128, drift_order=1, fir_delays=[0], add_regs=None, add_reg_names=None, path=None)

Make a design matrix while avoiding framework

Parameters :

see make_dmtx, plus :

path: string, optional: a path to write the output :

Returns :

dmtx array of shape(nreg, nbframes): :

the sampled design matrix

names list of strings of len (nreg) :

the names of the columns of the design matrix

nipy.modalities.fmri.design_matrix.make_dmtx(frametimes, paradigm=None, hrf_model='Canonical', drift_model='Cosine', hfcut=128, drift_order=1, fir_delays=[0], add_regs=None, add_reg_names=None)

Generate a design matrix from the input parameters

Parameters :

frametimes: array of shape(nbframes), the timing of the scans :

paradigm: Paradigm instance, optional :

description of the experimental paradigm

hrf_model: string, optional, :

that specifies the hemodynamic response function it can be ‘Canonical’, ‘Canonical With Derivative’ or ‘FIR’

drift_model: string, optional :

specifies the desired drift model, to be chosen among ‘Polynomial’, ‘Cosine’, ‘Blank’

hfcut: float, optional :

cut frequency of the low-pass filter

drift_order: int, optional :

order of the drift model (in case it is polynomial)

fir_delays: array of shape(nb_onsets) or list, optional, :

in case of FIR design, yields the array of delays used in the FIR model

add_regs: array of shape(nbframes, naddreg), optional :

additional user-supplied regressors

add_reg_names: list of (naddreg) regressor names, optional :

if None, while naddreg>0, these will be termed ‘reg_%i’,i=0..naddreg-1

Returns :

DesignMatrix instance :