Skip to content

fix: Removing depreciated behavior to enable compatiblity with numpy==2#26

Open
sebastianorbell-qm wants to merge 1 commit intomainfrom
fix/numpy_2
Open

fix: Removing depreciated behavior to enable compatiblity with numpy==2#26
sebastianorbell-qm wants to merge 1 commit intomainfrom
fix/numpy_2

Conversation

@sebastianorbell-qm
Copy link
Copy Markdown

Minor patch to enable compatibility with numpy>2.0

All tests pass with numpy<2 and numpy>2

Tested downstream with qua-libs and this fixes the compatibility errors found there.


The One Breaking Change (now fixed)

feature_detection.py — _position_from_index and _width_from_index

Both functions were returning np.array([val]) (a 1-element array) but were called via xr.apply_ufunc(..., output_core_dims=[[]], vectorize=True), which expects a scalar
return. In numpy 2, this becomes a hard ValueError: setting an array element with a sequence rather than a DeprecationWarning.

Fix applied — return scalars directly instead of wrapping in np.array([...]).

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Mar 3, 2026

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants