Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
cast type to unsigned int
Addresses warning when NPY_PROMOTION_STATE=weak_and_warn that result dtype changed due to the removal of value-based promotion from NumPy. Changed from int32 to int16.
  • Loading branch information
tompollard committed Oct 9, 2024
commit a3600e42d33dd69577989ac1523d4a7f7f9d9fc9
6 changes: 4 additions & 2 deletions wfdb/io/_signal.py
Original file line number Diff line number Diff line change
Expand Up @@ -2371,7 +2371,8 @@ def wr_dat_file(

elif fmt == "16":
# convert to 16 bit two's complement
d_signal[d_signal < 0] = d_signal[d_signal < 0] + 65536
d_signal = d_signal.astype(np.uint16)

# Split samples into separate bytes using binary masks
b1 = d_signal & [255] * tsamps_per_frame
b2 = (d_signal & [65280] * tsamps_per_frame) >> 8
Expand Down Expand Up @@ -2400,7 +2401,8 @@ def wr_dat_file(

elif fmt == "32":
# convert to 32 bit two's complement
d_signal[d_signal < 0] = d_signal[d_signal < 0] + 4294967296
d_signal = d_signal.astype(np.uint32)

# Split samples into separate bytes using binary masks
b1 = d_signal & [255] * tsamps_per_frame
b2 = (d_signal & [65280] * tsamps_per_frame) >> 8
Expand Down