LegBidPriceVectorTracer¶
-
class passengersim.tracers.bid_price.LegBidPriceVectorTracer(leg_ids: list[int], *, priority: int =
2)[source]¶ Bases:
GenericTracerA daily tracer that records the entire bid-price vector for specified legs.
At each day prior to departure, the current bid-price vector (one entry per seats-sold level) is captured for each tracked leg and accumulated using a Welford online estimator.
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 vector data to empty Welford accumulators.
Attributes
Identifier used to store results in
SimulationTables.callback_data.Nested mapping of leg-ID → days-prior → Welford accumulator over the bid-price vector.
-
name : str =
'leg_bid_price_vectors'¶ Identifier used to store results in
SimulationTables.callback_data.
- bid_price_vectors : dict[int, dict[int, Welford]]¶
Nested mapping of leg-ID → days-prior → Welford accumulator over the bid-price vector.
- fresh() LegBidPriceVectorTracer[source]¶
Return a new, empty tracer of the same type and configuration.
- Returns:
LegBidPriceVectorTracer – A freshly initialised tracer with the same leg IDs and priority but no accumulated data.
- attach(sim: Simulation) None[source]¶
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[source]¶
Aggregate accumulated Welford statistics into a tidy DataFrame.
- Returns:
pd.DataFrame – A DataFrame indexed by
(leg_id, days_prior, SeatsSold)with a single column containing the mean bid price at each cell. The DataFrame attrsn_trialsandaggregation_processare set for downstream aggregation.