
W_sigma not being updated

DimensionalDifficulties
FuncFit/H="01"/NTHR=0 cloudExpansion W_coefX averagesX /X=averagesXTimes /W=averagesXSigmas
and the sigma for each coefficient associated with the fitting is saved in W_sigma. However, when I call the function again on another wave
FuncFit/NTHR=0 cloudExpansion W_coefY averagesY /Y=averagesYTimes /W=averagesYSigmas
W_sigma still contains exactly the same value as it did after the first fit (even though different fit values are produced, and the data stored in averagesXTimes, averagesYTimes, averagesYSigmas, and averagesXSigmas are all different). The coefficients saved in W_coefY and W_coefX are different, but how can W_sigma not change? If I kill the wave W_sigma before calling the second FuncFit, it is not recreated.
If that's not the explanation, please post a copy of your experiment file so I can investigate.
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
January 20, 2014 at 09:32 am - Permalink
Here is my code:
--Now let's all stay positive, and do some science.
January 20, 2014 at 07:59 pm - Permalink
Make W_sigma
(Igor will make that wave whether you want it or not) and ADDWAVE W_sigma
AFTER the call to FuncFit.It is important that the WAVE statement be after FuncFit- it must be after the wave has been created by FuncFit. To learn why, read this in the Igor help:
DisplayHelpTopic "Wave References"
The explanation starts with the sentence "A Wave statement has both a compile-time and a runtime effect."
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
January 21, 2014 at 09:44 am - Permalink
I read the topic "Wave References", which doesn't explain why I would need to use "WAVE W_sigma" after calls to FuncFit, since I already know the name of the wave that is going to be created. I can just reference it as W_sigma even if I haven't used "WAVE W_sigma", right?
--Now let's all stay positive, and do some science.
January 21, 2014 at 11:01 am - Permalink
Yes, that's what I was recommending.
It does, actually.
No. The WAVE statement has two functions, one at compile time and one at runtime. That's what is described in that help topic.
At compile time, the compiler encounters a name like W_Sigma and it has to know what type of object it is (wave, variable, string) to compile the right kind of code.
At runtime, the WAVE statement actually causes Igor to go look up the wave and store a pointer to the wave in the wave reference. This is why it has to be after FuncFit- the wave doesn't exist (or may be a different wave) before FuncFit runs, so if the WAVE statement is before, then it can't look it up.
Just to confuse the whole issue, there are certain cases where the compiler knows what kind of object is required and will generate the right kind of code even without the WAVE statement. But let's not worry about that detail just yet.
Try to boil down the code to something I can run easily (I don't want to have to load the data set from an external file), make sure the code is copied into the experiment file, and post the file here. I'll try to take a look at it. Guidance is always appreciated in terms of instructions on how to invoke it, initial guesses if it's required, etc.
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
January 21, 2014 at 12:51 pm - Permalink
--Now let's all stay positive, and do some science.
January 21, 2014 at 04:32 pm - Permalink
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
January 22, 2014 at 08:50 am - Permalink