At present, if a Fit uses all the iterations it’s allowed, it returns “Success” and its best estimate so far of the parameters. If the user is watching carefully, it’s usually possible to detect this as the Progress bar goes all the way to 100%. But from a script there’s no returned “number of iterations used” or warning that the fit might not have converged yet.
In Sequential or batch fitting there ought to be some way to flag those data sets which weren’t successfully fitted so the user can go back and take a closer look at them. Usually the Cost Function will be rather higher than normal, but that may not be a reliable indication.
Should there be a documented list of possible return status values/messages from Fit in addition to “Success”, and exceptions like “Terminated by user” and numeric exceptions raised in the function? Fit library routines elsewhere have a large list of outcomes (depending on the minimiser used).
(As an aside Max iterations = 0 is a handy trick to do the equivalent of “Plot guess” from a script - this should still be available)
Opened an issue to fix that.
Thanks for suggesting CalculateChiSquared and it will come in useful - but as far as I can see from the documentation, it doesn’t generate the xxx_Workspace where the function is evaluated at all the X values of the input workspace using the initial parameter values given in the function.
EvaluateFunction would perhaps be the one I needed in that case.
Another useful side effect of Fit I’ve found is that the xxx_Parameters table is a handy way to parse a user-supplied arbitrary fit function string, and get the names of parameters so I can create a table to put them in, in advance of a main loop processing data.
The reverse parsing operation, taking the xxx_Parameters table from a successful fit and putting them back into an arbitrary fit function for further analysis by CalculateChiSquared, also looks tricky. Should that algorithm have the option to take a Parameters table as input in addition to the function string?