Open
Description
I have some data that crashes wrsamp
because calc_adc_params
produces values that don't fit the data (off by one):
chmin = -2147483648
chmax = 2147483648
IndexError: Channel 0 contain values outside allowed range [-2147483648, 2147483647] for fmt 32
As you can see, chmax
is just above the dmax
of 2147483647
for 32.
This is some data for reproduction:
data.float32.zip
You can try it with:
data = np.reshape(np.fromfile("data.float32", dtype=np.float32), [-1, 12])
wfdb.wrsamp(
record_name="test",
sig_name=[f"d{x}" for x in range(12)],
units=["mv"] * 12,
fs=500,
# fmt=["16"] * 12,
p_signal=data
)
Note how passing fmt=16 fixes the problem in this particular case, probably by chance because it happens to not trigger the bug.
Metadata
Metadata
Assignees
Labels
No labels