CurveFit and getting rid of W_sigma
thomas_braun
Therefore I want the curve fits to be as fast as possible.
Can I somehow tell CurveFit to not create W_sigma? Or use a free wave for that?
My current invocation looks like:
Make/FREE/D/N=2 coefWave
variable V_FitOptions = 4
variable V_FitError = 0
variable V_AbortCode = 0
try
CurveFit/Q/N=1/NTHR=1/M=0/W=2 line, kwCWave=coefWave, data[startRow,endRow][1][10]/X=data[startRow,endRow][0][3]/AD=0/AR=0; AbortOnRTE
catch
....
endtry
variable V_FitOptions = 4
variable V_FitError = 0
variable V_AbortCode = 0
try
CurveFit/Q/N=1/NTHR=1/M=0/W=2 line, kwCWave=coefWave, data[startRow,endRow][1][10]/X=data[startRow,endRow][0][3]/AD=0/AR=0; AbortOnRTE
catch
....
endtry
I know that not looking at W_sigma in a fit is usually not a clever thing to do ;)
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
February 2, 2015 at 01:53 pm - Permalink
Maybe you could instead speed things up by providing a better initial guess for the fit -- possibly using the previous W_coef wave?
February 3, 2015 at 12:32 am - Permalink
But you're also correct that the all the info needed to create the sigma wave is needed to do the fit, so the only saving would be in not creating the wave itself. If you are working in a datafolder with thousands of waves, that might, in fact, be slow. In order to create a new wave, Igor must first make sure you don't already have a wave called W_sigma. That requires walking a linked list of waves in the current data folder; if W_sigma is near the end of a list of thousands of waves, it can take a while.
So in the course of writing that description, I came up with a strategy that would work around it: pre-create a wave called W_sigma *before* you load your data waves into the current datafolder. That way Igor will find W_sigma right away and not have to walk very far.
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
February 3, 2015 at 09:05 am - Permalink
My main motivation was that without W_sigma the databrowser would not have to update after curve fitting.
I don't have thousands of waves in one folder.
I'm doing three of these line fits for every data channel.
Three line fits take, on my dev machine, 0.5ms. I have up to ~24 data channels.
So in the extreme case this takes up to 12ms.
February 4, 2015 at 03:51 am - Permalink
Can you do the timing with the DataBrowser closed?
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
February 5, 2015 at 09:41 am - Permalink
Sorry that was incorrect. I'm calling CurveFit from a background function and then only is the databrowser updating.
It is not updating during function execution.
February 5, 2015 at 02:22 pm - Permalink
Send it to support@wavemetrics.com.
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
February 6, 2015 at 10:22 am - Permalink