Custom Fitting Procedure
gregorK
I have a question about a custom fitting procedure I am writing. If one uses the built-in fitting, when there is an issue during fit, like parameters could be linearly dependent or a parameter cannot be held fixed and constrained at the same time, one gets some note about these errors. But when using custom fitting with catching any errors by
V_fitError
, etc. these two errors (and maybe other) are cought by a rather general fit error code, which is then not very useful to understand what the issue is during a fit.So I would like to know how to use (mimic) the built-in fitting error warnings (like the two mentioned) in a custom fitting procedure? Are there any codes available that IGOR is using to check on linear dependency, etc. which I could use too in my custom fitting procedure?
Thanks for any help.
Gregor
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
April 19, 2017 at 05:12 pm - Permalink
First of all thanks for the reply. Well, in fact I am already using a try catch around FuncFit, here is part of the code I am using now (I have omitted some of the history printing part of the code and some parameters of FuncFit for clarity, because it is a bit long line)
FuncFit/M=2/NTHR=0/Q/H=fixfit FitProc para_fit_value data_counts /X=data_be /W=data_err /I=1 /D=data_fit /R=data_res /E=para_epsilon /C=limits; AbortOnRTE
AbortOnValue V_FitError, 1
catch
sText = "Error during curve FIT:"
if (V_AbortCode == -4)
Variable CFerror = GetRTError(1)
sText = GetErrMessage(CFerror)
elseif (V_AbortCode == 1)
if ((V_FitError & kAnyError) != 0)
switch (V_FitQuitReason)
case 1:
sText = "Iteration Limit Reached"
break
case 2:
sText = "User Stopped the Fit"
break
case 3:
sText = "Limit of Passes Without Chi-Square Decreasing Reached"
break
endswitch
endif
if ((V_FitError & kSingularMatrix) != 0)
sText = "Singular Matrix encountered"
endif
if ((V_FitError & kOutOfMemory) != 0)
sText = "Out of memory"
endif
if ((V_FitError & kNANorINF) != 0)
sText = "Fit function returned NaN or INF"
endif
if ((V_FitError & kFitFuncStop) != 0)
sText = "Fit function requested stop"
endif
if ((V_FitError & kReentrant) != 0)
sText = "Reentrant curve fitting"
endif
endif
return 1
endtry
The problem is, that the special cases of (nearly) linearly dependent parameters, or parameters being held and constrained (maybe also other) are being caught just as "Error during curve FIT" (see above code), but none of the special purpose variables (V_FitError, V_FitQuitReason, V_AbortCode) are set in a way that these cases could be recognized.
So my question is how can I recognize these special cases of fit errors using a code like the one above?
Thanks again!
Gregor
--
Gregor K
ALOISA Beamline
Elettra Synchrotron
April 20, 2017 at 01:58 am - Permalink
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
April 20, 2017 at 09:49 am - Permalink