Skip to content

Event Results

Classes for accessing and querying detected events after propagation.

DetectedEvent

DetectedEvent()

Information about a detected event.

Contains all information about an event that was detected during propagation, including timing, state, and event metadata.

Attributes:

Name Type Description
window_open Epoch

Start time (entry for periods, event time for instantaneous)

window_close Epoch

End time (exit for periods, same as window_open for instantaneous)

entry_state ndarray

State vector at window_open

exit_state ndarray

State vector at window_close

value float

Event function value at detection

name str

Event detector name

action EventAction

Action taken (STOP or CONTINUE)

event_type EventType

Event type (INSTANTANEOUS or PERIOD)

Example
1
2
3
4
5
6
7
8
9
import brahe as bh

# After propagation with events (requires numerical propagator binding)
# events_detected = propagator.event_log()
# for event in events_detected:
#     print(f"Event '{event.name}' at {event.window_open}")
#     print(f"State: {event.entry_state}")
#     if event.event_type == bh.EventType.WINDOW:
#         print(f"Duration: {event.window_close - event.window_open} seconds")

Initialize instance.

action property

action: EventAction

Action taken (STOP or CONTINUE).

Returns:

Name Type Description
EventAction EventAction

Action taken after event detection

entry_state property

entry_state: ndarray

State vector at window_open.

Returns:

Name Type Description
ndarray ndarray

State at event entry

event_type property

event_type: EventType

Event type (INSTANTANEOUS or PERIOD).

Returns:

Name Type Description
EventType EventType

Type of event

exit_state property

exit_state: ndarray

State vector at window_close.

Returns:

Name Type Description
ndarray ndarray

State at event exit

name property

name: str

Event detector name.

Returns:

Name Type Description
str str

Name of the event detector

value property

value: float

Event function value at detection.

Returns:

Name Type Description
float float

Event function value

window_close property

window_close: Epoch

Window close time (exit for periods, same as window_open for instantaneous).

Returns:

Name Type Description
Epoch Epoch

End time of the event

window_open property

window_open: Epoch

Window open time (entry for periods, event time for instantaneous).

Returns:

Name Type Description
Epoch Epoch

Start time of the event

end_time method descriptor

end_time() -> Epoch

Alias for window_close.

Returns:

Name Type Description
Epoch Epoch

End time of the event

start_time method descriptor

start_time() -> Epoch

Alias for window_open.

Returns:

Name Type Description
Epoch Epoch

Start time of the event

t_end method descriptor

t_end() -> Epoch

Alias for window_close.

Returns:

Name Type Description
Epoch Epoch

End time of the event

t_start method descriptor

t_start() -> Epoch

Alias for window_open.

Returns:

Name Type Description
Epoch Epoch

Start time of the event

EventQuery

EventQuery()

Event query builder for filtering detected events.

Provides chainable filter methods for querying events with an idiomatic Python interface. Filters are applied lazily and can be combined in any order.

Example
import brahe as bh

# After propagation with events
# Get events from detector 0 within a time range
events = prop.query_events() \
    .by_detector_index(0) \
    .in_time_range(start, end) \
    .collect()

# Count events by name pattern
count = prop.query_events() \
    .by_name_contains("Altitude") \
    .count()

# Get first terminal event
event = prop.query_events() \
    .by_action(bh.EventAction.STOP) \
    .first()

Initialize instance.

after method descriptor

after(epoch: Epoch) -> EventQuery

Filter events after epoch (inclusive).

Returns events that occurred at or after the specified epoch.

Parameters:

Name Type Description Default
epoch Epoch

Epoch value (inclusive)

required

Returns:

Name Type Description
EventQuery EventQuery

New query with filter applied (for chaining)

Example
events = prop.query_events().after(cutoff_epoch).collect()

any method descriptor

any() -> bool

Check if any events match the filters.

Returns:

Name Type Description
bool bool

True if at least one event matches all applied filters

Example
if prop.query_events().by_action(bh.EventAction.STOP).any():
    print("Found terminal events")

before method descriptor

before(epoch: Epoch) -> EventQuery

Filter events before epoch (inclusive).

Returns events that occurred at or before the specified epoch.

Parameters:

Name Type Description Default
epoch Epoch

Epoch value (inclusive)

required

Returns:

Name Type Description
EventQuery EventQuery

New query with filter applied (for chaining)

Example
events = prop.query_events().before(cutoff_epoch).collect()

by_action method descriptor

by_action(action: EventAction) -> EventQuery

Filter by event action.

Returns events with the specified action.

Parameters:

Name Type Description Default
action EventAction

Event action to filter by (STOP or CONTINUE)

required

Returns:

Name Type Description
EventQuery EventQuery

New query with filter applied (for chaining)

Example
events = prop.query_events().by_action(bh.EventAction.STOP).collect()

by_detector_index method descriptor

by_detector_index(index: int) -> EventQuery

Filter by detector index.

Returns events detected by the specified detector.

Parameters:

Name Type Description Default
index int

Detector index (0-based, corresponding to add order)

required

Returns:

Name Type Description
EventQuery EventQuery

New query with filter applied (for chaining)

Example
events = prop.query_events().by_detector_index(0).collect()

by_event_type method descriptor

by_event_type(event_type: EventType) -> EventQuery

Filter by event type.

Returns events of the specified type.

Parameters:

Name Type Description Default
event_type EventType

Event type to filter by (INSTANTANEOUS or PERIOD)

required

Returns:

Name Type Description
EventQuery EventQuery

New query with filter applied (for chaining)

Example
events = prop.query_events().by_event_type(bh.EventType.WINDOW).collect()

by_name_contains method descriptor

by_name_contains(substring: str) -> EventQuery

Filter by detector name substring.

Returns events where the detector name contains the given substring.

Parameters:

Name Type Description Default
substring str

Substring to search for in event names

required

Returns:

Name Type Description
EventQuery EventQuery

New query with filter applied (for chaining)

Example
events = prop.query_events().by_name_contains("Altitude").collect()

by_name_exact method descriptor

by_name_exact(name: str) -> EventQuery

Filter by exact detector name.

Returns events where the detector name exactly matches the given string.

Parameters:

Name Type Description Default
name str

Exact name to match

required

Returns:

Name Type Description
EventQuery EventQuery

New query with filter applied (for chaining)

Example
events = prop.query_events().by_name_exact("Altitude Event").collect()

collect method descriptor

collect() -> list[DetectedEvent]

Collect filtered events into a list.

Returns:

Type Description
list[DetectedEvent]

list[DetectedEvent]: List of events matching all applied filters

Example
1
2
3
events = prop.query_events().by_detector_index(0).collect()
for event in events:
    print(f"Event: {event.name}")

count method descriptor

count() -> int

Count filtered events.

Returns:

Name Type Description
int int

Number of events matching all applied filters

Example
count = prop.query_events().by_name_contains("Altitude").count()

first method descriptor

first() -> DetectedEvent

Get the first matching event, if any.

Returns:

Type Description
DetectedEvent

DetectedEvent or None: First event matching all filters, or None if empty

Example
1
2
3
event = prop.query_events().by_action(bh.EventAction.STOP).first()
if event:
    print(f"First terminal event: {event.name}")

in_time_range method descriptor

in_time_range(start: Epoch, end: Epoch) -> EventQuery

Filter by time range (inclusive).

Returns events that occurred within the specified time range.

Parameters:

Name Type Description Default
start Epoch

Start of time range (inclusive)

required
end Epoch

End of time range (inclusive)

required

Returns:

Name Type Description
EventQuery EventQuery

New query with filter applied (for chaining)

Example
events = prop.query_events().in_time_range(start_epoch, end_epoch).collect()

is_empty method descriptor

is_empty() -> bool

Check if the query is empty.

Returns:

Name Type Description
bool bool

True if no events match all applied filters

last method descriptor

last() -> DetectedEvent

Get the last matching event, if any.

Returns:

Type Description
DetectedEvent

DetectedEvent or None: Last event matching all filters, or None if empty

Example
event = prop.query_events().by_detector_index(0).last()

See Also