You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Change in type promotion. Fixes to annotation.py (#506)
As discussed in #493, numpy
v2.0 introduced changes to type promotion rules:
https://numpy.org/devdocs/numpy_2_0_migration_guide.html#changes-to-numpy-data-type-promotion
Running pytest with `numpy==2.0.2` and
`NPY_PROMOTION_STATE=weak_and_warn` raises the following warnings for
wfdb/io/annotation.py:
```
/Users/tompollard/projects/wfdb-python/wfdb/io/annotation.py:2222: UserWarning: result dtype changed due to the removal of value-based promotion from NumPy. Changed from int64 to uint8.
while filebytes[bpi, 1] >> 2 == 59:
/Users/tompollard/projects/wfdb-python/wfdb/io/annotation.py:2239: UserWarning: result dtype changed due to the removal of value-based promotion from NumPy. Changed from int64 to uint8.
label_store = filebytes[bpi, 1] >> 2
tests/test_plot.py::TestPlotInternal::test_get_plot_dims
/Users/tompollard/projects/wfdb-python/wfdb/io/annotation.py:2240: UserWarning: result dtype changed due to the removal of value-based promotion from NumPy. Changed from int64 to uint8.
sample_diff += int(filebytes[bpi, 0] + 256 * (filebytes[bpi, 1] & 3))
```
The changes in this pull request address these issues by explicitly
casting the type. I plan to follow up with several additional fixes to
other modules.
0 commit comments