Use new API.

This commit is contained in:
Gilles Sadowski 2021-05-27 04:49:32 +02:00
parent 0e81847e45
commit 0466b29f83
1 changed files with 4 additions and 4 deletions

View File

@ -53,7 +53,7 @@ public class HarmonicCurveFitterTest {
final double[] fitted = fitter.fit(points.toList()); final double[] fitted = fitter.fit(points.toList());
Assert.assertEquals(a, fitted[0], 1.0e-13); Assert.assertEquals(a, fitted[0], 1.0e-13);
Assert.assertEquals(w, fitted[1], 1.0e-13); Assert.assertEquals(w, fitted[1], 1.0e-13);
Assert.assertEquals(p, PlaneAngleRadians.normalize(fitted[2], p), 1e-13); Assert.assertEquals(p, PlaneAngleRadians.normalizer(p).applyAsDouble(fitted[2]), 1e-13);
final HarmonicOscillator ff = new HarmonicOscillator(fitted[0], fitted[1], fitted[2]); final HarmonicOscillator ff = new HarmonicOscillator(fitted[0], fitted[1], fitted[2]);
for (double x = -1.0; x < 1.0; x += 0.01) { for (double x = -1.0; x < 1.0; x += 0.01) {
@ -78,7 +78,7 @@ public class HarmonicCurveFitterTest {
final double[] fitted = fitter.fit(points.toList()); final double[] fitted = fitter.fit(points.toList());
Assert.assertEquals(a, fitted[0], 7.6e-4); Assert.assertEquals(a, fitted[0], 7.6e-4);
Assert.assertEquals(w, fitted[1], 2.7e-3); Assert.assertEquals(w, fitted[1], 2.7e-3);
Assert.assertEquals(p, PlaneAngleRadians.normalize(fitted[2], p), 1.3e-2); Assert.assertEquals(p, PlaneAngleRadians.normalizer(p).applyAsDouble(fitted[2]), 1.3e-2);
} }
@Test @Test
@ -115,7 +115,7 @@ public class HarmonicCurveFitterTest {
final double[] fitted = fitter.fit(points.toList()); final double[] fitted = fitter.fit(points.toList());
Assert.assertEquals(a, fitted[0], 1.2e-3); Assert.assertEquals(a, fitted[0], 1.2e-3);
Assert.assertEquals(w, fitted[1], 3.3e-3); Assert.assertEquals(w, fitted[1], 3.3e-3);
Assert.assertEquals(p, PlaneAngleRadians.normalize(fitted[2], p), 1.7e-2); Assert.assertEquals(p, PlaneAngleRadians.normalizer(p).applyAsDouble(fitted[2]), 1.7e-2);
} }
@Test @Test
@ -157,7 +157,7 @@ public class HarmonicCurveFitterTest {
final double[] fitted = fitter.fit(points.toList()); final double[] fitted = fitter.fit(points.toList());
Assert.assertEquals(a, fitted[0], 7.6e-4); Assert.assertEquals(a, fitted[0], 7.6e-4);
Assert.assertEquals(w, fitted[1], 3.5e-3); Assert.assertEquals(w, fitted[1], 3.5e-3);
Assert.assertEquals(p, PlaneAngleRadians.normalize(fitted[2], p), 1.5e-2); Assert.assertEquals(p, PlaneAngleRadians.normalizer(p).applyAsDouble(fitted[2]), 1.5e-2);
} }
@Test(expected=MathIllegalStateException.class) @Test(expected=MathIllegalStateException.class)