Repository navigation
Fix conversion to float32 dtype - #4193
Conversation
hmaarrfk
left a comment
There was a problem hiding this comment.
Presumably theses tests pass when we increase the version to 1.14 for bumpy? If so. Lets go with that.
The added tests are nice, the change to the code is mildly interesting.
|
I'm +1 with @hmaarrfk : bump numpy + keep the tests. |
|
I removed inner functions because they are not required by design and they make |
|
It's not really the fact you separated the function but rather the shortcuts such as |
|
I also wanted to remove the |
|
|
||
| """ | ||
|
|
||
| compare_bits_to = bits.__le__ if kind == 'u' else bits.__lt__ |
There was a problem hiding this comment.
I agree with @sciunto, undo this particular optimisation, as it is much less readable than the inner compare function. Something preferable would be to just be explicit in the loop:
s = next(i for i in (itemsize,) + (2, 4, 8)
if bits < i*8 or bits == i*8 and kind == 'u')
sciunto
left a comment
There was a problem hiding this comment.
Awesome guys. I approve (although we need to wait for Travis)
|
Thx @sciunto, I am still stuck with Travis failures :-( Even using |
|
Try numpy 0.14.1. Looks like there is a fix backported in this version that might be related to this. |
|
It works. |
| >>> coords2 = np.concatenate((coords, [[17, 17]]), axis=0) | ||
| >>> np.round(moments_coords_central(coords2), 2) | ||
| >>> np.round(moments_coords_central(coords2), | ||
| ... decimals=2) # doctest: +NORMALIZE_WHITESPACE +ELLIPSIS |
There was a problem hiding this comment.
I don't think ELLIPSIS is need. The output does not contain ...
|
@hmaarrfk this is ready for you to pull the trigger! =) Thanks all! |
|
didn't know that my change request was blocking. I rarely mean to have blocking requests.. |
|
@hmaarrfk typically when I have requests that I don't want to block, I use "comment" rather than "request changes". Otherwise the big red x remains. I can "dismiss" it, but that feels, well, dismissive. =D |
Description
Closes #4189.
This PR consists in:
skimage.util.convert: defining annex functions (_scale,_dtype_bits,_dtype_itemsize) outside the body of theconvertfunction to make it more readable,_dtype_bits: removing the definition ofcomparefunction,np.obj2sctype(dtype)instead oftype_outto fix the conversion tofloat32whatever isnumpyversion,float32, np.float, float, etc...)Checklist
./doc/examples(new features only)./benchmarks, if your changes aren't covered by anexisting benchmark
For reviewers
later.
__init__.py.doc/release/release_dev.rst.@meeseeksdev backport to v0.14.x