|
3 | 3 |
|
4 | 4 | import numpy as np
|
5 | 5 | from scipy import signal
|
6 |
| -from sklearn.preprocessing import normalize |
7 | 6 |
|
8 |
| -from wfdb.processing.basic import get_filter_gain |
| 7 | +from wfdb.processing.basic import get_filter_gain, normalize |
9 | 8 | from wfdb.processing.peaks import find_local_peaks
|
10 | 9 | from wfdb.io.record import Record
|
11 | 10 |
|
@@ -288,10 +287,10 @@ def _learn_init_params(self, n_calib_beats=8):
|
288 | 287 |
|
289 | 288 | # Question: should the signal be squared? Case for inverse QRS
|
290 | 289 | # complexes
|
291 |
| - sig_segment = normalize((self.sig_f[i - self.qrs_radius: |
292 |
| - i + self.qrs_radius]).reshape(-1, 1), axis=0) |
| 290 | + sig_segment = normalize(self.sig_f[i - self.qrs_radius: |
| 291 | + i + self.qrs_radius]) |
293 | 292 |
|
294 |
| - xcorr = np.correlate(sig_segment[:, 0], ricker_wavelet[:,0]) |
| 293 | + xcorr = np.correlate(sig_segment, ricker_wavelet[:,0]) |
295 | 294 |
|
296 | 295 | # Classify as QRS if xcorr is large enough
|
297 | 296 | if xcorr > 0.6 and i-last_qrs_ind > self.rr_min:
|
@@ -530,8 +529,7 @@ def _is_twave(self, peak_num):
|
530 | 529 |
|
531 | 530 | # Get half the QRS width of the signal to the left.
|
532 | 531 | # Should this be squared?
|
533 |
| - sig_segment = normalize((self.sig_f[i - self.qrs_radius:i] |
534 |
| - ).reshape(-1, 1), axis=0) |
| 532 | + sig_segment = normalize(self.sig_f[i - self.qrs_radius:i]) |
535 | 533 | last_qrs_segment = self.sig_f[self.last_qrs_ind - self.qrs_radius:
|
536 | 534 | self.last_qrs_ind]
|
537 | 535 |
|
|
0 commit comments