Logo van Mne Python Guide

Mne Python Guide

OrganisatiePopulair
NeuroAIHub
mne-python-guide

Domain-validated pipeline guidance for EEG/MEG data analysis using MNE-Python: data loading, preprocessing (filtering, ICA, re-referencing), epoching, ERP/ERF computation, time-frequency decomposition, source localization, decoding/MVPA, statistical testing, simulation, and visualization. Use this skill whenever the user works with EEG/MEG/sEEG/ECoG/NIRS/eye-tracking data in Python, mentions MNE, or needs neurophysiological analysis guidance.

Add to TypingMind

Overzicht

UitgeverNeuroAIHub
RepositoryBrainPilot
Skillnaammne-python-guide
Sterren
1.1K
Forks
74
Meegeleverde bestanden
8
LicentieAGPL-3.0
Links
  • Instructies in Markdown

    Het model laadt het bestand SKILL.md alleen als dat nodig is. Dat kost dus alleen tokens als een verzoek daadwerkelijk bij de skill past.

  • Werkt met elk LLM

    AI-skills bestaan uit instructies in gewone Markdown, niet uit aanbiederspecifieke code. Daardoor werken ze met GPT, Claude, Gemini, Grok of een lokaal model.

  • Meegeleverde bestanden: 8

    Scripts, sjablonen en referentiemateriaal die het model tijdens het werken kan lezen. De bestanden kunnen alleen worden gelezen en worden nooit uitgevoerd.

  • Open source

    Gepubliceerd door NeuroAIHub op GitHub. Bekijk de bronbestanden voordat je de skill installeert.

Installatie

Installeer de AI-skill Mne Python Guide in TypingMind om deze met elk LLM te gebruiken, of voeg de skill toe aan een andere agent die SKILL.md kan lezen.

1

Installeren in TypingMind

TypingMind installeert een skill rechtstreeks vanuit de GitHub-map. De app leest SKILL.md, bundelt de bijbehorende bestanden en slaat het resultaat lokaal op.

  1. Open de app en ga naar Plug-ins → Skills.
  2. Kies "Installeren via GitHub".
  3. Plak de onderstaande URL van de skillmap en bevestig.
    https://github.com/NeuroAIHub/BrainPilot/tree/main/packages/skills/skills/05_EEG_ERP/mne-python-guide
  4. Schakel de skill in voor elke chat waarin je de skill wilt kunnen gebruiken.
Plug-ins → Skills → Skill toevoegen → Via GitHub-URL. Plak vervolgens de map-URL en druk op Doorgaan.
2

Installeren in een andere agent

Elke agent die het Agent Skills-formaat kan lezen, kan deze skill gebruiken — kopieer de map naar de skillmap van die agent.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/NeuroAIHub/BrainPilot.git /tmp/BrainPilot
mkdir -p .claude/skills
cp -r /tmp/BrainPilot/packages/skills/skills/05_EEG_ERP/mne-python-guide .claude/skills/mne-python-guide
Start Claude Code na het kopiëren opnieuw op, zodat de nieuwe skill wordt herkend.

Gebruik deze skill in TypingMind

Schakel Mne Python Guide in voor een chat naar keuze in TypingMind en het model doet de rest. De naam en beschrijving staan in de systeemprompt. Zodra een verzoek bij de skill past, laadt het model zelf de volledige instructies. Je hoeft de skill nooit handmatig aan te roepen. Pas als het model de skill daadwerkelijk gebruikt, kost dat tokens.

Het model laadt Mne Python Guide automatisch zodra een verzoek erbij past.

Werkt met elk AI-model

AI-skills zijn gewone Markdown-instructies in plaats van aanbiederspecifieke code. Daardoor is Mne Python Guide niet gebonden aan het model waarvoor de skill is geschreven. Installeer de skill één keer in TypingMind en gebruik deze met GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama of een lokaal model dat je zelf draait — allemaal met je eigen API-sleutels.

  • Alleen geladen wanneer nodig

    De systeemprompt bevat alleen de naam en beschrijving. De instructies worden bij het eerste bijpassende verzoek opgehaald, dus een ongebruikte skill kost niets.

  • Wissel van model tijdens een chat

    Omdat de skill uit instructies bestaat en niet uit code, blijft deze werken als je van model wisselt — het volgende model leest hetzelfde SKILL.md-bestand.

Skillinstructies

Dit is de inhoud van SKILL.md die het model laadt. Lees deze vóór de installatie — een skill bestaat uit instructies die je model zal volgen.

MNE-Python Analysis Guide

Purpose

This skill encodes expert methodological knowledge for analyzing neurophysiological data (EEG, MEG, sEEG, ECoG, NIRS, eye-tracking) using MNE-Python (Gramfort et al., 2013; Gramfort et al., 2014). It covers the complete analysis pipeline with recommended parameters, code examples, and common pitfall warnings.

When to Use This Skill

Activate when the user:

  • Asks about EEG/MEG/sEEG/ECoG/NIRS data analysis in Python
  • Mentions MNE, MNE-Python, epochs, evoked, Raw, source estimate, ICA, ERP, ERF
  • Wants to load neurophysiological data files (.fif, .edf, .bdf, .set, .vhdr, .mff, .cnt, .snirf)
  • Needs preprocessing, time-frequency, source localization, decoding, or statistical testing guidance
  • Wants to create MNE objects from numpy arrays or simulate data

Research Planning Protocol

  1. State the research question — What is the user investigating?
  2. Justify the method choice — Confirm MNE-Python fits their data type and goal.
  3. Declare expected outcomes — What output format? (ERP plots, TFR maps, source maps, decoding accuracy)
  4. Note assumptions and limitations — Data quality, sample size, MRI availability, montage info.
  5. Present the plan and WAIT for confirmation before writing code.

Verification Notice

This skill was generated by AI from MNE-Python source code and academic literature. All parameters, thresholds, and citations require independent verification. If you find errors, please open an issue at https://github.com/NeuroAIHub/awesome_cognitive_and_neuroscience_skills/issues.

Reference Files (Progressive Disclosure)

This skill uses layered references. Read the relevant file when the user's question goes deeper than the overview below:

TopicReference FileWhen to Read
Data I/O (30+ formats)references/io_formats.mdUser asks about loading specific file formats, creating objects from arrays, or exporting
Preprocessingreferences/preprocessing.mdUser needs ICA details, Maxwell filtering, artifact annotation, bad channel detection, CSD, fNIRS/iEEG-specific preprocessing
Time-Frequencyreferences/time_frequency.mdUser asks about TFR methods, PSD, CSD, baseline modes, array-level functions
Source Localizationreferences/source_localization.mdUser needs forward modeling, inverse methods, beamformers, dipole fitting details
Decoding & MVPAreferences/decoding.mdUser asks about classification, temporal generalization, CSP, SPoC, receptive fields
Statisticsreferences/statistics.mdUser needs cluster permutation, TFCE, ANOVA, adjacency matrices, correction methods
Visualizationreferences/visualization.mdUser asks about plotting functions, publication figures, 3D brain rendering
Simulationreferences/simulation.mdUser wants to create synthetic data, simulate sources, add artifacts

Pipeline Overview

Raw → Mark bad channels → Filter → ICA → Re-reference → Resample
  → Epochs → Evoked (ERP/ERF)
  → Time-Frequency (TFR/PSD)
  → Source Localization (MNE/dSPM/LCMV)
  → Decoding (MVPA)
  → Statistics (cluster permutation)

Core Data Structures

ObjectDescriptionCreate from
RawContinuous datamne.io.read_raw_*() or mne.io.RawArray(data, info)
EpochsEvent-segmented datamne.Epochs(raw, events, ...) or mne.EpochsArray(data, info)
EvokedAveraged epochsepochs.average() or mne.EvokedArray(data, info)
SourceEstimateBrain-mapped activityapply_inverse(evoked, inv, ...)
SpectrumPower spectrumraw.compute_psd() or epochs.compute_psd()
AverageTFRTime-frequency mapepochs.compute_tfr(method, freqs, ...)

All objects carry an info attribute (mne.Info) with channel metadata that propagates through the pipeline.

Quick Start Pipeline

python
import mne
import numpy as np

# 1. Load
raw = mne.io.read_raw_fif('data_raw.fif', preload=True)
# or: raw = mne.io.read_raw_edf('data.edf', preload=True)

# 2. Preprocess
raw.filter(l_freq=0.1, h_freq=40.)           # bandpass
raw.notch_filter(freqs=[50, 100])              # line noise
ica = mne.preprocessing.ICA(n_components=20, random_state=97, max_iter=800)
ica.fit(raw.copy().filter(l_freq=1., h_freq=None))  # fit on 1 Hz highpass copy
eog_idx, _ = ica.find_bads_eog(raw)
ica.exclude = eog_idx
ica.apply(raw)
raw.set_eeg_reference('average')

# 3. Epoch
events, event_id = mne.events_from_annotations(raw)
epochs = mne.Epochs(raw, events, event_id, tmin=-0.2, tmax=0.5,
                    baseline=(None, 0), preload=True,
                    reject=dict(eeg=150e-6))

# 4. ERP
evoked = epochs['target'].average()
evoked.plot_joint()

# 5. Time-frequency
freqs = np.arange(4, 30, 2)
power = epochs.compute_tfr(method="morlet", freqs=freqs, n_cycles=freqs / 2.)
power.plot()

# 6. Source localization (requires anatomy)
noise_cov = mne.compute_covariance(epochs, tmax=0., method='auto')
fwd = mne.read_forward_solution('sample-fwd.fif')
inv = mne.minimum_norm.make_inverse_operator(epochs.info, fwd, noise_cov)
stc = mne.minimum_norm.apply_inverse(evoked, inv, lambda2=1./9., method='dSPM')

# 7. Decoding
from mne.decoding import SlidingEstimator, cross_val_multiscore
from sklearn.linear_model import LogisticRegression
from sklearn.pipeline import make_pipeline
from sklearn.preprocessing import StandardScaler
X = epochs.get_data(copy=True)
y = epochs.events[:, -1]
clf = make_pipeline(StandardScaler(), LogisticRegression(solver='liblinear'))
slider = SlidingEstimator(clf, scoring='roc_auc')
scores = cross_val_multiscore(slider, X, y, cv=5)

# 8. Statistics
from mne.stats import spatio_temporal_cluster_test
adjacency, _ = mne.channels.find_ch_adjacency(epochs.info, 'eeg')
T_obs, clusters, p_values, H0 = spatio_temporal_cluster_test(
    [X_cond1, X_cond2], adjacency=adjacency, n_permutations=1000)

Common Pitfalls

  1. ICA on unfiltered data — Highpass ≥1 Hz before ICA fitting; slow drifts degrade decomposition (Jas et al., 2018)
  2. Baseline correction before ICA — Apply baseline after ICA, not before
  3. Filtering after epoching — Filter Raw, not Epochs, to avoid edge artifacts (Luck, 2014)
  4. Wrong rejection thresholds — Start with EEG 100–150 µV, adjust via epochs.plot_drop_log()
  5. Forgetting preload=True — Many operations require data in memory
  6. Re-referencing timing — Set reference after ICA but before epoching
  7. Events after resampling — Recompute events after downsampling, or resample Epochs directly
  8. Legacy API — Use epochs.compute_tfr() / raw.compute_psd() instead of deprecated tfr_morlet() / psd_welch()
  9. Decoding data leakage — Always cross-validate; never fit scaler on test data
  10. Cluster test interpretation — Clusters show where effects exist, not their spatial/temporal extent (Maris & Oostenveld, 2007)

References

  • Blankertz, B., et al. (2008). Optimizing spatial filters for robust EEG single-trial analysis. IEEE Signal Processing Magazine, 25(1), 41–56.
  • Dale, A. M., et al. (2000). Dynamic statistical parametric mapping. Neuron, 26(1), 55–67.
  • Gramfort, A., et al. (2013). MEG and EEG data analysis with MNE-Python. Frontiers in Neuroscience, 7, 267.
  • Gramfort, A., et al. (2014). MNE software for processing MEG and EEG data. NeuroImage, 86, 446–460.
  • Jas, M., et al. (2018). Autoreject: Automated artifact rejection for MEG and EEG data. NeuroImage, 159, 417–429.
  • King, J.-R., & Dehaene, S. (2014). Characterizing the dynamics of mental representations. Trends in Cognitive Sciences, 18(4), 203–210.
  • Luck, S. J. (2014). An Introduction to the Event-Related Potential Technique. MIT Press.
  • Maris, E., & Oostenveld, R. (2007). Nonparametric statistical testing of EEG- and MEG-data. Journal of Neuroscience Methods, 164(1), 177–190.
  • Pascual-Marqui, R. D. (2002). Standardized low-resolution brain electromagnetic tomography. Methods and Findings in Experimental and Clinical Pharmacology, 24(Suppl D), 5–12.
  • Tallon-Baudry, C., et al. (1997). Oscillatory gamma-band activity induced by a visual search task. Journal of Neuroscience, 17(2), 722–734.

Meegeleverde bestanden

Zolang de skill geladen is, leest het model deze bestanden als dat nodig is. Het model kan ze alleen lezen; ze worden nooit uitgevoerd.

Veelgestelde vragen

Wat doet de AI-skill Mne Python Guide?

Domain-validated pipeline guidance for EEG/MEG data analysis using MNE-Python: data loading, preprocessing (filtering, ICA, re-referencing), epoching, ERP/ERF computation, time-frequency decomposition, source localization, decoding/MVPA, statistical testing, simulation, and visualization. Use this skill whenever the user works with EEG/MEG/sEEG/ECoG/NIRS/eye-tracking data in Python, mentions MNE, or needs neurophysiological analysis guidance.

Waarom Mne Python Guide gebruiken in TypingMind?

Omdat je deze skill één keer installeert en met elk model kunt gebruiken. Mne Python Guide bestaat uit gewone Markdown in plaats van aanbiederspecifieke code. Dezelfde skill werkt dus met GPT-5, Claude, Gemini, Grok of een lokaal model. Ook als je midden in een chat van model wisselt, blijft de skill werken. TypingMind werkt met je eigen API-sleutels, dus je betaalt aanbieders rechtstreeks in plaats van een abonnement per gebruikersplek af te sluiten. Je skills en chats blijven in je eigen opslag.

Hoe installeer ik Mne Python Guide in TypingMind?

Open Plug-ins → Skills → Installeren vanaf GitHub in TypingMind en plak https://github.com/NeuroAIHub/BrainPilot/tree/main/packages/skills/skills/05_EEG_ERP/mne-python-guide. TypingMind leest het bestand SKILL.md, bundelt de bijbehorende bestanden en installeert het geheel als een skill die je per chat kunt inschakelen.

Welke AI-modellen kunnen Mne Python Guide gebruiken?

Elk model dat je in TypingMind koppelt. AI-skills bestaan uit gewone Markdown-instructies in plaats van aanbiederspecifieke code. GPT, Claude, Gemini, Grok en lokale modellen kunnen deze skill dus allemaal laden wanneer een verzoek erbij past.

Hoeveel AI-modellen kan ik met Mne Python Guide gebruiken?

Zoveel als je wilt. Je kunt Mne Python Guide gebruiken met elk model dat skills ondersteunt, zoals GPT, Claude, Gemini, Grok, DeepSeek, Mistral of Llama. Allemaal in TypingMind met je eigen API-sleutels.

Is de AI-skill Mne Python Guide gratis?

Ja. Deze skill is door NeuroAIHub op GitHub gepubliceerd onder de licentie AGPL-3.0. Je betaalt alleen je eigen AI-aanbieder voor de tokens die je gebruikt.

Wat zijn AI-skills?

Een AI-skill is een herbruikbare bundel instructies die een AI-model leert hoe het één specifieke taak moet uitvoeren. De skill volgt het open Agent Skills-formaat: het bestand SKILL.md bevat de naam en beschrijving van de skill. Daarnaast kan de skill scripts, sjablonen of referentiebestanden bevatten die het model nodig heeft. Het model leest de instructies alleen als je verzoek bij de skill past. Een geïnstalleerde skill kost dus niets zolang deze niet wordt gebruikt.

Waarin verschillen AI-skills van plug-ins of MCP-servers?

Een plug-in of MCP-server geeft een model nieuwe tools om aan te roepen: code die ergens wordt uitgevoerd en een resultaat teruggeeft. Een AI-skill geeft het model juist kennis en een werkwijze: hoe het een taak moet aanpakken, welke stappen het moet volgen en hoe goede uitvoer eruitziet. Skills bestaan uit gewone Markdown en hebben dus geen server, API-sleutel of runtime nodig. Ze werken met elk model.

Bekijk alles

Maak nu je eigen AI-werkruimte

Schrijf je in voor onze nieuwsbrief en blijf op de hoogte van nieuwe functies en toekomstige weggeefacties 👇