Skip to content

Commit d13e8ac

Browse files
committed
block conversion when signal has inf
1 parent ffa5113 commit d13e8ac

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

wfdb/io/_signal.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,8 @@ def calc_adc_params(self):
514514
pmin = minvals[ch]
515515
pmax = maxvals[ch]
516516

517+
if pmax == np.inf:
518+
raise ValueError('Signal contains inf. Cannot convert.')
517519
# map values using full digital range.
518520

519521
# If the entire signal is nan, just put any.
@@ -536,7 +538,6 @@ def calc_adc_params(self):
536538
# baseline has to be an integer.
537539
adc_gain = (dmax-dmin) / (pmax-pmin)
538540
baseline = dmin - adc_gain*pmin
539-
540541
# The baseline needs to be an integer
541542
if pmin > 0:
542543
baseline = int(np.ceil(baseline))

0 commit comments

Comments
 (0)