Skip to content

Commit

Permalink
Fixed one failing example
Browse files Browse the repository at this point in the history
  • Loading branch information
bthirion committed Dec 17, 2015
1 parent 06c9a3b commit e71ea46
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions examples/plot_spm_auditory.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import pandas as pd
import matplotlib.pyplot as plt

import nibabel
import nibabel as nib
from nilearn.plotting import plot_stat_map
from nilearn.image import mean_img

Expand All @@ -20,14 +20,12 @@

# fetch spm auditory data
subject_data = fetch_spm_auditory()
fmri_img = subject_data.func
fmri_img = nib.concat_images(subject_data.func)

# construct experimental paradigm
tr = 7.
n_scans = 96
one_duration = 6 # duration in TR
n_conditions = 2
epoch_duration = one_duration * tr # in seconds now
epoch_duration = 6 * tr # duration in seconds
conditions = ['rest', 'active'] * 8
n_blocks = len(conditions)
duration = epoch_duration * np.ones(n_blocks)
Expand All @@ -36,11 +34,10 @@
{'onset': onset, 'duration': duration, 'name': conditions})

# construct design matrix
n_scans = len(fmri_img)
frame_times = np.linspace(0, (n_scans - 1) * tr, n_scans)
drift_model = 'Cosine'
hrf_model = 'Canonical With Derivative'
period_cut = 2. * 2. * epoch_duration
period_cut = 4. * epoch_duration
design_matrix = make_design_matrix(
frame_times, paradigm, hrf_model=hrf_model, drift_model=drift_model,
period_cut=period_cut)
Expand Down Expand Up @@ -79,7 +76,7 @@
if not os.path.exists(map_dir):
os.makedirs(map_dir)
map_path = os.path.join(map_dir, '%s.nii.gz' % contrast_id)
nibabel.save(out_map, map_path)
nib.save(out_map, map_path)
print("\t\t%s map: %s" % (dtype, map_path))

# plot activation map
Expand Down

0 comments on commit e71ea46

Please sign in to comment.