When you take an image with a spectrometer, you don’t get calibrated intensity readings for each wavelength. Instead you get a unitless intensity value for each pixel, which is not particularly useful. There are two steps to making sense of this measurement. Firstly, mapping each pixel to its corresponding wavelength and secondly, adjusting the intensity values at each wavelength to compensate for any wavelength dependent efficiency of the device.
In order to find out which pixel corresponds to which wavelength we need to capture the spectrum of a known source. For the visible range a CFL bulb is perfect. It’s cheap and will provide several emission lines over the visible spectrum.
A completely uncalibrated capture will look like this:
For each peak we need to write down both the pixel number as well as its wavelength. Labelled spectral lines can be found here: https://en.wikipedia.org/wiki/File:Fluorescent_lighting_spectrum_peaks_labelled.gif
When we have several of those points we can do a polynomial fit through all of them to get a simple mapping function. I found a 3rd degree polynomial to work well, although the relationship is highly linear anyways:
We can use this polynomial to map each pixel to its corresponding wavelength and plot the result like this:
You can use this MATLAB script to get started. I’ve also included a sample measurement from my scanner. The output of pyCCDGUI needs to be adapted to match this format.