protected void checkFit( final TLE tle, final double duration, final double stepSize, final double threshold, final boolean positionOnly, final boolean withBStar, final double expectedRMS) throws OrekitException { Propagator p = TLEPropagator.selectExtrapolator(tle); List<SpacecraftState> sample = new ArrayList<SpacecraftState>(); for (double dt = 0; dt < duration; dt += stepSize) { sample.add(p.propagate(tle.getDate().shiftedBy(dt))); } TLEPropagatorBuilder builder = new TLEPropagatorBuilder( tle.getSatelliteNumber(), tle.getClassification(), tle.getLaunchYear(), tle.getLaunchNumber(), tle.getLaunchPiece(), tle.getElementNumber(), tle.getRevolutionNumberAtEpoch()); FiniteDifferencePropagatorConverter fitter = new FiniteDifferencePropagatorConverter(builder, threshold, 1000); if (withBStar) { fitter.convert(sample, positionOnly, TLEPropagatorBuilder.B_STAR); } else { fitter.convert(sample, positionOnly); } TLEPropagator prop = (TLEPropagator) fitter.getAdaptedPropagator(); TLE fitted = prop.getTLE(); Assert.assertEquals(expectedRMS, fitter.getRMS(), 0.001 * expectedRMS); Assert.assertEquals(tle.getSatelliteNumber(), fitted.getSatelliteNumber()); Assert.assertEquals(tle.getClassification(), fitted.getClassification()); Assert.assertEquals(tle.getLaunchYear(), fitted.getLaunchYear()); Assert.assertEquals(tle.getLaunchNumber(), fitted.getLaunchNumber()); Assert.assertEquals(tle.getLaunchPiece(), fitted.getLaunchPiece()); Assert.assertEquals(tle.getElementNumber(), fitted.getElementNumber()); Assert.assertEquals(tle.getRevolutionNumberAtEpoch(), fitted.getRevolutionNumberAtEpoch()); final double eps = 1.0e-5; Assert.assertEquals(tle.getMeanMotion(), fitted.getMeanMotion(), eps * tle.getMeanMotion()); Assert.assertEquals(tle.getE(), fitted.getE(), eps * tle.getE()); Assert.assertEquals(tle.getI(), fitted.getI(), eps * tle.getI()); Assert.assertEquals( tle.getPerigeeArgument(), fitted.getPerigeeArgument(), eps * tle.getPerigeeArgument()); Assert.assertEquals(tle.getRaan(), fitted.getRaan(), eps * tle.getRaan()); Assert.assertEquals(tle.getMeanAnomaly(), fitted.getMeanAnomaly(), eps * tle.getMeanAnomaly()); if (withBStar) { Assert.assertEquals(tle.getBStar(), fitted.getBStar(), eps * tle.getBStar()); } }