MATH-1534: Use value that probably conforms to the original intent.

Thanks to Christoph Läubrich.
This commit is contained in:
Gilles Sadowski 2020-05-27 01:52:14 +02:00
parent 52b374d85e
commit 9f17f6de64
1 changed files with 2 additions and 3 deletions

View File

@ -294,11 +294,10 @@ public class GaussianCurveFitter extends AbstractCurveFitter {
private double[] basicGuess(WeightedObservedPoint[] points) {
final int maxYIdx = findMaxY(points);
final double n = points[maxYIdx].getY();
final double m = points[maxYIdx].getX();
double fwhmApprox;
try {
final double halfY = n + ((m - n) / 2);
final double halfY = 0.5 * n;
final double fwhmX1 = interpolateXAtY(points, maxYIdx, -1, halfY);
final double fwhmX2 = interpolateXAtY(points, maxYIdx, 1, halfY);
fwhmApprox = fwhmX2 - fwhmX1;
@ -308,7 +307,7 @@ public class GaussianCurveFitter extends AbstractCurveFitter {
}
final double s = fwhmApprox / (2 * FastMath.sqrt(2 * FastMath.log(2)));
return new double[] { n, m, s };
return new double[] { n, points[maxYIdx].getX(), s };
}
/**