gtaylor / python-colormath

A python module that abstracts common color math operations. For example, converting from CIE L*a*b to XYZ, or from RGB to CMYK
python-colormath.readthedocs.org
BSD 3-Clause "New" or "Revised" License
456 stars 83 forks source link

Create "SpectralColor" object from "ndarray". #89

Closed imansaj closed 6 years ago

imansaj commented 6 years ago

Hello. how can i import a numpy array containing intensity values for each wavelength as a spectralcolor object.

tnx

KelSolaar commented 6 years ago

Hi @imansaj,

I think you should be able to pass the ndarray using the * operator, although I have not tried:

SpectralColor(*my_array)

This assumes that your array spectral domain is as follows: [340, 830] with 10nm bins.

The instantiation could be improved but it requires a significant amount of work. If you are going down hard the spectral road, I would recommend using Colour which is more mature on that end.

imansaj commented 6 years ago

Great It worked, thank you very much.

KelSolaar commented 6 years ago

Glad to hear! :)