<commit_before>"""
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]))

            plt.gray()
        except:
            # just go to the next one if the file is not present
            pass
        plt.axis("off")
    plt.suptitle(stim_type)

plt.show()
<commit_msg>DOC: avoid side effects in examples<commit_after>"""
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()

{'fraction_non_alphanumeric': 0.14579439252336449, 'fraction_numerical': 0.009345794392523364, 'mean_word_length': 2.921245421245421, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4514816', 'n_tokens_mistral': 663, 'n_tokens_neox': 601, 'n_words': 195}