register_end_sample_callback

passengersim.callbacks.register_end_sample_callback(callback: Callable[[CallbackMixin], dict | None] | GenericTracer | None = None, *, priority: int | None = None, skip_burn: bool | None = None, name: str | None = None) → Callable[[CallbackMixin], dict | None] | GenericTracer

Deprecated global registration for the end_sample hook.

For a reusable callback, register it with register_callback (a function) or register_tracer (a tracer class) and select it in config.callbacks; those do not attach it to every simulation. For development and testing, use sim.end_sample_callback(...) or an explicit CallbackMixin bundle with bundle.apply_callback_functions(sim). Calls emit DeprecationWarning.

Register a function to be triggered at the end of each sample.

The callback function will be triggered before counters are reset or history buffers are rolled over.

It runs at an offset, in seconds, from the trigger time of the final DCP (the day of departure). The offset is the priority option if given, else the callback’s own priority attribute if it has one, and otherwise one second, which is after the final DCP’s RM systems (-1) and bookkeeping (0). A negative priority runs it before that bookkeeping, or, below -1, before the RM systems as well. A priority of zero is not allowed, as for a daily callback.

callbackCallable[[Simulation], dict | None] or GenericTracer, optional

The callback function to register. It should accept a single argument, which will be the Simulation object, and return a dictionary of interesting things to store, or nothing. Omit it to use this method as a decorator with options.

priorityint, optional

Offset in seconds from the final DCP’s trigger time; see above.

skip_burnbool, optional

If True, the callback is not called during burn-in samples.

namestr, optional

Store returned dictionaries under callback_data.<name> instead of the shared hook key; for a tracer, its result name.

Callable or GenericTracer

The callback, or the fresh copy of a tracer. Without callback, a decorator that registers the function it decorates.