Coupling Events with Detector

First off, hi everyone. I am an orekit newbee so sorry if these questions have an obvious solution, but:

Using Conda install (recently) w/orekit 12.0.1 and python

Consider the following scenario: Propagating a satellite and finding the AOS+LOS times of several ground stations (TopocentricFrame) using ElevationDetector.


  1. If only using the EventsLogger and iterating through events after propagation, how do I identify the ElevationDetector involved in the event? The event.getEventDetector() method returns an object with different id than the originally created ElevationDetector.
  2. Using EventHandler.eventOccurred() should return an Action, but I cannot find the python definition? I found the correct import in the examples, but I have problem making it work:
class TestHandler(EventHandler):
   # Without __init__() orekit throws NotImplementedError: ('instantiating java class', <class '<...>.TestHandler'>)
   def __init__(self):

   def eventOccurred(self, s: SpacecraftState, detector: EventDetector, increasing: bool):
       print(f"Event: {increasing}")
       return Action.CONTINUE

# Adding the event handler using this:
ed = (ElevationDetector(site.frame).

I get the following error:

orekit.JavaError: <super: <class 'JavaError'>, <JavaError object>>
    Java stacktrace:
        at org.orekit.propagation.analytical.AbstractAnalyticalPropagator.propagate(

Hi and welcome to orekit!

It is indeed not obvious. To subclass java classes in Python one needs to use some specially designed classes for this, that is prepared in the orekit python wrapper. These are named the same, but with a Python added in front, so you should subclass PythonEventHandler.

You will also need to implement all methods that are exposed to python in that class, you can see an example at python_files/test/ · master · Orekit Labs / Orekit Python Wrapper · GitLab