gds_sim.compat¶
cadCAD signature detection and adaptation helpers.
Auto-detect and wrap cadCAD-style function signatures.
cadCAD policies have 4 positional args
(params, substep, state_history, previous_state) -> Signal
cadCAD state update functions have 5 positional args
(params, substep, state_history, previous_state, policy_input) -> (key, val)
gds-sim native signatures
policy: (state, params, kw) -> Signal suf: (state, params, signal=, kw) -> (key, val)
Detection runs once at Model construction time — zero cost in the hot loop.
adapt_policy(fn)
¶
Wrap a cadCAD 4-arg policy to the gds-sim signature, or pass through.
Source code in packages/gds-sim/gds_sim/compat.py
adapt_suf(fn)
¶
Wrap a cadCAD 5-arg SUF to the gds-sim signature, or pass through.