Unexpected behaviour with "colour.colorimetry.reshape_sd" definition #1105
-
I have an issue when reshaping some spectra. Below I load a spectrum with non-uniform wavelength intervals (file attached: White CRI98 6000K.csv) When reshaping to (400, 700, 5) and (300, 700, 5) it works as expected, but when I try (300, 700, 5) the step is 5.033333, except for one point, where it is 2.36666.
Best regards, |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Hi @frankkjensen, The code tries to preserve as much as possible of the original data, there are some explanations in this issue but let me give you some more details. All the magic happens in the colour.SpectralDistribution.interpolate method. Given the requested shape is
Such a shape will generate fractional intervals! It is a case where I would recommend doing a direct extraction of the values you need as follows: sd[colour.SpectralShape(300, 700, 5).wavelengths] Hope it makes sense! Cheers, Thomas |
Beta Was this translation helpful? Give feedback.
-
Ok, I understand. Best regards, |
Beta Was this translation helpful? Give feedback.
Hi @frankkjensen,
The code tries to preserve as much as possible of the original data, there are some explanations in this issue but let me give you some more details. All the magic happens in the colour.SpectralDistribution.interpolate method.
Given the requested shape is
(300, 700, 5)
, the code finds the minimum and maximum wavelength in the distribution of your spectrum:(397.07, 779.67)
(300, 700, 5)
thus the effective …