swd = tempfile.mkdtemp() ######################################## # Design matrix ######################################## paradigm = dm.EventRelatedParadigm(conditions, onsets) X, names = dm.dmtx_light(frametimes, drift_model='Cosine', hfcut=128, hrf_model=hrf_model, paradigm=paradigm, add_regs=motion, add_reg_names=add_reg_names) ####################################### # Get the FMRI data ####################################### fmri_data = surrogate_4d_dataset(shape=shape, n_scans=n_scans)[0] # if you want to save it as an image data_file = op.join(swd,'fmri_data.nii') save(fmri_data, data_file) ######################################## # Perform a GLM analysis ######################################## # GLM fit Y = fmri_data.get_data() model = "ar1" method = "kalman" glm = GLM.glm() mp.pcolor(X)
######################################## paradigm = dm.EventRelatedParadigm(conditions, onsets) X, names = dm.dmtx_light(frametimes, drift_model='Cosine', hfcut=128, hrf_model=hrf_model, paradigm=paradigm, add_regs=motion, add_reg_names=add_reg_names) ####################################### # Get the FMRI data ####################################### fmri_data = surrogate_4d_dataset(shape=shape, n_scans=n_scans)[0] # if you want to save it as an image data_file = op.join(swd, 'fmri_data.nii') save(fmri_data, data_file) ######################################## # Perform a GLM analysis ######################################## # GLM fit Y = fmri_data.get_data() model = "ar1" method = "kalman" glm = GLM.glm() mp.pcolor(X)
######################################## # Design matrix ######################################## paradigm = np.vstack(([conditions, onsets])).T paradigm = dm.EventRelatedParadigm(conditions, onsets) X, names = dm.dmtx_light(frametimes, paradigm, drift_model='Cosine', hfcut=128, hrf_model=hrf_model, add_regs=motion, add_reg_names=add_reg_names) ####################################### # Get the FMRI data ####################################### fmri_data = surrogate_4d_dataset(mask=mask, dmtx=X, seed=1) # if you want to save it as an image # data_file = op.join(swd,'fmri_data.nii') # save(fmri_data, data_file) ######################################## # Perform a GLM analysis ######################################## # GLM fit Y = fmri_data.get_data()[mask.get_data()>0, :] model = "ar1" method = "kalman" glm = GLM.glm() glm.fit(Y.T, X, method=method, model=model)