Skip to content

Commit c661d90

Browse files
committed
fix test
1 parent 761dbc0 commit c661d90

File tree

3 files changed

+25
-11
lines changed

3 files changed

+25
-11
lines changed

wfdb/plot/plot.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ def plot_wfdb(record=None, annotation=None, plot_sym=False,
334334
335335
If the annotation object is input, the function will extract from it:
336336
- sample locations, from the `sample` attribute
337-
- symbols, from the `sym` attribute
337+
- symbols, from the `symbol` attribute
338338
- the annotation channels, from the `chan` attribute
339339
- the sampling frequency, from the `fs` attribute if present, and if fs
340340
was not already extracted from the `record` argument.
@@ -383,8 +383,9 @@ def plot_wfdb(record=None, annotation=None, plot_sym=False,
383383
>>> record = wfdb.rdrecord('sample-data/100', sampto=3000)
384384
>>> annotation = wfdb.rdann('sample-data/100', 'atr', sampto=3000)
385385
386-
wfdb.plot_wfdb(record=record, annotation=annotation, time_units='seconds',
387-
title='MIT-BIH Record 100', figsize=(10,4), ecg_grids='all')
386+
>>> wfdb.plot_wfdb(record=record, annotation=annotation, plot_sym=True
387+
time_units='seconds', title='MIT-BIH Record 100',
388+
figsize=(10,4), ecg_grids='all')
388389
389390
"""
390391
(signal, ann_samp, ann_sym, fs, sig_name,

wfdb/processing/gqrs.py

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ def time_to_sample_number(seconds, frequency):
77

88

99
class Conf(object):
10-
def __init__(self, freq, gain,
11-
hr=75,
10+
def __init__(self, freq, gain, hr=75,
1211
RRdelta=0.2, RRmin=0.28, RRmax=2.4,
1312
QS=0.07, QT=0.35,
1413
RTmin=0.25, RTmax=0.33,
@@ -225,7 +224,7 @@ def sm(self, at_t):
225224

226225
return self.smv_at(at_t)
227226

228-
def qf(self): # CHECKED!
227+
def qf(self):
229228
# evaluate the QRS detector filter for the next sample
230229

231230
# do this first, to ensure that all of the other smoothed values needed below are in the buffer
@@ -471,10 +470,12 @@ def gqrs_detect(x, fs, adc_gain, adc_zero, threshold=1.0,
471470
QS=0.07, QT=0.35, RTmin=0.25, RTmax=0.33,
472471
QRSa=750, QRSamin=130):
473472
"""
474-
Detect qrs locations in a single channel ecg.
473+
Detect qrs locations in a single channel ecg. Functionally, a direct port
474+
of the gqrs algorithm from the original wfdb package. See the notes below
475+
for a summary of the program.
475476
476-
Functionally, a direct port of the gqrs algorithm from the original
477-
wfdb package. Therefore written to accept wfdb record fields.
477+
This algorithm is not being developed/supported. Use another algorithm
478+
such as `xqrs_detect` for a supported qrs detector.
478479
479480
Parameters
480481
----------
@@ -518,8 +519,20 @@ def gqrs_detect(x, fs, adc_gain, adc_zero, threshold=1.0,
518519
519520
Notes
520521
-----
522+
The algorithm works as follows:
523+
- Apply trapezoid low-pass filtering to the signal
524+
- Convolve a QRS matched filter with the filtered signal
525+
- Run the learning phase:
526+
- Run the detection:
527+
-
528+
521529
This function should not be used for signals with fs <= 50Hz
522530
531+
A list of issues from the original c code and hence this python
532+
implementationcan be found here: https://github.com/bemoody/wfdb/issues/17
533+
534+
gqrs will not be developed in this library.
535+
523536
"""
524537
conf = Conf(freq=fs, gain=adc_gain, hr=hr,
525538
RRdelta=RRdelta, RRmin=RRmin, RRmax=RRmax,

wfdb/processing/qrs.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@ def bandpass(self, fc_low=5, fc_high=20):
108108
self.fc_low = fc_low
109109
self.fc_high = fc_high
110110

111-
b, a = signal.butter(2, [fc_low * 2 / self.fs, fc_high * 2 / self.fs],
112-
'pass')
111+
b, a = signal.butter(2, [float(fc_low) * 2 / self.fs,
112+
float(fc_high) * 2 / self.fs], 'pass')
113113
self.sig_f = signal.filtfilt(b, a, self.sig[self.sampfrom:self.sampto],
114114
axis=0)
115115
# Save the passband gain (x2 due to double filtering)

0 commit comments

Comments
 (0)