I am trying to use poliastro to obtain the positions of the propagated spacecraft and the lighting conditions at each position. The documentation in poliastro page shows an example of the shadow function and the event detectors, but some aspects are undocumented and hard to understand.

From the above link

umbra_event = UmbraEvent(orbit, terminal=True)
events = [umbra_event]

tofs = np.arange(0, 600, 30) << u.s
method = CowellPropagator(events=events)
rr, vv = orbit.to_ephem(EpochsArray(orbit.epoch + tofs, method=method)).rv()
    f"The umbral shadow entry time was {umbra_event.last_t} after the orbit's epoch"

The umbral shadow entry time was 524.7274279607626 s after the orbit's epoch

Note: Even though the eclipse events UmbraEvent and PenumbraEvent take the Orbit as input, they are not used in propagation but used only to access some helpful attributes of the orbit.

From UmbraEvent page

 class poliastro.twobody.events.UmbraEvent(orbit, terminal=False, direction=0)¶

    Bases: EclipseEvent

    Detect whether a satellite is in umbra or not.


            orbit (poliastro.twobody.orbit.Orbit) – Orbit of the satellite.

            terminal (bool, optional) – Whether to terminate integration when the event occurs, defaults to False.

            direction (float, optional) – Handle triggering of event based on whether entry is into or out of umbra, defaults to 0, i.e., event is triggered at both, entry and exit points.
  1. The detector identifies both entry and exit events by default (direction =0 ). How can I differentiate between an entry and exit event in that context?
  2. The documentation does not specify the value needed for direction to detect only entry or exit events. Through experimentation I figured it accepts -1 and +1, but which is entry and exit is still unknown.
  3. The shadow function demonstrated is not explained in regards to the units shown and the output value range. I get both negative and positive values, in the range -9e6 ... 2e6 , but I can find no indication of how I can translate this to a binary light/no light condition.
  • $\begingroup$ As an alternative, the source code for Vallado's book also has a "shadow" implementation. The link below has the source in a few languages, and if you search around, you should be able to find unofficial source in most popular languages. celestrak.org/software/vallado-sw.php $\endgroup$ Nov 21, 2023 at 14:13


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.