MATH-1534: Use value that probably conforms to the original intent.
Thanks to Christoph Läubrich.
This commit is contained in:
parent
52b374d85e
commit
9f17f6de64
|
@ -294,11 +294,10 @@ public class GaussianCurveFitter extends AbstractCurveFitter {
|
||||||
private double[] basicGuess(WeightedObservedPoint[] points) {
|
private double[] basicGuess(WeightedObservedPoint[] points) {
|
||||||
final int maxYIdx = findMaxY(points);
|
final int maxYIdx = findMaxY(points);
|
||||||
final double n = points[maxYIdx].getY();
|
final double n = points[maxYIdx].getY();
|
||||||
final double m = points[maxYIdx].getX();
|
|
||||||
|
|
||||||
double fwhmApprox;
|
double fwhmApprox;
|
||||||
try {
|
try {
|
||||||
final double halfY = n + ((m - n) / 2);
|
final double halfY = 0.5 * n;
|
||||||
final double fwhmX1 = interpolateXAtY(points, maxYIdx, -1, halfY);
|
final double fwhmX1 = interpolateXAtY(points, maxYIdx, -1, halfY);
|
||||||
final double fwhmX2 = interpolateXAtY(points, maxYIdx, 1, halfY);
|
final double fwhmX2 = interpolateXAtY(points, maxYIdx, 1, halfY);
|
||||||
fwhmApprox = fwhmX2 - fwhmX1;
|
fwhmApprox = fwhmX2 - fwhmX1;
|
||||||
|
@ -308,7 +307,7 @@ public class GaussianCurveFitter extends AbstractCurveFitter {
|
||||||
}
|
}
|
||||||
final double s = fwhmApprox / (2 * FastMath.sqrt(2 * FastMath.log(2)));
|
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 };
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue