Skip to content

Commit 384b987

Browse files
author
Benjamin Moody
committed
adc (expanded=True): do not rely on n_sig.
When converting physical to digital sample arrays, all the information we need is contained in self.e_p_signal, self.adc_gain, self.baseline, and self.fmt. We don't need to rely on self.n_sig here, and we don't use n_sig in the expanded=False case, so for consistency, don't use n_sig in the expanded=True case either.
1 parent 235e142 commit 384b987

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

wfdb/io/_signal.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -561,9 +561,9 @@ def adc_inplace_2d(p_signal):
561561
# Do inplace conversion and set relevant variables.
562562
if inplace:
563563
if expanded:
564-
for ch in range(self.n_sig):
564+
for ch, ch_p_signal in enumerate(self.e_p_signal):
565565
ch_d_signal = adc_inplace_1d(
566-
self.e_p_signal[ch],
566+
ch_p_signal,
567567
self.adc_gain[ch],
568568
self.baseline[ch],
569569
d_nans[ch],
@@ -579,9 +579,9 @@ def adc_inplace_2d(p_signal):
579579
else:
580580
if expanded:
581581
d_signal = []
582-
for ch in range(self.n_sig):
582+
for ch, ch_p_signal in enumerate(self.e_p_signal):
583583
ch_d_signal = adc_inplace_1d(
584-
self.e_p_signal[ch].copy(),
584+
ch_p_signal.copy(),
585585
self.adc_gain[ch],
586586
self.baseline[ch],
587587
d_nans[ch],

0 commit comments

Comments
 (0)