NIPY logo

Site Navigation

NIPY Community

Github repo

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:

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
write_csv
__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: axis handle, optional :

Handle to axis onto which we will draw design matrix

Returns :

ax: axis handle :

write_csv(path)

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

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

Notes

The frametimes are not written

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 :