Skip to main content

py_terman_wang_simulate

Function py_terman_wang_simulate 

Source
pub(crate) fn py_terman_wang_simulate<'py>(
    py: Python<'py>,
    v0: f64,
    w0: f64,
    alpha: f64,
    beta: f64,
    epsilon: f64,
    rho: f64,
    dt: f64,
    v_peak: f64,
    n_steps: usize,
    current: f64,
) -> (Bound<'py, PyArray1<f64>>, i64, f64, f64)
Expand description

N-step Terman-Wang (LEGION) relaxation-oscillator simulation.

Parity contract with sc_neurocore.neurons.models.terman_wang.TermanWangOscillator.simulate: for the same parameters and constant input the returned v trace, upward-crossing spike count, and final (v, w) state match the Python RK4 reference. The cubic uses v.powi(3) = v*v*v (matching the Python v*v*v); the tanh gating resolves to the same glibc symbol as Python on Linux, so this backend is bit-identical there (Julia/Go/Mojo use their own libm tanh, ULP-bounded, and the two-dimensional relaxation oscillator is non-chaotic so it does not amplify).