NotImplementedError when trying to use Orbit class

Hi,

I am using the orekit python wrapper in Anaconda (Spider version=5.1.5, Python version=3.8.12). I am trying to generate an Orbit object in order to use it for numerical orbit determination.

Although the arguments seem to be correctly defined to me,

pv
Out[2]: <TimeStampedPVCoordinates: {2022-02-28T01:01:01.000, P(7246501.833749097, -6629344.953026285, -379029.58411002025), V(239.41055302605602, 8.121210084076568, 5793.972294831995), A(-3.042118686204863, 2.7830331171467266, 0.15911856628444881)}>

OrekitFrame
Out[3]: <FactoryManagedFrame: EME2000>

mu
Out[4]: 398600441800000.0

when I write

orbit = Orbit(pv, OrekitFrame, mu)

I receive the following error:

NotImplementedError: ('instantiating java class', <class 'org.orekit.orbits.Orbit'>)

I do not understand what I could be doing wrong, do you think I am making some silly mistake or could it be something related to the Java - Python interface?

Thank you again forum for your invaluable help.

Hi @marc,

In Java the Orbit class is abstract and its constructor protected.
So you cannot instantiate it like that (in Java and Python), you have to chose either CartesianOrbit, KeplerianOrbit, EquinoctialOrbit or CircularOrbit.

Given that your inputs are PVs I would recommend using

orbit = CartesianOrbit(pv, OrekitFrame, mu)

I admit that the error thrown by Python (probably from JCC?) is not super helpful.

Hope this helps,
Maxime

Thank you a lot @MaximeJ. I just did as you said and it works perfectly.

NotImplementedError is an exception that is raised when a method or function is not implemented, or when a subclass does not implement an abstract method from its parent class. This exception can be raised intentionally to signal that the functionality is not yet implemented, or it can be raised accidentally due to a coding mistake.

Check if the method or function is intentionally not implemented: If the NotImplementedError is raised intentionally, you can leave the method or function as is, or provide a placeholder implementation that raises the NotImplementedError. However, if the NotImplementedError is raised accidentally, you need to provide a proper implementation.

If you are dealing with an python abstract method, you can either provide a concrete implementation for the method in the subclass, or mark the subclass as abstract and force its children to implement the method.