What I want to do
There's long been talk about a more intuitive, more precise, all-around better wavelength calibration procedure for Spectral Workbench, and I've spent time over the past couple weeks putting that together into a working interface. I'm generally tracking progress in this Github issue
It's not complete, but you can see what it's like by cloning this spectrum to play with:
How it works
As you can see in the above screenshot, when you click on "Calibrate" in the new 2.0 Spectral Workbench beta interface, you're presented with two sliders, and a reference spectrum, which is actually @cfastie's "snowsky" CFL calibration, one I've used a lot as it's super sharp and has very low noise: https://spectralworkbench.org/spectrums/4474
The steps are:
- Click "Calibrate" in the new 2.0 beta interface.
- It will attempt to auto-calibrate. If it looks good, just click "Save."
- If not, drag the sliders yourself. The "Snap" checkbox will make the sliders "stick" to nearby peaks.
- Once you have a good match (the red vertical lines should intersect the graph peaks very precisely), click
Note: It does not handle image reversal well. Sometimes reversed images can cause problems, so if it looks like the auto-calibration is opposite -- i.e. right to left instead of left to right -- you could try to "Set new cross-section" which will get fresh graph of data out of the image. We hope to solve reversal problems once and for all in an upcoming version.
"Fit" and next steps
You may notice the green indicator that says "FIT" to the right. This is an attempt to compare the expected ratio of three known peaks to the peaks found in the image. Unfortunately, it has some shortcomings, and we'll probably be switching to a root-mean-square error approach, where we compare a much larger # of points to those of a known spectrum, after height-adjusting for the baseline and maximum peak height. We'll see if that works better, but for now, please be aware that the "FIT" indicator is not that reliable.
Why I'm interested
This project has integrated several ideas:
- auto-calibration, based on @sreyanth's work during last summer's Google Summer of Code
- a better, more visual UI for calibration
- a measure of "how good" calibration is
Hopefully in the future, we can combine these -- if we can collect data on how good auto-calibration works for many different spectra, we could say that if it's "better than 90% fit" or something, it just auto-calibrates it in one click. But if it doesn't manage to get a good fit, it prompts the user for help.
Have trouble? Input, suggestions? Leave a comment!
Here is a text file with the 14 peaks I used to calibrate the CFL spectrum (in nm):
Here is a csv file of the intensity at each wavelength of the calibrated (3rd order polynomial) CFL spectrum:
Here is a jpg image of the calibrated diffraction pattern of the Snowy Sky CFL spectrum (the emission lines are where they should be according to this source):
I think the jpeg has the dimensions you requested.
The slider is definitely a little jerky, but it does not affect the function very much.
I did a check on the files I attached to the last comment and they are not as precise as I thought they would be.
A graph of the data file of intensity x calibrated wavelength (pink) overlain on the corrected diffraction pattern. Both data sources are from the Snowy Sky CFL spectrum.
The reason for the imprecision is that the image of the diffraction pattern was corrected differently than the data series of emission peak intensities. The diffraction image was corrected manually in Photoshop by moving individual emission lines or groups of lines so they matched an overlay of the known emission lines of a CFL. So the lines in the image should be within a nm or two of where they should be. The data file is the result of applying a 3rd order polynomial correction (based on the same known emission line data) to the intensity series. This should also be accurate to within a nm or two. But the error for the two results is not necessarily in the same direction for any particular line, so there is a discrepancy of a nm or two for some lines.
This is probably good enough for your current application, but be aware that these data sets have their limitations.
OK, so we have two different needs:
First, a list of known spectral peaks:
- from some known trusted
- maybe an external source, like NIST?
- we only need wavelengths and intensities
- we should use this long-term as a means of assessing how good a calibration spectrum is
I'm going to use the 14CFLpeaks.txt file for this.
Second, an example reference spectrum:
- which we can upgrade later
- which should be viewable alongside existing spectra
- which has as good precision/accuracy as we are hoping users will achieve
For this, I agree that we don't need something to the same standard as the first case. I'm curious though --
corrected manually in Photoshop by moving individual emission lines or groups of lines
How did you do this? With the Warp tool, somehow? Or did you just marquee select lines and translate them left and right?
Also, in the jpg of "the calibrated diffraction pattern of the Snowy Sky CFL spectrum" are the peaks at the same positions, i.e. 586px from left, and then 538px from there, as in the image I used? Or should I re-measure that?
One more thought. Although this would only work for a monochrome image (although we could colorize it for clarity, in theory), we could generate an image directly from the graph data, so it's 1:1. We could even do so from some external source, like NIST or something. Would that be of interest?
Is this a question? Click here to post it to the Questions page.