use of org.orekit.errors.OrekitExceptionWrapper in project Orekit by CS-SI.
the class JacobianPropagatorConverter method getModel.
/**
* {@inheritDoc}
*/
protected MultivariateJacobianFunction getModel() {
return new MultivariateJacobianFunction() {
/**
* {@inheritDoc}
*/
public Pair<RealVector, RealMatrix> value(final RealVector point) throws IllegalArgumentException, OrekitExceptionWrapper {
try {
final RealVector value = new ArrayRealVector(getTargetSize());
final RealMatrix jacobian = MatrixUtils.createRealMatrix(getTargetSize(), point.getDimension());
final NumericalPropagator prop = builder.buildPropagator(point.toArray());
final int stateSize = isOnlyPosition() ? 3 : 6;
final ParameterDriversList orbitalParameters = builder.getOrbitalParametersDrivers();
final PartialDerivativesEquations pde = new PartialDerivativesEquations("pde", prop);
final ParameterDriversList propagationParameters = pde.getSelectedParameters();
prop.setInitialState(pde.setInitialJacobians(prop.getInitialState()));
final JacobiansMapper mapper = pde.getMapper();
final List<SpacecraftState> sample = getSample();
for (int i = 0; i < sample.size(); ++i) {
final int row = i * stateSize;
if (prop.getInitialState().getDate().equals(sample.get(i).getDate())) {
// use initial state and Jacobians
fillRows(value, jacobian, row, prop.getInitialState(), stateSize, orbitalParameters, propagationParameters, mapper);
} else {
// use a date detector to pick up state and Jacobians
prop.addEventDetector(new DateDetector(sample.get(i).getDate()).withHandler(new EventHandler<DateDetector>() {
/**
* {@inheritDoc}
*/
@Override
public Action eventOccurred(final SpacecraftState state, final DateDetector detector, final boolean increasing) throws OrekitException {
fillRows(value, jacobian, row, state, stateSize, orbitalParameters, propagationParameters, mapper);
return row + stateSize >= getTargetSize() ? Action.STOP : Action.CONTINUE;
}
}));
}
}
prop.propagate(sample.get(sample.size() - 1).getDate().shiftedBy(10.0));
return new Pair<RealVector, RealMatrix>(value, jacobian);
} catch (OrekitException ex) {
throw new OrekitExceptionWrapper(ex);
}
}
};
}
use of org.orekit.errors.OrekitExceptionWrapper in project Orekit by CS-SI.
the class FieldIntegratedEphemeris method basicPropagate.
/**
* {@inheritDoc}
*/
@Override
protected FieldSpacecraftState<T> basicPropagate(final FieldAbsoluteDate<T> date) throws OrekitException {
try {
final FieldODEStateAndDerivative<T> os = getInterpolatedState(date);
FieldSpacecraftState<T> state = mapper.mapArrayToState(mapper.mapDoubleToDate(os.getTime(), date), os.getPrimaryState(), os.getPrimaryDerivative(), meanFieldOrbit);
for (Map.Entry<String, T[]> initial : unmanaged.entrySet()) {
state = state.addAdditionalState(initial.getKey(), initial.getValue());
}
return state;
} catch (OrekitExceptionWrapper oew) {
throw new OrekitException(oew.getException());
}
}
use of org.orekit.errors.OrekitExceptionWrapper in project Orekit by CS-SI.
the class IntegratedEphemeris method basicPropagate.
/**
* {@inheritDoc}
*/
@Override
protected SpacecraftState basicPropagate(final AbsoluteDate date) throws OrekitException {
try {
final ODEStateAndDerivative os = getInterpolatedState(date);
SpacecraftState state = mapper.mapArrayToState(mapper.mapDoubleToDate(os.getTime(), date), os.getPrimaryState(), os.getPrimaryDerivative(), meanOrbit);
for (Map.Entry<String, double[]> initial : unmanaged.entrySet()) {
state = state.addAdditionalState(initial.getKey(), initial.getValue());
}
return state;
} catch (OrekitExceptionWrapper oew) {
throw oew.getException();
}
}
use of org.orekit.errors.OrekitExceptionWrapper in project Orekit by CS-SI.
the class Model method value.
/**
* {@inheritDoc}
*/
@Override
public Pair<RealVector, RealMatrix> value(final RealVector point) throws OrekitExceptionWrapper {
try {
// Set up the propagators parallelizer
final NumericalPropagator[] propagators = createPropagators(point);
final Orbit[] orbits = new Orbit[propagators.length];
for (int i = 0; i < propagators.length; ++i) {
mappers[i] = configureDerivatives(propagators[i]);
orbits[i] = propagators[i].getInitialState().getOrbit();
}
final PropagatorsParallelizer parallelizer = new PropagatorsParallelizer(Arrays.asList(propagators), configureMeasurements(point));
// Reset value and Jacobian
evaluations.clear();
value.set(0.0);
for (int i = 0; i < jacobian.getRowDimension(); ++i) {
for (int j = 0; j < jacobian.getColumnDimension(); ++j) {
jacobian.setEntry(i, j, 0.0);
}
}
// Run the propagation, gathering residuals on the fly
if (forwardPropagation) {
// Propagate forward from firstDate
parallelizer.propagate(firstDate.shiftedBy(-1.0), lastDate.shiftedBy(+1.0));
} else {
// Propagate backward from lastDate
parallelizer.propagate(lastDate.shiftedBy(+1.0), firstDate.shiftedBy(-1.0));
}
observer.modelCalled(orbits, evaluations);
return new Pair<RealVector, RealMatrix>(value, jacobian);
} catch (OrekitException oe) {
throw new OrekitExceptionWrapper(oe);
}
}
use of org.orekit.errors.OrekitExceptionWrapper in project Orekit by CS-SI.
the class Model method getInnovation.
/**
* {@inheritDoc}
*/
@Override
public RealVector getInnovation(final MeasurementDecorator measurement, final NonLinearEvolution evolution, final RealMatrix innovationCovarianceMatrix) throws OrekitExceptionWrapper {
try {
// Apply the dynamic outlier filter, if it exists
applyDynamicOutlierFilter(predictedMeasurement, innovationCovarianceMatrix);
if (predictedMeasurement.getStatus() == EstimatedMeasurement.Status.REJECTED) {
// set innovation to null to notify filter measurement is rejected
return null;
} else {
// Normalized innovation of the measurement (Nx1)
final double[] observed = predictedMeasurement.getObservedMeasurement().getObservedValue();
final double[] estimated = predictedMeasurement.getEstimatedValue();
final double[] sigma = predictedMeasurement.getObservedMeasurement().getTheoreticalStandardDeviation();
final double[] residuals = new double[observed.length];
for (int i = 0; i < observed.length; i++) {
residuals[i] = (observed[i] - estimated[i]) / sigma[i];
}
return MatrixUtils.createRealVector(residuals);
}
} catch (OrekitException oe) {
throw new OrekitExceptionWrapper(oe);
}
}
Aggregations