PathForecastTracer¶
- class passengersim.tracers.forecasts.PathForecastTracer(path_ids: list[int])[source]¶
Bases:
_ForecastTracerA per-sample tracer that records the forecasts for specified paths.
This will generally be called as a begin-sample callback, so that it records the forecasts at the start of each sample.
Alongside the forecasts, this records the adjusted fare for each booking class and timeframe, in the
adjusted_pricecolumns. The forecasting steps compute adjusted fares for every timeframe at the first DCP, just before this callback runs, so one snapshot per sample matches the values the database records at each DCP. An RM step that changes adjusted fares later in a sample would not be reflected here.Methods
__init__(path_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
Lifecycle hook shared by manual and configured attachment.
Canonical result key in
callback_data.Configured-callback implementation version; bump when results change meaning.
-
name : str =
'selected_path_forecasts'¶ Canonical result key in
callback_data.
- options_model¶
Configured-callback options; fields mirror the constructor.
alias of
PathForecastTracerOptions
- 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.
-
name : str =