{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n\n# Sensitivity map of SSP projections\n\nThis example shows the sources that have a forward field\nsimilar to the first SSP vector correcting for ECG.\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "# Author: Alexandre Gramfort \n#\n# License: BSD-3-Clause\n# Copyright the MNE-Python contributors." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "import matplotlib.pyplot as plt\n\nfrom mne import read_forward_solution, read_proj, sensitivity_map\nfrom mne.datasets import sample\n\nprint(__doc__)\n\ndata_path = sample.data_path()\n\nsubjects_dir = data_path / \"subjects\"\nmeg_path = data_path / \"MEG\" / \"sample\"\nfname = meg_path / \"sample_audvis-meg-eeg-oct-6-fwd.fif\"\necg_fname = meg_path / \"sample_audvis_ecg-proj.fif\"\n\nfwd = read_forward_solution(fname)\n\nprojs = read_proj(ecg_fname)\n# take only one projection per channel type\nprojs = projs[::2]\n\n# Compute sensitivity map\nssp_ecg_map = sensitivity_map(fwd, ch_type=\"grad\", projs=projs, mode=\"angle\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Show sensitivity map\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "plt.hist(ssp_ecg_map.data.ravel())\nplt.show()\n\nargs = dict(\n clim=dict(kind=\"value\", lims=(0.2, 0.6, 1.0)),\n smoothing_steps=7,\n hemi=\"rh\",\n subjects_dir=subjects_dir,\n)\nssp_ecg_map.plot(subject=\"sample\", time_label=\"ECG SSP sensitivity\", **args)" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.12.2" } }, "nbformat": 4, "nbformat_minor": 0 }