Custom BatchLSObserver with Python wrapper

Hello,
I am using the Orekit Python wrapper to do Orbit Determination.
I would like to use a specific implementation of the interface BatchLSObserver.
Is it something that we can do with the Python wrapper ?
Many thanks

Hi @Anthony-C31

Welcome to the Orekit forum!

Did you try to use the PythonBatchLSObserver class? It is the Python wrapper’s equivalent of the BatchLSObserver Orekit class.

You can try something like:

class MyObserver(PythonBatchLSObserver):
    def evaluationPerformed(self, itCounts, 
           evCounts, orbits, orbParams, propParams, 
           measParams, provider, lspEval):
        # Do what you want

Best regards,
Bryan

Thanks for your help.
I can’t find the class PythonBatchLSObserver. Which import shall I do to use it ?

Once the class is created, I suppose I’ll just have to use
estimator.setObserver(MyObserver);
Is that correct ?

Anthony

That’s strange. Looking at the conda-forge package, I can see the PythonBatchLSObserver class in the org.orekit.estimation.leastsquares package.

Yes, it is

Bryan

Unfortunately, I get this error when trying to set the Observer:

estimator.setObserver(od_observer)

orekit.InvalidArgsError: (<class ‘org.orekit.estimation.leastsquares.BatchLSEstimator’>, ‘setObserver’, <class ‘main.od_observer’>)

Could you show me how do you implement and instanciate the observer?

Your reply made me think that I forgot to instantiate the class “od_observer”

I used
estimator.setObserver(od_observer)
instead of
estimator.setObserver(od_observer())

Seems to work now,
Thanks a lot

1 Like

Good :slight_smile: