Skip to content

Commit a8a5804

Browse files
author
Nicolas Legrand
committed
Sphinx html
1 parent 3a9b9a8 commit a8a5804

10 files changed

+146
-36
lines changed
1.05 KB
Binary file not shown.
356 Bytes
Binary file not shown.

source/auto_examples/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ If you want to see the tutorials in action, you can also click on the link below
6262

6363
.. raw:: html
6464

65-
<div class="sphx-glr-thumbcontainer" tooltip="This example shows how to detect extra ectobeats, missed and ectobeats from RR time series usin...">
65+
<div class="sphx-glr-thumbcontainer" tooltip="Here, we describe two method for artefacts and outliers correction, after detection using the m...">
6666

6767
.. only:: html
6868

source/auto_examples/plot_ArtefactsCorrection.ipynb

Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"cell_type": "markdown",
1616
"metadata": {},
1717
"source": [
18-
"\nOutliers and ectobeats correction\n=================================\n\nThis example shows how to detect extra ectobeats, missed and ectobeats from RR\ntime series using the method proposed by Lipponen & Tarvainen (2019) [#]_.\n"
18+
"\nOutliers and ectobeats correction\n=================================\n\nHere, we describe two method for artefacts and outliers correction, after\ndetection using the method proposed by Lipponen & Tarvainen (2019) [#]_.\n"
1919
]
2020
},
2121
{
@@ -26,7 +26,54 @@
2626
},
2727
"outputs": [],
2828
"source": [
29-
"# Author: Nicolas Legrand <nicolas.legrand@cfin.au.dk>\n# Licence: GPL v3\n\n# Two approaches for artefacts correction are proposed:\n# * `correct_peaks()` will find and correct artefacts in a boolean peaks\n# vector, thus ensuring the length of recording remain constant and corrected\n# peaks fit the signal sampling rate. This method is more adapted to\n# event-related cardiac activity designs.\n\n# * `correct_rr()` will find and correct artefacts in the RR time series. The\n# signal length will possibly change after the interpolation of long, short or\n# ectopic beats. This method is more relevant for HRV analyse of long recording\n# where the timing of experimental events is not important.\n#\n# import numpy as np\n# import matplotlib.pyplot as plt\n#\n# rr = rr_artifacts()\n#\n# # Method 1\n# ##########"
29+
"# Author: Nicolas Legrand <nicolas.legrand@cfin.au.dk>\n# Licence: GPL v3\n\n# Two approaches for artefacts correction are proposed:\n# * `correct_peaks()` will find and correct artefacts in a boolean peaks\n# vector, thus ensuring the length of recording remain constant and corrected\n# peaks fit the signal sampling rate. This method is more adapted to\n# event-related cardiac activity designs.\n\n# * `correct_rr()` will find and correct artefacts in the RR time series. The\n# signal length will possibly change after the interpolation of long, short or\n# ectopic beats. This method is more relevant for HRV analyse of long recording\n# where the timing of experimental events is not important."
30+
]
31+
},
32+
{
33+
"cell_type": "code",
34+
"execution_count": null,
35+
"metadata": {
36+
"collapsed": false
37+
},
38+
"outputs": [],
39+
"source": [
40+
"import numpy as np\nimport matplotlib.pyplot as plt\nfrom systole import simulate_rr\nfrom systole.plotting import plot_subspaces\nfrom systole.correction import correct_peaks, correct_rr"
41+
]
42+
},
43+
{
44+
"cell_type": "markdown",
45+
"metadata": {},
46+
"source": [
47+
"#############################\n\n"
48+
]
49+
},
50+
{
51+
"cell_type": "code",
52+
"execution_count": null,
53+
"metadata": {
54+
"collapsed": false
55+
},
56+
"outputs": [],
57+
"source": [
58+
"peaks = simulate_rr(as_peaks=True)\npeaks_correction = correct_peaks(peaks)\npeaks_correction"
59+
]
60+
},
61+
{
62+
"cell_type": "markdown",
63+
"metadata": {},
64+
"source": [
65+
"#############################\n\n"
66+
]
67+
},
68+
{
69+
"cell_type": "code",
70+
"execution_count": null,
71+
"metadata": {
72+
"collapsed": false
73+
},
74+
"outputs": [],
75+
"source": [
76+
"rr = simulate_rr()\nrr_correction = correct_rr(rr)"
3077
]
3178
},
3279
{

source/auto_examples/plot_ArtefactsCorrection.py

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
Outliers and ectobeats correction
33
=================================
44
5-
This example shows how to detect extra ectobeats, missed and ectobeats from RR
6-
time series using the method proposed by Lipponen & Tarvainen (2019) [#]_.
5+
Here, we describe two method for artefacts and outliers correction, after
6+
detection using the method proposed by Lipponen & Tarvainen (2019) [#]_.
77
"""
88

99
# Author: Nicolas Legrand <nicolas.legrand@cfin.au.dk>
@@ -19,14 +19,26 @@
1919
# signal length will possibly change after the interpolation of long, short or
2020
# ectopic beats. This method is more relevant for HRV analyse of long recording
2121
# where the timing of experimental events is not important.
22-
#
23-
# import numpy as np
24-
# import matplotlib.pyplot as plt
25-
#
26-
# rr = rr_artifacts()
27-
#
28-
# # Method 1
29-
# ##########
22+
23+
#%%
24+
import numpy as np
25+
import matplotlib.pyplot as plt
26+
from systole import simulate_rr
27+
from systole.plotting import plot_subspaces
28+
from systole.correction import correct_peaks, correct_rr
29+
30+
31+
#%% Method 1 - Peaks correction
32+
# #############################
33+
34+
peaks = simulate_rr(as_peaks=True)
35+
peaks_correction = correct_peaks(peaks)
36+
peaks_correction
37+
38+
#%% Method 2 - RR correction
39+
# #############################
40+
rr = simulate_rr()
41+
rr_correction = correct_rr(rr)
3042

3143
#%%
3244
# References
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
55d2665a614d8fb37111586d079ea212
1+
b249ea1af60fe433eb0565a2693898a6

source/auto_examples/plot_ArtefactsCorrection.rst

Lines changed: 69 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
1-
.. note::
2-
:class: sphx-glr-download-link-note
1+
.. only:: html
2+
3+
.. note::
4+
:class: sphx-glr-download-link-note
35

4-
Click :ref:`here <sphx_glr_download_auto_examples_plot_ArtefactsCorrection.py>` to download the full example code
5-
.. rst-class:: sphx-glr-example-title
6+
Click :ref:`here <sphx_glr_download_auto_examples_plot_ArtefactsCorrection.py>` to download the full example code
7+
.. rst-class:: sphx-glr-example-title
68

7-
.. _sphx_glr_auto_examples_plot_ArtefactsCorrection.py:
9+
.. _sphx_glr_auto_examples_plot_ArtefactsCorrection.py:
810

911

1012
Outliers and ectobeats correction
1113
=================================
1214

13-
This example shows how to detect extra ectobeats, missed and ectobeats from RR
14-
time series using the method proposed by Lipponen & Tarvainen (2019) [#]_.
15+
Here, we describe two method for artefacts and outliers correction, after
16+
detection using the method proposed by Lipponen & Tarvainen (2019) [#]_.
1517

1618

1719
.. code-block:: default
@@ -30,14 +32,63 @@ time series using the method proposed by Lipponen & Tarvainen (2019) [#]_.
3032
# signal length will possibly change after the interpolation of long, short or
3133
# ectopic beats. This method is more relevant for HRV analyse of long recording
3234
# where the timing of experimental events is not important.
33-
#
34-
# import numpy as np
35-
# import matplotlib.pyplot as plt
36-
#
37-
# rr = rr_artifacts()
38-
#
39-
# # Method 1
40-
# ##########
35+
36+
37+
38+
39+
40+
41+
42+
43+
44+
.. code-block:: default
45+
46+
import numpy as np
47+
import matplotlib.pyplot as plt
48+
from systole import simulate_rr
49+
from systole.plotting import plot_subspaces
50+
from systole.correction import correct_peaks, correct_rr
51+
52+
53+
54+
55+
56+
57+
58+
59+
60+
#############################
61+
62+
63+
.. code-block:: default
64+
65+
66+
peaks = simulate_rr(as_peaks=True)
67+
peaks_correction = correct_peaks(peaks)
68+
peaks_correction
69+
70+
71+
72+
73+
74+
.. rst-class:: sphx-glr-script-out
75+
76+
Out:
77+
78+
.. code-block:: none
79+
80+
81+
{'clean_peaks': array([ True, False, False, ..., False, False, False]), 'ectopic': 0, 'short': 0, 'long': 0, 'extra': 1, 'missed': 1}
82+
83+
84+
85+
#############################
86+
87+
88+
.. code-block:: default
89+
90+
rr = simulate_rr()
91+
rr_correction = correct_rr(rr)
4192
4293
4394
@@ -56,7 +107,7 @@ References
56107
57108
.. rst-class:: sphx-glr-timing
58109

59-
**Total running time of the script:** ( 0 minutes 0.002 seconds)
110+
**Total running time of the script:** ( 0 minutes 0.493 seconds)
60111

61112

62113
.. _sphx_glr_download_auto_examples_plot_ArtefactsCorrection.py:
@@ -69,13 +120,13 @@ References
69120
70121
71122
72-
.. container:: sphx-glr-download
123+
.. container:: sphx-glr-download sphx-glr-download-python
73124
74125
:download:`Download Python source code: plot_ArtefactsCorrection.py <plot_ArtefactsCorrection.py>`
75126
76127
77128
78-
.. container:: sphx-glr-download
129+
.. container:: sphx-glr-download sphx-glr-download-jupyter
79130
80131
:download:`Download Jupyter notebook: plot_ArtefactsCorrection.ipynb <plot_ArtefactsCorrection.ipynb>`
81132
Binary file not shown.

source/auto_examples/sg_execution_times.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55

66
Computation times
77
=================
8-
**00:36.528** total execution time for **auto_examples** files:
8+
**00:00.493** total execution time for **auto_examples** files:
99

1010
+---------------------------------------------------------------------------------------------------------+-----------+--------+
11-
| :ref:`sphx_glr_auto_examples_plot_HeartBeatEvokedArpeggios.py` (``plot_HeartBeatEvokedArpeggios.py``) | 00:36.528 | 0.0 MB |
12-
+---------------------------------------------------------------------------------------------------------+-----------+--------+
13-
| :ref:`sphx_glr_auto_examples_plot_ArtefactsCorrection.py` (``plot_ArtefactsCorrection.py``) | 00:00.000 | 0.0 MB |
11+
| :ref:`sphx_glr_auto_examples_plot_ArtefactsCorrection.py` (``plot_ArtefactsCorrection.py``) | 00:00.493 | 0.0 MB |
1412
+---------------------------------------------------------------------------------------------------------+-----------+--------+
1513
| :ref:`sphx_glr_auto_examples_plot_ArtefactsDetection.py` (``plot_ArtefactsDetection.py``) | 00:00.000 | 0.0 MB |
1614
+---------------------------------------------------------------------------------------------------------+-----------+--------+
15+
| :ref:`sphx_glr_auto_examples_plot_HeartBeatEvokedArpeggios.py` (``plot_HeartBeatEvokedArpeggios.py``) | 00:00.000 | 0.0 MB |
16+
+---------------------------------------------------------------------------------------------------------+-----------+--------+
1717
| :ref:`sphx_glr_auto_examples_plot_InstantaneousHeartRate.py` (``plot_InstantaneousHeartRate.py``) | 00:00.000 | 0.0 MB |
1818
+---------------------------------------------------------------------------------------------------------+-----------+--------+
1919
| :ref:`sphx_glr_auto_examples_plot_InteractiveVisualizations.py` (``plot_InteractiveVisualizations.py``) | 00:00.000 | 0.0 MB |
Binary file not shown.

0 commit comments

Comments
 (0)