8.3.1. 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)

  • ../../_images/sphx_glr_plot_haxby_stimuli_001.png
  • ../../_images/sphx_glr_plot_haxby_stimuli_002.png
  • ../../_images/sphx_glr_plot_haxby_stimuli_003.png
  • ../../_images/sphx_glr_plot_haxby_stimuli_004.png
  • ../../_images/sphx_glr_plot_haxby_stimuli_005.png
  • ../../_images/sphx_glr_plot_haxby_stimuli_006.png
  • ../../_images/sphx_glr_plot_haxby_stimuli_007.png
from scipy.misc import imread
import matplotlib.pyplot as plt

from nilearn import datasets

haxby_dataset = datasets.fetch_haxby(subjects=[], fetch_stimuli=True)
stimulus_information = haxby_dataset.stimuli

for stim_type in sorted(stimulus_information.keys()):
    if stim_type == b'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()

Total running time of the script: ( 0 minutes 16.085 seconds)

Generated by Sphinx-Gallery