eyurtsev / eyurtsev/fcsparser

compatibility with numpy>2.0

Open
#74 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
Python
Stars
84
Forks
51
PR merge metrics
No merged PRs in 30d

Description

numpy >2.0 is not backwards compatible, and specifically fails in the endian/byteorder check. An updated implementation (along with explicitly specifying the proper endianness) that is compliant with the changes made in numpy 2.0 and later would be:

```
# Convert to native byte order
# This is needed for working with pandas data structures
sys_is_le = sys.byteorder == 'little'
native_code = '<' if sys_is_le else '>'
swapped_code = '>' if sys_is_le else '<'
if endian != native_code:
# swaps the actual bytes and also the endianness
# updated to be numpy>= 2.0 compliant
data = data.view(data.dtype.newbyteorder(swapped_code)).byteswap()
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.