LegBidPriceTracer¶
-
class passengersim.tracers.bid_price.LegBidPriceTracer(leg_ids: list[int], *, priority: int =
1)[source]¶ Bases:
_BidPriceTracerA daily tracer that records bid prices for specified legs.
At each daily data collection, the current bid price for each tracked leg is captured and accumulated using a Welford online estimator so that the mean and standard deviation across simulation samples can be computed efficiently.
Initialize the tracer.
- Parameters:
Methods
__init__(leg_ids, *[, priority])Initialize the tracer.
attach(sim)Attach a fresh instance of this tracer to sim as a daily callback.
finalize()Aggregate accumulated Welford statistics into a tidy DataFrame.
fresh()Return a new, empty tracer of the same type and configuration.
reset()Reset all accumulated bid-price data to empty Welford accumulators.
Attributes
Identifier used to store results in
SimulationTables.callback_data.Nested mapping of entity-ID → days-prior → Welford accumulator.
-
name : str =
'leg_bid_prices'¶ Identifier used to store results in
SimulationTables.callback_data.
- attach(sim: Simulation) None¶
Attach a fresh instance of this tracer to sim as a daily callback.
- Parameters:
- sim : Simulation¶
The simulation to attach the callback to.
- finalize() DataFrame¶
Aggregate accumulated Welford statistics into a tidy DataFrame.
- Returns:
pd.DataFrame – A DataFrame with a MultiIndex of
(statistic, days_prior)containing mean and sample standard deviation bid prices for each tracked entity. The DataFrame attrsn_trialsandaggregation_processare set for downstream aggregation.
- fresh() _BidPriceTracer¶
Return a new, empty tracer of the same type and configuration.
- Returns:
_BidPriceTracer – A freshly initialized tracer of the same concrete type, with the same IDs and priority but no accumulated data.
- reset() None¶
Reset all accumulated bid-price data to empty Welford accumulators.