use of gdsc.smlm.fitting.nonlinear.StoppingCriteria in project GDSC-SMLM by aherbert.
the class FitConfiguration method createStoppingCriteria.
/**
* Creates the appropriate stopping criteria for the configuration
*
* @param func
* The Gaussian function
* @param params
* The Gaussian parameters
* @return The stopping criteria
*/
public StoppingCriteria createStoppingCriteria(Gaussian2DFunction func, double[] params) {
StoppingCriteria stoppingCriteria;
if (fitCriteria == FitCriteria.PARAMETERS) {
ParameterStoppingCriteria sc = new ParameterStoppingCriteria(func);
sc.setSignificantDigits(significantDigits);
addPeakRestrictions(func, sc, params);
stoppingCriteria = sc;
} else if (fitCriteria == FitCriteria.COORDINATES) {
GaussianStoppingCriteria sc = new GaussianStoppingCriteria(func);
sc.setDelta(delta);
addPeakRestrictions(func, sc, params);
stoppingCriteria = sc;
} else {
ErrorStoppingCriteria sc = new ErrorStoppingCriteria();
sc.setSignificantDigits(significantDigits);
sc.setAvoidPlateau(fitCriteria == FitCriteria.LEAST_SQUARED_PLUS);
stoppingCriteria = sc;
}
// Removed to reduce verbosity of logging output
//stoppingCriteria.setLog(log);
stoppingCriteria.setMinimumIterations(minIterations);
stoppingCriteria.setMaximumIterations(maxIterations);
return stoppingCriteria;
}
Aggregations