enthought / enthought/chaco

DataRange1D NumPy FutureWarning on assigning 1d array to high_setting

Open
#485 2 comments 0 reactions 0 assignees View on GitHub
ETS Backlog
Dominant language
Python
Stars
305
Forks
97
PR merge metrics
No merged PRs in 30d

Description

In `DataRange1D`, we're getting a NumPy `FutureWarning` when setting `high_setting` or `low_setting` with a shape (1,) NumPy array. That `FutureWarning` is coming from code like this:
https://github.com/enthought/chaco/blob/e0e4f7d8bc5551191ad65295fe97f55190e87a9c/chaco/data_range_1d.py#L285

which compares the current value with the `val` array. If the current value is a string (either `"auto"` or `"track"`),and `val` is a shape `(1,)` array, NumPy will convert the string to a character array and then do a comparison, resulting in this future warning.

I *think* this is mostly benign: in a future version of NumPy, `self._high_setting != val` will be returning a shape `(1,)` array of dtype bool, and for now that should still be usable in an `if` condition. But I could see that (ab)use of bool arrays changing in some future NumPy version, and it would be good to fix this.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.