LegForecastTracer

class passengersim.tracers.forecasts.LegForecastTracer(leg_ids: list[int])[source]

Bases: _ForecastTracer

A per-sample tracer that records the forecasts for specified legs.

This will generally be called as a begin-sample callback, so that it records the forecasts at the start of each sample.

Methods

__init__(leg_ids)

attach(sim)

Attach this tracer to a Simulation, which will be traced as it runs.

finalize()

Convert the internal counters on this tracer to a dataframe.

fresh()

Return a fresh copy of this tracer, tracing the same targets but not sharing state.

reset()

Reset the internal counters on this tracer to a null state.

Attributes

hook

Lifecycle hook shared by manual and configured attachment.

name

Canonical result key in callback_data.

options_version

Configured-callback implementation version; bump when results change meaning.

name : str = 'selected_leg_forecasts'

Canonical result key in callback_data.

options_model

Configured-callback options; fields mirror the constructor.

alias of LegForecastTracerOptions

attach(sim: Simulation) → None

Attach this tracer to a Simulation, which will be traced as it runs.

finalize() → DataFrame

Convert the internal counters on this tracer to a dataframe.

fresh() → _ForecastTracer

Return a fresh copy of this tracer, tracing the same targets but not sharing state.

hook : ClassVar[Literal['begin_sample', 'daily', 'end_sample']] = 'begin_sample'

Lifecycle hook shared by manual and configured attachment.

options_version : ClassVar[str] = '1'

Configured-callback implementation version; bump when results change meaning.

reset() → None

Reset the internal counters on this tracer to a null state.