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
{{ message }}
Repository navigation
skimage.util.convert not converting to 'float32' with numpy v1.13.3 #4189
During my explorations for PR #4161 CI failure, I found that skimage.util.convert doesn't convert double precision images to single precision with numpy v1.13.3 when called with dtype='float32'. Even more strange, it works when dtype=np.float32
What about using dtypeobj_in.kind == dtypeobj_out.kind and np.can_cast(dtypeobj_in, dtypeobj_out) instead of np.issubdtype(dtypeobj_in, type_out) in the convert function?
I can come with a PR for this if you agree with this solution...
@hmaarrfk I thought about that, but checked and NumPy 1.13 is only 2yo, which isn't that long. Having said that, if someone tried to support skimage from 2y ago simultaneously with today's skimage, they would not have fun, so perhaps we should move a bit faster.
On Jan 16, 2019 drop support for Numpy 1.12 (initially released on Jan 15, 2017)
On Mar 14, 2019 drop support for Python 3.5 (initially released on Sep 13, 2015)
On Jun 08, 2019 drop support for Numpy 1.13 (initially released on Jun 07, 2017)
On Jan 07, 2020 drop support for Numpy 1.14 (initially released on Jan 06, 2018)
On Jun 23, 2020 drop support for Python 3.6 (initially released on Dec 23, 2016)
On Jul 23, 2020 drop support for Numpy 1.15 (initially released on Jul 23, 2018)
On Jan 13, 2021 drop support for Numpy 1.16 (initially released on Jan 13, 2019)
On Jul 26, 2021 drop support for Numpy 1.17 (initially released on Jul 26, 2019)
On Dec 26, 2021 drop support for Python 3.7 (initially released on Jun 27, 2018)
By the way, there is code at the bottom of that NEP to calculate this table, so we can automate a check so that we automatically upgrade our NumPy and Python deps.
I thought we were saying the numpy drop is today. And we would support a PR that Drops it. Most of time, unless there is a real big, we don't drop it, but maybe we should just drop regardless. That NEP is new.
Oh, I misread @stefanv comment, I though that the NEP was advising to drop numpy 1.13 on On Jun 08, 2020 😄 .
By the way, the PR includes also small refactoring of skimage.utils.dtype and some tests that may have avoided this issue.
Activity
jni commentedon Sep 26, 2019
@rfezzani Crazy outcome of your investigation! Can this issue be fixed by internally changing any
'float32's tonp.float32?jni commentedon Sep 26, 2019
"internally" meaning inside the "convert" function
rfezzani commentedon Sep 26, 2019
I am checking this ;)
rfezzani commentedon Sep 26, 2019
OK, the bug comes from
np.issubdtypethat was fixed innumpy v1.14:Using
numpy v1.13, I obtain:There is no obvious fix for
convert, but I will investigate more ;-)hmaarrfk commentedon Sep 26, 2019
Numpy 1.13.3 is basically dead. Numpy doesn't recommend supporting older than 1.14. So let's just bump out version number
rfezzani commentedon Sep 26, 2019
What about using
dtypeobj_in.kind == dtypeobj_out.kind and np.can_cast(dtypeobj_in, dtypeobj_out)instead ofnp.issubdtype(dtypeobj_in, type_out)in the convert function?I can come with a PR for this if you agree with this solution...
jni commentedon Sep 27, 2019
@stefanv thoughts about bumping up NumPy dep?
@hmaarrfk I thought about that, but checked and NumPy 1.13 is only 2yo, which isn't that long. Having said that, if someone tried to support skimage from 2y ago simultaneously with today's skimage, they would not have fun, so perhaps we should move a bit faster.
stefanv commentedon Sep 27, 2019
NEP 20 — Recommend Python and Numpy version support as a community policy standard
stefanv commentedon Sep 27, 2019
stefanv commentedon Sep 27, 2019
By the way, there is code at the bottom of that NEP to calculate this table, so we can automate a check so that we automatically upgrade our NumPy and Python deps.
rfezzani commentedon Sep 27, 2019
This bug also affects
img_as_float32:rfezzani commentedon Sep 27, 2019
If you don't want to wait for numpy 1.13 drop, the PR #4193 fixes this issue ;-)
hmaarrfk commentedon Sep 27, 2019
I thought we were saying the numpy drop is today. And we would support a PR that Drops it. Most of time, unless there is a real big, we don't drop it, but maybe we should just drop regardless. That NEP is new.
rfezzani commentedon Sep 27, 2019
Oh, I misread @stefanv comment, I though that the NEP was advising to drop
numpy 1.13on On Jun 08, 2020 😄 .By the way, the PR includes also small refactoring of
skimage.utils.dtypeand some tests that may have avoided this issue.stefanv commentedon Sep 27, 2019
The NEP is likely to be accepted; there have been no objections.
Go ahead and drop 1.13 support.