<jupyter_start><jupyter_text>The :class:`Info ` data structure===========================================The :class:`Info ` data object is typically createdwhen data is imported into MNE-Python and contains details such as:- date, subject information, and other recording details- the sampling rate- information about the data channels (name, type, position, etc.)- digitized points- sensor–head coordinate transformation matricesand so forth. See the :class:`the API reference `for a complete list of all data fields. Once created, this object is passedaround throughout the data analysis pipeline.<jupyter_code>import mne
import os.path as op<jupyter_output><empty_output><jupyter_text>:class:`mne.Info` behaves as a nested Python dictionary:<jupyter_code># Read the info object from an example recording
info = mne.io.read_info(
    op.join(mne.datasets.sample.data_path(), 'MEG', 'sample',
            'sample_audvis_raw.fif'), verbose=False)<jupyter_output><empty_output><jupyter_text>List all the fields in the info object<jupyter_code>print('Keys in info dictionary:\n', info.keys())<jupyter_output><empty_output><jupyter_text>Obtain the sampling rate of the data<jupyter_code>print(info['sfreq'], 'Hz')<jupyter_output><empty_output><jupyter_text>List all information about the first data channel<jupyter_code>print(info['chs'][0])<jupyter_output><empty_output><jupyter_text>Obtaining subsets of channels-----------------------------There are a number of convenience functions to obtain channel indices, givenan :class:`mne.Info` object. Get channel indices by name<jupyter_code>channel_indices = mne.pick_channels(info['ch_names'], ['MEG 0312', 'EEG 005'])<jupyter_output><empty_output><jupyter_text>Get channel indices by regular expression<jupyter_code>channel_indices = mne.pick_channels_regexp(info['ch_names'], 'MEG *')<jupyter_output><empty_output><jupyter_text>Channel types-------------MNE supports different channel types:- eeg : For EEG channels with data stored in Volts (V)- meg (mag) : For MEG magnetometers channels stored in Tesla (T)- meg (grad) : For MEG gradiometers channels stored in Tesla/Meter (T/m)- ecg : For ECG channels stored in Volts (V)- seeg : For Stereotactic EEG channels in Volts (V).- ecog : For Electrocorticography (ECoG) channels in Volts (V).- fnirs (HBO) : Functional near-infrared spectroscopy oxyhemoglobin data.- fnirs (HBR) : Functional near-infrared spectroscopy deoxyhemoglobin data.- emg : For EMG channels stored in Volts (V)- bio : For biological channels (AU).- stim : For the stimulus (a.k.a. trigger) channels (AU)- resp : For the response-trigger channel (AU)- chpi : For HPI coil channels (T).- exci : Flux excitation channel used to be a stimulus channel.- ias : For Internal Active Shielding data (maybe on Triux only).- syst : System status channel information (on Triux systems only).Get channel indices by type<jupyter_code>channel_indices = mne.pick_types(info, meg=True)  # MEG only
channel_indices = mne.pick_types(info, meg=False, eeg=True)  # EEG only<jupyter_output><empty_output><jupyter_text>MEG gradiometers and EEG channels<jupyter_code>channel_indices = mne.pick_types(info, meg='grad', eeg=True)<jupyter_output><empty_output><jupyter_text>Get a dictionary of channel indices, grouped by channel type<jupyter_code>channel_indices_by_type = mne.io.pick.channel_indices_by_type(info)
print('The first three magnetometers:', channel_indices_by_type['mag'][:3])<jupyter_output><empty_output><jupyter_text>Obtaining information about channels------------------------------------<jupyter_code># Channel type of a specific channel
channel_type = mne.io.pick.channel_type(info, 75)
print('Channel #75 is of type:', channel_type)<jupyter_output><empty_output><jupyter_text>Channel types of a collection of channels<jupyter_code>meg_channels = mne.pick_types(info, meg=True)[:10]
channel_types = [mne.io.pick.channel_type(info, ch) for ch in meg_channels]
print('First 10 MEG channels are of type:\n', channel_types)<jupyter_output><empty_output><jupyter_text>Dropping channels from an info structure----------------------------------------It is possible to limit the info structure to only include a subset ofchannels with the :func:`mne.pick_info` function:<jupyter_code># Only keep EEG channels
eeg_indices = mne.pick_types(info, meg=False, eeg=True)
reduced_info = mne.pick_info(info, eeg_indices)

print(reduced_info)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.13351436976691558, 'fraction_numerical': 0.003847024213622992, 'mean_word_length': 5.842105263157895, 'pattern_counts': {'":': 0, '<': 53, '<?xml version=': 0, '>': 53, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '13', 'dir': 'jupyter-structured-clean-dedup', 'id': '49364', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 1386, 'n_tokens_neox': 1322, 'n_words': 402, 'path': '0.17/_downloads/3ebd331f774b241a9eda870b8410800d/plot_info.ipynb', 'repo_name': 'drammock/mne-tools.github.io', 'size': '4419'}