Skip to content

Commit 366f894

Browse files
committed
Merge branch 'master' of github.com:MIT-LCP/wfdb-python
2 parents 0a2e0b8 + c8b6856 commit 366f894

File tree

2 files changed

+3
-38
lines changed

2 files changed

+3
-38
lines changed

README.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ file with 'rdann'.
106106

107107
The attributes of the Annotation object give information about the annotation as specified
108108
by https://www.physionet.org/physiotools/wag/annot-5.htm:
109+
109110
- ``annsamp``: The annotation location in samples relative to the beginning of the record.
110111
- ``anntype``: The annotation type according the the standard WFDB codes.
111112
- ``subtype``: The marked class/category of the annotation.
@@ -628,10 +629,10 @@ Example Usage:
628629
max_bpm = 350
629630
min_gap = fs*60/min_bpm
630631
max_gap = fs*60/max_bpm
631-
new_indexes = wfdb.processing.correct_peaks(x=sig[:,0], peak_indexes=peak_indexes, min_gap=min_gap, max_gap=max_gap, smooth_window=150)
632+
new_indexes = wfdb.processing.correct_peaks(x=sig[:,0], peaks_indexes=peak_indexes, min_gap=min_gap, max_gap=max_gap, smooth_window=150)
632633

633634
Input arguments:
634-
peaks_indexes, min_gap, max_gap, smooth_window
635+
635636
- ``x`` (required): The signal.
636637
- ``peaks_indexes`` (required): The location of the peaks.
637638
- ``min_gap`` (required): The minimum gap in samples between two peaks.

wfdb/processing/peaks.py

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -39,42 +39,6 @@ def find_peaks(x):
3939
soft_peaks = numpy.asarray(soft_peaks)+1
4040
return hard_peaks, soft_peaks
4141

42-
def find_peaks(x):
43-
# Definitions:
44-
# * Hard peak: a peak that is either /\ or \/
45-
# * Soft peak: a peak that is either /-*\ or \-*/ (In that cas we define the middle of it as the peak)
46-
47-
# Returns two numpy arrays:
48-
# * hard_peaks contains the indexes of the Hard peaks
49-
# * soft_peaks contains the indexes of the Soft peaks
50-
51-
if len(x) == 0:
52-
return numpy.empty([0]), numpy.empty([0])
53-
54-
tmp = x[1:]
55-
tmp = numpy.append(tmp, [x[-1]])
56-
tmp = x-tmp
57-
tmp[numpy.where(tmp>0)] = +1
58-
tmp[numpy.where(tmp==0)] = 0
59-
tmp[numpy.where(tmp<0)] = -1
60-
tmp2 = tmp[1:]
61-
tmp2 = numpy.append(tmp2, [0])
62-
tmp = tmp-tmp2
63-
hard_peaks = numpy.where(numpy.logical_or(tmp==-2,tmp==+2))[0]+1
64-
soft_peaks = []
65-
for iv in numpy.where(numpy.logical_or(tmp==-1,tmp==+1))[0]:
66-
t = tmp[iv]
67-
i = iv+1
68-
while True:
69-
if i==len(tmp) or tmp[i] == -t or tmp[i] == -2 or tmp[i] == 2:
70-
break
71-
if tmp[i] == t:
72-
soft_peaks.append(int(iv+(i-iv)/2))
73-
break
74-
i += 1
75-
soft_peaks = numpy.asarray(soft_peaks)+1
76-
return hard_peaks, soft_peaks
77-
7842

7943
def correct_peaks(x, peaks_indexes, min_gap, max_gap, smooth_window):
8044
N = x.shape[0]

0 commit comments

Comments
 (0)