ColorPy icon indicating copy to clipboard operation
ColorPy copied to clipboard

Index in ciexyz.xyz_from_wavelength() should be explicitly converted to int.

Open markkness opened this issue 9 years ago • 3 comments

The index used in ciexyz.xyz_from_wavelength() is intended to be an integer, but is actually a floating point type with an integral value. It should be explicitly converted to an integer to avoid a deprecation warning.

markkness avatar Jun 20 '16 15:06 markkness

In my case, I directly get IndexError. Would be great to get it fixed.

jmllorens avatar May 12 '17 09:05 jmllorens

It's an error in numpy 1.12.x now:

File "/vls/lib/python2.7/site-packages/colorpy/ciexyz.py", line 709, in xyz_from_wavelength
    return _xyz_colors [index] + frac_wl_nm * _xyz_deltas [index]
IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boolean arrays are valid indices

thecere avatar Jun 04 '17 08:06 thecere

index = int(index)

GordonDongZHAO avatar Dec 12 '19 06:12 GordonDongZHAO