One-step execution#

These helpers perform one native step and accept the shared callback and runtime-input contracts. The model methods retain their chaining return value when pure callback collection is not requested.

step(model, dt=None, *, inputs=None, draws=None, ve=None, extra=None, callbacks=None, loop_hooks=False, callback_state=None, functional_callbacks=None, functional_callback_state=None)[source]#

Advance a Dendra Population or Network by one timestep.

Parameters:
  • model (Population or Network) – Object to advance.

  • dt (float, optional) – Population timestep in milliseconds. For Network objects, the timestep is fixed by network.initialize(dt)/network.build(dt); if dt is provided here it must match network.dt.

  • inputs (dendra.func.Inputs or mapping of str to dendra.func.Inputs, optional) – Deterministic voltage and current frames. A Population consumes one packet; a Network consumes a mapping keyed by exact Population names. Frames pass unchanged to the native method, which validates broadcasting, dtype/device and conflicts with existing stimulation sources.

  • draws (dendra.func.RuntimeDraws, optional) – One explicit native NOISE/SDE frame, including NetStim for a Network. The native method validates and consumes it, publishing its RNG suffixes. Populations and Networks replay solver-owned intra/extra Poisson banks. Mechanism-owned Poisson injections use their fixed native invocation profiles.

  • ve (Tensor, optional) – Population-only precomputed extracellular voltage for this single step.

  • extra (optional) – Extracellular stimulation specification. For populations, this has the same meaning as Population.run(extra=...). For networks, this is the same population-name mapping accepted by Network.run(extra=...).

  • callbacks (sequence of Callback or dendra.func.FunctionalCallbacks, optional) – Native hook sequence, or a pure collection prepared once with dn.func.make_callbacks for this model or a compatible initialized receiver. Observations read receiver state with fixed prepared selections. Population dt must honor prepared cadence and threshold timing; a Network uses its matching initialized timestep and mode. Pure observations run after clock advancement and before native post-step hooks. Native hooks retain their loop/chunk/step timing.

  • loop_hooks (bool, optional) – Whether to call pre_loop_hook and post_loop_hook around the single step.

  • callback_state (dendra.func.FunctionalCallbackState, optional) – Carry from the same prepared collection supplied through callbacks or functional_callbacks. Resumes sampling phase and reducer totals without another initial observation.

  • functional_callbacks (dendra.func.FunctionalCallbacks, optional) – Compatibility spelling for the prepared pure collection. Use it alongside callbacks=[...] to combine native hooks and pure observations. Supply the collection through only one argument.

  • functional_callback_state (dendra.func.FunctionalCallbackState, optional) – Compatibility spelling for callback_state. Supply carry through only one argument; either collection spelling is accepted.

Returns:

The advanced object for chaining when pure observations are omitted. With pure observations, returns their named results and explicit callback carry; simulation state remains on the model.

Return type:

Population, Network or dendra.func.FunctionalCallbackResults

step_population(population, dt=None, *, inputs=None, draws=None, ve=None, extra=None, callbacks=None, loop_hooks=False, callback_state=None, functional_callbacks=None, functional_callback_state=None)[source]#

Advance a Dendra Population by one timestep.

Parameters:
  • population (Population) – Object to advance.

  • dt (float, optional) – Population timestep in milliseconds.

  • inputs (dendra.func.Inputs, optional) – Deterministic extracellular voltage and intracellular current frames. The native method validates broadcasting, dtype/device and stimulation conflicts. Tensor references and gradients are retained.

  • draws (dendra.func.RuntimeDraws, optional) – One explicit NOISE/SDE frame and authoritative RNG suffixes, validated by the native method. Solver-owned intra/extra Poisson waveform banks and mechanism-owned injections consume invocation-indexed draws in native execution order.

  • ve (Tensor, optional) – Precomputed extracellular voltage for this single step.

  • extra (optional) – Extracellular stimulation specification. This has the same meaning as Population.run(extra=...).

  • callbacks (sequence of Callback or dendra.func.FunctionalCallbacks, optional) – Native hook sequence, or a pure collection prepared once with dn.func.make_callbacks for this Population or a compatible initialized receiver. Observations read receiver state with fixed prepared selections. Requested dt must honor prepared cadence and threshold timing. Pure observations run after clock advancement and before native post-step hooks. Native hooks retain their loop/chunk/step timing.

  • loop_hooks (bool, optional) – Whether to call pre_loop_hook and post_loop_hook around the single step.

  • callback_state (dendra.func.FunctionalCallbackState, optional) – Carry from the same prepared collection supplied through callbacks or functional_callbacks. Resumes sampling phase and reducer totals without another initial observation.

  • functional_callbacks (dendra.func.FunctionalCallbacks, optional) – Compatibility spelling for the prepared pure collection. Use it alongside callbacks=[...] to combine native hooks and pure observations. Supply the collection through only one argument.

  • functional_callback_state (dendra.func.FunctionalCallbackState, optional) – Compatibility spelling for callback_state. Supply carry through only one argument; either collection spelling is accepted.

Returns:

The advanced Population for chaining when pure observations are omitted. With pure observations, returns their named results and explicit callback carry; simulation state remains on the Population.

Return type:

Population or dendra.func.FunctionalCallbackResults

step_network(network, *, extra=None, inputs=None, draws=None, callbacks=None, loop_hooks=False, callback_state=None, functional_callbacks=None, functional_callback_state=None)[source]#

Advance a Dendra Network by one timestep.

Parameters:
  • network (Network) – Object to advance.

  • extra (optional) – Extracellular stimulation specification. This is the same population-name mapping accepted by Network.run(extra=...).

  • inputs (mapping of str to dendra.func.Inputs, optional) – Deterministic voltage and current frames keyed by exact Population names. The native method validates broadcasting, dtype/device and stimulation conflicts. Tensor references and gradients are retained.

  • draws (dendra.func.RuntimeDraws, optional) – One explicit NOISE/SDE and NetStim frame and authoritative RNG boundaries, validated by the native method. Solver-owned intra/extra Poisson banks consume invocation-indexed draws in native Network order; mechanism-owned injections replay their native invocation profiles.

  • callbacks (sequence of Callback or dendra.func.FunctionalCallbacks, optional) – Native hook sequence, or a pure collection prepared once with dn.func.make_callbacks for this Network or a compatible initialized receiver with matching timestep and mode. Observations read receiver state with fixed prepared selections. Pure observations run after clock advancement and before native post-step hooks. Native hooks retain their loop/chunk/step timing.

  • loop_hooks (bool, optional) – Whether to call pre_loop_hook and post_loop_hook around the single step.

  • callback_state (dendra.func.FunctionalCallbackState, optional) – Carry from the same prepared collection supplied through callbacks or functional_callbacks. Resumes sampling phase and reducer totals without another initial observation.

  • functional_callbacks (dendra.func.FunctionalCallbacks, optional) – Compatibility spelling for the prepared pure collection. Use it alongside callbacks=[...] to combine native hooks and pure observations. Supply the collection through only one argument.

  • functional_callback_state (dendra.func.FunctionalCallbackState, optional) – Compatibility spelling for callback_state. Supply carry through only one argument; either collection spelling is accepted.

Returns:

The advanced Network for chaining when pure observations are omitted. With pure observations, returns their named results and explicit callback carry; simulation state remains on the Network.

Return type:

Network or dendra.func.FunctionalCallbackResults