register_initialize_sample_callback

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

Deprecated global registration for the initialize_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.initialize_sample_callback(...) or an explicit CallbackMixin bundle with bundle.apply_callback_functions(sim). Calls emit DeprecationWarning.

Register a synchronous callback before sample demand generation.

The sample number, random seed, and counters have been initialized, but the new sample’s RM steps have not run. Changes to demand inputs affect this sample. Callbacks run in registration order, with configured callbacks first; event priority does not apply.

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

Callback receiving the simulation. Returned dictionaries are stored under callback_data.initialize_sample with trial/sample keys. Omit it to use this method as a decorator with options.

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.