Measurement derivatives with respect to a ParameterDriver with several spans are always attributed to the first span

Hi,

I might have found a bug in the estimation of ParameterDrivers for measurements with multiple spans.

I’m using OneWayGNSSRange but I think the issue affects other types as well. I was trying to estimate a receiver clock offset with multiple spans. It seems that the derivatives are always attributed to the first span, which means that only the first span can actually be estimated.

I think this behavior can be traced to getValue() in ParameterDriver: it goes through every span, but the index in the result does not depend on the input date, and is apparently the index of the first span containing data.

    public Gradient getValue(final int freeParameters, final Map<String, Integer> indices, final AbsoluteDate date) {
        Integer index = null;
        for (Span<String> span = nameSpanMap.getFirstSpan(); span != null; span = span.next()) {
            index = indices.get(span.getData());
            if (index != null) {
                break;
            }
        }
        return (index == null) ? Gradient.constant(freeParameters, getValue(date)) : Gradient.variable(freeParameters, index, getValue(date));
    }

I may have misunderstood something though. Also, apparently this code will be refactored in Orekit 14, so it might not be an important bug to fix.

I am attaching a small Python script which reproduces the bug by comparing with a manual finite-difference computation.

Cheers,
Clément

span_derivatives_mre.py (3.1 KB)

Yes, the time spans inside ParameterDriver have been completely removed in 14.0. This is explained in the upgrade instructions here.