Measurement type within estimator

Hey there,

I am retrieving the EstimatedMeasurement objects from a batch least square estimator, coming from a mixed pool of observations. Is there a proper way to understand which object is what? Right now I’m inferring the type from the size of GetObservedValue, but this is not enough to discriminate between AngularRaDec and AngularAzEl for example. I would appreciate being able to retrieve the class of the original measurement given to the estimator. Should I try casting until I get lucky?


Hi Romain,

Maybe you could try using isInstance(…) method of Python inside if statements in order to have something close to have something close to what we do in the tutorials to compute residual statistics.


Hi Bryan,

Well done guessing this was about the Python wrapper :wink:
I just edited the category accordingly, sorry for the wrong original tag

Actually I already tried the Python’s isinstance method, but it does not work, as we know the Python wrapper has difficulties coping with multiple inheritances from Java.
In the end, what works is as I expected try casting the ObservedMeasurement (not the EstimatedMeasurement) into the different candidates, until not catching a TypeError!
If someone has something more elegant, please drop it here.


Hi @Serrof,

Unfortunately, I don’t…

However, for a future version, it could be possible to add a method getMeasurementType that would return the type of the measurement as a String.
It would then be much easier to understand which object an EstimatedMeasurement represents.

What do you think ?


+1 for having this method. Maybe the String could be the name of the class (e.g., “Range” for Range, “RangeRate” for RangeRate, etc.)


Yes, I made a very quick test with the OD tutorial and just adding the following default method in ComparableMeasurement class does the job:

default String getMeasurementType() {
        return this.getClass().getSimpleName();

However I’m not sure that using getClass in an interface is a Java good practice…

I would say, it depends on the situation. In that case, it is to retrieve the name of the class. For me, it’s not a bad practice for this specific case. Moreover, if it helps our python users, it confirms that in this case it is not a bad practice.

getClass() is used in orekit to access the name of the Earth’s potential loaders.


Ok thanks Bryan.

On that occasion we can get rid of some of the instanceof that lurk in the code, tests and tutorials.

@Serrof what’s your opinion about this ?
If you’re ok with this would you like to open an issue on the forge ?

Hi Bryan and Maxime,

I think that’s a good idea.
I will create the issue as soon as I have a bit more time (probably next week).


Hi all,
This feature is really good for python using.
What I am done is like the followings:

observedMeasurement = estimated.getObservedMeasurement()
if 'Range' in str(observedMeasurement)
1 Like

Good idea @lirw1984, thanks for the tip.

I still think we could add a built-in “clean” method to get the type of measurement though.

Yes, I agree. The built-in method is a much better solution.