Wednesday, August 22, 2012

Fit those spectra!!!

Ignoring the continuum normalization (that part of my code still has issues... more on that later) and giving my "data" spectra (yellow) a doppler shift of 15 km/s, SNR (signal-to-noise ration) of 3000, and a line broadening of 0.1:

Before any fitting:

So, what I do in the fitting is I transform the model as if it had been broadened and shifted by some given amount, then evaluate the "likelihood" (this process is the Bayesian methodology that allows minimizing chi squared as a fitting mechanism...) at those values. Then, the Levenburg-Marquardt algorithm finds the highest likelihood value, which should be the correct values of doppler shift and line broadening.

After cross-correlation (to find an initial guess) and Levenburg-Marquardt:
Let's zoom in on that fit:




 What??? I can't see the data, the values for the transformed model are practically the same!! The fit is too good! Where is it? Zoom in further to see the slight discrepancy due to noise:



Fitting algorithm estimates a doppler shift of 14.9999878 (I expected 15) and a line broadening of 0.0999971716 (with no prior information!! I started the line broadening at 0, and expected to get 0.1).

Not bad!


No comments:

Post a Comment