{"id":50854719,"url":"https://github.com/mne-tools/mne-denoise","last_synced_at":"2026-06-14T17:32:07.914Z","repository":{"id":248058603,"uuid":"827539180","full_name":"mne-tools/mne-denoise","owner":"mne-tools","description":"mne-denoise provides narrow-band artefact removal tailored to MNE-Python workflows. It wraps harmonic regression techniques to suppress power-line noise and other oscillatory contaminants while preserving signal rank and interpretability.","archived":false,"fork":false,"pushed_at":"2026-06-05T19:04:15.000Z","size":125004,"stargazers_count":27,"open_issues_count":11,"forks_count":8,"subscribers_count":6,"default_branch":"main","last_synced_at":"2026-06-05T20:22:06.512Z","etag":null,"topics":["bci","brain-computer-interface","datacleaning","dss","eeg","neuroscience","noiseremoval","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mne-tools.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-07-11T21:13:13.000Z","updated_at":"2026-06-04T15:00:47.000Z","dependencies_parsed_at":"2024-11-02T17:22:27.040Z","dependency_job_id":"d7a80191-76b5-4947-b7a1-9b98b157ba57","html_url":"https://github.com/mne-tools/mne-denoise","commit_stats":null,"previous_names":["snesmaeili/pyzapline_plus","mne-tools/mne-denoise"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/mne-tools/mne-denoise","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mne-tools%2Fmne-denoise","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mne-tools%2Fmne-denoise/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mne-tools%2Fmne-denoise/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mne-tools%2Fmne-denoise/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mne-tools","download_url":"https://codeload.github.com/mne-tools/mne-denoise/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mne-tools%2Fmne-denoise/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34331808,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-14T02:00:07.365Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bci","brain-computer-interface","datacleaning","dss","eeg","neuroscience","noiseremoval","python"],"created_at":"2026-06-14T17:32:06.943Z","updated_at":"2026-06-14T17:32:07.906Z","avatar_url":"https://github.com/mne-tools.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mne-denoise\n\n[![CI](https://github.com/mne-tools/mne-denoise/actions/workflows/ci.yml/badge.svg)](https://github.com/mne-tools/mne-denoise/actions/workflows/ci.yml)\n[![codecov](https://codecov.io/gh/mne-tools/mne-denoise/branch/main/graph/badge.svg)](https://codecov.io/gh/mne-tools/mne-denoise)\n[![PyPI version](https://img.shields.io/pypi/v/mne-denoise.svg)](https://pypi.org/project/mne-denoise/)\n[![Python versions](https://img.shields.io/pypi/pyversions/mne-denoise.svg)](https://pypi.org/project/mne-denoise/)\n[![License](https://img.shields.io/badge/License-BSD_3--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause)\n[![Code style: ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)\n[![Documentation](https://img.shields.io/badge/docs-stable-blue.svg)](https://mne.tools/mne-denoise/)\n[![Downloads](https://pepy.tech/badge/mne-denoise)](https://pepy.tech/project/mne-denoise)\n\n**Advanced denoising algorithms for M/EEG data in MNE-Python.**\n\n`mne-denoise` provides powerful signal denoising techniques for the MNE-Python ecosystem, including **Denoising Source Separation (DSS)** and **ZapLine** algorithms. These methods excel at extracting signals of interest by exploiting data structure rather than just variance.\n\n## Features\n\n### DSS Module\n\n- **Linear DSS**: Extract components based on reproducibility across trials or characteristic frequencies\n- **Iterative DSS**: Powerful nonlinear separation for complex non-Gaussian sources\n- **20+ Pluggable Denoisers**: Spectral, temporal, periodic, and ICA-style bias functions\n- **Specialized Variants**: TSR, SSVEP enhancement, narrowband oscillation extraction\n\n### ZapLine Module\n\n- **ZapLine**: Efficient removal of power line noise (50/60 Hz) and harmonics\n- **ZapLine-plus**: Fully adaptive mode with automatic frequency detection\n- **Per-chunk Processing**: Handles non-stationary noise characteristics\n- **Quality Assurance**: Built-in spectral checks to prevent over-cleaning\n\n### Integration\n\n- **MNE-Python**: Works directly with `Raw`, `Epochs`, and `Evoked` objects or `numpy` arrays.\n- **Scikit-Learn API**: Standard `fit()`, `transform()`, `fit_transform()` interface\n- **Visualization**: Built-in plotting for components and cleaning results\n\n## Installation\n\n### From PyPI (recommended)\n\n```bash\npip install mne-denoise\n```\n\n### From source (development)\n\n```bash\ngit clone https://github.com/mne-tools/mne-denoise.git\ncd mne-denoise\npip install -e \".[dev]\"\n```\n\n## Quick Start\n\n### DSS: Enhancing Evoked Responses\n\nDSS finds spatial filters that maximize the ratio of reproducible (evoked) to total power:\n\n```python\nimport mne\nfrom mne_denoise.dss import DSS, AverageBias\n\n# Load your epoched data\nepochs = mne.read_epochs(\"sample-epo.fif\")\n\n# Create DSS with trial-average bias\ndss = DSS(bias=AverageBias(), n_components=5)\ndss.fit(epochs)\n\n# Option 1: Extract source time courses\nsources = dss.transform(epochs)\n\n# Option 2: Reconstruct denoised sensor data\ncleaned_epochs = dss.transform(epochs, return_type=\"epochs\")\n```\n\n### DSS: Extracting Oscillations\n\nIsolate specific frequency bands (e.g., alpha rhythm):\n\n```python\nfrom mne_denoise.dss import DSS, BandpassBias\n\n# Create bandpass bias for alpha (8-12 Hz)\nbias = BandpassBias(sfreq=epochs.info[\"sfreq\"], freq=10, bandwidth=4)\n\ndss = DSS(bias=bias, n_components=3)\nalpha_sources = dss.fit_transform(epochs)\n```\n\n### ZapLine: Removing Line Noise\n\nRemove 50/60 Hz power line artifacts:\n\n```python\nimport mne\nfrom mne_denoise.zapline import ZapLine\n\n# Load continuous data\nraw = mne.io.read_raw_fif(\"sample-raw.fif\", preload=True)\n\n# Standard mode: specify line frequency\nzapline = ZapLine(sfreq=raw.info[\"sfreq\"], line_freq=50.0)\ncleaned_data = zapline.fit_transform(raw)\n\n# Adaptive mode: automatic detection and per-chunk processing\nzapline_plus = ZapLine(\n    sfreq=raw.info[\"sfreq\"],\n    line_freq=None,  # Auto-detect\n    adaptive=True,\n)\ncleaned = zapline_plus.fit_transform(raw)\nprint(f\"Detected line frequency: {zapline_plus.detected_freq_} Hz\")\n```\n\n## Documentation\n\nFull documentation is available at **[mne.tools/mne-denoise](https://mne.tools/mne-denoise/)**.\n\n- [Getting Started Guide](https://mne.tools/mne-denoise/getting-started.html)\n- [API Reference](https://mne.tools/mne-denoise/api.html)\n- [Example Gallery](https://mne.tools/mne-denoise/auto_examples/index.html)\n\n## 🏗️ Architecture\n\n```\nmne_denoise/\n├── dss/                    # Denoising Source Separation\n│   ├── linear.py           # Core DSS algorithm, DSS estimator\n│   ├── nonlinear.py        # Iterative DSS, IterativeDSS estimator\n│   ├── denoisers/          # 20+ pluggable bias functions\n│   │   ├── spectral.py     # BandpassBias, LineNoiseBias\n│   │   ├── temporal.py     # TimeShiftBias, SmoothingBias\n│   │   ├── periodic.py     # CombFilterBias, PeakFilterBias\n│   │   └── ...\n│   └── variants/           # Pre-built applications\n│       ├── tsr.py          # Time-Shift Repeatability\n│       ├── ssvep.py        # SSVEP enhancement\n│       └── narrowband.py   # Oscillation extraction\n├── zapline/                # Line noise removal\n│   ├── core.py             # ZapLine estimator\n│   └── adaptive.py         # ZapLine-plus utilities\n└── viz/                    # Visualization tools\n```\n\n## Testing\n\n```bash\n# Run tests\npytest\n\n# With coverage\npytest --cov=mne_denoise --cov-report=html\n```\n\n## Contributing\n\nWe welcome contributions! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.\n\n```bash\n# Development setup\ngit clone https://github.com/\u003cyour-username\u003e/mne-denoise.git\ncd mne-denoise\npip install -e \".[dev,docs]\"\npre-commit install\n```\n\n## References\n\n### DSS\n\n\u003e Särelä, J., \u0026 Valpola, H. (2005). Denoising source separation. _Journal of Machine Learning Research_, 6, 233-272.\n\n\u003e de Cheveigné, A., \u0026 Simon, J. Z. (2008). Denoising based on spatial filtering. _Journal of Neuroscience Methods_, 171(2), 331-339.\n\n### ZapLine\n\n\u003e de Cheveigné, A. (2020). ZapLine: A simple and effective method to remove power line artifacts. _NeuroImage_, 207, 116356.\n\n\u003e Klug, M., \u0026 Kloosterman, N. A. (2022). Zapline-plus: A completely automatic and highly effective method for removing power line noise. _Human Brain Mapping_, 43(9), 2743-2758.\n\n## License\n\nBSD 3-Clause License. See [LICENSE](LICENSE) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmne-tools%2Fmne-denoise","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmne-tools%2Fmne-denoise","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmne-tools%2Fmne-denoise/lists"}