forked from nilearn/nilearn
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathplot_haxby_stimuli.py
37 lines (28 loc) · 1.01 KB
/
plot_haxby_stimuli.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
"""
Show stimuli of Haxby et al. dataset
===============================================================================
In this script we plot an overview of the stimuli used in "Distributed
and Overlapping Representations of Faces and Objects in Ventral Temporal
Cortex" (Science 2001)
"""
from scipy.misc import imread
import matplotlib.pyplot as plt
from nilearn.datasets import fetch_haxby
stimulus_information = fetch_haxby(n_subjects=0,
fetch_stimuli=True).stimuli
for stim_type in sorted(stimulus_information.keys()):
if stim_type == "controls":
# skip control images, there are too many
continue
file_names = stimulus_information[stim_type]
plt.figure()
for i in range(48):
plt.subplot(6, 8, i + 1)
try:
plt.imshow(imread(file_names[i]), cmap=plt.cm.gray)
except:
# just go to the next one if the file is not present
pass
plt.axis("off")
plt.suptitle(stim_type)
plt.show()