From a8ef2404764bc39d525e16a1f375441750d61dd9 Mon Sep 17 00:00:00 2001 From: Russell Anderson <5637107+rpanderson@users.noreply.github.com> Date: Sun, 28 Jun 2020 23:59:06 +1000 Subject: [PATCH 1/2] Example use of mdinclude directive for benchmarks/ecg_preprocessing Use m2r for the mdinclude directive and recommonmark for everything else, per https://github.com/readthedocs/recommonmark/issues/191#issuecomment-622369992. To make this work, I had to additionally: * Use HTML for any hyperlinks in bold/italics; * Relative link figures from docs directory, i.e. prepend ../../benchmarks/ecg_preprocessing to image paths; and * Remove line blank lines from references div. --- benchmarks/ecg_preprocessing/README.md | 64 +++++++++++--------------- docs/benchmarks/ecg_preprocessing.rst | 2 +- docs/conf.py | 13 ++++-- docs/environment.yml | 1 + 4 files changed, 39 insertions(+), 41 deletions(-) diff --git a/benchmarks/ecg_preprocessing/README.md b/benchmarks/ecg_preprocessing/README.md index 4a1c164587..2f50928956 100644 --- a/benchmarks/ecg_preprocessing/README.md +++ b/benchmarks/ecg_preprocessing/README.md @@ -1,7 +1,7 @@ # Benchmarking of ECG Preprocessing Methods -*This study can be referenced by* [*citing the package*](https://github.com/neuropsychology/NeuroKit#citation). +This study can be referenced by citing the package. **We'd like to publish this study, but unfortunately we currently don't have the time. If you want to help to make it happen, please contact us!** @@ -22,9 +22,9 @@ running on a treadmill, using a hand bike). The sampling rate is 250Hz for all the conditions. The script to download and format the database using the -[**ECG-GUDB**](https://github.com/berndporr/ECG-GUDB) Python package by +ECG-GUDB Python package by Bernd Porr can be found -[**here**](https://github.com/neuropsychology/NeuroKit/blob/dev/data/gudb/download_gudb.py). +here. ### MIT-BIH Arrhythmia Database @@ -35,7 +35,7 @@ including common but clinically significant arrhythmias (denoted as the `MIT-Arrhythmia-x` database). The script to download and format the database using the can be found -[**here**](https://github.com/neuropsychology/NeuroKit/blob/dev/data/mit_arrhythmia/download_mit_arrhythmia.py). +here. @@ -48,7 +48,7 @@ Due to memory limits, we only kept the second hour of recording of each participant. The script to download and format the database using the can be found -[**here**](https://github.com/neuropsychology/NeuroKit/blob/dev/data/mit_normal/download_mit_normal.py). +here. @@ -177,7 +177,7 @@ data %>% scale_fill_manual(values=colors) ``` -![](figures/unnamed-chunk-6-1.png) +![](../../benchmarks/ecg_preprocessing/figures/unnamed-chunk-6-1.png) **Conclusion:** It seems that `gamboa2008` and `martinez2003` are particularly prone to errors, especially in the case of a noisy ECG @@ -212,7 +212,7 @@ data %>% ylab("Duration (seconds per data sample)") ``` -![](figures/unnamed-chunk-8-1.png) +![](../../benchmarks/ecg_preprocessing/figures/unnamed-chunk-8-1.png) @@ -269,7 +269,7 @@ means %>% ylab("Duration (seconds per data sample)") ``` -![](figures/unnamed-chunk-9-1.png) +![](../../benchmarks/ecg_preprocessing/figures/unnamed-chunk-9-1.png) **Conclusion:** It seems that `gamboa2008` and `neurokit` are the fastest methods, followed by `martinez2003`, `kalidas2017`, @@ -302,7 +302,7 @@ data %>% ylab("Amount of Error") ``` -![](figures/unnamed-chunk-10-1.png) +![](../../benchmarks/ecg_preprocessing/figures/unnamed-chunk-10-1.png) ##### Statistical Modelling @@ -335,7 +335,7 @@ means %>% ylab("Amount of Error") ``` -![](figures/unnamed-chunk-11-1.png) +![](../../benchmarks/ecg_preprocessing/figures/unnamed-chunk-11-1.png) **Conclusion:** It seems that `neurokit`, `kalidas2017` and `christov2004` the most accurate algorithms to detect R-peaks. This @@ -430,7 +430,7 @@ data %>% ylab("Amount of Error") ``` -![](figures/unnamed-chunk-15-1.png) +![](../../benchmarks/ecg_preprocessing/figures/unnamed-chunk-15-1.png) ##### Statistical Modelling @@ -461,7 +461,7 @@ means %>% ylab("Amount of Error") ``` -![](figures/unnamed-chunk-16-1.png) +![](../../benchmarks/ecg_preprocessing/figures/unnamed-chunk-16-1.png) ### Conclusion @@ -471,28 +471,18 @@ method. # References
- -
- -Howell, L., & Porr, B. (2018). *High precision ecg database with -annotated r peaks, recorded and filmed under realistic conditions*. - -
- -
- -Moody, G. B., & Mark, R. G. (2001). The impact of the mit-bih arrhythmia -database. *IEEE Engineering in Medicine and Biology Magazine*, *20*(3), -45–50. - -
- -
- -Porr, B., & Howell, L. (2019). R-peak detector stress test with a new -noisy ecg database reveals significant performance differences amongst -popular detectors. *bioRxiv*, 722397. - -
- -
+
+ Howell, L., & Porr, B. (2018). High precision ecg database with + annotated r peaks, recorded and filmed under realistic conditions. +
+
+ Moody, G. B., & Mark, R. G. (2001). The impact of the mit-bih arrhythmia + database. IEEE Engineering in Medicine and Biology Magazine, 20(3), + 45–50. +
+
+ Porr, B., & Howell, L. (2019). R-peak detector stress test with a new + noisy ecg database reveals significant performance differences amongst + popular detectors. bioRxiv, 722397. +
+ \ No newline at end of file diff --git a/docs/benchmarks/ecg_preprocessing.rst b/docs/benchmarks/ecg_preprocessing.rst index 3b5aed1644..a900d9559f 100644 --- a/docs/benchmarks/ecg_preprocessing.rst +++ b/docs/benchmarks/ecg_preprocessing.rst @@ -1 +1 @@ -.. include:: ../../benchmarks/ecg_preprocessing/README.md +.. mdinclude:: ../../benchmarks/ecg_preprocessing/README.md diff --git a/docs/conf.py b/docs/conf.py index a8ab088cfc..1c363f50c6 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -22,12 +22,10 @@ import re import sys import mock -import recommonmark - +from m2r import MdInclude from recommonmark.transform import AutoStructify - sys.path.insert(0, os.path.abspath('../')) @@ -269,8 +267,17 @@ def find_version(): # -- Setup for recommonmark --------------------------------------------- def setup(app): + # Use m2r only for mdinclude and recommonmark for everything else + # https://github.com/readthedocs/recommonmark/issues/191#issuecomment-622369992 app.add_config_value('recommonmark_config', { # 'url_resolver': lambda url: github_doc_root + url, 'auto_toc_tree_section': 'Contents', }, True) app.add_transform(AutoStructify) + + # from m2r to make `mdinclude` work + app.add_config_value('no_underscore_emphasis', False, 'env') + app.add_config_value('m2r_parse_relative_links', False, 'env') + app.add_config_value('m2r_anonymous_references', False, 'env') + app.add_config_value('m2r_disable_inline_math', False, 'env') + app.add_directive('mdinclude', MdInclude) diff --git a/docs/environment.yml b/docs/environment.yml index 358e430741..fcc14f516d 100644 --- a/docs/environment.yml +++ b/docs/environment.yml @@ -15,3 +15,4 @@ dependencies: - sphinx-gallery - sphinx-copybutton - recommonmark + - m2r From a90f157b2704f23051324a24080098ed9e54be5a Mon Sep 17 00:00:00 2001 From: Russell Anderson <5637107+rpanderson@users.noreply.github.com> Date: Mon, 29 Jun 2020 00:33:01 +1000 Subject: [PATCH 2/2] Added rpanderson to AUTHORS.rst --- AUTHORS.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS.rst b/AUTHORS.rst index d8f11db099..65f1809bf1 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -25,6 +25,7 @@ Contributors * `Tiago Rodrigues `_ *(IST, Lisbon)* * `Mitchell Bishop `_ *(NINDS, USA)* * `Robert Richer `_ *(FAU Erlangen-Nürnberg, Germany)* +* `Russell Anderson `_ *(La Trobe Institute for Molecular Science, Australia)* Thanks also to `Gansheng Tan `_, `Chuan-Peng Hu `_, `@ucohen `_, `Anthony Gatti `_, `Julien Lamour `_, `@renatosc `_, `Nicolas Beaudoin-Gagnon `_ and `@rubinovitz `_ for their contribution in `NeuroKit 1 `_.