PyRASA - Spectral parametrization in python based on IRASA
PyRASA - Spectral parametrization in python based on IRASA - Published in JOSS (2025)
Science Score: 93.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
✓DOI references
Found 3 DOI reference(s) in README and JOSS metadata -
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
✓JOSS paper metadata
Published in Journal of Open Source Software
Keywords
Scientific Fields
Repository
a package for spectral parametrization in python based on the IRASA algorithm
Basic Info
- Host: GitHub
- Owner: schmidtfa
- License: bsd-2-clause
- Language: Python
- Default Branch: main
- Homepage: https://schmidtfa.github.io/pyrasa/
- Size: 24.9 MB
Statistics
- Stars: 17
- Watchers: 4
- Forks: 2
- Open Issues: 2
- Releases: 1
Topics
Metadata Files
README.md
PyRASA - Spectral parametrization in python based on IRASA
PyRASA is a Python library designed to separate and parametrize aperiodic (fractal) and periodic (oscillatory) components in time series data based on the IRASA algorithm (Wen & Liu, 2016).
Features
- Aperiodic and Periodic Decomposition: Utilize the IRASA algorithm to decompose power spectra into aperiodic and periodic components, enabling better interpretation of neurophysiological signals.
- Time Resolved Spectral Parametrization: Perform time resolved spectral parametrizazion, allowing you to track changes in spectral components over time.
- Support for Raw and Epoched MNE Objects: PyRASA provides functions designed for both continuous (Raw) and event-related (Epochs) data, making it versatile for various types of EEG/MEG analyses.
- Consistent Ontology: PyRASA uses the same jargon to label parameters as specparam, the most commonly used tool to parametrize power spectra, to allow users to easily switch between tools depending on their needs, while keeping the labeling of features consistent.
- Custom Aperiodic Fit Models: In addition to the built-in "fixed" and "knee" models for aperiodic fitting, users can specify their custom aperiodic fit functions, offering flexibility in how aperiodic components are modeled.
Documentation
Documentation for PyRASA, including detailed descriptions of functions, parameters, and tutorials is available here.
Installation
To install the latest stable version of PyRASA, you can soon use pip:
bash
$ pip install pyrasa
or conda
bash
$ conda install -c conda-forge pyrasa
Dependencies
PyRASA has the following dependencies: - Core Dependencies: - numpy - scipy - pandas
- Optional Dependencies for Full Functionality:
- mne: Required for directly working with EEG/MEG data in
RaworEpochsformats.
- mne: Required for directly working with EEG/MEG data in
Example Usage
Decompose spectra in periodic and aperiodic components If you want to reproduce the example below checkout example
```python from pyrasa.irasa import irasa
irasaout = irasa(sig, fs=fs, band=(.1, 200), nperseg=durationfs, noverlap=durationfs*overlap, hsetinfo=(1, 2, 0.05))
```

Extract periodic parameters
```python
irasaout.getpeaks()
``` | ch_name | cf | bw | pw | |----------:|-----:|--------:|-------:| | 0 | 10.0 | 1.1887 | 0.4950 |
Extract aperiodic parameters
```python
irasaout.fitaperiodicmodel(fitfunc='knee').aperiodic_params
```
| Offset | Knee | Exponent1 | Exponent2 | fittype | Knee Frequency (Hz) | tau | chname | |---------:|-------:|-------------:|-------------:|:-----------|----------------------:|----------:|----------:| | 4.3299e-17 | 62.1060 | 0.0552 | 1.4602 | knee | 13.8547 | 0.0115 | 0 |
And the goodness of fit
```python
irasaout.fitaperiodicmodel(fitfunc='knee').gof
```
| mse | rsquared | BIC | AIC | fittype | ch_name | |------------:|------------:|---------:|---------:|:-----------|----------:| | 0.000088 | 0.999303 | -31.9892 | -47.9550 | knee | 0 |
How to Contribute
Contributions to PyRASA are welcome! Whether it's raising issues, improving documentation, fixing bugs, or adding new features, your help is appreciated.
To file bug reports and/or ask questions about this project, please use the Github issue tracker.
Please refer to the CONTRIBUTING.md file for more information on how to get involved.
Reference
If you are using IRASA please cite the smart people who came up with the algorithm:
Wen, H., & Liu, Z. (2016). Separating fractal and oscillatory components in the power spectrum of neurophysiological signal. Brain topography, 29, 13-26. https://doi.org/10.1007/s10548-015-0448-0
If you are using PyRASA it would be nice, if you could additionally cite us (whenever the paper is finally ready):
Schmidt F., Hartmann T., & Weisz, N. (2025). PyRASA - Spectral parametrization in python based on IRASA.
Owner
- Name: Fabi
- Login: schmidtfa
- Kind: user
- Website: https://schmidtfa.github.io/schmidtfa/
- Twitter: schmidtfa1
- Repositories: 7
- Profile: https://github.com/schmidtfa
I'm a phd student in cognitive neuroscience interested in [auditory] perception, speech processing and [a-]periodic [brain] activity.
JOSS Publication
PyRASA - Spectral parametrization in python based on IRASA
Authors
Paris-Lodron-University of Salzburg, Department of Psychology, Centre for Cognitive Neuroscience, Salzburg, Austria
Tags
spectral parametrization 1/f aperiodic oscillations electrophysiology time frequency analysis electroencephalography EEG magnetoencephalography MEGGitHub Events
Total
- Issues event: 16
- Watch event: 10
- Delete event: 5
- Issue comment event: 17
- Push event: 45
- Pull request event: 25
- Fork event: 1
- Create event: 16
Last Year
- Issues event: 16
- Watch event: 10
- Delete event: 5
- Issue comment event: 17
- Push event: 45
- Pull request event: 25
- Fork event: 1
- Create event: 16
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 29
- Total pull requests: 50
- Average time to close issues: 16 days
- Average time to close pull requests: 2 days
- Total issue authors: 4
- Total pull request authors: 4
- Average comments per issue: 1.28
- Average comments per pull request: 0.36
- Merged pull requests: 37
- Bot issues: 0
- Bot pull requests: 8
Past Year
- Issues: 11
- Pull requests: 22
- Average time to close issues: 24 days
- Average time to close pull requests: 3 days
- Issue authors: 4
- Pull request authors: 4
- Average comments per issue: 1.45
- Average comments per pull request: 0.14
- Merged pull requests: 16
- Bot issues: 0
- Bot pull requests: 7
Top Authors
Issue Authors
- schmidtfa (15)
- thht (5)
- wmvanvliet (5)
- OleBialas (4)
Pull Request Authors
- schmidtfa (23)
- thht (18)
- dependabot[bot] (8)
- csoneson (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- pypi 25 last-month
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 3
- Total maintainers: 2
pypi.org: pyrasa
Spectral parametrization based on IRASA
- Documentation: https://pyrasa.readthedocs.io/
- License: BSD-3-Clause
-
Latest release: 1.1.1
published 10 months ago
Dependencies
- actions/checkout v4 composite
- coverallsapp/github-action v2 composite
- prefix-dev/setup-pixi v0.8.1 composite
- numpy *
- pandas *
- scipy >=1.12
- obob_mne *
- plus_slurm *
- pymatreader *