with one click
drop-bads
Remove channels marked as bad (flat, noisy, or manually flagged)
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Menu
Remove channels marked as bad (flat, noisy, or manually flagged)
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Based on SOC occupation classification
Neurodata Without Borders (.nwb) — the de-facto standard for in-vivo electrophysiology (Neuropixels / AIBS / DANDI / IBL)
Index of L0 data-format loader skills by family
Index of all L2 paradigm skills by group + analysis_goal → paradigm matrix
Two-phase BCI data preprocessing pipeline: deep-inspect → plan → propose → user confirm → automated code/execute/QC/export
BIDS-iEEG sidecar (*_channels.tsv / *_electrodes.tsv / *_coordsystem.json / *_ieeg.json) — clinical sEEG / ECoG standard
Multiscale Electrophysiology Format v3 (Mayo Clinic) — long-duration encrypted sEEG
| name | drop_bads |
| description | Remove channels marked as bad (flat, noisy, or manually flagged) |
| layer | L3 |
| group | channel |
| metadata | {"tags":["operator","channels","bad","reject","quality"],"modalities":["eeg","seeg","ecog","meg"],"step_string":"drop_bads","analysis_goal_allowed":["classification","source_localization","feature_extraction","clinical_screening","exploratory","generic","connectivity","phase_amplitude_coupling","online_inference"],"analysis_goal_forbidden":[]} |
Removes channels from the data array that are marked as bad in meta.bad_channels. Reduces channel count. Irreversible — use interpolate_bads if you want to preserve channel count.
drop_bads — No parameters. Operates on pre-identified bad channels.
Bad channels are marked during quality_check or inspect_data and stored in data_dict["meta"]["bad_channels"]. Criteria:
interpolate_bads instead)meta.bad_channels list exists, this step does nothingdata.shape[0] and channels list accordinglycar (bad channels corrupt the average reference)ica (bad channels waste ICA components)interpolate_bads instead if channel preservation neededraw.drop_channels(['Fp1', 'Fp2'])
import numpy as np
bad_channels = ['Fp1', 'Fp2'] # from meta.bad_channels
keep_idx = [i for i, ch in enumerate(channels) if ch not in bad_channels]
data = data[keep_idx]
channels = [channels[i] for i in keep_idx]
raw.drop_channels(bad_list) — MNE methoddata_dict["meta"]["bad_channels"] in pipeline contextdrop_bads:auto (Phase 1+)When the param is the literal string auto, the operator detects bad channels automatically:
| Criterion | Threshold | Notes |
|---|---|---|
| flat | std < 1e-7 | sensor disconnected / amplifier rail |
| high variance | std > 3 × median(non-zero σ) | usually muscle / electrical artifact |
| spike | `max( | x |
Detected names are written to meta['bad_channels'] and dropped from data + channels arrays. No interpolation is performed — downstream goals that need every channel filled in must explicitly add interpolate_bads after this step.
The trailing dropped_channels list in meta is what qc.py and reasoning.md surface to the user.
Goal-conditional auto-injection (codegen/generator.py:_enforce_clean_output):
| analysis_goal | drop_bads:auto auto-inserted? |
|---|---|
| classification | yes |
| feature_extraction | yes |
| clinical_screening | yes |
| generic | yes |
| source_localization | no |
| exploratory | no |
For opted-out goals, manually add drop_bads:auto or interpolate_bads if you need them.