Skip to content

Commit 2eabaa5

Browse files
author
Benjamin Moody
committed
adc (inplace=False, expanded=False): refactor for clarity.
1 parent dc05f44 commit 2eabaa5

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

wfdb/io/_signal.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -581,13 +581,12 @@ def adc(self, expanded=False, inplace=False):
581581
d_signal.append(ch_d_signal)
582582

583583
else:
584-
nanlocs = np.isnan(self.p_signal)
585-
# Cannot cast dtype to int now because gain is float.
586-
d_signal = self.p_signal.copy()
587-
np.multiply(d_signal, self.adc_gain, d_signal)
588-
np.add(d_signal, self.baseline, d_signal)
589-
np.round(d_signal, 0, d_signal)
590-
d_signal = d_signal.astype(intdtype, copy=False)
584+
p_signal = self.p_signal.copy()
585+
nanlocs = np.isnan(p_signal)
586+
np.multiply(p_signal, self.adc_gain, p_signal)
587+
np.add(p_signal, self.baseline, p_signal)
588+
np.round(p_signal, 0, p_signal)
589+
d_signal = p_signal.astype(intdtype, copy=False)
591590

592591
if nanlocs.any():
593592
for ch in range(d_signal.shape[1]):

0 commit comments

Comments
 (0)