This is how I implemented Clayton's algorithm
static public class Clayton1987PeakStripping extends PeakStripping {
public Clayton1987PeakStripping() {
super("Clayton - 1987", "Clayton E, Duerden P, Cohen DD. Nuclear Instrum Methods B22:91, 1987");
}
private final int MAX_ITERATIONS = 1000;
@Override
protected void initializeDefaultStrategy() {
}
@Override
public ISpectrumData computeBackground(ISpectrumData src) {
final double[] ch = SpectrumUtils.toDoubleArray(src);
double delta = 0.0, delta0 = -Double.MAX_VALUE;
for (int iter = 0; (iter < MAX_ITERATIONS) && (delta > (1.0e-6 * delta0)); ++iter) {
delta = 0.0;
for (int i = ch.length - 2; i >= 1; --i) {
final double m = 0.5 * (ch[i + 1] + ch[i - 1]);
if (ch[i] > m) {
delta += ch[i] - m;
ch[i] = m;
}
}
if (delta0 == -Double.MAX_VALUE)
delta0 = delta;
}
return new DerivedSpectrum.BasicDerivedSpectrum(src, ch, "Clayton[" + src.toString() + "]");
}
}
So it uses a dynamic test to determine the number of iterations.
On the other hand, the mechanism that DTSA-II uses to fit spectra does not depend on the peak being a Gaussian shape so it might work just fine on your spectra.