Fork me on GitHub

pyhrf.glm module

pyhrf.glm.glm_nipy(fmri_data, contrasts=None, hrf_model='Canonical', drift_model='Cosine', hfcut=128, residuals_model='spherical', fit_method='ols', fir_delays=[0], rescale_results=False, rescale_factor=None)

Perform a GLM analysis on fMRI data using the implementation of Nipy.

Parameters:
  • fmri_data (pyhrf.core.FmriData) – the input fMRI data defining the paradigm and the measured 3D+time signal.
  • contrasts (dict) – keys are contrast labels and values are arithmetic expressions involving regressor names. Valid names are: * names of experimental conditions as defined in fmri_data * constant
  • hrf_model – “Canonical”, “Canonical with Derivative”, “FIR”
  • residuals_model – “spherical”, “ar1”
  • fit_method – “ols”, “kalman” (If residuals_model is “ar1” then method is set to “kalman” and this argument is ignored)
  • fir_delays – list of integers indicating the delay of each FIR coefficient (in terms of scans). Eg if TR = 2s. and we want a FIR duration of 20s.: fir_delays=range(10)
Returns:

(glm instance, design matrix, dict of contrasts of objects)

Examples: >>> from pyhrf.core import FmriData >>> from pyhrf.glm import glm_nipy >>> g,dmtx,con = glm_nipy(FmriData.from_vol_ui()) >>> g,dmtx,con = glm_nipy(FmriData.from_vol_ui(), contrasts={‘A-V’:’audio-video’})

pyhrf.glm.glm_nipy_from_files(bold_file, tr, paradigm_csv_file, output_dir, mask_file, session=0, contrasts=None, con_test_baseline=0.0, hrf_model='Canonical', drift_model='Cosine', hfcut=128, residuals_model='spherical', fit_method='ols', fir_delays=[0])

#TODO: handle surface data hrf_model : Canonical | Canonical with Derivative | FIR