Skip to content

Commit 8444785

Browse files
author
Nicolas Legrand
committed
Fix test recording for Travis (Python 3.7)
1 parent f768b64 commit 8444785

File tree

3 files changed

+14
-16
lines changed

3 files changed

+14
-16
lines changed

systole/detection.py

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,10 @@ def oxi_peaks(x, sfreq=75, win=1, new_sfreq=1000, clipping=True,
5252
5353
References
5454
----------
55-
Some of the processing steps were adapted from the HeartPy toolbox [1]:
55+
Some of the processing steps were adapted from the HeartPy toolbox:
5656
https://python-heart-rate-analysis-toolkit.readthedocs.io/en/latest/index.html
5757
58-
..[1] van Gent, P., Farah, H., van Nes, N. and van Arem, B., 2019.
58+
.. [1] van Gent, P., Farah, H., van Nes, N. and van Arem, B., 2019.
5959
Analysing Noisy Driver Physiology Real-Time Using Off-the-Shelf Sensors:
6060
Heart Rate Analysis Software from the Taking the Fast Lane Project. Journal
6161
of Open Research Software, 7(1), p.32. DOI: http://doi.org/10.5334/jors.241
@@ -111,6 +111,8 @@ def ecg_peaks(x, sfreq=1000, new_sfreq=1000, method='pan-tompkins',
111111
find_local=True, win_size=100):
112112
"""A simple wrapper for many popular R peaks detectors algorithms.
113113
114+
This function calls methods from the py-ecg-detectors [#]_ module.
115+
114116
Parameters
115117
----------
116118
x : list or 1d array-like
@@ -152,10 +154,7 @@ def ecg_peaks(x, sfreq=1000, new_sfreq=1000, method='pan-tompkins',
152154
153155
References
154156
----------
155-
Some of the processing steps were adapted from the HeartPy toolbox [1]:
156-
https://python-heart-rate-analysis-toolkit.readthedocs.io/en/latest/index.html
157-
158-
..[1] Howell, L., Porr, B. Popular ECG R peak detectors written in
157+
.. [#] Howell, L., Porr, B. Popular ECG R peak detectors written in
159158
python. DOI: 10.5281/zenodo.3353396
160159
"""
161160
if isinstance(x, list):
@@ -247,8 +246,8 @@ def rr_artefacts(rr, c1=0.13, c2=0.17, alpha=5.2):
247246
248247
Notes
249248
-----
250-
This function will use the method proposed by Lipponen & Tarvainen (2019)
251-
to detect ectopic beats, long, shorts, missed and extra RR intervals.
249+
This function will use the method proposed by [#]_ to detect ectopic beats,
250+
long, shorts, missed and extra RR intervals.
252251
253252
Examples
254253
--------
@@ -260,7 +259,7 @@ def rr_artefacts(rr, c1=0.13, c2=0.17, alpha=5.2):
260259
261260
References
262261
----------
263-
.. [1] Lipponen, J. A., & Tarvainen, M. P. (2019). A robust algorithm for
262+
.. [#] Lipponen, J. A., & Tarvainen, M. P. (2019). A robust algorithm for
264263
heart rate variability time series artefact correction using novel
265264
beat classification. Journal of Medical Engineering & Technology,
266265
43(3), 173–181. https://doi.org/10.1080/03091902.2019.1640306
@@ -369,7 +368,10 @@ def rr_artefacts(rr, c1=0.13, c2=0.17, alpha=5.2):
369368

370369

371370
def interpolate_clipping(signal, threshold=255):
372-
"""Interoplate clipping segment.
371+
"""Interoplate clipping artefacts.
372+
373+
This function removes all data points equalling the provided threshold
374+
and re-creates the missing segments using cubic spline interpolation.
373375
374376
Parameters
375377
----------
@@ -405,7 +407,7 @@ def interpolate_clipping(signal, threshold=255):
405407
406408
.. Warning:: If clipping artefact is found at the edge of the signal, this
407409
function will decrement the first/last value to allow interpolation,
408-
which can lead to incorrect estimation.
410+
which can result in incorrect estimation.
409411
410412
References
411413
----------

systole/recording.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,7 @@ def read(self, duration):
568568
self.lastBlock = -1
569569

570570
print("Reading TCP/IP connection (" +
571-
str(channelCount) + "channels found). "
571+
str(channelCount) + " channels found). "
572572
+ str(resolutions) + " Hz. "
573573
+ str(samplingInterval) + " samples. "
574574
+ str(channelNames))

systole/tests/test_recording.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ def simulateEXG():
7373
conn.send(data2)
7474
conn.send(data3)
7575
conn.send(data4)
76-
server.close()
7776

7877
# Start fake server in background thread
7978
server_thread = threading.Thread(target=simulateEXG)
@@ -87,9 +86,6 @@ def simulateEXG():
8786
'EGG1', 'EGG2', 'EGG3', 'EGG4', 'EGG5', 'EGG6', 'RESP', 'PLETH']
8887
assert all([data[k].shape[0] == 20 for k in list(data.keys())])
8988

90-
# Ensure server ends
91-
server_thread.join()
92-
9389

9490
if __name__ == '__main__':
9591
unittest.main(argv=['first-arg-is-ignored'], exit=False)

0 commit comments

Comments
 (0)