{ "nbformat_minor": 0, "nbformat": 4, "cells": [ { "execution_count": null, "cell_type": "code", "source": [ "%matplotlib inline" ], "outputs": [], "metadata": { "collapsed": false } }, { "source": [ "\n# Compare evoked responses for different conditions\n\n\nIn this example, an Epochs object for visual and\nauditory responses is created. Both conditions\nare then accessed by their respective names to\ncreate a sensor layout plot of the related\nevoked responses.\n\n\n" ], "cell_type": "markdown", "metadata": {} }, { "execution_count": null, "cell_type": "code", "source": [ "# Authors: Denis Engemann \n# Alexandre Gramfort \n\n# License: BSD (3-clause)\n\n\nimport matplotlib.pyplot as plt\nimport mne\n\nfrom mne.viz import plot_evoked_topo\nfrom mne.datasets import sample\n\nprint(__doc__)\n\ndata_path = sample.data_path()" ], "outputs": [], "metadata": { "collapsed": false } }, { "source": [ "Set parameters\n\n" ], "cell_type": "markdown", "metadata": {} }, { "execution_count": null, "cell_type": "code", "source": [ "raw_fname = data_path + '/MEG/sample/sample_audvis_filt-0-40_raw.fif'\nevent_fname = data_path + '/MEG/sample/sample_audvis_filt-0-40_raw-eve.fif'\nevent_id = 1\ntmin = -0.2\ntmax = 0.5\n\n# Setup for reading the raw data\nraw = mne.io.read_raw_fif(raw_fname)\nevents = mne.read_events(event_fname)\n\n# Set up pick list: MEG + STI 014 - bad channels (modify to your needs)\ninclude = [] # or stim channels ['STI 014']\n# bad channels in raw.info['bads'] will be automatically excluded\n\n# Set up amplitude-peak rejection values for MEG channels\nreject = dict(grad=4000e-13, mag=4e-12)\n\n# pick MEG channels\npicks = mne.pick_types(raw.info, meg=True, eeg=False, stim=False, eog=True,\n include=include, exclude='bads')\n\n# Create epochs including different events\nevent_id = {'audio/left': 1, 'audio/right': 2,\n 'visual/left': 3, 'visual/right': 4}\nepochs = mne.Epochs(raw, events, event_id, tmin, tmax,\n picks=picks, baseline=(None, 0), reject=reject)\n\n# Generate list of evoked objects from conditions names\nevokeds = [epochs[name].average() for name in ('left', 'right')]" ], "outputs": [], "metadata": { "collapsed": false } }, { "source": [ "Show topography for two different conditions\n\n" ], "cell_type": "markdown", "metadata": {} }, { "execution_count": null, "cell_type": "code", "source": [ "colors = 'yellow', 'green'\ntitle = 'MNE sample data - left vs right (A/V combined)'\n\nplot_evoked_topo(evokeds, color=colors, title=title)\n\nplt.show()" ], "outputs": [], "metadata": { "collapsed": false } } ], "metadata": { "kernelspec": { "display_name": "Python 2", "name": "python2", "language": "python" }, "language_info": { "mimetype": "text/x-python", "nbconvert_exporter": "python", "name": "python", "file_extension": ".py", "version": "2.7.13", "pygments_lexer": "ipython2", "codemirror_mode": { "version": 2, "name": "ipython" } } } }