From 1b7999c354ec67a9c1644b60834a90bca0f12f6a Mon Sep 17 00:00:00 2001 From: Fabi Date: Fri, 4 Oct 2024 09:51:11 +0200 Subject: [PATCH 01/11] fixed some parts of the paper --- paper/paper.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/paper/paper.md b/paper/paper.md index 0169c30..e24ae01 100644 --- a/paper/paper.md +++ b/paper/paper.md @@ -28,19 +28,19 @@ affiliations: index: 1 - name: Neuroscience Institute, Christian Doppler University Hospital, Paracelsus Medical University, Salzburg, Austria index: 2 -date: XX August 2024 +date: XX October 2024 bibliography: paper.bib --- # Summary -The electric signals generated by physiological activity exhibit both activity patterns that are regularly repeating over time (i.e. periodic) and activity patterns that are temporally irregular (i.e. aperiodic). In recent years several algorithms have been proposed to separate the periodic from the aperiodic parts of the signal, such as the irregular-resampling auto-spectral analysis (IRASA; `@wen2016separating`). IRASA separates periodic and aperiodic components by up-/downsampling time domain signals and computing their respective auto-power spectra. Finally, the aperiodic component is isolated by averaging over the resampled auto-power spectra removing any frequency specific activity. The aperiodic component can then be subtracted from the original power spectrum yielding the residual periodic component. -`PyRASA` is a package that is built upon and extends the IRASA algorithm `[@wen2016separating]`. The package allows its users not only to separate power spectra, but also contains functionality to further parametrize the periodic and aperiodic spectra, by means of peak detection and several slope fitting options (eg. spectral knees). Furthermore, we extended the IRASA algorithm to the time-frequency domain allowing for a time-resolved spectral parameterization using IRASA. +The electric signals generated by physiological activity exhibit both activity patterns that are regularly repeating over time (i.e. periodic) and activity patterns that are temporally irregular (i.e. aperiodic). In recent years several algorithms have been proposed to separate the periodic from the aperiodic parts of the signal, such as the irregular-resampling auto-spectral analysis (IRASA; `@wen2016separating`). IRASA separates periodic and aperiodic components by up-/downsampling time domain signals and computing their respective auto-power spectra. Finally, the aperiodic component is isolated by averaging over the resampled auto-power spectra removing any frequency specific activity. The aperiodic component can then be subtracted from the original power spectrum yielding the residual periodic component. +`PyRASA` is a package that is built upon and extends the IRASA algorithm `[@wen2016separating]`. The package allows its users not only to separate power spectra, but also contains functionality to further parametrize the periodic and aperiodic spectra, by means of peak detection and several slope fitting options (eg. spectral knees). Furthermore, we implemented a function to use the IRASA algorithm in the time-frequency domain allowing for a time-resolved spectral parameterization using IRASA. # Statement of Need -`PyRASA` is an open-source Python package for the parametrization of (neural) power spectra. `PyRASA` has a lightweight architecture that allows users to directly apply the respective functions to separate power spectra to numpy arrays containing time series data `[@harris2020array]`. However, `PyRASA` can also be optionally extended with functionality to be used in conjunction with MNE Python (a popular beginner-friendly tool for the analysis of electrophysiological data, `@gramfort2014mne`). Thus offering both beginners in (neural) time series analysis and more advanced users a tool to easily analyze their data. The IRASA algorithm per se has been implemented in a couple other software packages `[@cole2019neurodsp; @vallat2021open; @oostenveld2011fieldtrip]`, but these implementations of IRASA largely lack functionality to further parametrize periodic and aperiodic spectra in their respective components. We close this gap by offering such functionality both for periodic and aperiodic spectra. For periodic spectra users can extract peak height, bandwidth and center frequency of putative oscillations. Aperiodic spectra can be further analyzed by means of several slope fitting options that allow not only for the assessment of Goodness of fit by several metrics (R2, mean squared error), but also allow for model comparison using information criteria (BIC/AIC). Furthermore, we extended the IRASA algorithm to the time-frequency domain, by computing IRASA over up/downsampled versions of spectrograms instead of power spectra thereby also allowing for a time-resolved spectral parametrization of (neural) time series data. +`PyRASA` is an open-source Python package for the parametrization of (neural) power spectra. `PyRASA` has a lightweight architecture that allows users to directly apply the respective functions to separate power spectra to numpy arrays containing time series data `[@harris2020array]`. However, `PyRASA` can also be optionally extended with functionality to be used in conjunction with MNE Python (a popular beginner-friendly tool for the analysis of electrophysiological data, `@gramfort2014mne`). Thus offering both beginners in (neural) time series analysis and more advanced users a tool to easily analyze their data. The IRASA algorithm per se has been implemented in a couple other software packages `[@cole2019neurodsp; @vallat2021open; @oostenveld2011fieldtrip]`, but these implementations of IRASA largely lack functionality to further parametrize periodic and aperiodic spectra in their respective components. We close this gap by offering such functionality both for periodic and aperiodic spectra. For periodic spectra users can extract peak height, bandwidth and center frequency of putative oscillations. Aperiodic spectra can be further analyzed by means of several slope fitting options that allow not only for the assessment of Goodness of fit by several metrics (R2, mean squared error), but also allow for model comparison using information criteria (BIC/AIC). Additionally, users can easily implement their own custom functions to model aperiodic activity. Furthermore, we implemented a function to use the IRASA algorithm in the time-frequency domain, by computing IRASA over up/downsampled versions of spectrograms instead of power spectra thereby also allowing for a time-resolved spectral parametrization of (neural) time series data. # Related Projects -`PyRASA’s` functionality is inspired by specparam (formerly FOOOF, `@donoghue2020parameterizing`) a popular tool spectral parametrization built upon a different algorithm that seperates powers spectra by first flattening the spectrum and then sequentially modelling peaks as gaussians which is followed a final fit of the aperiodic component. Each algorithm (IRASA vs. Specparam) comes with their specific advantages and disadvantages that are in part also discussed herein `[@gerster2022separating]` and further eluded to in our `Documentation`. +`PyRASA’s` functionality is inspired by specparam (formerly FOOOF, `@donoghue2020parameterizing`) a popular tool spectral parametrization built upon a different algorithm that seperates powers spectra by first flattening the spectrum and then sequentially modelling peaks as gaussians which is followed a final fit of the aperiodic component. Each algorithm (IRASA vs. Specparam) comes with their specific advantages and disadvantages that are also discussed herein `[@gerster2022separating]`. The IRASA algorithm has also been implemented as part of other software packages NeuroDSP `[@cole2019neurodsp]`, YASA `[@vallat2021open]` and FieldTrip `[@oostenveld2011fieldtrip]`. From 6d4f2eba13bd2a1bd87655e8bf87d0ee522c6041 Mon Sep 17 00:00:00 2001 From: Fabi Date: Fri, 4 Oct 2024 13:10:32 +0200 Subject: [PATCH 02/11] fixed some tutorial texts --- .github/workflows/documentation.yml | 4 ++-- doc/source/examples/irasa_sprint.ipynb | 18 ++---------------- 2 files changed, 4 insertions(+), 18 deletions(-) diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index c431e99..b1bc58e 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -1,8 +1,8 @@ name: documentation on: [push, pull_request, workflow_dispatch] - branches: - - main + branches: + - main permissions: contents: write diff --git a/doc/source/examples/irasa_sprint.ipynb b/doc/source/examples/irasa_sprint.ipynb index cb82aeb..0e8e8a9 100644 --- a/doc/source/examples/irasa_sprint.ipynb +++ b/doc/source/examples/irasa_sprint.ipynb @@ -6,8 +6,8 @@ "source": [ "# Run IRASA timeresolved\n", "\n", - "One of the original features of IRASA was its applicability in the time-frequency domain (Wen & Liu 2016).\n", - "The authors used this to investigate changes periodic and aperiodic activity over time and even computed broadband correlations of aperiodic activity over channels across time (see [Wen & Liu, 2016](https://doi.org/10.1523/JNEUROSCI.0187-16.2016)). To make this form of analysis more accessible and track aperiodic and periodic changes over time we implemented the irasa_sprint function, that similarly to the SPRiNT package ([Wilson, da Silva Castanheira & Baillet, 2022](https://doi.org/10.7554/eLife.77348)), enables you to compute periodic and aperiodic spectrograms." + "In the original IRASA manuscript Wen & Liu ([2016](https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4706469/)) show that the algorithm can be used in the time-frequency domain.\n", + "The authors used this in a subsequent manuscript to investigate changes periodic and aperiodic activity over time and even computed broadband correlations of aperiodic activity over channels across time (see [Wen & Liu, 2016](https://doi.org/10.1523/JNEUROSCI.0187-16.2016)). To make this form of analysis more accessible and track aperiodic and periodic changes over time we implemented the irasa_sprint function, that similarly to the SPRiNT package ([Wilson, da Silva Castanheira & Baillet, 2022](https://doi.org/10.7554/eLife.77348)), enables you to compute periodic and aperiodic spectrograms." ] }, { @@ -320,20 +320,6 @@ "f.tight_layout()" ] }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - }, { "cell_type": "code", "execution_count": null, From b8b2cfb2e3221d1e0fa8f9e733ea1cd4421c0c73 Mon Sep 17 00:00:00 2001 From: Fabi Date: Fri, 4 Oct 2024 14:40:45 +0200 Subject: [PATCH 03/11] fixing doc.yml --- .github/workflows/documentation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index b1bc58e..b4eb2f0 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -1,6 +1,6 @@ name: documentation -on: [push, pull_request, workflow_dispatch] +on: push branches: - main From 5ac109c51485cf9ba7dddb7c03f2f5d42be25017 Mon Sep 17 00:00:00 2001 From: Fabi Date: Fri, 4 Oct 2024 14:51:11 +0200 Subject: [PATCH 04/11] fixing doc.yml --- .github/workflows/documentation.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index b4eb2f0..90a2cff 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -1,8 +1,9 @@ name: documentation -on: push - branches: - - main +on: + push: + branches: + - main permissions: contents: write From 5959ca615a0909fa208073047d3dae109615bb43 Mon Sep 17 00:00:00 2001 From: Fabi Date: Sat, 5 Oct 2024 01:04:23 +0200 Subject: [PATCH 05/11] fixed project status --- README.md | 2 +- doc/source/index.rst | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index b79329d..9be6f57 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # PyRASA - Spectral parameterization in python based on IRASA -[![Project Status: WIP – Initial development is in progress, but there has not yet been a stable, usable release suitable for the public.](https://www.repostatus.org/badges/latest/wip.svg)](https://www.repostatus.org/#wip) +[![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active) [![License](https://img.shields.io/badge/License-BSD_2--Clause-orange.svg)](https://opensource.org/licenses/BSD-2-Clause) [![Checked with mypy](http://www.mypy-lang.org/static/mypy_badge.svg)](http://mypy-lang.org/) [![Coverage Status](https://coveralls.io/repos/github/schmidtfa/pyrasa/badge.svg?branch=main)](https://coveralls.io/github/schmidtfa/pyrasa?branch=main) diff --git a/doc/source/index.rst b/doc/source/index.rst index 29285ae..16d6aab 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -1,9 +1,9 @@ PyRASA - Spectral parameterization in python based on IRASA =========================================================== -.. image:: https://www.repostatus.org/badges/latest/wip.svg - :target: https://www.repostatus.org/#wip - :alt: Project Status: WIP – Initial development is in progress, but there has not yet been a stable, usable release suitable for the public. +.. image:: https://www.repostatus.org/badges/latest/active.svg + :target: https://www.repostatus.org/#active + :alt: Project Status: Active – The project has reached a stable, usable state and is being actively developed. .. image:: https://img.shields.io/badge/License-BSD_2--Clause-orange.svg :target: https://opensource.org/licenses/BSD-2-Clause From f9786706b4d4af191fa7e582759e6b928882b674 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 7 Oct 2024 07:37:46 +0000 Subject: [PATCH 06/11] Bump peaceiris/actions-gh-pages from 3 to 4 in the dependencies group Bumps the dependencies group with 1 update: [peaceiris/actions-gh-pages](https://github.com/peaceiris/actions-gh-pages). Updates `peaceiris/actions-gh-pages` from 3 to 4 - [Release notes](https://github.com/peaceiris/actions-gh-pages/releases) - [Changelog](https://github.com/peaceiris/actions-gh-pages/blob/main/CHANGELOG.md) - [Commits](https://github.com/peaceiris/actions-gh-pages/compare/v3...v4) --- updated-dependencies: - dependency-name: peaceiris/actions-gh-pages dependency-type: direct:production update-type: version-update:semver-major dependency-group: dependencies ... Signed-off-by: dependabot[bot] --- .github/workflows/documentation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index 90a2cff..0cb0fd9 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -23,7 +23,7 @@ jobs: frozen: false environments: doc - run: pixi run -e doc build_docs - - uses: peaceiris/actions-gh-pages@v3 + - uses: peaceiris/actions-gh-pages@v4 with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./doc/build/html From 0bf58415d284f207b2941094af20d7412a871696 Mon Sep 17 00:00:00 2001 From: Fabi Date: Thu, 10 Oct 2024 10:42:54 +0200 Subject: [PATCH 07/11] installation updates --- doc/source/examples/irasa_mne.ipynb | 8 -------- doc/source/examples/irasa_sprint.ipynb | 10 ++-------- doc/source/install.rst | 26 +++++++++++++++++++------- doc/source/tutorials.rst | 20 +++++++++++++++++++- 4 files changed, 40 insertions(+), 24 deletions(-) diff --git a/doc/source/examples/irasa_mne.ipynb b/doc/source/examples/irasa_mne.ipynb index d758928..600fa95 100644 --- a/doc/source/examples/irasa_mne.ipynb +++ b/doc/source/examples/irasa_mne.ipynb @@ -17,7 +17,6 @@ "metadata": {}, "outputs": [], "source": [ - "import sys\n", "from neurodsp.sim import sim_combined\n", "import numpy as np\n", "import scipy.signal as dsp\n", @@ -25,15 +24,8 @@ "\n", "import pandas as pd\n", "\n", - "sys.path.append('../')\n", "import seaborn as sns\n", "\n", - "import matplotlib as mpl\n", - "new_rc_params = {'text.usetex': False,\n", - " \"svg.fonttype\": 'none'\n", - "}\n", - "mpl.rcParams.update(new_rc_params)\n", - "\n", "import mne\n", "from mne.datasets import sample\n", "\n", diff --git a/doc/source/examples/irasa_sprint.ipynb b/doc/source/examples/irasa_sprint.ipynb index 0e8e8a9..08da5ef 100644 --- a/doc/source/examples/irasa_sprint.ipynb +++ b/doc/source/examples/irasa_sprint.ipynb @@ -16,7 +16,7 @@ "metadata": {}, "outputs": [], "source": [ - "import sys\n", + "\n", "from neurodsp.sim import set_random_seed\n", "from neurodsp.sim import sim_powerlaw, sim_oscillation\n", "from neurodsp.utils import create_times\n", @@ -28,12 +28,6 @@ "#import seaborn as sns\n", "import pandas as pd\n", "\n", - "import matplotlib as mpl\n", - "new_rc_params = {'text.usetex': False,\n", - " \"svg.fonttype\": 'none'\n", - "}\n", - "mpl.rcParams.update(new_rc_params)\n", - "\n", "set_random_seed(84)\n", "\n", "from pyrasa.irasa import irasa_sprint" @@ -330,7 +324,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "default", "language": "python", "name": "python3" }, diff --git a/doc/source/install.rst b/doc/source/install.rst index e38605f..5f0fa7a 100644 --- a/doc/source/install.rst +++ b/doc/source/install.rst @@ -43,28 +43,40 @@ The required dependencies for installing PyRASA are: .. code:: - numpy>=1.26, <3 - pandas>=2.1, <3 - scipy>=1.12 + numpy >= 1.26 + pandas >= 2.1 + scipy >= 1.12 attrs and .. code:: - python>=3.11 + python >= 3.11 Optional dependencies ===================== Optionally you can combine PyRASA with MNE Python to better integrate spectral parametrization in your -M/EEG analysis workflow. +M/EEG analysis workflow. If you already have an MNE Python installation running you can try to install PyRASA in the respective environment. +If you don't already have MNE Python in your environment you can install PyRASA including its optional dependency +`mne ` using either pip or conda-forge. -.. code:: +Using pip +--------- +.. code:: bash + + pip install "pyrasa[mne]" + +Using conda-forge +----------------- +.. code:: bash + + conda install -c conda-forge pyrasa mne - mne +For a more detailed instruction on how to configure your MNE Python installation please refer to the `mne installation guide `. diff --git a/doc/source/tutorials.rst b/doc/source/tutorials.rst index bb0eb38..da65193 100644 --- a/doc/source/tutorials.rst +++ b/doc/source/tutorials.rst @@ -3,7 +3,25 @@ Tutorials ========= -This section contains a number of tutorials, to get you started with PyRASA. +This section contains a number of tutorials, to get you started with PyRASA. +In order to easily run the tutorials you need to add some additional python libraries to your current environment. +You can do so using pip or conda-forge. + +Using pip +--------- +.. code:: bash + + pip install neurodsp seaborn + +Using conda-forge +----------------- +.. code:: bash + + conda install -c conda-forge neurodsp seaborn + +If you want to use PyRASA together with MNE Python (see Tutorial 4. IRASA MNE). +You also need MNE Python installed in your current enviroment (see `install ` for further instructions). + Introductory ------------ From 59e74fd25f66cba2435670345d2e627754a5da14 Mon Sep 17 00:00:00 2001 From: Fabi Date: Mon, 14 Oct 2024 14:55:18 +0200 Subject: [PATCH 08/11] added paper builder --- .github/workflows/draft-pdf.yml | 24 ++++++++++++++++++++++++ paper/paper.md | 11 ++++++----- 2 files changed, 30 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/draft-pdf.yml diff --git a/.github/workflows/draft-pdf.yml b/.github/workflows/draft-pdf.yml new file mode 100644 index 0000000..d6f1774 --- /dev/null +++ b/.github/workflows/draft-pdf.yml @@ -0,0 +1,24 @@ +name: Draft PDF +on: [push] + +jobs: + paper: + runs-on: ubuntu-latest + name: Paper Draft + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Build draft PDF + uses: openjournals/openjournals-draft-action@master + with: + journal: joss + # This should be the path to the paper within your repo. + paper-path: paper/paper.md + - name: Upload + uses: actions/upload-artifact@v4 + with: + name: paper + # This is the output path where Pandoc will write the compiled + # PDF. Note, this should be the same directory as the input + # paper.md + path: paper/paper.pdf \ No newline at end of file diff --git a/paper/paper.md b/paper/paper.md index e24ae01..52ab3df 100644 --- a/paper/paper.md +++ b/paper/paper.md @@ -17,18 +17,18 @@ authors: corresponding: true orcid: 0000-0002-9839-1614 affiliation: 1 - - name: Thomas Hartmann - orcid: 0000-0002-8298-8125 - affiliation: 1 - name: Nathan Weisz orcid: 0000-0001-7816-0037 affiliation: "1, 2" + - name: Thomas Hartmann + orcid: 0000-0002-8298-8125 + affiliation: 1 affiliations: - name: Paris-Lodron-University of Salzburg, Department of Psychology, Centre for Cognitive Neuroscience, Salzburg, Austria index: 1 - name: Neuroscience Institute, Christian Doppler University Hospital, Paracelsus Medical University, Salzburg, Austria index: 2 -date: XX October 2024 +date: 14 October 2024 bibliography: paper.bib --- @@ -45,6 +45,7 @@ The electric signals generated by physiological activity exhibit both activity p The IRASA algorithm has also been implemented as part of other software packages NeuroDSP `[@cole2019neurodsp]`, YASA `[@vallat2021open]` and FieldTrip `[@oostenveld2011fieldtrip]`. # Acknowledgements -We want to thank Gianpaolo Demarchi, Patrick Reisinger and Mohammed Ameen for beta testing PyRASA and helpful comments that improved its development. +We want to thank Gianpaolo Demarchi, Patrick Reisinger and Mohammed Ameen for beta testing PyRASA and helpful comments that improved its development. +This project received financial support from the Land Salzburg through the BrainAge project (20102/F2400537-FPR). # References \ No newline at end of file From 360b6f9c14be459510a9fa5c3677bcaca100c0cc Mon Sep 17 00:00:00 2001 From: Fabi Date: Mon, 14 Oct 2024 15:28:34 +0200 Subject: [PATCH 09/11] added paper builder --- paper/paper.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/paper/paper.md b/paper/paper.md index 52ab3df..8ba3d44 100644 --- a/paper/paper.md +++ b/paper/paper.md @@ -33,16 +33,16 @@ bibliography: paper.bib --- # Summary -The electric signals generated by physiological activity exhibit both activity patterns that are regularly repeating over time (i.e. periodic) and activity patterns that are temporally irregular (i.e. aperiodic). In recent years several algorithms have been proposed to separate the periodic from the aperiodic parts of the signal, such as the irregular-resampling auto-spectral analysis (IRASA; `@wen2016separating`). IRASA separates periodic and aperiodic components by up-/downsampling time domain signals and computing their respective auto-power spectra. Finally, the aperiodic component is isolated by averaging over the resampled auto-power spectra removing any frequency specific activity. The aperiodic component can then be subtracted from the original power spectrum yielding the residual periodic component. -`PyRASA` is a package that is built upon and extends the IRASA algorithm `[@wen2016separating]`. The package allows its users not only to separate power spectra, but also contains functionality to further parametrize the periodic and aperiodic spectra, by means of peak detection and several slope fitting options (eg. spectral knees). Furthermore, we implemented a function to use the IRASA algorithm in the time-frequency domain allowing for a time-resolved spectral parameterization using IRASA. +The electric signals generated by physiological activity exhibit both activity patterns that are regularly repeating over time (i.e. periodic) and activity patterns that are temporally irregular (i.e. aperiodic). In recent years several algorithms have been proposed to separate the periodic from the aperiodic parts of the signal, such as the irregular-resampling auto-spectral analysis (IRASA; [@wen2016separating]). IRASA separates periodic and aperiodic components by up-/downsampling time domain signals and computing their respective auto-power spectra. Finally, the aperiodic component is isolated by averaging over the resampled auto-power spectra removing any frequency specific activity. The aperiodic component can then be subtracted from the original power spectrum yielding the residual periodic component. +`PyRASA` is a package that is built upon and extends the IRASA algorithm [@wen2016separating]. The package allows its users not only to separate power spectra, but also contains functionality to further parametrize the periodic and aperiodic spectra, by means of peak detection and several slope fitting options (eg. spectral knees). Furthermore, we implemented a function to use the IRASA algorithm in the time-frequency domain allowing for a time-resolved spectral parameterization using IRASA. # Statement of Need -`PyRASA` is an open-source Python package for the parametrization of (neural) power spectra. `PyRASA` has a lightweight architecture that allows users to directly apply the respective functions to separate power spectra to numpy arrays containing time series data `[@harris2020array]`. However, `PyRASA` can also be optionally extended with functionality to be used in conjunction with MNE Python (a popular beginner-friendly tool for the analysis of electrophysiological data, `@gramfort2014mne`). Thus offering both beginners in (neural) time series analysis and more advanced users a tool to easily analyze their data. The IRASA algorithm per se has been implemented in a couple other software packages `[@cole2019neurodsp; @vallat2021open; @oostenveld2011fieldtrip]`, but these implementations of IRASA largely lack functionality to further parametrize periodic and aperiodic spectra in their respective components. We close this gap by offering such functionality both for periodic and aperiodic spectra. For periodic spectra users can extract peak height, bandwidth and center frequency of putative oscillations. Aperiodic spectra can be further analyzed by means of several slope fitting options that allow not only for the assessment of Goodness of fit by several metrics (R2, mean squared error), but also allow for model comparison using information criteria (BIC/AIC). Additionally, users can easily implement their own custom functions to model aperiodic activity. Furthermore, we implemented a function to use the IRASA algorithm in the time-frequency domain, by computing IRASA over up/downsampled versions of spectrograms instead of power spectra thereby also allowing for a time-resolved spectral parametrization of (neural) time series data. +`PyRASA` is an open-source Python package for the parametrization of (neural) power spectra. `PyRASA` has a lightweight architecture that allows users to directly apply the respective functions to separate power spectra to numpy arrays containing time series data [@harris2020array]. However, `PyRASA` can also be optionally extended with functionality to be used in conjunction with `MNE Python` (a popular beginner-friendly tool for the analysis of electrophysiological data, [@gramfort2014mne]). Thus offering both beginners in (neural) time series analysis and more advanced users a tool to easily analyze their data. The IRASA algorithm per se has been implemented in a couple other software packages [@cole2019neurodsp; @vallat2021open; @oostenveld2011fieldtrip], but these implementations of IRASA largely lack functionality to further parametrize periodic and aperiodic spectra in their respective components. We close this gap by offering such functionality both for periodic and aperiodic spectra. For periodic spectra users can extract peak height, bandwidth and center frequency of putative oscillations. Aperiodic spectra can be further analyzed by means of several slope fitting options that allow not only for the assessment of Goodness of fit by several metrics (R2, mean squared error), but also allow for model comparison using information criteria (BIC/AIC). Additionally, users can easily implement their own custom functions to model aperiodic activity. Furthermore, we implemented a function to use the IRASA algorithm in the time-frequency domain, by computing IRASA over up/downsampled versions of spectrograms instead of power spectra thereby also allowing for a time-resolved spectral parametrization of (neural) time series data. # Related Projects -`PyRASA’s` functionality is inspired by specparam (formerly FOOOF, `@donoghue2020parameterizing`) a popular tool spectral parametrization built upon a different algorithm that seperates powers spectra by first flattening the spectrum and then sequentially modelling peaks as gaussians which is followed a final fit of the aperiodic component. Each algorithm (IRASA vs. Specparam) comes with their specific advantages and disadvantages that are also discussed herein `[@gerster2022separating]`. +`PyRASA’s` functionality is inspired by specparam (formerly `FOOOF`, [@donoghue2020parameterizing]) a popular tool spectral parametrization built upon a different algorithm that seperates powers spectra by first flattening the spectrum and then sequentially modelling peaks as gaussians which is followed a final fit of the aperiodic component. Each algorithm (IRASA vs. Specparam) comes with their specific advantages and disadvantages that are also discussed herein `[@gerster2022separating]`. -The IRASA algorithm has also been implemented as part of other software packages NeuroDSP `[@cole2019neurodsp]`, YASA `[@vallat2021open]` and FieldTrip `[@oostenveld2011fieldtrip]`. +The IRASA algorithm has also been implemented as part of other software packages `NeuroDSP` [@cole2019neurodsp], `YASA` [@vallat2021open] and `FieldTrip` [@oostenveld2011fieldtrip]. # Acknowledgements We want to thank Gianpaolo Demarchi, Patrick Reisinger and Mohammed Ameen for beta testing PyRASA and helpful comments that improved its development. From e1712ad0ff066810382118bb034d285a8d006649 Mon Sep 17 00:00:00 2001 From: Fabi Date: Mon, 14 Oct 2024 23:09:48 +0200 Subject: [PATCH 10/11] fixed reference --- paper/paper.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/paper/paper.md b/paper/paper.md index 8ba3d44..7c14f8b 100644 --- a/paper/paper.md +++ b/paper/paper.md @@ -40,7 +40,7 @@ The electric signals generated by physiological activity exhibit both activity p `PyRASA` is an open-source Python package for the parametrization of (neural) power spectra. `PyRASA` has a lightweight architecture that allows users to directly apply the respective functions to separate power spectra to numpy arrays containing time series data [@harris2020array]. However, `PyRASA` can also be optionally extended with functionality to be used in conjunction with `MNE Python` (a popular beginner-friendly tool for the analysis of electrophysiological data, [@gramfort2014mne]). Thus offering both beginners in (neural) time series analysis and more advanced users a tool to easily analyze their data. The IRASA algorithm per se has been implemented in a couple other software packages [@cole2019neurodsp; @vallat2021open; @oostenveld2011fieldtrip], but these implementations of IRASA largely lack functionality to further parametrize periodic and aperiodic spectra in their respective components. We close this gap by offering such functionality both for periodic and aperiodic spectra. For periodic spectra users can extract peak height, bandwidth and center frequency of putative oscillations. Aperiodic spectra can be further analyzed by means of several slope fitting options that allow not only for the assessment of Goodness of fit by several metrics (R2, mean squared error), but also allow for model comparison using information criteria (BIC/AIC). Additionally, users can easily implement their own custom functions to model aperiodic activity. Furthermore, we implemented a function to use the IRASA algorithm in the time-frequency domain, by computing IRASA over up/downsampled versions of spectrograms instead of power spectra thereby also allowing for a time-resolved spectral parametrization of (neural) time series data. # Related Projects -`PyRASA’s` functionality is inspired by specparam (formerly `FOOOF`, [@donoghue2020parameterizing]) a popular tool spectral parametrization built upon a different algorithm that seperates powers spectra by first flattening the spectrum and then sequentially modelling peaks as gaussians which is followed a final fit of the aperiodic component. Each algorithm (IRASA vs. Specparam) comes with their specific advantages and disadvantages that are also discussed herein `[@gerster2022separating]`. +`PyRASA’s` functionality is inspired by specparam (formerly `FOOOF`, [@donoghue2020parameterizing]) a popular tool spectral parametrization built upon a different algorithm that seperates powers spectra by first flattening the spectrum and then sequentially modelling peaks as gaussians which is followed a final fit of the aperiodic component. Each algorithm (IRASA vs. Specparam) comes with their specific advantages and disadvantages that are also discussed herein [@gerster2022separating]. The IRASA algorithm has also been implemented as part of other software packages `NeuroDSP` [@cole2019neurodsp], `YASA` [@vallat2021open] and `FieldTrip` [@oostenveld2011fieldtrip]. From c72b46e23f3d55fe296945d037f67de65c13fc5f Mon Sep 17 00:00:00 2001 From: Fabi <50550513+schmidtfa@users.noreply.github.com> Date: Mon, 14 Oct 2024 23:52:38 +0200 Subject: [PATCH 11/11] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9be6f57..394a236 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ $ pip install pyrasa or conda ```bash -$ conda install pyrasa +$ conda install -c conda-forge pyrasa ``` ### Dependencies @@ -117,4 +117,4 @@ Wen, H., & Liu, Z. (2016). Separating fractal and oscillatory components in the 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. (2049). PyRASA - Spectral parameterization in python based on IRASA. SOME JOURNAL THAT LIKES US \ No newline at end of file +Schmidt F., Hartmann T., & Weisz, N. (2049). PyRASA - Spectral parameterization in python based on IRASA. SOME JOURNAL THAT LIKES US