colour-science / colour

Colour Science for Python
https://www.colour-science.org
BSD 3-Clause "New" or "Revised" License
2.08k stars 259 forks source link

[FEATURE]: Implement modern / more generalized bandpass correction techniques #1016

Open tjdcs opened 2 years ago

tjdcs commented 2 years ago

Description

Description

Bandpass error in spectral measurements is a very important source of error in spectral data. The library already provides some older / simpler bandpass correction methods for the case where the bandwidth of the spectrometer exactly matches the sampling interval. However, this is rarely the case. The CR-300 and CS-2000 (two common spectroradiometers) have bandwidths of 2nm, but have a sampling size of 1nm. Similarly the Photo Research family of spectrometers has much wider bandwidths than its sampling intervals. As high as 8nm bandwidth to 1nm sampling.

For LED sources which are getting increasingly narrow, for laser projectors, or for some fluorescent sources with particularly narrow emission bands the error can be quite large. Fig 1.

It would be greatly appreciated to implement one of the modern methods that can provide correction for these cases. I've found three relevant papers and attempted to implement a deconvolution method myself with scipy.signal.deconvolve but failed to make it work on the relevant simulated cases. Bandpass error can be simulated by convolving a bandpass function with a simulated spectrum, treating the convolved signal as the measurement value and applying the bandpass correction method to hopefully retrieve the input spectrum.

I am suggesting one or both of the methods below:

Papers

Spectral deconvolution applications for colorimetry Comparison of the Richardson–Lucy method and a classical approach for spectrometer bandpass correction

A Flexible Bandpass Correction Method for Spectrometers

Figure 1

Simulated bandpass error of 2nm triangular bandwidth on 1nm sampling spectrometer (CR-300, CS-2000A). True spectrum is shown in blue, while the measurement is shown in orange. output

KelSolaar commented 2 years ago

This relates to #54 that was never implemented.

KelSolaar commented 2 years ago

Out of curiosity @tjdcs, did you try the scikit-image implementation? It should work for 1D arrays: https://github.com/scikit-image/scikit-image/blob/main/skimage/restoration/deconvolution.py#L371