Skip to main content

Module wong_wang

Module wong_wang 

Source
Expand description

Batch parity with WongWangUnit.step in src/sc_neurocore/neurons/models/wong_wang.py (Wong & Wang 2006, J. Neurosci. 26:1314–1328).

Per step:

  1. i_k = j_n * s_k - j_cross * s_(3-k) + i_0 + stim_k + sigma * xi
  2. r_k = phi(i_k) where phi(i) = (a*i - b) / (1 - exp(-d*(a*i - b))) with singularity guard |a*i - b| < 1e-6 -> 1/d.
  3. integrate the coupled s1, s2 ODE with fixed-step RK4 while holding the step’s pre-drawn noise sample constant.
  4. clamp s_k into [0, 1] after the candidate state is finite.

The Python primary draws np.random.randn() twice per step; the Rust simulator takes xi pre-drawn from the Python RNG so trajectories are bit-exact for matching seeds. This mirrors the ping.rs + PINGCircuit pattern: Python owns the RNG, Rust owns the inner loop.

ConstantsΒ§

A πŸ”’
B πŸ”’
D πŸ”’

FunctionsΒ§

derivatives πŸ”’
phi πŸ”’
simulate
Simulate n_steps Wong-Wang iterations; write per-step state + firing-rate traces. xi must be length 2 * n_steps (two noise samples per step, consumed in i1, i2 order).