neurokit2


Nameneurokit2 JSON
Version 0.2.7 PyPI version JSON
download
home_pagehttps://github.com/neuropsychology/NeuroKit
SummaryThe Python Toolbox for Neurophysiological Signal Processing.
upload_time2023-11-06 11:38:32
maintainer
docs_urlNone
authorDominique Makowski
requires_python
licenseMIT license
keywords neurokit2 physiology bodily signals python ecg eda emg ppg
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            .. image:: https://raw.github.com/neuropsychology/NeuroKit/master/docs/img/banner.png
        :target: https://neuropsychology.github.io/NeuroKit/

.. image:: https://img.shields.io/pypi/pyversions/neurokit2.svg?logo=python&logoColor=FFE873
        :target: https://pypi.python.org/pypi/neurokit2

.. image:: https://img.shields.io/pypi/dm/neurokit2
        :target: https://pypi.python.org/pypi/neurokit2

.. image:: https://img.shields.io/pypi/v/neurokit2.svg?logo=pypi&logoColor=FFE873
        :target: https://pypi.python.org/pypi/neurokit2

.. image:: https://github.com/neuropsychology/NeuroKit/actions/workflows/tests.yml/badge.svg
        :target: https://github.com/neuropsychology/NeuroKit/actions/workflows/tests.yml

.. image:: https://codecov.io/gh/neuropsychology/NeuroKit/branch/master/graph/badge.svg
        :target: https://codecov.io/gh/neuropsychology/NeuroKit

.. image:: https://api.codeclimate.com/v1/badges/517cb22bd60238174acf/maintainability
        :target: https://codeclimate.com/github/neuropsychology/NeuroKit/maintainability
        :alt: Maintainability


**The Python Toolbox for Neurophysiological Signal Processing**

**NeuroKit2** is a user-friendly package providing easy access to advanced biosignal processing routines.
Researchers and clinicians without extensive knowledge of programming or biomedical signal processing
can **analyze physiological data with only two lines of code**.


Quick Example
------------------

.. code-block:: python

    import neurokit2 as nk

    # Download example data
    data = nk.data("bio_eventrelated_100hz")

    # Preprocess the data (filter, find peaks, etc.)
    processed_data, info = nk.bio_process(ecg=data["ECG"], rsp=data["RSP"], eda=data["EDA"], sampling_rate=100)

    # Compute relevant features
    results = nk.bio_analyze(processed_data, sampling_rate=100)

And **boom** 💥 your analysis is done 😎

Download
--------

You can download NeuroKit2 from `PyPI <https://pypi.org/project/neurokit2/>`_

.. code-block::

    pip install neurokit2

or `conda-forge <https://anaconda.org/conda-forge/neurokit2>`_

.. code-block::

    conda install -c conda-forge neurokit2

If you're not sure what to do, read our `installation guide <https://neuropsychology.github.io/NeuroKit/installation.html>`_.

Contributing
-------------

.. image:: https://img.shields.io/badge/License-MIT-blue.svg
        :target: https://github.com/neuropsychology/NeuroKit/blob/master/LICENSE
        :alt: License

.. image:: https://github.com/neuropsychology/neurokit/workflows/%E2%9C%A8%20Style/badge.svg?branch=master
        :target: https://github.com/neuropsychology/NeuroKit/actions
        :alt: GitHub CI

.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
        :target: https://github.com/psf/black
        :alt: Black code

NeuroKit2 is the most `welcoming <https://github.com/neuropsychology/NeuroKit#popularity>`_ project with a large community of contributors with all levels of programming expertise. **But the package is still far from being perfect!** Thus, if you have some ideas for **improvement**, **new features**, or just want to **learn Python** and do something useful at the same time, do not hesitate and check out the following guide:

- `Contributing to NeuroKit <https://neuropsychology.github.io/NeuroKit/resources/contributing.html>`_

Also, if you have developed new signal processing methods or algorithms and you want to **increase their usage, popularity, and citations**, get in touch with us to eventually add them to NeuroKit. A great opportunity for the users as well as the original developers!

You have spotted a **mistake**? An **error** in a formula or code? OR there is just a step that seems strange and you don't understand? **Please let us know!** We are human beings, and we'll appreciate any inquiry.

Documentation
----------------

.. image:: https://img.shields.io/badge/documentation-online-brightgreen.svg
        :target: https://neuropsychology.github.io/NeuroKit/
        :alt: Documentation Status

.. image:: https://img.shields.io/badge/functions-API-orange.svg?colorB=2196F3
        :target: https://neuropsychology.github.io/NeuroKit/functions/index.html
        :alt: API

.. image:: https://img.shields.io/badge/tutorials-examples-orange.svg?colorB=E91E63
        :target: https://neuropsychology.github.io/NeuroKit/examples/index.html
        :alt: Tutorials

.. .. image:: https://img.shields.io/badge/documentation-pdf-purple.svg?colorB=FF9800
..         :target: https://neurokit2.readthedocs.io/_/downloads/en/latest/pdf/
..         :alt: PDF

.. .. image:: https://mybinder.org/badge_logo.svg
..         :target: https://mybinder.org/v2/gh/neuropsychology/NeuroKit/dev?urlpath=lab%2Ftree%2Fdocs%2Fexamples
..         :alt: Binder

.. .. image:: https://img.shields.io/gitter/room/neuropsychology/NeuroKit.js.svg
..         :target: https://gitter.im/NeuroKit/community
..         :alt: Chat on Gitter


Click on the links above and check out our tutorials:

General
^^^^^^^^^^

-  `Get familiar with Python in 10 minutes <https://neuropsychology.github.io/NeuroKit/resources/learn_python.html>`_
-  `Recording good quality signals <https://neuropsychology.github.io/NeuroKit/resources/recording.html>`_
-  `Install Python and NeuroKit <https://neuropsychology.github.io/NeuroKit/installation.html>`_
-  `Included datasets <https://neuropsychology.github.io/NeuroKit/functions/data.html#datasets>`_
-  `Additional Resources <https://neuropsychology.github.io/NeuroKit/resources/resources.html>`_


Examples
^^^^^^^^^^

-  `Simulate Artificial Physiological Signals <https://neuropsychology.github.io/NeuroKit/examples/signal_simulation/signal_simulation.html>`_
-  `Customize your Processing Pipeline <https://neuropsychology.github.io/NeuroKit/examples/bio_custom/bio_custom.html>`_
-  `Event-related Analysis <https://neuropsychology.github.io/NeuroKit/examples/bio_eventrelated/bio_eventrelated.html>`_
-  `Interval-related Analysis <https://neuropsychology.github.io/NeuroKit/examples/bio_intervalrelated/bio_intervalrelated.html>`_
-  `Analyze Electrodermal Activity (EDA) <https://neuropsychology.github.io/NeuroKit/examples/eda_peaks/eda_peaks.html>`_
-  `Analyze Respiratory Rate Variability (RRV) <https://neuropsychology.github.io/NeuroKit/examples/rsp_rrv/rsp_rrv.html>`_
-  `Extract and Visualize Individual Heartbeats <https://neuropsychology.github.io/NeuroKit/examples/ecg_heartbeats/ecg_heartbeats.html>`_
-  `Locate P, Q, S, and T waves in ECG <https://neuropsychology.github.io/NeuroKit/examples/ecg_delineate/ecg_delineate.html>`_
-  `Analyze Electrooculography EOG data <https://neuropsychology.github.io/NeuroKit/examples/eog_analyze/eog_analyze.html>`_

.. *You can try out these examples directly* `in your browser <https://github.com/neuropsychology/NeuroKit/tree/master/docs/examples#cloud-based-interactive-examples>`_.

**Don't know which tutorial is suited for your case?** Follow this flowchart:


.. image:: https://raw.github.com/neuropsychology/NeuroKit/master/docs/readme/workflow.png
        :target: https://neuropsychology.github.io/NeuroKit/

Citation
---------

.. image:: https://zenodo.org/badge/218212111.svg
   :target: https://zenodo.org/badge/latestdoi/218212111

.. image:: https://img.shields.io/badge/details-authors-purple.svg?colorB=9C27B0
   :target: https://neuropsychology.github.io/NeuroKit/authors.html


The **NeuroKit2** paper can be found `here <https://doi.org/10.3758/s13428-020-01516-y>`_ 🎉 Additionally, you can get the reference directly from Python by running:

.. code-block:: python

    nk.cite()


.. code-block:: tex

    You can cite NeuroKit2 as follows:

    - Makowski, D., Pham, T., Lau, Z. J., Brammer, J. C., Lespinasse, F., Pham, H.,
    Schölzel, C., & Chen, S. A. (2021). NeuroKit2: A Python toolbox for neurophysiological signal processing.
    Behavior Research Methods, 53(4), 1689–1696. https://doi.org/10.3758/s13428-020-01516-y

    Full bibtex reference:

    @article{Makowski2021neurokit,
        author = {Dominique Makowski and Tam Pham and Zen J. Lau and Jan C. Brammer and Fran{\c{c}}ois Lespinasse and Hung Pham and Christopher Schölzel and S. H. Annabel Chen},
        title = {{NeuroKit}2: A Python toolbox for neurophysiological signal processing},
        journal = {Behavior Research Methods},
        volume = {53},
        number = {4},
        pages = {1689--1696},
        publisher = {Springer Science and Business Media {LLC}},
        doi = {10.3758/s13428-020-01516-y},
        url = {https://doi.org/10.3758%2Fs13428-020-01516-y},
        year = 2021,
        month = {feb}
    }


**Let us know if you used NeuroKit2 in a publication!** Open a new `discussion <https://github.com/neuropsychology/NeuroKit/discussions>`_ (select the *NK in publications* category) and link the paper. The community would be happy to know about how you used it and learn about your research. We could also feature it once we have a section on the website for papers that used the software.

..
    Design
    --------

    *NeuroKit2* is designed to provide a **consistent**, **accessible** yet **powerful** and **flexible** API.

    - **Consistency**: For each type of signals (ECG, RSP, EDA, EMG...), the same function names are called (in the form :code:`signaltype_functiongoal()`) to achieve equivalent goals, such as :code:`*_clean()`, :code:`*_findpeaks()`, :code:`*_process()`, :code:`*_plot()` (replace the star with the signal type, e.g., :code:`ecg_clean()`).
    - **Accessibility**: Using NeuroKit2 is made very easy for beginners through the existence of powerful high-level "master" functions, such as :code:`*_process()`, that performs cleaning, preprocessing and processing with sensible defaults.
    - **Flexibility**: However, advanced users can very easily build their own custom analysis pipeline by using the mid-level functions (such as :code:`*_clean()`, :code:`*_rate()`), offering more control and flexibility over their parameters.


Physiological Data Preprocessing
---------------------------------

Simulate physiological signals
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

You can easily simulate artificial ECG (also `12-Lead multichannel ECGs <https://neuropsychology.github.io/NeuroKit/examples/ecg_generate_12leads/ecg_generate_12leads.html>`_), PPG, RSP, EDA, and EMG signals to test your scripts and algorithms.

.. code-block:: python

    import numpy as np
    import pandas as pd
    import neurokit2 as nk

    # Generate synthetic signals
    ecg = nk.ecg_simulate(duration=10, heart_rate=70)
    ppg = nk.ppg_simulate(duration=10, heart_rate=70)
    rsp = nk.rsp_simulate(duration=10, respiratory_rate=15)
    eda = nk.eda_simulate(duration=10, scr_number=3)
    emg = nk.emg_simulate(duration=10, burst_number=2)

    # Visualise biosignals
    data = pd.DataFrame({"ECG": ecg,
                         "PPG": ppg,
                         "RSP": rsp,
                         "EDA": eda,
                         "EMG": emg})
    nk.signal_plot(data, subplots=True)


.. image:: https://raw.github.com/neuropsychology/NeuroKit/master/docs/readme/README_simulation.png
        :target: https://neuropsychology.github.io/NeuroKit/examples/signal_simulation/signal_simulation.html


Electrodermal Activity (EDA/GSR)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. code-block:: python

    # Generate 10 seconds of EDA signal (recorded at 250 samples / second) with 2 SCR peaks
    eda = nk.eda_simulate(duration=10, sampling_rate=250, scr_number=2, drift=0.01)

    # Process it
    signals, info = nk.eda_process(eda, sampling_rate=250)

    # Visualise the processing
    nk.eda_plot(signals, info)

.. image:: https://raw.github.com/neuropsychology/NeuroKit/master/docs/readme/README_eda.png
        :target: https://neuropsychology.github.io/NeuroKit/examples/eda_peaks/eda_peaks.html


Cardiac activity (ECG)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. code-block:: python

    # Generate 15 seconds of ECG signal (recorded at 250 samples/second)
    ecg = nk.ecg_simulate(duration=15, sampling_rate=250, heart_rate=70)

    # Process it
    signals, info = nk.ecg_process(ecg, sampling_rate=250)

    # Visualise the processing
    nk.ecg_plot(signals, info)


.. image:: https://raw.github.com/neuropsychology/NeuroKit/master/docs/readme/README_ecg.png
        :target: https://neuropsychology.github.io/NeuroKit/examples/ecg_heartbeats/ecg_heartbeats.html


Respiration (RSP)
^^^^^^^^^^^^^^^^^^^

.. code-block:: python

    # Generate one minute of respiratory (RSP) signal (recorded at 250 samples / second)
    rsp = nk.rsp_simulate(duration=60, sampling_rate=250, respiratory_rate=15)

    # Process it
    signals, info = nk.rsp_process(rsp, sampling_rate=250)

    # Visualise the processing
    nk.rsp_plot(signals, info)


.. image:: https://raw.github.com/neuropsychology/NeuroKit/master/docs/readme/README_rsp.png
        :target: https://neuropsychology.github.io/NeuroKit/examples/rsp_rrv/rsp_rrv.html


Photoplethysmography (PPG/BVP)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. code-block:: python

    # Generate 15 seconds of PPG signal (recorded at 250 samples/second)
    ppg = nk.ppg_simulate(duration=15, sampling_rate=250, heart_rate=70)

    # Process it
    signals, info = nk.ppg_process(ppg, sampling_rate=250)

    # Visualize the processing
    nk.ppg_plot(signals, info)


.. image:: https://raw.github.com/neuropsychology/NeuroKit/master/docs/readme/README_ppg.png


Electromyography (EMG)
^^^^^^^^^^^^^^^^^^^^^^^

.. code-block:: python

    # Generate 10 seconds of EMG signal (recorded at 250 samples/second)
    emg = nk.emg_simulate(duration=10, sampling_rate=250, burst_number=3)

    # Process it
    signals, info = nk.emg_process(emg, sampling_rate=250)

    # Visualise the processing
    nk.emg_plot(signals, info)


.. image:: https://raw.github.com/neuropsychology/NeuroKit/master/docs/readme/README_emg.png



Electrooculography (EOG)
^^^^^^^^^^^^^^^^^^^^^^^^^^

.. code-block:: python

    # Import EOG data
    eog_signal = nk.data("eog_100hz")

    # Process it
    signals, info = nk.eog_process(eog_signal, sampling_rate=100)

    # Plot
    nk.eog_plot(signals, info)


.. image:: https://raw.github.com/neuropsychology/NeuroKit/master/docs/readme/README_eog.png



Electrogastrography (EGG)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Consider `helping us develop it <https://neuropsychology.github.io/NeuroKit/resources/contributing.html>`_!


Physiological Data Analysis
----------------------------

The analysis of physiological data usually comes in two types, **event-related** or **interval-related**.



.. image:: https://raw.github.com/neuropsychology/NeuroKit/master/docs/readme/features.png


Event-related
^^^^^^^^^^^^^^

This type of analysis refers to physiological changes immediately occurring in response to an event.
For instance, physiological changes following the presentation of a stimulus (e.g., an emotional stimulus) are indicated by
the dotted lines in the figure above. In this situation, the analysis is epoch-based.
An epoch is a short chunk of the physiological signal (usually < 10 seconds), that is locked to a specific stimulus and hence
the physiological signals of interest are time-segmented accordingly. This is represented by the orange boxes in the figure above.
In this case, using `bio_analyze()` will compute features like rate changes, peak characteristics, and phase characteristics.

- `Event-related example <https://neuropsychology.github.io/NeuroKit/examples/bio_eventrelated/bio_eventrelated.html>`_

Interval-related
^^^^^^^^^^^^^^^^^

This type of analysis refers to the physiological characteristics and features that occur over
longer periods of time (from a few seconds to days of activity). Typical use cases are either
periods of resting state, in which the activity is recorded for several minutes while the participant
is at rest, or during different conditions in which there is no specific time-locked event
(e.g., watching movies, listening to music, engaging in physical activity, etc.). For instance,
this type of analysis is used when people want to compare the physiological activity under different
intensities of physical exercise, different types of movies, or different intensities of
stress. To compare event-related and interval-related analysis, we can refer to the example figure above.
For example, a participant might be watching a 20s-long short film where particular stimuli of
interest in the movie appear at certain time points (marked by the dotted lines). While
event-related analysis pertains to the segments of signals within the orange boxes (to understand the physiological
changes pertaining to the appearance of stimuli), interval-related analysis can be
applied on the entire 20s duration to investigate how physiology fluctuates in general.
In this case, using `bio_analyze()` will compute features such as rate characteristics (in particular,
variability metrics) and peak characteristics.

- `Interval-related example <https://neuropsychology.github.io/NeuroKit/examples/bio_intervalrelated/bio_intervalrelated.html>`_


Heart Rate Variability (HRV)
----------------------------
.. image:: https://img.shields.io/badge/Tutorial-HRV-green
        :target: https://www.mdpi.com/1424-8220/21/12/3998

Check-out our **Heart Rate Variability in Psychology: A Review of HRV Indices and an Analysis Tutorial** `paper <https://doi.org/10.3390/s21123998>`_ for:

- a comprehensive review of the most up-to-date HRV indices
- a discussion of their significance in psychological research and practices
- a step-by-step guide for HRV analysis using **NeuroKit2**


.. code-block:: tex

    You can cite the paper as follows:

    - Pham, T., Lau, Z. J., Chen, S. H. A., & Makowski, D. (2021).
    Heart Rate Variability in Psychology: A Review of HRV Indices and an Analysis Tutorial.
    Sensors, 21(12), 3998. https://doi:10.3390/s21123998


- **Compute HRV indices using Python**

  - **Time domain**: RMSSD, MeanNN, SDNN, SDSD, CVNN, etc.
  - **Frequency domain**: Spectral power density in various frequency bands (Ultra low/ULF, Very low/VLF, Low/LF, High/HF, Very high/VHF), Ratio of LF to HF power, Normalized LF (LFn) and HF (HFn), Log transformed HF (LnHF).
  - **Nonlinear domain**: Spread of RR intervals (SD1, SD2, ratio between SD2 to SD1), Cardiac Sympathetic Index (CSI), Cardial Vagal Index (CVI), Modified CSI, Sample Entropy (SampEn).


.. code-block:: python

    # Download data
    data = nk.data("bio_resting_8min_100hz")

    # Find peaks
    peaks, info = nk.ecg_peaks(data["ECG"], sampling_rate=100)

    # Compute HRV indices
    nk.hrv(peaks, sampling_rate=100, show=True)
    >>>    HRV_RMSSD  HRV_MeanNN   HRV_SDNN  ...   HRV_CVI  HRV_CSI_Modified  HRV_SampEn
    >>> 0  69.697983  696.395349  62.135891  ...  4.829101        592.095372    1.259931



.. image:: https://raw.github.com/neuropsychology/NeuroKit/master/docs/readme/README_hrv.png

Miscellaneous
----------------------------

ECG Delineation
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

- Delineate the QRS complex of an electrocardiac signal (ECG) including P-peaks, T-peaks, as well as their onsets and offsets.


.. code-block:: python


    # Download data
    ecg_signal = nk.data(dataset="ecg_3000hz")

    # Extract R-peaks locations
    _, rpeaks = nk.ecg_peaks(ecg_signal, sampling_rate=3000)

    # Delineate
    signal, waves = nk.ecg_delineate(ecg_signal, rpeaks, sampling_rate=3000, method="dwt", show=True, show_type='all')



.. image:: https://raw.github.com/neuropsychology/NeuroKit/master/docs/readme/README_delineate.png
       :target: https://neuropsychology.github.io/NeuroKit/examples/ecg_delineate/ecg_delineate.html



Signal Processing
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

- **Signal processing functionalities**

  - **Filtering**: Using different methods.
  - **Detrending**: Remove the baseline drift or trend.
  - **Distorting**: Add noise and artifacts.

.. code-block:: python

    # Generate original signal
    original = nk.signal_simulate(duration=6, frequency=1)

    # Distort the signal (add noise, linear trend, artifacts, etc.)
    distorted = nk.signal_distort(original,
                                  noise_amplitude=0.1,
                                  noise_frequency=[5, 10, 20],
                                  powerline_amplitude=0.05,
                                  artifacts_amplitude=0.3,
                                  artifacts_number=3,
                                  linear_drift=0.5)

    # Clean (filter and detrend)
    cleaned = nk.signal_detrend(distorted)
    cleaned = nk.signal_filter(cleaned, lowcut=0.5, highcut=1.5)

    # Compare the 3 signals
    plot = nk.signal_plot([original, distorted, cleaned])


.. image:: https://raw.github.com/neuropsychology/NeuroKit/master/docs/readme/README_signalprocessing.png


Complexity (Entropy, Fractal Dimensions, ...)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

- **Optimize complexity parameters** (delay *tau*, dimension *m*, tolerance *r*)

.. code-block:: python

    # Generate signal
    signal = nk.signal_simulate(frequency=[1, 3], noise=0.01, sampling_rate=200)

    # Find optimal time delay, embedding dimension, and r
    parameters = nk.complexity_optimize(signal, show=True)



.. image:: https://raw.github.com/neuropsychology/NeuroKit/master/docs/readme/README_complexity_optimize.png
        :target: https://neuropsychology.github.io/NeuroKit/functions/complexity.html



- **Compute complexity features**

  - **Entropy**: Sample Entropy (SampEn), Approximate Entropy (ApEn), Fuzzy Entropy (FuzzEn), Multiscale Entropy (MSE), Shannon Entropy (ShEn)
  - **Fractal dimensions**: Correlation Dimension D2, ...
  - **Detrended Fluctuation Analysis**

.. code-block:: python

    nk.entropy_sample(signal)
    nk.entropy_approximate(signal)


Signal Decomposition
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. code-block:: python

    # Create complex signal
    signal = nk.signal_simulate(duration=10, frequency=1)  # High freq
    signal += 3 * nk.signal_simulate(duration=10, frequency=3)  # Higher freq
    signal += 3 * np.linspace(0, 2, len(signal))  # Add baseline and linear trend
    signal += 2 * nk.signal_simulate(duration=10, frequency=0.1, noise=0)  # Non-linear trend
    signal += np.random.normal(0, 0.02, len(signal))  # Add noise

    # Decompose signal using Empirical Mode Decomposition (EMD)
    components = nk.signal_decompose(signal, method='emd')
    nk.signal_plot(components)  # Visualize components

    # Recompose merging correlated components
    recomposed = nk.signal_recompose(components, threshold=0.99)
    nk.signal_plot(recomposed)  # Visualize components

.. image:: https://raw.github.com/neuropsychology/NeuroKit/master/docs/readme/README_decomposition.png
        :target: https://neuropsychology.github.io/NeuroKit/functions/signal.html#signal-decompose

Signal Power Spectrum Density (PSD)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. code-block:: python

    # Generate complex signal
    signal = nk.signal_simulate(duration=20, frequency=[0.5, 5, 10, 15], amplitude=[2, 1.5, 0.5, 0.3], noise=0.025)

    # Get the PSD using different methods
    welch = nk.signal_psd(signal, method="welch", min_frequency=1, max_frequency=20, show=True)
    multitaper = nk.signal_psd(signal, method="multitapers", max_frequency=20, show=True)
    lomb = nk.signal_psd(signal, method="lomb", min_frequency=1, max_frequency=20, show=True)
    burg = nk.signal_psd(signal, method="burg", min_frequency=1, max_frequency=20, order=10, show=True)

.. image:: https://raw.github.com/neuropsychology/NeuroKit/master/docs/readme/README_psd.png
        :target: https://neuropsychology.github.io/NeuroKit/functions/signal.html#signal-psd

Statistics
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

- **Highest Density Interval (HDI)**

.. code-block:: python

    x = np.random.normal(loc=0, scale=1, size=100000)

    ci_min, ci_max = nk.hdi(x, ci=0.95, show=True)

.. image:: https://raw.github.com/neuropsychology/NeuroKit/master/docs/readme/README_hdi.png
        :target: https://neuropsychology.github.io/NeuroKit/functions/stats.html#hdi

.. used_at_section

Popularity
---------------------

.. image:: https://img.shields.io/pypi/dd/neurokit2
        :target: https://pypi.python.org/pypi/neurokit2

.. image:: https://img.shields.io/github/stars/neuropsychology/NeuroKit
        :target: https://github.com/neuropsychology/NeuroKit/stargazers

.. image:: https://img.shields.io/github/forks/neuropsychology/NeuroKit
        :target: https://github.com/neuropsychology/NeuroKit/network


NeuroKit2 is one of the most welcoming packages for new contributors and users, as well as the fastest-growing package. So stop hesitating and hop on board 🤗

.. image:: https://raw.github.com/neuropsychology/NeuroKit/dev/docs/readme/README_popularity.png
        :target: https://pypi.python.org/pypi/neurokit2


Used at
-------

|ntu| |univ_paris| |univ_duke| |uni_auckland| |uni_pittsburh| |uni_washington|

.. |ntu| image:: https://upload.wikimedia.org/wikipedia/en/thumb/c/c6/Nanyang_Technological_University.svg/1024px-Nanyang_Technological_University.svg.png
   :height: 70
.. |univ_duke| image:: https://www.tutelaprep.com/blog/wp-content/uploads/2019/12/duke.png
   :height: 70
.. |univ_paris| image:: https://study-eu.s3.amazonaws.com/uploads/university/universit--de-paris-logo.svg
   :height: 70
.. |uni_auckland| image:: https://upload.wikimedia.org/wikipedia/en/thumb/a/ae/University_of_Auckland.svg/1024px-University_of_Auckland.svg.png
   :height: 70
.. |uni_pittsburh| image:: https://upload.wikimedia.org/wikipedia/en/thumb/f/fb/University_of_Pittsburgh_seal.svg/1200px-University_of_Pittsburgh_seal.svg.png
   :height: 70
.. |uni_washington| image:: https://upload.wikimedia.org/wikipedia/en/thumb/5/58/University_of_Washington_seal.svg/768px-University_of_Washington_seal.svg.png
   :height: 70


Disclaimer
----------
*The authors do not provide any warranty. If this software causes your keyboard to blow up, your brain to liquefy, your toilet to clog or a zombie plague to break loose, the authors CANNOT IN ANY WAY be held responsible.*




News
-----

0.2.4
^^^^^^^^^^^^^^^^^^^
Fixes
+++++++++++++

* `eda_sympathetic()` has been reviewed: low-pass filter and resampling have been added to be in
  line with the original paper
* `eda_findpeaks()` using methods proposed in nabian2018 is reviewed and improved. Differentiation
  has been added before smoothing. Skin conductance response criteria have been revised based on
  the original paper.



0.2.1
^^^^^^^^^^^^^^^^^^^
New Features
+++++++++++++

* Allow for input with NaNs and extrapolation in `signal_interpolate()`
* Add argument `method` in `find_outliers()`
* A lot (see https://github.com/neuropsychology/NeuroKit/pull/645)




0.2.0
^^^^^^^^^^^^^^^^^^^
New Features
+++++++++++++

* Add new time-domain measures in `hrv_time()`: `Prc20NN`, `Prc80NN`, `MinNN`, and `MaxNN`





0.1.6
^^^^^^^^^^^^^^^^^^^

Breaking Changes
+++++++++++++++++

* Argument `type` changed to `out` in `expspace()`


New Features
+++++++++++++

* Add new time-domain measures in `hrv_time()`: `Prc20NN`, `Prc80NN`, `MinNN`, and `MaxNN`
* Allow `fix_peaks()` to account for larger intervals

Fixes
+++++++++++++





0.1.5
^^^^^^^^^^^^^^^^^^^

Breaking Changes
+++++++++++++++++

* Argument `r` changed to `radius` in `fractal_correlation()`
* Argument `r` changed to `tolerance` in entropy and complexity utility functions
* Argument `r_method` changed to `tolerance_method` in `complexity_optimize()`
* `complexity_lempelziv()`, `fractal_higuchi()`, `fractal_katz()`, `fractal_correlation()`, `fractal_dfa()`, `entropy_multiscale()`, `entropy_shannon()`, `entropy_approximate()`, `entropy_fuzzy()`, `entropy_sample()` now return a tuple consisting of the complexity index, and a dictionary comprising of the different parameters specific to the measure. For `fractal_katz()` and `entropy_shannon()`, the parameters dictionary is empty.
* Restructure `complexity` submodules with optimization files starting with `optim_*`, such as `optim_complexity_delay()`, `optim_complexity_dimension()`, `optim_complexity_k()`, `optim_complexity_optimize()`, and `optim_complexity_tolerance()`.
* `mutual_information()` moved from `stats` module to `complexity` module.

New Features
+++++++++++++

* Added various complexity indices: `complexity_hjorth()`, `complexity_hurst()`, `complexity_lyapunov()`, `complexity_rqa()`, `complexity_rr()`, `entropy_coalition()`, `entropy_permutation()`, `entropy_range()`, `entropy_spectral()`, `fractal_nld()`, `fractal_psdslope()`, `fractal_sda()`, `fractal_sevcik()`
* Added `mne_templateMRI()` as a helper to get MNE's template MRI.
* Added `eeg_source()` as a helper to perform source reconstruction.
* Added `eeg_source_extract()` to extract the activity from a brain region.
* Added `parallel_run()` in `misc` as a parallel processing utility function.
* Added `find_plateau()` in `misc` to find the point of plateau in an array of values.
* Added `write_csv()` in `data` to facilitate saving dataframes into multiple parts.
* Added more complexity-related functions, `entropy_cumulative_residual()`, `entropy_differential()`, `entropy_svd()`, `fractal_petrosian()`, and `information_fisher()`.
* Updates logic to find `kmax` in `fractal_higuchi()`
* Add RSP_Amplitude_Baseline in event-related analysis
* Add argument `add_firstsamples` in `mne_channel_extract()` to account for first sample attribute in mne raw objects
* Allow plotting of `mne.Epochs` in `epochs_plot()`
* Add `mne_crop()` to crop `mne` Raw objects with additional flexibility to specify first and last elements
* Plotting function in `eeg_badchannels()` to visualize overlay of individual EEG channels and highlighting of bad ones
* Add `eog_peaks()` as wrapper for `eog_findpeaks()`
* Allow `ecg_delineate()` to account for different heart rate


Fixes
+++++++++++++

* Ensure detected offset in `emg_activation()` is not beyond signal length
* Raise ValueError in `_hrv_sanitize_input()` if RRIs are detected instead of peaks
* Ensure that multifractal DFA indices returned by `fractal_mdfa()` is not Nan when array of slopes contains Nan (due to zero fluctuations)
* Documentation of respiration from peak/trough terminology to inhale/exhale onsets
* Change labelling in `rsp_plot()` from "inhalation peaks" and "exhalation troughs" to "peaks (exhalation onsets)" and "troughs (inhalation onsets)" respectively.
* Change RSP_Amplitude_Mean/Min/Max parameters to be corrected based on value closest to t=0 in event-related analysis, rather than using all pre-zero values.
* Have `rsp_rrv()` compute breath-to-breath intervals based on trough indices (inhalation onsets) rather than peak indices
* Compute `rsp_rate()` based on trough indices (rather than peak indices) in 'periods' method


0.1.4.1
^^^^^^^^^^^^^^^^^^^

Fixes
+++++++++++++
* Adjust `kmax` parameter in `fractal_higuchi()` according to signal length as having `kmax` more than half of signal length leads to division by zero error
* Ensure that sanitization of input in `_hrv_dfa()` is done before windows for `DFA_alpha2` is computed
* `np.seterr` is added to `fractal_dfa()` to avoid returning division by zero warning which is an expected behaviour


0.1.4
^^^^^^^^^^^^^^^^^^^

Breaking Changes
+++++++++++++++++

* `fractal_df()` now returns a dictionary of windows, fluctuations and the slope value (see documentation for more information. If `multifractal` is True, the dictionary additionally contains the parameters of the singularity spectrum (see `singularity_spectrum()` for more information)

New Features
+++++++++++++

* Add convenience function `intervals_to_peaks()` useful for RRI or BBI conversion to peak indices
* `hrv_nonlinear()` and `rrv_rsp()` now return the parameters of singularity spectrum for multifractal DFA analysis
* Add new complexity measures in `fractal_higuchi()`, `fractal_katz()` and `fractal_lempelziv()`
* Add new time-domain measures in `hrv_time()`: `SDANN` and `SDNNI`
* Add new non-linear measures in `hrv_nonlinear()`: `ShanEn`, `FuzzyEn`, `HFD`, `KFD` and `LZC`

Fixes
+++++++++++++

* Add path argument in `mne_data()` and throw warning to download mne datasets if data folder is not present
* The implementation of `TTIN` in `hrv_time()` is amended to its correct formulation.
* The default binsize used for RRI histogram in the computation of geometric HRV indices is set to 1 / 128 seconds


0.1.3
^^^^^^^^^^^^^^^^^^^

Breaking Changes
+++++++++++++++++

* None

New Features
+++++++++++++

* Add internal function for detecting missing data points and forward filling missing values in `nk.*_clean()` functions
* Add computation of standard deviation in `eventrelated()` functions for *ECG_Rate_SD*, *EMG_Amplitude_SD*, *EOG_Rate_SD*, *PPG_Rate_SD*, *RSP_Rate_SD*, *RSP_Amplitude_SD*
* Add labelling for interval related features if a dictionary of dataframes is passed
* Retrun Q peaks and S Peaks information for wavelet-based methods in `nk.ecg_delineate()`

Fixes
+++++++++++++

* Fix epochs columns with `dtype: object` generated by `nk.epochs_create()`
* Bug fix ecg_findpeaks_rodrigues for array out of bounds bug


0.1.2
^^^^^^^^^^^^^^^^^^^

New Features
+++++++++++++

* Additional features for `nk.rsp_intervalrelated()`: average inspiratory and expiratory durations, inspiratory-to-expiratory (I/E) time ratio
* Add multiscale entropy measures (MSE, CMSE, RCMSE) and fractal methods (Detrended Fluctuation Analysis, Correlation Dimension) into `nk.hrv_nonlinear()`
* Allow for data resampling in `nk.read_bitalino()`
* Add `bio_resting_8min_200hz` into database for reading with `nk.data()`
* Reading of url links in `nk.data()`
* Allow for `nk.hrv()` to compute RSA indices if respiratory data is present
* All `hrv` functions to automatically detect correct sampling rate if tuple or dict is passed as input
* Add support for PPG analysis: `nk.ppg_eventrelated()`, `nk.ppg_intervalrelated()`, `nk.ppg_analyze()`
* Add Zhao et al. (2018) method for `nk.ecg_quality()`
* Add tests for `epochs` module
* Add sub-epoch option for ECG and RSP event-related analysis:
	* users can create a smaller sub-epoch within the event-related epoch
	* the rate-related features of ECG and RSP signals are calculated over the sub-epoch
	* the remaining features are calculated over the original epoch, not the sub-epoch

Fixes
+++++++++++++

* Fix propagation of values in `nk.signal_formatpeaks()` for formatting SCR column outputs generated by `eda_peaks()`
* Fix docstrings of `nk.rsp_phase()`, from "RSP_Inspiration" to "RSP_Phase"
* Update `signal_filter()` method for `rsp_clean()`: to use `sos` form, instead of `ba` form of butterworth (similar to `eda_clean()`)





0.1.1
^^^^^^^^^^^^^^^^^^^

New Features
+++++++++++++

* Use duration from `nk.events_find()` as `epochs_end` in `nk.epochs_create()`
* Allow customized subsets of epoch lengths in `nk.bio_analyze()` with `window_lengths` argument
* Add `nk.find_outliers()` to identify outliers (abnormal values)
* Add utility function - `nk.check_type()` to return appropriate boolean values of input (integer, list, ndarray, pandas dataframe or pandas series)
* (experimental) Add error bars in the summary plot method to illustrate standard error of each bin


Fixes
+++++++++++++

* Fix type of value in `nk.signal_formatpeaks()` to ensure slice assignment is done on the same type


0.0.1 (2019-10-29)
^^^^^^^^^^^^^^^^^^^

* First release on PyPI.




            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/neuropsychology/NeuroKit",
    "name": "neurokit2",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "NeuroKit2,physiology,bodily signals,Python,ECG,EDA,EMG,PPG",
    "author": "Dominique Makowski",
    "author_email": "dom.makowski@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/93/d3/3ca695227d11196908392c6a409eebd36578bc8dacb0b9b5758facafe68e/neurokit2-0.2.7.tar.gz",
    "platform": null,
    "description": ".. image:: https://raw.github.com/neuropsychology/NeuroKit/master/docs/img/banner.png\n        :target: https://neuropsychology.github.io/NeuroKit/\n\n.. image:: https://img.shields.io/pypi/pyversions/neurokit2.svg?logo=python&logoColor=FFE873\n        :target: https://pypi.python.org/pypi/neurokit2\n\n.. image:: https://img.shields.io/pypi/dm/neurokit2\n        :target: https://pypi.python.org/pypi/neurokit2\n\n.. image:: https://img.shields.io/pypi/v/neurokit2.svg?logo=pypi&logoColor=FFE873\n        :target: https://pypi.python.org/pypi/neurokit2\n\n.. image:: https://github.com/neuropsychology/NeuroKit/actions/workflows/tests.yml/badge.svg\n        :target: https://github.com/neuropsychology/NeuroKit/actions/workflows/tests.yml\n\n.. image:: https://codecov.io/gh/neuropsychology/NeuroKit/branch/master/graph/badge.svg\n        :target: https://codecov.io/gh/neuropsychology/NeuroKit\n\n.. image:: https://api.codeclimate.com/v1/badges/517cb22bd60238174acf/maintainability\n        :target: https://codeclimate.com/github/neuropsychology/NeuroKit/maintainability\n        :alt: Maintainability\n\n\n**The Python Toolbox for Neurophysiological Signal Processing**\n\n**NeuroKit2** is a user-friendly package providing easy access to advanced biosignal processing routines.\nResearchers and clinicians without extensive knowledge of programming or biomedical signal processing\ncan **analyze physiological data with only two lines of code**.\n\n\nQuick Example\n------------------\n\n.. code-block:: python\n\n    import neurokit2 as nk\n\n    # Download example data\n    data = nk.data(\"bio_eventrelated_100hz\")\n\n    # Preprocess the data (filter, find peaks, etc.)\n    processed_data, info = nk.bio_process(ecg=data[\"ECG\"], rsp=data[\"RSP\"], eda=data[\"EDA\"], sampling_rate=100)\n\n    # Compute relevant features\n    results = nk.bio_analyze(processed_data, sampling_rate=100)\n\nAnd **boom** \ud83d\udca5 your analysis is done \ud83d\ude0e\n\nDownload\n--------\n\nYou can download NeuroKit2 from `PyPI <https://pypi.org/project/neurokit2/>`_\n\n.. code-block::\n\n    pip install neurokit2\n\nor `conda-forge <https://anaconda.org/conda-forge/neurokit2>`_\n\n.. code-block::\n\n    conda install -c conda-forge neurokit2\n\nIf you're not sure what to do, read our `installation guide <https://neuropsychology.github.io/NeuroKit/installation.html>`_.\n\nContributing\n-------------\n\n.. image:: https://img.shields.io/badge/License-MIT-blue.svg\n        :target: https://github.com/neuropsychology/NeuroKit/blob/master/LICENSE\n        :alt: License\n\n.. image:: https://github.com/neuropsychology/neurokit/workflows/%E2%9C%A8%20Style/badge.svg?branch=master\n        :target: https://github.com/neuropsychology/NeuroKit/actions\n        :alt: GitHub CI\n\n.. image:: https://img.shields.io/badge/code%20style-black-000000.svg\n        :target: https://github.com/psf/black\n        :alt: Black code\n\nNeuroKit2 is the most `welcoming <https://github.com/neuropsychology/NeuroKit#popularity>`_ project with a large community of contributors with all levels of programming expertise. **But the package is still far from being perfect!** Thus, if you have some ideas for **improvement**, **new features**, or just want to **learn Python** and do something useful at the same time, do not hesitate and check out the following guide:\n\n- `Contributing to NeuroKit <https://neuropsychology.github.io/NeuroKit/resources/contributing.html>`_\n\nAlso, if you have developed new signal processing methods or algorithms and you want to **increase their usage, popularity, and citations**, get in touch with us to eventually add them to NeuroKit. A great opportunity for the users as well as the original developers!\n\nYou have spotted a **mistake**? An **error** in a formula or code? OR there is just a step that seems strange and you don't understand? **Please let us know!** We are human beings, and we'll appreciate any inquiry.\n\nDocumentation\n----------------\n\n.. image:: https://img.shields.io/badge/documentation-online-brightgreen.svg\n        :target: https://neuropsychology.github.io/NeuroKit/\n        :alt: Documentation Status\n\n.. image:: https://img.shields.io/badge/functions-API-orange.svg?colorB=2196F3\n        :target: https://neuropsychology.github.io/NeuroKit/functions/index.html\n        :alt: API\n\n.. image:: https://img.shields.io/badge/tutorials-examples-orange.svg?colorB=E91E63\n        :target: https://neuropsychology.github.io/NeuroKit/examples/index.html\n        :alt: Tutorials\n\n.. .. image:: https://img.shields.io/badge/documentation-pdf-purple.svg?colorB=FF9800\n..         :target: https://neurokit2.readthedocs.io/_/downloads/en/latest/pdf/\n..         :alt: PDF\n\n.. .. image:: https://mybinder.org/badge_logo.svg\n..         :target: https://mybinder.org/v2/gh/neuropsychology/NeuroKit/dev?urlpath=lab%2Ftree%2Fdocs%2Fexamples\n..         :alt: Binder\n\n.. .. image:: https://img.shields.io/gitter/room/neuropsychology/NeuroKit.js.svg\n..         :target: https://gitter.im/NeuroKit/community\n..         :alt: Chat on Gitter\n\n\nClick on the links above and check out our tutorials:\n\nGeneral\n^^^^^^^^^^\n\n-  `Get familiar with Python in 10 minutes <https://neuropsychology.github.io/NeuroKit/resources/learn_python.html>`_\n-  `Recording good quality signals <https://neuropsychology.github.io/NeuroKit/resources/recording.html>`_\n-  `Install Python and NeuroKit <https://neuropsychology.github.io/NeuroKit/installation.html>`_\n-  `Included datasets <https://neuropsychology.github.io/NeuroKit/functions/data.html#datasets>`_\n-  `Additional Resources <https://neuropsychology.github.io/NeuroKit/resources/resources.html>`_\n\n\nExamples\n^^^^^^^^^^\n\n-  `Simulate Artificial Physiological Signals <https://neuropsychology.github.io/NeuroKit/examples/signal_simulation/signal_simulation.html>`_\n-  `Customize your Processing Pipeline <https://neuropsychology.github.io/NeuroKit/examples/bio_custom/bio_custom.html>`_\n-  `Event-related Analysis <https://neuropsychology.github.io/NeuroKit/examples/bio_eventrelated/bio_eventrelated.html>`_\n-  `Interval-related Analysis <https://neuropsychology.github.io/NeuroKit/examples/bio_intervalrelated/bio_intervalrelated.html>`_\n-  `Analyze Electrodermal Activity (EDA) <https://neuropsychology.github.io/NeuroKit/examples/eda_peaks/eda_peaks.html>`_\n-  `Analyze Respiratory Rate Variability (RRV) <https://neuropsychology.github.io/NeuroKit/examples/rsp_rrv/rsp_rrv.html>`_\n-  `Extract and Visualize Individual Heartbeats <https://neuropsychology.github.io/NeuroKit/examples/ecg_heartbeats/ecg_heartbeats.html>`_\n-  `Locate P, Q, S, and T waves in ECG <https://neuropsychology.github.io/NeuroKit/examples/ecg_delineate/ecg_delineate.html>`_\n-  `Analyze Electrooculography EOG data <https://neuropsychology.github.io/NeuroKit/examples/eog_analyze/eog_analyze.html>`_\n\n.. *You can try out these examples directly* `in your browser <https://github.com/neuropsychology/NeuroKit/tree/master/docs/examples#cloud-based-interactive-examples>`_.\n\n**Don't know which tutorial is suited for your case?** Follow this flowchart:\n\n\n.. image:: https://raw.github.com/neuropsychology/NeuroKit/master/docs/readme/workflow.png\n        :target: https://neuropsychology.github.io/NeuroKit/\n\nCitation\n---------\n\n.. image:: https://zenodo.org/badge/218212111.svg\n   :target: https://zenodo.org/badge/latestdoi/218212111\n\n.. image:: https://img.shields.io/badge/details-authors-purple.svg?colorB=9C27B0\n   :target: https://neuropsychology.github.io/NeuroKit/authors.html\n\n\nThe **NeuroKit2** paper can be found `here <https://doi.org/10.3758/s13428-020-01516-y>`_ \ud83c\udf89 Additionally, you can get the reference directly from Python by running:\n\n.. code-block:: python\n\n    nk.cite()\n\n\n.. code-block:: tex\n\n    You can cite NeuroKit2 as follows:\n\n    - Makowski, D., Pham, T., Lau, Z. J., Brammer, J. C., Lespinasse, F., Pham, H.,\n    Sch\u00f6lzel, C., & Chen, S. A. (2021). NeuroKit2: A Python toolbox for neurophysiological signal processing.\n    Behavior Research Methods, 53(4), 1689\u20131696. https://doi.org/10.3758/s13428-020-01516-y\n\n    Full bibtex reference:\n\n    @article{Makowski2021neurokit,\n        author = {Dominique Makowski and Tam Pham and Zen J. Lau and Jan C. Brammer and Fran{\\c{c}}ois Lespinasse and Hung Pham and Christopher Sch\u00f6lzel and S. H. Annabel Chen},\n        title = {{NeuroKit}2: A Python toolbox for neurophysiological signal processing},\n        journal = {Behavior Research Methods},\n        volume = {53},\n        number = {4},\n        pages = {1689--1696},\n        publisher = {Springer Science and Business Media {LLC}},\n        doi = {10.3758/s13428-020-01516-y},\n        url = {https://doi.org/10.3758%2Fs13428-020-01516-y},\n        year = 2021,\n        month = {feb}\n    }\n\n\n**Let us know if you used NeuroKit2 in a publication!** Open a new `discussion <https://github.com/neuropsychology/NeuroKit/discussions>`_ (select the *NK in publications* category) and link the paper. The community would be happy to know about how you used it and learn about your research. We could also feature it once we have a section on the website for papers that used the software.\n\n..\n    Design\n    --------\n\n    *NeuroKit2* is designed to provide a **consistent**, **accessible** yet **powerful** and **flexible** API.\n\n    - **Consistency**: For each type of signals (ECG, RSP, EDA, EMG...), the same function names are called (in the form :code:`signaltype_functiongoal()`) to achieve equivalent goals, such as :code:`*_clean()`, :code:`*_findpeaks()`, :code:`*_process()`, :code:`*_plot()` (replace the star with the signal type, e.g., :code:`ecg_clean()`).\n    - **Accessibility**: Using NeuroKit2 is made very easy for beginners through the existence of powerful high-level \"master\" functions, such as :code:`*_process()`, that performs cleaning, preprocessing and processing with sensible defaults.\n    - **Flexibility**: However, advanced users can very easily build their own custom analysis pipeline by using the mid-level functions (such as :code:`*_clean()`, :code:`*_rate()`), offering more control and flexibility over their parameters.\n\n\nPhysiological Data Preprocessing\n---------------------------------\n\nSimulate physiological signals\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nYou can easily simulate artificial ECG (also `12-Lead multichannel ECGs <https://neuropsychology.github.io/NeuroKit/examples/ecg_generate_12leads/ecg_generate_12leads.html>`_), PPG, RSP, EDA, and EMG signals to test your scripts and algorithms.\n\n.. code-block:: python\n\n    import numpy as np\n    import pandas as pd\n    import neurokit2 as nk\n\n    # Generate synthetic signals\n    ecg = nk.ecg_simulate(duration=10, heart_rate=70)\n    ppg = nk.ppg_simulate(duration=10, heart_rate=70)\n    rsp = nk.rsp_simulate(duration=10, respiratory_rate=15)\n    eda = nk.eda_simulate(duration=10, scr_number=3)\n    emg = nk.emg_simulate(duration=10, burst_number=2)\n\n    # Visualise biosignals\n    data = pd.DataFrame({\"ECG\": ecg,\n                         \"PPG\": ppg,\n                         \"RSP\": rsp,\n                         \"EDA\": eda,\n                         \"EMG\": emg})\n    nk.signal_plot(data, subplots=True)\n\n\n.. image:: https://raw.github.com/neuropsychology/NeuroKit/master/docs/readme/README_simulation.png\n        :target: https://neuropsychology.github.io/NeuroKit/examples/signal_simulation/signal_simulation.html\n\n\nElectrodermal Activity (EDA/GSR)\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n.. code-block:: python\n\n    # Generate 10 seconds of EDA signal (recorded at 250 samples / second) with 2 SCR peaks\n    eda = nk.eda_simulate(duration=10, sampling_rate=250, scr_number=2, drift=0.01)\n\n    # Process it\n    signals, info = nk.eda_process(eda, sampling_rate=250)\n\n    # Visualise the processing\n    nk.eda_plot(signals, info)\n\n.. image:: https://raw.github.com/neuropsychology/NeuroKit/master/docs/readme/README_eda.png\n        :target: https://neuropsychology.github.io/NeuroKit/examples/eda_peaks/eda_peaks.html\n\n\nCardiac activity (ECG)\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n.. code-block:: python\n\n    # Generate 15 seconds of ECG signal (recorded at 250 samples/second)\n    ecg = nk.ecg_simulate(duration=15, sampling_rate=250, heart_rate=70)\n\n    # Process it\n    signals, info = nk.ecg_process(ecg, sampling_rate=250)\n\n    # Visualise the processing\n    nk.ecg_plot(signals, info)\n\n\n.. image:: https://raw.github.com/neuropsychology/NeuroKit/master/docs/readme/README_ecg.png\n        :target: https://neuropsychology.github.io/NeuroKit/examples/ecg_heartbeats/ecg_heartbeats.html\n\n\nRespiration (RSP)\n^^^^^^^^^^^^^^^^^^^\n\n.. code-block:: python\n\n    # Generate one minute of respiratory (RSP) signal (recorded at 250 samples / second)\n    rsp = nk.rsp_simulate(duration=60, sampling_rate=250, respiratory_rate=15)\n\n    # Process it\n    signals, info = nk.rsp_process(rsp, sampling_rate=250)\n\n    # Visualise the processing\n    nk.rsp_plot(signals, info)\n\n\n.. image:: https://raw.github.com/neuropsychology/NeuroKit/master/docs/readme/README_rsp.png\n        :target: https://neuropsychology.github.io/NeuroKit/examples/rsp_rrv/rsp_rrv.html\n\n\nPhotoplethysmography (PPG/BVP)\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n.. code-block:: python\n\n    # Generate 15 seconds of PPG signal (recorded at 250 samples/second)\n    ppg = nk.ppg_simulate(duration=15, sampling_rate=250, heart_rate=70)\n\n    # Process it\n    signals, info = nk.ppg_process(ppg, sampling_rate=250)\n\n    # Visualize the processing\n    nk.ppg_plot(signals, info)\n\n\n.. image:: https://raw.github.com/neuropsychology/NeuroKit/master/docs/readme/README_ppg.png\n\n\nElectromyography (EMG)\n^^^^^^^^^^^^^^^^^^^^^^^\n\n.. code-block:: python\n\n    # Generate 10 seconds of EMG signal (recorded at 250 samples/second)\n    emg = nk.emg_simulate(duration=10, sampling_rate=250, burst_number=3)\n\n    # Process it\n    signals, info = nk.emg_process(emg, sampling_rate=250)\n\n    # Visualise the processing\n    nk.emg_plot(signals, info)\n\n\n.. image:: https://raw.github.com/neuropsychology/NeuroKit/master/docs/readme/README_emg.png\n\n\n\nElectrooculography (EOG)\n^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n.. code-block:: python\n\n    # Import EOG data\n    eog_signal = nk.data(\"eog_100hz\")\n\n    # Process it\n    signals, info = nk.eog_process(eog_signal, sampling_rate=100)\n\n    # Plot\n    nk.eog_plot(signals, info)\n\n\n.. image:: https://raw.github.com/neuropsychology/NeuroKit/master/docs/readme/README_eog.png\n\n\n\nElectrogastrography (EGG)\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nConsider `helping us develop it <https://neuropsychology.github.io/NeuroKit/resources/contributing.html>`_!\n\n\nPhysiological Data Analysis\n----------------------------\n\nThe analysis of physiological data usually comes in two types, **event-related** or **interval-related**.\n\n\n\n.. image:: https://raw.github.com/neuropsychology/NeuroKit/master/docs/readme/features.png\n\n\nEvent-related\n^^^^^^^^^^^^^^\n\nThis type of analysis refers to physiological changes immediately occurring in response to an event.\nFor instance, physiological changes following the presentation of a stimulus (e.g., an emotional stimulus) are indicated by\nthe dotted lines in the figure above. In this situation, the analysis is epoch-based.\nAn epoch is a short chunk of the physiological signal (usually < 10 seconds), that is locked to a specific stimulus and hence\nthe physiological signals of interest are time-segmented accordingly. This is represented by the orange boxes in the figure above.\nIn this case, using `bio_analyze()` will compute features like rate changes, peak characteristics, and phase characteristics.\n\n- `Event-related example <https://neuropsychology.github.io/NeuroKit/examples/bio_eventrelated/bio_eventrelated.html>`_\n\nInterval-related\n^^^^^^^^^^^^^^^^^\n\nThis type of analysis refers to the physiological characteristics and features that occur over\nlonger periods of time (from a few seconds to days of activity). Typical use cases are either\nperiods of resting state, in which the activity is recorded for several minutes while the participant\nis at rest, or during different conditions in which there is no specific time-locked event\n(e.g., watching movies, listening to music, engaging in physical activity, etc.). For instance,\nthis type of analysis is used when people want to compare the physiological activity under different\nintensities of physical exercise, different types of movies, or different intensities of\nstress. To compare event-related and interval-related analysis, we can refer to the example figure above.\nFor example, a participant might be watching a 20s-long short film where particular stimuli of\ninterest in the movie appear at certain time points (marked by the dotted lines). While\nevent-related analysis pertains to the segments of signals within the orange boxes (to understand the physiological\nchanges pertaining to the appearance of stimuli), interval-related analysis can be\napplied on the entire 20s duration to investigate how physiology fluctuates in general.\nIn this case, using `bio_analyze()` will compute features such as rate characteristics (in particular,\nvariability metrics) and peak characteristics.\n\n- `Interval-related example <https://neuropsychology.github.io/NeuroKit/examples/bio_intervalrelated/bio_intervalrelated.html>`_\n\n\nHeart Rate Variability (HRV)\n----------------------------\n.. image:: https://img.shields.io/badge/Tutorial-HRV-green\n        :target: https://www.mdpi.com/1424-8220/21/12/3998\n\nCheck-out our **Heart Rate Variability in Psychology: A Review of HRV Indices and an Analysis Tutorial** `paper <https://doi.org/10.3390/s21123998>`_ for:\n\n- a comprehensive review of the most up-to-date HRV indices\n- a discussion of their significance in psychological research and practices\n- a step-by-step guide for HRV analysis using **NeuroKit2**\n\n\n.. code-block:: tex\n\n    You can cite the paper as follows:\n\n    - Pham, T., Lau, Z. J., Chen, S. H. A., & Makowski, D. (2021).\n    Heart Rate Variability in Psychology: A Review of HRV Indices and an Analysis Tutorial.\n    Sensors, 21(12), 3998. https://doi:10.3390/s21123998\n\n\n- **Compute HRV indices using Python**\n\n  - **Time domain**: RMSSD, MeanNN, SDNN, SDSD, CVNN, etc.\n  - **Frequency domain**: Spectral power density in various frequency bands (Ultra low/ULF, Very low/VLF, Low/LF, High/HF, Very high/VHF), Ratio of LF to HF power, Normalized LF (LFn) and HF (HFn), Log transformed HF (LnHF).\n  - **Nonlinear domain**: Spread of RR intervals (SD1, SD2, ratio between SD2 to SD1), Cardiac Sympathetic Index (CSI), Cardial Vagal Index (CVI), Modified CSI, Sample Entropy (SampEn).\n\n\n.. code-block:: python\n\n    # Download data\n    data = nk.data(\"bio_resting_8min_100hz\")\n\n    # Find peaks\n    peaks, info = nk.ecg_peaks(data[\"ECG\"], sampling_rate=100)\n\n    # Compute HRV indices\n    nk.hrv(peaks, sampling_rate=100, show=True)\n    >>>    HRV_RMSSD  HRV_MeanNN   HRV_SDNN  ...   HRV_CVI  HRV_CSI_Modified  HRV_SampEn\n    >>> 0  69.697983  696.395349  62.135891  ...  4.829101        592.095372    1.259931\n\n\n\n.. image:: https://raw.github.com/neuropsychology/NeuroKit/master/docs/readme/README_hrv.png\n\nMiscellaneous\n----------------------------\n\nECG Delineation\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n- Delineate the QRS complex of an electrocardiac signal (ECG) including P-peaks, T-peaks, as well as their onsets and offsets.\n\n\n.. code-block:: python\n\n\n    # Download data\n    ecg_signal = nk.data(dataset=\"ecg_3000hz\")\n\n    # Extract R-peaks locations\n    _, rpeaks = nk.ecg_peaks(ecg_signal, sampling_rate=3000)\n\n    # Delineate\n    signal, waves = nk.ecg_delineate(ecg_signal, rpeaks, sampling_rate=3000, method=\"dwt\", show=True, show_type='all')\n\n\n\n.. image:: https://raw.github.com/neuropsychology/NeuroKit/master/docs/readme/README_delineate.png\n       :target: https://neuropsychology.github.io/NeuroKit/examples/ecg_delineate/ecg_delineate.html\n\n\n\nSignal Processing\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n- **Signal processing functionalities**\n\n  - **Filtering**: Using different methods.\n  - **Detrending**: Remove the baseline drift or trend.\n  - **Distorting**: Add noise and artifacts.\n\n.. code-block:: python\n\n    # Generate original signal\n    original = nk.signal_simulate(duration=6, frequency=1)\n\n    # Distort the signal (add noise, linear trend, artifacts, etc.)\n    distorted = nk.signal_distort(original,\n                                  noise_amplitude=0.1,\n                                  noise_frequency=[5, 10, 20],\n                                  powerline_amplitude=0.05,\n                                  artifacts_amplitude=0.3,\n                                  artifacts_number=3,\n                                  linear_drift=0.5)\n\n    # Clean (filter and detrend)\n    cleaned = nk.signal_detrend(distorted)\n    cleaned = nk.signal_filter(cleaned, lowcut=0.5, highcut=1.5)\n\n    # Compare the 3 signals\n    plot = nk.signal_plot([original, distorted, cleaned])\n\n\n.. image:: https://raw.github.com/neuropsychology/NeuroKit/master/docs/readme/README_signalprocessing.png\n\n\nComplexity (Entropy, Fractal Dimensions, ...)\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n- **Optimize complexity parameters** (delay *tau*, dimension *m*, tolerance *r*)\n\n.. code-block:: python\n\n    # Generate signal\n    signal = nk.signal_simulate(frequency=[1, 3], noise=0.01, sampling_rate=200)\n\n    # Find optimal time delay, embedding dimension, and r\n    parameters = nk.complexity_optimize(signal, show=True)\n\n\n\n.. image:: https://raw.github.com/neuropsychology/NeuroKit/master/docs/readme/README_complexity_optimize.png\n        :target: https://neuropsychology.github.io/NeuroKit/functions/complexity.html\n\n\n\n- **Compute complexity features**\n\n  - **Entropy**: Sample Entropy (SampEn), Approximate Entropy (ApEn), Fuzzy Entropy (FuzzEn), Multiscale Entropy (MSE), Shannon Entropy (ShEn)\n  - **Fractal dimensions**: Correlation Dimension D2, ...\n  - **Detrended Fluctuation Analysis**\n\n.. code-block:: python\n\n    nk.entropy_sample(signal)\n    nk.entropy_approximate(signal)\n\n\nSignal Decomposition\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n.. code-block:: python\n\n    # Create complex signal\n    signal = nk.signal_simulate(duration=10, frequency=1)  # High freq\n    signal += 3 * nk.signal_simulate(duration=10, frequency=3)  # Higher freq\n    signal += 3 * np.linspace(0, 2, len(signal))  # Add baseline and linear trend\n    signal += 2 * nk.signal_simulate(duration=10, frequency=0.1, noise=0)  # Non-linear trend\n    signal += np.random.normal(0, 0.02, len(signal))  # Add noise\n\n    # Decompose signal using Empirical Mode Decomposition (EMD)\n    components = nk.signal_decompose(signal, method='emd')\n    nk.signal_plot(components)  # Visualize components\n\n    # Recompose merging correlated components\n    recomposed = nk.signal_recompose(components, threshold=0.99)\n    nk.signal_plot(recomposed)  # Visualize components\n\n.. image:: https://raw.github.com/neuropsychology/NeuroKit/master/docs/readme/README_decomposition.png\n        :target: https://neuropsychology.github.io/NeuroKit/functions/signal.html#signal-decompose\n\nSignal Power Spectrum Density (PSD)\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n.. code-block:: python\n\n    # Generate complex signal\n    signal = nk.signal_simulate(duration=20, frequency=[0.5, 5, 10, 15], amplitude=[2, 1.5, 0.5, 0.3], noise=0.025)\n\n    # Get the PSD using different methods\n    welch = nk.signal_psd(signal, method=\"welch\", min_frequency=1, max_frequency=20, show=True)\n    multitaper = nk.signal_psd(signal, method=\"multitapers\", max_frequency=20, show=True)\n    lomb = nk.signal_psd(signal, method=\"lomb\", min_frequency=1, max_frequency=20, show=True)\n    burg = nk.signal_psd(signal, method=\"burg\", min_frequency=1, max_frequency=20, order=10, show=True)\n\n.. image:: https://raw.github.com/neuropsychology/NeuroKit/master/docs/readme/README_psd.png\n        :target: https://neuropsychology.github.io/NeuroKit/functions/signal.html#signal-psd\n\nStatistics\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n- **Highest Density Interval (HDI)**\n\n.. code-block:: python\n\n    x = np.random.normal(loc=0, scale=1, size=100000)\n\n    ci_min, ci_max = nk.hdi(x, ci=0.95, show=True)\n\n.. image:: https://raw.github.com/neuropsychology/NeuroKit/master/docs/readme/README_hdi.png\n        :target: https://neuropsychology.github.io/NeuroKit/functions/stats.html#hdi\n\n.. used_at_section\n\nPopularity\n---------------------\n\n.. image:: https://img.shields.io/pypi/dd/neurokit2\n        :target: https://pypi.python.org/pypi/neurokit2\n\n.. image:: https://img.shields.io/github/stars/neuropsychology/NeuroKit\n        :target: https://github.com/neuropsychology/NeuroKit/stargazers\n\n.. image:: https://img.shields.io/github/forks/neuropsychology/NeuroKit\n        :target: https://github.com/neuropsychology/NeuroKit/network\n\n\nNeuroKit2 is one of the most welcoming packages for new contributors and users, as well as the fastest-growing package. So stop hesitating and hop on board \ud83e\udd17\n\n.. image:: https://raw.github.com/neuropsychology/NeuroKit/dev/docs/readme/README_popularity.png\n        :target: https://pypi.python.org/pypi/neurokit2\n\n\nUsed at\n-------\n\n|ntu| |univ_paris| |univ_duke| |uni_auckland| |uni_pittsburh| |uni_washington|\n\n.. |ntu| image:: https://upload.wikimedia.org/wikipedia/en/thumb/c/c6/Nanyang_Technological_University.svg/1024px-Nanyang_Technological_University.svg.png\n   :height: 70\n.. |univ_duke| image:: https://www.tutelaprep.com/blog/wp-content/uploads/2019/12/duke.png\n   :height: 70\n.. |univ_paris| image:: https://study-eu.s3.amazonaws.com/uploads/university/universit--de-paris-logo.svg\n   :height: 70\n.. |uni_auckland| image:: https://upload.wikimedia.org/wikipedia/en/thumb/a/ae/University_of_Auckland.svg/1024px-University_of_Auckland.svg.png\n   :height: 70\n.. |uni_pittsburh| image:: https://upload.wikimedia.org/wikipedia/en/thumb/f/fb/University_of_Pittsburgh_seal.svg/1200px-University_of_Pittsburgh_seal.svg.png\n   :height: 70\n.. |uni_washington| image:: https://upload.wikimedia.org/wikipedia/en/thumb/5/58/University_of_Washington_seal.svg/768px-University_of_Washington_seal.svg.png\n   :height: 70\n\n\nDisclaimer\n----------\n*The authors do not provide any warranty. If this software causes your keyboard to blow up, your brain to liquefy, your toilet to clog or a zombie plague to break loose, the authors CANNOT IN ANY WAY be held responsible.*\n\n\n\n\nNews\n-----\n\n0.2.4\n^^^^^^^^^^^^^^^^^^^\nFixes\n+++++++++++++\n\n* `eda_sympathetic()` has been reviewed: low-pass filter and resampling have been added to be in\n  line with the original paper\n* `eda_findpeaks()` using methods proposed in nabian2018 is reviewed and improved. Differentiation\n  has been added before smoothing. Skin conductance response criteria have been revised based on\n  the original paper.\n\n\n\n0.2.1\n^^^^^^^^^^^^^^^^^^^\nNew Features\n+++++++++++++\n\n* Allow for input with NaNs and extrapolation in `signal_interpolate()`\n* Add argument `method` in `find_outliers()`\n* A lot (see https://github.com/neuropsychology/NeuroKit/pull/645)\n\n\n\n\n0.2.0\n^^^^^^^^^^^^^^^^^^^\nNew Features\n+++++++++++++\n\n* Add new time-domain measures in `hrv_time()`: `Prc20NN`, `Prc80NN`, `MinNN`, and `MaxNN`\n\n\n\n\n\n0.1.6\n^^^^^^^^^^^^^^^^^^^\n\nBreaking Changes\n+++++++++++++++++\n\n* Argument `type` changed to `out` in `expspace()`\n\n\nNew Features\n+++++++++++++\n\n* Add new time-domain measures in `hrv_time()`: `Prc20NN`, `Prc80NN`, `MinNN`, and `MaxNN`\n* Allow `fix_peaks()` to account for larger intervals\n\nFixes\n+++++++++++++\n\n\n\n\n\n0.1.5\n^^^^^^^^^^^^^^^^^^^\n\nBreaking Changes\n+++++++++++++++++\n\n* Argument `r` changed to `radius` in `fractal_correlation()`\n* Argument `r` changed to `tolerance` in entropy and complexity utility functions\n* Argument `r_method` changed to `tolerance_method` in `complexity_optimize()`\n* `complexity_lempelziv()`, `fractal_higuchi()`, `fractal_katz()`, `fractal_correlation()`, `fractal_dfa()`, `entropy_multiscale()`, `entropy_shannon()`, `entropy_approximate()`, `entropy_fuzzy()`, `entropy_sample()` now return a tuple consisting of the complexity index, and a dictionary comprising of the different parameters specific to the measure. For `fractal_katz()` and `entropy_shannon()`, the parameters dictionary is empty.\n* Restructure `complexity` submodules with optimization files starting with `optim_*`, such as `optim_complexity_delay()`, `optim_complexity_dimension()`, `optim_complexity_k()`, `optim_complexity_optimize()`, and `optim_complexity_tolerance()`.\n* `mutual_information()` moved from `stats` module to `complexity` module.\n\nNew Features\n+++++++++++++\n\n* Added various complexity indices: `complexity_hjorth()`, `complexity_hurst()`, `complexity_lyapunov()`, `complexity_rqa()`, `complexity_rr()`, `entropy_coalition()`, `entropy_permutation()`, `entropy_range()`, `entropy_spectral()`, `fractal_nld()`, `fractal_psdslope()`, `fractal_sda()`, `fractal_sevcik()`\n* Added `mne_templateMRI()` as a helper to get MNE's template MRI.\n* Added `eeg_source()` as a helper to perform source reconstruction.\n* Added `eeg_source_extract()` to extract the activity from a brain region.\n* Added `parallel_run()` in `misc` as a parallel processing utility function.\n* Added `find_plateau()` in `misc` to find the point of plateau in an array of values.\n* Added `write_csv()` in `data` to facilitate saving dataframes into multiple parts.\n* Added more complexity-related functions, `entropy_cumulative_residual()`, `entropy_differential()`, `entropy_svd()`, `fractal_petrosian()`, and `information_fisher()`.\n* Updates logic to find `kmax` in `fractal_higuchi()`\n* Add RSP_Amplitude_Baseline in event-related analysis\n* Add argument `add_firstsamples` in `mne_channel_extract()` to account for first sample attribute in mne raw objects\n* Allow plotting of `mne.Epochs` in `epochs_plot()`\n* Add `mne_crop()` to crop `mne` Raw objects with additional flexibility to specify first and last elements\n* Plotting function in `eeg_badchannels()` to visualize overlay of individual EEG channels and highlighting of bad ones\n* Add `eog_peaks()` as wrapper for `eog_findpeaks()`\n* Allow `ecg_delineate()` to account for different heart rate\n\n\nFixes\n+++++++++++++\n\n* Ensure detected offset in `emg_activation()` is not beyond signal length\n* Raise ValueError in `_hrv_sanitize_input()` if RRIs are detected instead of peaks\n* Ensure that multifractal DFA indices returned by `fractal_mdfa()` is not Nan when array of slopes contains Nan (due to zero fluctuations)\n* Documentation of respiration from peak/trough terminology to inhale/exhale onsets\n* Change labelling in `rsp_plot()` from \"inhalation peaks\" and \"exhalation troughs\" to \"peaks (exhalation onsets)\" and \"troughs (inhalation onsets)\" respectively.\n* Change RSP_Amplitude_Mean/Min/Max parameters to be corrected based on value closest to t=0 in event-related analysis, rather than using all pre-zero values.\n* Have `rsp_rrv()` compute breath-to-breath intervals based on trough indices (inhalation onsets) rather than peak indices\n* Compute `rsp_rate()` based on trough indices (rather than peak indices) in 'periods' method\n\n\n0.1.4.1\n^^^^^^^^^^^^^^^^^^^\n\nFixes\n+++++++++++++\n* Adjust `kmax` parameter in `fractal_higuchi()` according to signal length as having `kmax` more than half of signal length leads to division by zero error\n* Ensure that sanitization of input in `_hrv_dfa()` is done before windows for `DFA_alpha2` is computed\n* `np.seterr` is added to `fractal_dfa()` to avoid returning division by zero warning which is an expected behaviour\n\n\n0.1.4\n^^^^^^^^^^^^^^^^^^^\n\nBreaking Changes\n+++++++++++++++++\n\n* `fractal_df()` now returns a dictionary of windows, fluctuations and the slope value (see documentation for more information. If `multifractal` is True, the dictionary additionally contains the parameters of the singularity spectrum (see `singularity_spectrum()` for more information)\n\nNew Features\n+++++++++++++\n\n* Add convenience function `intervals_to_peaks()` useful for RRI or BBI conversion to peak indices\n* `hrv_nonlinear()` and `rrv_rsp()` now return the parameters of singularity spectrum for multifractal DFA analysis\n* Add new complexity measures in `fractal_higuchi()`, `fractal_katz()` and `fractal_lempelziv()`\n* Add new time-domain measures in `hrv_time()`: `SDANN` and `SDNNI`\n* Add new non-linear measures in `hrv_nonlinear()`: `ShanEn`, `FuzzyEn`, `HFD`, `KFD` and `LZC`\n\nFixes\n+++++++++++++\n\n* Add path argument in `mne_data()` and throw warning to download mne datasets if data folder is not present\n* The implementation of `TTIN` in `hrv_time()` is amended to its correct formulation.\n* The default binsize used for RRI histogram in the computation of geometric HRV indices is set to 1 / 128 seconds\n\n\n0.1.3\n^^^^^^^^^^^^^^^^^^^\n\nBreaking Changes\n+++++++++++++++++\n\n* None\n\nNew Features\n+++++++++++++\n\n* Add internal function for detecting missing data points and forward filling missing values in `nk.*_clean()` functions\n* Add computation of standard deviation in `eventrelated()` functions for *ECG_Rate_SD*, *EMG_Amplitude_SD*, *EOG_Rate_SD*, *PPG_Rate_SD*, *RSP_Rate_SD*, *RSP_Amplitude_SD*\n* Add labelling for interval related features if a dictionary of dataframes is passed\n* Retrun Q peaks and S Peaks information for wavelet-based methods in `nk.ecg_delineate()`\n\nFixes\n+++++++++++++\n\n* Fix epochs columns with `dtype: object` generated by `nk.epochs_create()`\n* Bug fix ecg_findpeaks_rodrigues for array out of bounds bug\n\n\n0.1.2\n^^^^^^^^^^^^^^^^^^^\n\nNew Features\n+++++++++++++\n\n* Additional features for `nk.rsp_intervalrelated()`: average inspiratory and expiratory durations, inspiratory-to-expiratory (I/E) time ratio\n* Add multiscale entropy measures (MSE, CMSE, RCMSE) and fractal methods (Detrended Fluctuation Analysis, Correlation Dimension) into `nk.hrv_nonlinear()`\n* Allow for data resampling in `nk.read_bitalino()`\n* Add `bio_resting_8min_200hz` into database for reading with `nk.data()`\n* Reading of url links in `nk.data()`\n* Allow for `nk.hrv()` to compute RSA indices if respiratory data is present\n* All `hrv` functions to automatically detect correct sampling rate if tuple or dict is passed as input\n* Add support for PPG analysis: `nk.ppg_eventrelated()`, `nk.ppg_intervalrelated()`, `nk.ppg_analyze()`\n* Add Zhao et al. (2018) method for `nk.ecg_quality()`\n* Add tests for `epochs` module\n* Add sub-epoch option for ECG and RSP event-related analysis:\n\t* users can create a smaller sub-epoch within the event-related epoch\n\t* the rate-related features of ECG and RSP signals are calculated over the sub-epoch\n\t* the remaining features are calculated over the original epoch, not the sub-epoch\n\nFixes\n+++++++++++++\n\n* Fix propagation of values in `nk.signal_formatpeaks()` for formatting SCR column outputs generated by `eda_peaks()`\n* Fix docstrings of `nk.rsp_phase()`, from \"RSP_Inspiration\" to \"RSP_Phase\"\n* Update `signal_filter()` method for `rsp_clean()`: to use `sos` form, instead of `ba` form of butterworth (similar to `eda_clean()`)\n\n\n\n\n\n0.1.1\n^^^^^^^^^^^^^^^^^^^\n\nNew Features\n+++++++++++++\n\n* Use duration from `nk.events_find()` as `epochs_end` in `nk.epochs_create()`\n* Allow customized subsets of epoch lengths in `nk.bio_analyze()` with `window_lengths` argument\n* Add `nk.find_outliers()` to identify outliers (abnormal values)\n* Add utility function - `nk.check_type()` to return appropriate boolean values of input (integer, list, ndarray, pandas dataframe or pandas series)\n* (experimental) Add error bars in the summary plot method to illustrate standard error of each bin\n\n\nFixes\n+++++++++++++\n\n* Fix type of value in `nk.signal_formatpeaks()` to ensure slice assignment is done on the same type\n\n\n0.0.1 (2019-10-29)\n^^^^^^^^^^^^^^^^^^^\n\n* First release on PyPI.\n\n\n\n",
    "bugtrack_url": null,
    "license": "MIT license",
    "summary": "The Python Toolbox for Neurophysiological Signal Processing.",
    "version": "0.2.7",
    "project_urls": {
        "Homepage": "https://github.com/neuropsychology/NeuroKit"
    },
    "split_keywords": [
        "neurokit2",
        "physiology",
        "bodily signals",
        "python",
        "ecg",
        "eda",
        "emg",
        "ppg"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b422e7e3b341b80a1e56f270a0137d4a3e6b20a58ae56c77785c0f6d3c6ba653",
                "md5": "f30dd4f74ef639c79e56efe29dfecfc2",
                "sha256": "960412136d42ec02eca21b20de2f4ba2bce1d9eeabb34153b2e962682ff2ca42"
            },
            "downloads": -1,
            "filename": "neurokit2-0.2.7-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f30dd4f74ef639c79e56efe29dfecfc2",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": null,
            "size": 1284915,
            "upload_time": "2023-11-06T11:38:29",
            "upload_time_iso_8601": "2023-11-06T11:38:29.432738Z",
            "url": "https://files.pythonhosted.org/packages/b4/22/e7e3b341b80a1e56f270a0137d4a3e6b20a58ae56c77785c0f6d3c6ba653/neurokit2-0.2.7-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "93d33ca695227d11196908392c6a409eebd36578bc8dacb0b9b5758facafe68e",
                "md5": "343aa99f3e8b3b4bb786911382b22d52",
                "sha256": "f7c1fad4536a5491d136681fc44ea814cfc563409198002dd2389ea409b3ab67"
            },
            "downloads": -1,
            "filename": "neurokit2-0.2.7.tar.gz",
            "has_sig": false,
            "md5_digest": "343aa99f3e8b3b4bb786911382b22d52",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 21411625,
            "upload_time": "2023-11-06T11:38:32",
            "upload_time_iso_8601": "2023-11-06T11:38:32.364319Z",
            "url": "https://files.pythonhosted.org/packages/93/d3/3ca695227d11196908392c6a409eebd36578bc8dacb0b9b5758facafe68e/neurokit2-0.2.7.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-11-06 11:38:32",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "neuropsychology",
    "github_project": "NeuroKit",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "tox": true,
    "lcname": "neurokit2"
}
        
Elapsed time: 0.14586s