Estimate only a selection of orbital parameters with the BatchLeastSquareEstimator

Hello everyone,
First of all, I would like to thank you for the great new orbit determination and estimation features in Orekit 11, it is really helpful !
Lately, we have been encountering this error when trying to estimate only a selection of orbital parameters with the BatchLeastSquareEstimator :

java.lang.IndexOutOfBoundsException: Index: 1, Size: 1

	at java.util.ArrayList.rangeCheck(
	at java.util.ArrayList.get(
	at java.util.Collections$UnmodifiableList.get(
	at org.orekit.estimation.leastsquares.AbstractBatchLSModel.fetchEvaluatedMeasurement(
	at org.orekit.estimation.leastsquares.MeasurementHandler.handleStep(
	at org.orekit.propagation.PropagatorsParallelizer$SinglePropagatorHandler.handleStep(
	at org.orekit.propagation.integration.AbstractIntegratedPropagator$AdaptedStepHandler.handleStep(

It happens when estimating only the semi-major axis for example.
Here is the test that is inspired from the BatchLSEstimatorTest to reproduce this issue:

public void testEstimateOnlyOneOrbitalParameter() {

        Context context = EstimationTestUtils.eccentricContext("regular-data:potential:tides");

        final NumericalPropagatorBuilder propagatorBuilder =
                context.createBuilder(OrbitType.KEPLERIAN, PositionAngle.TRUE, true,
                                      1.0e-6, 60.0, 1.0);

        // create perfect PV measurements
        final Propagator propagator = EstimationTestUtils.createPropagator(context.initialOrbit,
        final List<ObservedMeasurement<?>> measurements =
                                                       new PVMeasurementCreator(),
                                                       0.0, 1.0, 300.0);

        // select only the first orbital parameter
        boolean[] orbitalParametersEstimated = new boolean[]{true, false, false, false, false, false};
        List<ParameterDriversList.DelegatingDriver> orbitalElementsDrivers = propagatorBuilder.getOrbitalParametersDrivers().getDrivers();
        IntStream.range(0, orbitalParametersEstimated.length).forEach(i -> orbitalElementsDrivers.get(i).setSelected(orbitalParametersEstimated[i]));

        //create the estimator
        final BatchLSEstimator estimator = new BatchLSEstimator(new LevenbergMarquardtOptimizer(),
        for (final ObservedMeasurement<?> measurement : measurements) {

I was wondering if it comes not from line 462 of the class AbstractBatchLSModel class (fetchEvaluatedMeasurement method) :

for (int j = 0; j < dMdY0.getColumnDimension(); ++j) {
                        final ParameterDriver driver = selectedOrbitalDrivers.getDrivers().get(j);

dMdY0.getColumnDimension() seems to be always equals to 6, which is not necessarily the case of the number of selected orbital drivers … Or maybe we should always estimate the six parameters at a time ?
Thanks in advance for your help,
Have a good day!

You are right, there is a dimension problem here.
I think dMdY0 should still have 6 columns because the MatricesHarvester always provides a complete matrices, it has no clue about how these matrices will be used. What should be done however is that we should check which columns to use and which columns to ignore, depending on estimated parameters.

As selectedOrbitalDrivers already has filtered out the selected coefficients, we have to find some mapping between the selected ones and the columns indexes. If for example we estimate a and i in a Keplerian orbit, we have to parameters and we should extract columns 0 and 2, ignoring columns 1, 3, 4 and 5.

1 Like

Hi Luc,
Thank you very much for your quick answser ! I could create an issue in gitlab if you agree.
We keep on validating our product with the 11.1.2 version meanwhile.
Good evening.

Yes, go ahead creating an issue for this.

Thank you, the issue #928 has been created in Gitlab.

Have a good day!