passengersim.tracers.

segmentation

Database-free tracer for sales and revenue by demand segment and timeframe.

The SegmentationTracer collects the same information as the database-backed segmentation_detail summary table (cumulative sales by carrier, market, booking class and DCP, split by passenger segment), plus realized revenue, without needing the simulation database. It can optionally be limited to a subset of O&D markets and/or carriers, which keeps both run time and memory use small for large networks.

Results are averaged per sample across all (post-burn) samples in all trials, so the final table has no trial dimension. When run with passengersim.MultiSimulation, the per-process results are combined as a sample-weighted mean, giving the same result as a single-process run.

Examples

>>> import passengersim as pax
>>> from passengersim.tracers import SegmentationTracer
>>> sim = pax.Simulation(cfg)
>>> SegmentationTracer(markets=[("BOS", "ORD"), ("ORD", "LAX")]).attach(
...     sim
... )
>>> summary = sim.run()
>>> summary.segmentation_detail_traced
>>> summary.fig_segmentation_detail(metric="revenue")

Classes

SegmentationTracer([markets, carriers, ...])

A daily tracer recording sales and revenue by segment at each DCP.

SegmentationTracerOptions(*[, markets, ...])

Configured-callback options for SegmentationTracer.

Functions

cumulative_to_timeframe(df)

Convert cumulative-through-DCP values into values within each timeframe.

segment_metric_table(source[, metric])

Get cumulative values of one metric with segments as columns.

segmentation_detail_traced(source, *[, ...])

Get the tracer-based segmentation detail table, optionally reshaped.