Skip to content

Commit bfb35cd

Browse files
committed
Change in type promotion. Fixes to edf.py
1 parent 80c0526 commit bfb35cd

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

Diff for: wfdb/io/convert/edf.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -402,22 +402,24 @@ def read_edf(
402402
temp_sig_data = np.fromfile(edf_file, dtype=np.int16)
403403
temp_sig_data = temp_sig_data.reshape((-1, sum(samps_per_block)))
404404
temp_all_sigs = np.hsplit(temp_sig_data, np.cumsum(samps_per_block)[:-1])
405+
405406
for i in range(n_sig):
406407
# Check if `samps_per_frame` has all equal values
407408
if samps_per_frame.count(samps_per_frame[0]) == len(samps_per_frame):
408409
sig_data[:, i] = (
409-
temp_all_sigs[i].flatten() - baseline[i]
410+
temp_all_sigs[i].flatten().astype(np.int64) - baseline[i]
410411
) / adc_gain_all[i]
411412
else:
412413
temp_sig_data = temp_all_sigs[i].flatten()
414+
413415
if samps_per_frame[i] == 1:
414-
sig_data[:, i] = (temp_sig_data - baseline[i]) / adc_gain_all[i]
416+
sig_data[:, i] = (temp_sig_data.astype(np.int64) - baseline[i]) / adc_gain_all[i]
415417
else:
416418
for j in range(sig_len):
417419
start_ind = j * samps_per_frame[i]
418420
stop_ind = start_ind + samps_per_frame[i]
419421
sig_data[j, i] = np.mean(
420-
(temp_sig_data[start_ind:stop_ind] - baseline[i])
422+
temp_sig_data[start_ind:stop_ind].astype(np.int64) - baseline[i]
421423
/ adc_gain_all[i]
422424
)
423425

0 commit comments

Comments
 (0)