.. _sphx_glr_auto_examples_plot_interpolate_missing_channels.py: ========================================================== Interpolate channel that are missing in an HCP output file ========================================================== We'll take a look at the coregistration here. .. code-block:: python # Author: Denis A. Enegemann # License: BSD 3 clause import os.path as op import mne import hcp from hcp import preprocessing as preproc mne.set_log_level('WARNING') we assume our data is inside a designated folder under $HOME and set the IO params .. code-block:: python storage_dir = op.expanduser('~') hcp_params = dict(hcp_path=op.join(storage_dir, 'mne-hcp-data', 'HCP'), subject='105923', data_type='task_working_memory') we take the some evoked and create an interpolated copy .. code-block:: python evoked = hcp.read_evokeds(**hcp_params)[0] # The HCP pipelines don't interpolate missing channels print('%i channels out of 248 expected' % len(evoked.ch_names)) evoked_interpolated = preproc.interpolate_missing(evoked, **hcp_params) .. rst-class:: sphx-glr-script-out Out:: 243 channels out of 248 expected Let's visualize what has changed! .. code-block:: python # we calculate the difference ... bads = set(evoked_interpolated.ch_names) - set(evoked.ch_names) print(bads) # ... and mark the respective channels as bad ... evoked_interpolated.info['bads'] += list(bads) # ... such that MNE is displaying the interpolated time series in red ... evoked_interpolated.plot(exclude=[]) .. image:: /auto_examples/images/sphx_glr_plot_interpolate_missing_channels_001.png :align: center .. rst-class:: sphx-glr-script-out Out:: set(['A248', 'A2', 'A244', 'A247', 'A246']) **Total running time of the script:** ( 0 minutes 4.375 seconds) .. container:: sphx-glr-download :download:`Download Python source code: plot_interpolate_missing_channels.py ` .. container:: sphx-glr-download :download:`Download Jupyter notebook: plot_interpolate_missing_channels.ipynb ` .. rst-class:: sphx-glr-signature `Generated by Sphinx-Gallery `_