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) orregister_tracer(a tracer class) and select it inconfig.callbacks; those do not attach it to every simulation. For development and testing, usesim.initialize_sample_callback(...)or an explicitCallbackMixinbundle withbundle.apply_callback_functions(sim). Calls emitDeprecationWarning.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_samplewith 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.