1
$\begingroup$

I have a AS7265x triad spectroscopy sensor from SparkFun (link) which gives me measurements at 18 individual light wavelengths between 410nm and 940nm. The datasheet says that the FWHM of each sensor is 20nm.

How can I draw a smooth spectrum given these 18 numbers?

My approach so far is to use interpolation by radial basis functions. I tried gaussian functions with FWHM=20nm but this is what I get for an artificial signal with a constant spectrum of all ones:

enter image description here

I experimented with other radial basis functions and found that a multiquadric function gives me the best result. It produces a flat interpolation when each measurement is equal to one. However, it looks strange at frequencies below the lowest measured frequency and above the highest one:

enter image description here

I fix this by requiring the lines at both ends to decrease to zero as gaussians with FWHM=20nm and amplitudes equal to the values measured at 410nm and 940nm.

Also, sometimes this interpolation shows negative values, for example, when only a single measurement is one, and all other are zeros:

enter image description here

I fix it by simply putting the values of the spectrum to zero where it is negative.

I tested it with a few LEDs, and I am getting spectra from them that look realistic. However, I have a feeling that my approach has too many quick fixes. My code and LED spectra are here.

Is what I am doing an acceptable way to draw a spectrum from a limited number of sensors that don't densely cover the whole range of frequencies? If not, how to do it correctly?

$\endgroup$
  • $\begingroup$ Great gadget! My first question is what is your goal. A spectrum analyzer or a color analyzer? They are radically different creatures. As a color analyzer your in pretty easy territory. As a spectrum analyzer, you have to line up a requirements list/document. In the blind concerning spectrum and no prior requirements, I would use cubic-spines for interpolation. Be aware that there are significant improvements, knots, for the basic cubic-spline available. Spreading the tie points to acknowledge the finite width of tie points, I would have to think about. $\endgroup$ – rrogers Jul 30 at 20:19
  • $\begingroup$ @rrogers Currently I want to get spectra from some fluorescent material. I would like just smooth, nicely looking spectra given the accuracy of this device. After that I want to play with this toy more and see what I can get out of it. I tried natural cubic splines with scipy they work quite well. They just interpolated peak signals a teeny-weeny worse than multiquadric RBF, so I chose the latter. $\endgroup$ – Vladislav Gladkikh Jul 31 at 4:40
  • $\begingroup$ "fluorescent " ! What a great application; at least for mineral identification! i.e. I was looking at fluo.mineralogie.be/SpectraSilicates.html Willemite & calcite section. My previous work was gas spectral analysis in the NIR region and so isn't directly applicable but ... Unfortunately, this comment is off-topic and I don't want the HALL-MONITORS dinging me yet again. But for material identification you have to think well beyond just having a flat spectral response; like including the first derivative (or some such). $\endgroup$ – rrogers Jul 31 at 14:10
  • $\begingroup$ I still favour cubic-spline; but lacking applications/requirements I can't justify that. In any case: Rule #1 don't mislead the user. They really hate that; particularly if it leads them down the wrong path and hours/days of work. Or in my case; leads them to convincing management of something that one has to attempt to retract while maintaining a shred of diginity/respect. $\endgroup$ – rrogers Jul 31 at 14:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.