From e61cf3d6965b4391bc599d1434a7a35427e4ef7b Mon Sep 17 00:00:00 2001 From: maestroque Date: Wed, 3 Jul 2024 01:21:05 +0300 Subject: [PATCH 01/12] docs: Add API page --- docs/Makefile | 20 ++++++ docs/api.rst | 29 +++++++++ docs/conf.py | 113 +++++++++++++++++++++++++++++++++ docs/index.rst | 11 ++++ docs/installation.rst | 19 ++++++ docs/requirements.txt | 3 + docs/usage.rst | 12 ++++ docs/user_guide/loading.rst | 0 docs/user_guide/metrics.rst | 0 docs/user_guide/processing.rst | 0 docs/user_guide/saving.rst | 0 11 files changed, 207 insertions(+) create mode 100644 docs/Makefile create mode 100644 docs/api.rst create mode 100644 docs/conf.py create mode 100644 docs/index.rst create mode 100644 docs/installation.rst create mode 100644 docs/requirements.txt create mode 100644 docs/usage.rst create mode 100644 docs/user_guide/loading.rst create mode 100644 docs/user_guide/metrics.rst create mode 100644 docs/user_guide/processing.rst create mode 100644 docs/user_guide/saving.rst diff --git a/docs/Makefile b/docs/Makefile new file mode 100644 index 0000000..f610428 --- /dev/null +++ b/docs/Makefile @@ -0,0 +1,20 @@ +# Minimal makefile for Sphinx documentation +# + +# You can set these variables from the command line. +SPHINXOPTS = +SPHINXBUILD = sphinx-build +SPHINXPROJ = phys2denoise +SOURCEDIR = . +BUILDDIR = _build + +# Put it first so that "make" without argument is like "make help". +help: + @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +.PHONY: help Makefile + +# Catch-all target: route all unknown targets to Sphinx using the new +# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). +%: Makefile + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/docs/api.rst b/docs/api.rst new file mode 100644 index 0000000..676c368 --- /dev/null +++ b/docs/api.rst @@ -0,0 +1,29 @@ +.. _api_ref: + +API +=== + +.. py:module:: phys2denoise + +Cardiac data +------------------ + +.. automodule:: phys2denoise.metrics.cardiac + :members: heart_rate, heart_rate_variability, heart_beat_interval, cardiac_phase + +Respiratory data +------------ + +.. automodule:: phys2denoise.metrics.chest_belt + :members: respiratory_cariance_time, respiratory_pattern_variability, env, respiratory_variance, respiratory_phase + +Multimodal data +--------------- + +.. autofunction:: phys2denoise.multimodal.retroicor + +Response functions +----------- + +.. automodule:: phys2denoise.metrics.responses + :members: crf, icrf, rrf diff --git a/docs/conf.py b/docs/conf.py new file mode 100644 index 0000000..e42ac87 --- /dev/null +++ b/docs/conf.py @@ -0,0 +1,113 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +# +# Configuration file for the Sphinx documentation builder. + +# -- Path setup -------------------------------------------------------------- + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +import os +import sys + +import matplotlib as mpl + +mpl.use("Agg") + +# -- Project information ----------------------------------------------------- + +# Add project name, copyright holder, and author(s) +project = "phys2denoise" +copyright = "2024, physiopy" +author = "physiopy" + +# Import project to get version info +sys.path.insert(0, os.path.abspath(os.path.pardir)) +import phys2denoise # noqa + +# The short X.Y version +version = phys2denoise.__version__ +# The full version, including alpha/beta/rc tags +release = phys2denoise.__version__ + +# -- General configuration --------------------------------------------------- + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = [ + "matplotlib.sphinxext.plot_directive", + "sphinx.ext.autodoc", + "sphinx.ext.autosummary", + "sphinx.ext.doctest", + "sphinx.ext.intersphinx", + "sphinx.ext.mathjax", + "sphinx.ext.napoleon", + "sphinx.ext.viewcode", +] + +# Generate the API documentation when building +autosummary_generate = True +numpydoc_show_class_members = False +autoclass_content = "class" + +# Add any paths that contain templates here, relative to this directory. +templates_path = ["_templates"] + +# The suffix(es) of source filenames. +source_suffix = ".rst" + +# The master toctree document. +master_doc = "index" + +# The language for content autogenerated by Sphinx. Refer to documentation +# for a list of supported languages. +# +# This is also used if you do content translation via gettext catalogs. +# Usually you set "language" from the command line for these cases. +language = None + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +# This pattern also affects html_static_path and html_extra_path . +exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"] + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = "sphinx" + +# -- Options for HTML output ------------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +import sphinx_rtd_theme # noqa + +html_theme = "sphinx_rtd_theme" +html_show_sourcelink = False + +# Theme options are theme-specific and customize the look and feel of a theme +# further. For a list of options available for each theme, see the +# documentation. +html_theme_options = {} + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ["_static"] + +# -- Options for HTMLHelp output --------------------------------------------- + +# Output file base name for HTML help builder. +htmlhelp_basename = "peakdetdoc" + +# -- Extension configuration ------------------------------------------------- +intersphinx_mapping = { + "matplotlib": ("https://matplotlib.org", None), + "numpy": ("https://docs.scipy.org/doc/numpy", None), + "scipy": ("https://docs.scipy.org/doc/scipy/reference", None), +} + +plot_include_source = True +plot_formats = [("png", 90)] +plot_html_show_formats = False +plot_html_show_source_link = False diff --git a/docs/index.rst b/docs/index.rst new file mode 100644 index 0000000..590f394 --- /dev/null +++ b/docs/index.rst @@ -0,0 +1,11 @@ +.. include:: ../README.rst + +Contents +-------- + +.. toctree:: + :maxdepth: 1 + + installation + usage + api diff --git a/docs/installation.rst b/docs/installation.rst new file mode 100644 index 0000000..709983c --- /dev/null +++ b/docs/installation.rst @@ -0,0 +1,19 @@ +.. _installation_setup: + +Installation and setup +====================== + +.. _basic_installation: + +Developer installation +-------------------- + +This package requires Python >= 3.6. Assuming you have the correct version of +Python installed, you can install ``phys2denoise`` by opening a terminal and running +the following: + +.. code-block:: bash + + git clone https://github.com/physiopy/phys2denoise.git + cd phys2denoise + pip install -e .[dev] diff --git a/docs/requirements.txt b/docs/requirements.txt new file mode 100644 index 0000000..ed30bc9 --- /dev/null +++ b/docs/requirements.txt @@ -0,0 +1,3 @@ +-r ../requirements.txt +sphinx>=1.2 +sphinx_rtd_theme diff --git a/docs/usage.rst b/docs/usage.rst new file mode 100644 index 0000000..27eab4b --- /dev/null +++ b/docs/usage.rst @@ -0,0 +1,12 @@ +.. _usage: + +User guide +========== + +.. toctree:: + :numbered: + + user_guide/loading.rst + user_guide/processing.rst + user_guide/saving.rst + user_guide/metrics.rst diff --git a/docs/user_guide/loading.rst b/docs/user_guide/loading.rst new file mode 100644 index 0000000..e69de29 diff --git a/docs/user_guide/metrics.rst b/docs/user_guide/metrics.rst new file mode 100644 index 0000000..e69de29 diff --git a/docs/user_guide/processing.rst b/docs/user_guide/processing.rst new file mode 100644 index 0000000..e69de29 diff --git a/docs/user_guide/saving.rst b/docs/user_guide/saving.rst new file mode 100644 index 0000000..e69de29 From 2534b50182312361c2c98e8f1faf67be4ef4a600 Mon Sep 17 00:00:00 2001 From: maestroque Date: Wed, 17 Jul 2024 11:21:36 +0300 Subject: [PATCH 02/12] docs: Minor additions --- docs/usage.rst | 4 +--- docs/user_guide/exporting.rst | 4 ++++ docs/user_guide/loading.rst | 0 docs/user_guide/metrics.rst | 14 ++++++++++++++ docs/user_guide/processing.rst | 0 docs/user_guide/saving.rst | 0 6 files changed, 19 insertions(+), 3 deletions(-) create mode 100644 docs/user_guide/exporting.rst delete mode 100644 docs/user_guide/loading.rst delete mode 100644 docs/user_guide/processing.rst delete mode 100644 docs/user_guide/saving.rst diff --git a/docs/usage.rst b/docs/usage.rst index 27eab4b..58b7c89 100644 --- a/docs/usage.rst +++ b/docs/usage.rst @@ -6,7 +6,5 @@ User guide .. toctree:: :numbered: - user_guide/loading.rst - user_guide/processing.rst - user_guide/saving.rst user_guide/metrics.rst + user_guide/exporting.rst diff --git a/docs/user_guide/exporting.rst b/docs/user_guide/exporting.rst new file mode 100644 index 0000000..2a9a7bb --- /dev/null +++ b/docs/user_guide/exporting.rst @@ -0,0 +1,4 @@ +.. _usage_exporting: + +Exporting physiological data metrics +------------------------------------ diff --git a/docs/user_guide/loading.rst b/docs/user_guide/loading.rst deleted file mode 100644 index e69de29..0000000 diff --git a/docs/user_guide/metrics.rst b/docs/user_guide/metrics.rst index e69de29..81edc89 100644 --- a/docs/user_guide/metrics.rst +++ b/docs/user_guide/metrics.rst @@ -0,0 +1,14 @@ +.. _usage_metrics: + +Computing physiological data metrics +------------------------------------ + + 1. :ref:`_usage_metrics_physio`, + +.. _usage_metrics_physio: + +Using a Physio object +--------------------- + +Physiological data metrics can be easily computed using Physio objects, from :py:mod:`physutils`, +on which the physiological data will be loaded. diff --git a/docs/user_guide/processing.rst b/docs/user_guide/processing.rst deleted file mode 100644 index e69de29..0000000 diff --git a/docs/user_guide/saving.rst b/docs/user_guide/saving.rst deleted file mode 100644 index e69de29..0000000 From 7b4dc311f48b17e186a4ecfa20b7e47905b8648e Mon Sep 17 00:00:00 2001 From: maestroque Date: Wed, 17 Jul 2024 13:58:56 +0300 Subject: [PATCH 03/12] docs: Add computing metrics page --- docs/api.rst | 1 - docs/user_guide/metrics.rst | 72 ++++++++++++++++++++++++++++++++++--- 2 files changed, 67 insertions(+), 6 deletions(-) diff --git a/docs/api.rst b/docs/api.rst index 676c368..c033d58 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -1,5 +1,4 @@ .. _api_ref: - API === diff --git a/docs/user_guide/metrics.rst b/docs/user_guide/metrics.rst index 81edc89..402fe0c 100644 --- a/docs/user_guide/metrics.rst +++ b/docs/user_guide/metrics.rst @@ -1,14 +1,76 @@ .. _usage_metrics: Computing physiological data metrics ------------------------------------- +------------------------------------- +The :py:mod:`phys2denoise` package provides a set of functions to compute physiological data metrics. The set of supported metrics +includes: - 1. :ref:`_usage_metrics_physio`, +- Cardiac metrics + - Cardiac phase + - Heart rate + - Heart rate variability + - Heart beat interval +- Respiratory metrics + - Respiratory phase + - Respiratory variance + - Respiratory pattern variability + - Envelope +- Multimodal metrics + - RETROICOR + +All of the metrics computation function definitions, descriptions and references can be found in :ref:`api_ref`. -.. _usage_metrics_physio: Using a Physio object ---------------------- +##################### -Physiological data metrics can be easily computed using Physio objects, from :py:mod:`physutils`, +Physiological data metrics can be easily computed using Physio objects, from the :py:mod:`physutils` module, on which the physiological data will be loaded. + +The following example shows how to compute the respiratory variance time using a Physio object. + +.. code-block:: python + + from physutils import io + from phys2denoise.metrics.chest_belt import respiratory_variance_time + # peakdet is an example package that provides peak/trough detection for the respiratory signal + from peakdet import operations + + # Load the physiological data + sample_rate = 1000 + physio = io.load_physio('path/to/physiological/data', fs=sample_rate) + + # Peak/trough detection for the respiratory signal, using the peakdet package + physio = operations.peakfind_physio(physio) + + # Compute RVT + physio, rvt = respiratory_variance_time(physio) + +:py:func:`respiratory_variance_time` returns a tuple with the updated Physio object and the computed respiratory variance time. + +:py:mod:`peakdet` is used in this example as it is also compatible with the Physio object. However, any other peak/trough detection +package can be used. In this case, the peak and trough values should be stored in the Physio object manually as follows: + +.. code-block:: python + + # Store the peak and trough values in the Physio object + physio._metadata["peaks"] = peaks + physio._metadata["troughs"] = troughs + +The benefit of using a Physio object other than the encapsulation of all the desired parameters in a single object is the fact that +the object retains a history of all the operations performed on it. This allows for easy debugging and reproducibility of the results. +For further information refer to the :py:mod:`physutils` documentation. + +Without using a Physio object +############################# + +However, if the use of :py:mod:`physutils` is not preferred, the metrics can be also computed without it. The following +example shows how to compute the heart rate and the heart rate variability using the :py:mod:`phys2denoise` package. + +.. code-block:: python + + from phys2denoise.metrics.chest_belt import respiratory_variance_time + + # Given that the respiratory signal is stored in `data`, the peaks in `peaks`, the troughs in `troughs` + # and the sample rate in `sample_rate` + _, rvt = respiratory_variance_time(physio, peaks, troughs, sample_rate) From 83662c9452f68b706132c69d40a10b11fdfd0d42 Mon Sep 17 00:00:00 2001 From: maestroque Date: Thu, 18 Jul 2024 15:15:38 +0300 Subject: [PATCH 04/12] docs: Add utils to API --- docs/api.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/api.rst b/docs/api.rst index c033d58..da73600 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -26,3 +26,9 @@ Response functions .. automodule:: phys2denoise.metrics.responses :members: crf, icrf, rrf + +Utilities +----------- + +.. automodule:: phys2denoise.metrics.utils + :members: print_metric_call, mirrorpad_1d, rms_envelope_1d, apply_lags, apply_function_in_sliding_window, convolve_and_rescale, export_metric \ No newline at end of file From 9004c11d74342d6ef79152d0d4b1faa1355a3423 Mon Sep 17 00:00:00 2001 From: maestroque Date: Thu, 18 Jul 2024 15:31:53 +0300 Subject: [PATCH 05/12] docs: Add exporting metrics page --- docs/api.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/api.rst b/docs/api.rst index da73600..dde3b05 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -31,4 +31,4 @@ Utilities ----------- .. automodule:: phys2denoise.metrics.utils - :members: print_metric_call, mirrorpad_1d, rms_envelope_1d, apply_lags, apply_function_in_sliding_window, convolve_and_rescale, export_metric \ No newline at end of file + :members: print_metric_call, mirrorpad_1d, rms_envelope_1d, apply_lags, apply_function_in_sliding_window, convolve_and_rescale, export_metric From d31a19c32b3a84ca0861211b72a3e92bc4ad4915 Mon Sep 17 00:00:00 2001 From: maestroque Date: Thu, 18 Jul 2024 15:32:34 +0300 Subject: [PATCH 06/12] docs: Add exporting metrics page --- docs/user_guide/exporting.rst | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/docs/user_guide/exporting.rst b/docs/user_guide/exporting.rst index 2a9a7bb..6e1d8db 100644 --- a/docs/user_guide/exporting.rst +++ b/docs/user_guide/exporting.rst @@ -2,3 +2,28 @@ Exporting physiological data metrics ------------------------------------ +Another feature of the :py:mod:`phys2denoise` package is the ability to export the computed physiological data metrics to a file, with various parameters. +This can be done using the :py:func:`export_metric` function, which provides the following capabilities: + +- Exporting the computed metrics, resampled at the TR of the fMRI data, along with the original data. +- Flagging if the exported data is the convolved version or if the metric contains lags of itself, resulting in appropriate file naming. +- Defining the output file extension and file prefix. +- Defining the number of timepoints to be considered. + +The following example shows how to export the computed respiratory variance time using a Physio object. + +.. code-block:: python + + RVT = respiratory_variance_time( + resp.data, resp.peaks, resp.troughs, resp.fs, lags=(0, 4, 8, 12) + ) + + export_metric( + RVT, + resp.fs, + tr=1.5, + fileprefix="data/pk-p2d/sub-007_ses-05_task-rest_run-01_RVT", + ntp=400, + is_convolved=False, + has_lags=True, + ) From 34a2e7662e71e30f2aeadc4523c693b795d2a1ac Mon Sep 17 00:00:00 2001 From: maestroque Date: Thu, 18 Jul 2024 15:35:07 +0300 Subject: [PATCH 07/12] docs: Remove README.rst reference --- docs/index.rst | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/index.rst b/docs/index.rst index 590f394..0651d73 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,4 +1,3 @@ -.. include:: ../README.rst Contents -------- From 8c3f1bd7f25c309d3b7655051e82f12a233bf8fe Mon Sep 17 00:00:00 2001 From: maestroque Date: Thu, 18 Jul 2024 15:37:15 +0300 Subject: [PATCH 08/12] docs: Minor codeblock fix --- docs/user_guide/exporting.rst | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/docs/user_guide/exporting.rst b/docs/user_guide/exporting.rst index 6e1d8db..61f6522 100644 --- a/docs/user_guide/exporting.rst +++ b/docs/user_guide/exporting.rst @@ -13,17 +13,19 @@ This can be done using the :py:func:`export_metric` function, which provides the The following example shows how to export the computed respiratory variance time using a Physio object. .. code-block:: python + from phys2denoise.metrics.chest_belt import respiratory_variance_time + from phys2denoise.metrics.utils import export_metric - RVT = respiratory_variance_time( - resp.data, resp.peaks, resp.troughs, resp.fs, lags=(0, 4, 8, 12) - ) + RVT = respiratory_variance_time( + resp.data, resp.peaks, resp.troughs, resp.fs, lags=(0, 4, 8, 12) + ) - export_metric( - RVT, - resp.fs, - tr=1.5, - fileprefix="data/pk-p2d/sub-007_ses-05_task-rest_run-01_RVT", - ntp=400, - is_convolved=False, - has_lags=True, - ) + export_metric( + RVT, + resp.fs, + tr=1.5, + fileprefix="data/sub-002_ses-01_task-rest_run-01_RVT", + ntp=400, + is_convolved=False, + has_lags=True, + ) From 3af24c7a535f6262394d85a056de97687152d3de Mon Sep 17 00:00:00 2001 From: maestroque Date: Thu, 18 Jul 2024 15:37:51 +0300 Subject: [PATCH 09/12] docs: Minor codeblock fix --- docs/user_guide/exporting.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/user_guide/exporting.rst b/docs/user_guide/exporting.rst index 61f6522..1a9421f 100644 --- a/docs/user_guide/exporting.rst +++ b/docs/user_guide/exporting.rst @@ -13,6 +13,7 @@ This can be done using the :py:func:`export_metric` function, which provides the The following example shows how to export the computed respiratory variance time using a Physio object. .. code-block:: python + from phys2denoise.metrics.chest_belt import respiratory_variance_time from phys2denoise.metrics.utils import export_metric From 931207754d63bdc0a2929cf8dd6c798db8f7061b Mon Sep 17 00:00:00 2001 From: maestroque Date: Thu, 8 Aug 2024 21:47:56 +0300 Subject: [PATCH 10/12] Add basic installation, README.rst in index page and minor fixes --- README.rst | 22 ++++++++++++++++++++++ docs/index.rst | 1 + docs/installation.rst | 11 +++++++++++ docs/user_guide/exporting.rst | 3 ++- docs/user_guide/metrics.rst | 4 ++-- 5 files changed, 38 insertions(+), 3 deletions(-) create mode 100644 README.rst diff --git a/README.rst b/README.rst new file mode 100644 index 0000000..d247555 --- /dev/null +++ b/README.rst @@ -0,0 +1,22 @@ +phys2denoise: A toolbox for physiological metrics calculation +============================================================= + +This package is designed for use in the metrics calculation of physiological data, more specifically of cardiac and respiratory signals, to be used in fMRI denoising. + + +.. image:: https://readthedocs.org/projects/phys2denoise/badge/?version=latest + :target: http://phys2denoise.readthedocs.io/en/latest +.. image:: https://img.shields.io/badge/license-Apache%202-blue.svg + :target: http://www.apache.org/licenses/LICENSE-2.0 +.. image:: https://img.shields.io/badge/python-3.6+-blue.svg + :target: https://www.python.org/downloads/ + + +.. _licensing: + +License Information +------------------- + +This codebase is licensed under the Apache License, Version 2.0. The full +license can be found in the `LICENSE `_ file in the ``phys2denoise`` distribution. You may also +obtain a copy of the license at: http://www.apache.org/licenses/LICENSE-2.0. diff --git a/docs/index.rst b/docs/index.rst index 0651d73..590f394 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,3 +1,4 @@ +.. include:: ../README.rst Contents -------- diff --git a/docs/installation.rst b/docs/installation.rst index 709983c..a647649 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -5,6 +5,17 @@ Installation and setup .. _basic_installation: +Basic installation +------------------ + +The easiest way to install ``phys2denoise`` is to use ``pip``. Assuming you have +Python >= 3.6 installed, you can install ``phys2denoise`` by opening a terminal +and running the following: + +.. code-block:: bash + + pip install phys2denoise + Developer installation -------------------- diff --git a/docs/user_guide/exporting.rst b/docs/user_guide/exporting.rst index 1a9421f..5674a34 100644 --- a/docs/user_guide/exporting.rst +++ b/docs/user_guide/exporting.rst @@ -10,7 +10,8 @@ This can be done using the :py:func:`export_metric` function, which provides the - Defining the output file extension and file prefix. - Defining the number of timepoints to be considered. -The following example shows how to export the computed respiratory variance time using a Physio object. +The following example shows how to export the computed respiratory variance time using a Physio object. In the following example, +we consider that the Physio object is ``resp``, containing the respiratory data, peaks and troughs. .. code-block:: python diff --git a/docs/user_guide/metrics.rst b/docs/user_guide/metrics.rst index 402fe0c..7b1c5dc 100644 --- a/docs/user_guide/metrics.rst +++ b/docs/user_guide/metrics.rst @@ -64,7 +64,7 @@ For further information refer to the :py:mod:`physutils` documentation. Without using a Physio object ############################# -However, if the use of :py:mod:`physutils` is not preferred, the metrics can be also computed without it. The following +However, if the use of the ``Physio`` object of the :py:mod:`physutils` module is not preferred, the metrics can be also computed without it. The following example shows how to compute the heart rate and the heart rate variability using the :py:mod:`phys2denoise` package. .. code-block:: python @@ -73,4 +73,4 @@ example shows how to compute the heart rate and the heart rate variability using # Given that the respiratory signal is stored in `data`, the peaks in `peaks`, the troughs in `troughs` # and the sample rate in `sample_rate` - _, rvt = respiratory_variance_time(physio, peaks, troughs, sample_rate) + _, rvt = respiratory_variance_time(data, peaks, troughs, sample_rate) From 9b6a03c92781e2c7e6723ceef64d40c6fee1d6c1 Mon Sep 17 00:00:00 2001 From: Marie-Eve Picard Date: Thu, 8 Aug 2024 15:24:43 -0400 Subject: [PATCH 11/12] FIX typos and layout --- README.rst | 2 +- docs/api.rst | 8 ++++---- docs/installation.rst | 7 ++++++- docs/user_guide/metrics.rst | 2 +- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/README.rst b/README.rst index d247555..4316096 100644 --- a/README.rst +++ b/README.rst @@ -1,7 +1,7 @@ phys2denoise: A toolbox for physiological metrics calculation ============================================================= -This package is designed for use in the metrics calculation of physiological data, more specifically of cardiac and respiratory signals, to be used in fMRI denoising. +This package is designed for calculating physiological metrics, derived specifically cardiac and respiratory signals, to use in fMRI denoising. .. image:: https://readthedocs.org/projects/phys2denoise/badge/?version=latest diff --git a/docs/api.rst b/docs/api.rst index dde3b05..b419f38 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -5,13 +5,13 @@ API .. py:module:: phys2denoise Cardiac data ------------------- +------------ .. automodule:: phys2denoise.metrics.cardiac :members: heart_rate, heart_rate_variability, heart_beat_interval, cardiac_phase Respiratory data ------------- +---------------- .. automodule:: phys2denoise.metrics.chest_belt :members: respiratory_cariance_time, respiratory_pattern_variability, env, respiratory_variance, respiratory_phase @@ -22,13 +22,13 @@ Multimodal data .. autofunction:: phys2denoise.multimodal.retroicor Response functions ------------ +------------------ .. automodule:: phys2denoise.metrics.responses :members: crf, icrf, rrf Utilities ------------ +--------- .. automodule:: phys2denoise.metrics.utils :members: print_metric_call, mirrorpad_1d, rms_envelope_1d, apply_lags, apply_function_in_sliding_window, convolve_and_rescale, export_metric diff --git a/docs/installation.rst b/docs/installation.rst index a647649..8e5fe3a 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -16,8 +16,13 @@ and running the following: pip install phys2denoise +.. warning:: + + If you encounter an ImportError related to numpy.core.multiarray, please try to update + your matplotlib version to 3.9. + Developer installation --------------------- +---------------------- This package requires Python >= 3.6. Assuming you have the correct version of Python installed, you can install ``phys2denoise`` by opening a terminal and running diff --git a/docs/user_guide/metrics.rst b/docs/user_guide/metrics.rst index 7b1c5dc..e387600 100644 --- a/docs/user_guide/metrics.rst +++ b/docs/user_guide/metrics.rst @@ -64,7 +64,7 @@ For further information refer to the :py:mod:`physutils` documentation. Without using a Physio object ############################# -However, if the use of the ``Physio`` object of the :py:mod:`physutils` module is not preferred, the metrics can be also computed without it. The following +However, if the use of the ``Physio`` object from the :py:mod:`physutils` module is not preferred, the metrics can be also computed without it. The following example shows how to compute the heart rate and the heart rate variability using the :py:mod:`phys2denoise` package. .. code-block:: python From a596838137384e963268a9e9183912783f409924 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 8 Aug 2024 19:25:08 +0000 Subject: [PATCH 12/12] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- docs/installation.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/installation.rst b/docs/installation.rst index 8e5fe3a..fc61add 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -18,7 +18,7 @@ and running the following: .. warning:: - If you encounter an ImportError related to numpy.core.multiarray, please try to update + If you encounter an ImportError related to numpy.core.multiarray, please try to update your matplotlib version to 3.9. Developer installation