Skip to content

Add orbital numbers file parser and Events trimmer

Benoit Seignovert requested to merge 58-events-slicer into main

Added

>>> orbits = read_events('juice.orb')
no. event utc peri event sclk peri ... semi axis
1 2031 JUL 21 20:46:34 1/0288391662.57647 ... -8734123.78
2 2032 FEB 14 14:19:45 1/0306339653.54137 ... 4313415.24

The orbits can be queried by No. values:

>>> orbits[1]  # returns a Event object
no. 1
event utc peri 2031 JUL 21 20:46:34
event sclk peri 1/0288391662.57647
... ...
semi axis -8734123.78

Support for tuple and slice is also implemented:

>>> orbits[2, 4]
no. event utc peri event sclk peri ... semi axis
0 2 2032 FEB 14 14:19:45 1/0306339653.54137 ... 4313415.24
1 4 2032 MAY 10 14:44:53 1/0313771562.20434 ... 2298334.65
>>> orbits[1:2]  # Note: the last element is always included
no. event utc peri event sclk peri ... semi axis
0 1 2031 JUL 21 20:46:34 1/0288391662.57647 ... -8734123.78
1 2 2032 FEB 14 14:19:45 1/0306339653.54137 ... 4313415.24

Therefore it is fairly easy to compute a trajectory for a given orbit number:

>>> traj = tour[orbit[1:2]]  # or tour[orbit[1]:orbit[2]] -> start='2031-07-21T20:46:34' and stop='2032-02-14 14:19:45'
  • Event, EventWindow, EventsList and EventsDict objects can be trimmed with time boundary conditions (#58 (closed)):
>>> event = EventWindow('FOO', t_start='2035-04-01', t_end='2035-07-01')

>>> event.trim(before='2035-05-01')
<EventWindow> FOO (2035-05-01 -> 2035-07-01):
 - t_start: 2035-05-01
 - t_end: 2035-07-01

>>> event.trim(after='2035-06-01')
<EventWindow> FOO (2035-04-01 -> 2035-06-01):
 - t_start: 2035-04-01
 - t_end: 2035-06-01

>>> event.trim(before='2035-05-01', after='2035-06-01')
<EventWindow> FOO (2035-05-01 -> 2035-06-01):
 - t_start: 2035-05-01
 - t_end: 2035-06-01

# trim by Event/EventWindow object
>>> event_bar = EventWindow('BAR', t_start='2035-05-01', t_end='2035-06-01')

>>> event.trim(by_event=event_bar)
<EventWindow> FOO (2035-05-01 -> 2035-06-01):
 - t_start: 2035-05-01
 - t_end: 2035-06-01

# Outside the time window -> return `None`
>>> event.trim(before='2035-08-01')
None

>>> event.trim(after='2035-03-01')
None

In all cases, you get a copy of the event(s) with the same the primary key and properties but with a trimmed start and stop time. The original events are not edited.

Fixes

  • datetime() parser now support NaT/N/A values.

Closes #39 (closed) and #58 (closed)

Edited by Benoit Seignovert

Merge request reports