Dynamics and Simulation#

Primitives for building dynamical systems and time-evolving neural models: differential-equation base classes, prefetch/delay utilities, ring-buffer delays, collective operations over module hierarchies, and numerical integration.

Dynamics Base Class#

Dynamics provides the foundation for differential equation-based models and time-stepped simulation. The helper decorators control how update inputs and outputs are received during a simulation step.

Dynamics

Base class for implementing neural dynamics models in BrainState.

receive_update_output

The decorator to mark the object (as the after updates) to receive the output of the update function.

not_receive_update_output

The decorator to mark the object (as the after updates) to not receive the output of the update function.

receive_update_input

The decorator to mark the object (as the before updates) to receive the input of the update function.

not_receive_update_input

The decorator to mark the object (as the before updates) to not receive the input of the update function.

Dynamics Utilities#

Utilities for managing temporal dynamics, prefetching, and delayed outputs in dynamical systems. Enable efficient handling of time-stepped simulations and asynchronous signal processing in recurrent and spiking neural networks.

Prefetch

Prefetch a state or variable in a module before it is initialized.

PrefetchDelay

Provides access to delayed versions of a prefetched state or variable.

PrefetchDelayAt

Provides access to a specific delayed state or variable value at the specific time.

OutputDelayAt

Provides access to a specific delayed state or variable value at the specific time.

init_maybe_prefetch

Initialize a prefetch target if needed, based on its type.

Delay Utilities#

Temporal delay buffers and state management for neural dynamics with synaptic delays. Delay provides ring buffer storage, DelayAccess enables retrieval of past values, and StateWithDelay integrates delay mechanisms with state variables for realistic neural modeling. InterpolationRegistry manages interpolation methods for delays.

Delay

Delay variable for storing short-term history data.

DelayAccess

Accessor node for a registered entry in a Delay instance.

StateWithDelay

Delayed history buffer bound to a module state.

InterpolationRegistry

Registry for interpolation methods.

Collective Operations#

Batch operations for managing states and function calls across module hierarchies. Includes utilities for initialization, resetting, and vectorized execution (vmap) of all states and functions in a network. Essential for efficient batch processing and state management in complex neural architectures.

call_order

Decorator for specifying the execution order of functions in collective operations.

call_all_fns

Call a specified function on all module nodes within a target, respecting call order.

vmap_call_all_fns

Apply vectorized mapping to call a function on all module nodes with batched state handling.

init_all_states

Initialize states for all module nodes within the target.

vmap_init_all_states

Initialize states with vectorized mapping for creating batched module instances.

reset_all_states

Reset states for all module nodes within the target.

vmap_reset_all_states

Reset states with vectorized mapping across batched module instances.

assign_state_values

Assign state values to a module from one or more state dictionaries.

Numerical Integration#

Numerical integration methods for solving ordinary differential equations (ODEs) in dynamical systems. exp_euler_step implements the exponential Euler method for stable integration of linear and nonlinear dynamics in neuronal models.

exp_euler_step

One-step Exponential Euler method for solving ODEs and SDEs.