Welcome to Laser Pointer Forums - discuss green laser pointers, blue laser pointers, and all types of lasers



Laser Pointer Store

Spectrometer Calibration

Mosc007

Active member
Joined
Feb 2, 2012
Messages
533
Points
43
I was about to post my results from implementing the LeastSquares function in a COM visible .net dll when I saw your post. So, I grabbed the VB6 code you linked and implemented that in C# as well. Both results match what I get in Spectrum Studio.
Do they match what is output from Excel ?
 

chloderic

Active member
Joined
Jan 21, 2018
Messages
300
Points
43
It is not always easy to find an acurat fit in an polynominal 3th order. Because in the software of Mosc007 the calibration is outside (not in the device, there it is in a file) it is possible do modify the calculation to an 5th or more order (if you write a software your own like Mosc007, great job).
I am using my calibration of the device only for orientation and make it more acurat in a postcalculation, because there is a need of this in the application i am using this.
 
Last edited:

Agastar

New member
Joined
Sep 26, 2016
Messages
52
Points
0
It is not always easy to find an acurat fit in an polynominal 3th order. Because in the software of Mosc007 the calibration is outside (not in the device, there it is in a file) it is possible do modify the calculation to an 5th or more order (if you write a software your own like Mosc007, great job).
I am using my calibration of the device only for orientation and make it more acurat in a postcalculation, because there is a need of this in the application i am using this.
This got me thinking and so I went back to the code. The VB6 code I converted to C# lets you specify the polynomial order you want to calculate for. Since we've been talking about 3rd order polynomials I've just been passing in the number 3 for that parameter.

Here is the function
Code:
public static double[] FindPolynomialLeastSquaresFit(double[] PtX, double[] PtY, int degree)
And, here is how I'm calling that function.

Code:
cNums = LeastSquaresSimple.FindPolynomialLeastSquaresFit(pixels, wavelengths, 3);
This function would allow you to calculate nth polynomial orders and pass in nth number of points.

If I pass in 3 for degrees, I get 3 numbers back, if I pass in 4 for degrees, I get back 4 numbers. Spectrum Studio allows for nth number of points but only calculates 3 degrees.

Not sure if that is usefull but I thought I'd share :)
 

chloderic

Active member
Joined
Jan 21, 2018
Messages
300
Points
43
I have tested the regression ^3 ^5 ^7 and ^9 and analysed the results. The known points will get closer and the calculated point are far away therefor. That means i have to go an other way .... maybe split the regression in multiple parts. I will test it and report later.
 

Atomicrox

Well-known member
Joined
Jun 22, 2011
Messages
2,432
Points
83
That's probably because of overfitting. I don't think increasing the order is going to help getting a better fit outside the sampled region.
 

kecked

Active member
Joined
Jun 18, 2012
Messages
308
Points
28
I wonder if you could sweep a monochromator feed with tungsten across the spec and note the pixels every 10nm or so. Now do this for 20 different specs and determine the regression for each. Now do a regression on the curves the coefficients describe themselves to find a common curve for the detectors in general. A little linear algebra matrix could do this. It might only be good within 2nm or so but it would give an instant starting point for this class of spec.
 
Last edited:

chloderic

Active member
Joined
Jan 21, 2018
Messages
300
Points
43
https://terpconnect.umd.edu/~toh/models/CalibrationCurve.html

This is a nice resource. The regression curves we use are fine but no reason not to see other calibration curve regression methods.
yes so it is, in the region of my spectral interest the 3th polynominal we discuss about is around 1.2nm beside what it should be, and that in the place i set a known calibration point. That means more than 42/cm-1 shifterror that is to much ....
If i say XXXnm = YYY-pixel in the calculation of the regression curve, i expect NOT, that after calibrating it is XXX+1.2nm at exact this point!
 

paul1598419

Well-known member
Joined
Sep 20, 2013
Messages
14,591
Points
113
The third polynomial regression has worked fine for calibrating spectrometers for a long time now. If you are having problems with fitting the curve, it might be an astigmatism of the light hitting the CCD. As long as your alignment is spot on, this should work for your purposes.
 

chloderic

Active member
Joined
Jan 21, 2018
Messages
300
Points
43
The third polynomial regression has worked fine for calibrating spectrometers for a long time now. If you are having problems with fitting the curve, it might be an astigmatism of the light hitting the CCD. As long as your alignment is spot on, this should work for your purposes.
Yes sir, I'm afraid of that, i have to try an other of this devices.
 

kecked

Active member
Joined
Jun 18, 2012
Messages
308
Points
28
I hit a wall trying to calibrate after moving the grating. I am afraid I messed up the alignment. Is there a how to for aligning a spec? I see a line and it cuts the active area of the detector. It looks straight up and down and is a sharp line. I did have to move the concave mirror to make the line hit the detector in the right place. I did not move the slit or the first mirror so it can only be the concave or the grating I messed up. Was trying to shift the wavelength to the NIR and was then going to do second into the 400 range. At this point no reason not to try different gratings. i also notice the spectrum is not as distinct as it was. The peaks are wider for the neon calibration. I see 25-30 neon lines now.
 

chloderic

Active member
Joined
Jan 21, 2018
Messages
300
Points
43
I hit a wall trying to calibrate after moving the grating. I am afraid I messed up the alignment. Is there a how to for aligning a spec? I see a line and it cuts the active area of the detector. It looks straight up and down and is a sharp line. I did have to move the concave mirror to make the line hit the detector in the right place. I did not move the slit or the first mirror so it can only be the concave or the grating I messed up. Was trying to shift the wavelength to the NIR and was then going to do second into the 400 range. At this point no reason not to try different gratings. i also notice the spectrum is not as distinct as it was. The peaks are wider for the neon calibration. I see 25-30 neon lines now.
Could you please post a picture of what you see ?
 

chloderic

Active member
Joined
Jan 21, 2018
Messages
300
Points
43
Hi, because of some personal trouble it is a few weeks ago that I could post something here.
But now something ...

I found on ebay classifieds for 5 euros a xenon plasma tube, which can be used very well for calibration.
A He-NE tube and other emission lamps also light up when approaching without any further voltage sources and can then be used as spectral sources.
 

Attachments





Top