Skip to main content

sc_neurocore_engine/bindings/stochastic/
gamma_renewal.rs

1// SPDX-License-Identifier: AGPL-3.0-or-later
2// Commercial license available
3// © Concepts 1996–2026 Miroslav Šotek. All rights reserved.
4// © Code 2020–2026 Miroslav Šotek. All rights reserved.
5// ORCID: 0009-0009-3560-0851
6// Contact: www.anulum.li | protoscience@anulum.li
7// SC-NeuroCore — Gamma-renewal neuron PyO3 binding
8
9use pyo3::prelude::*;
10
11use crate::neurons;
12
13#[pyclass(
14    name = "GammaRenewalNeuron",
15    module = "sc_neurocore_engine.sc_neurocore_engine"
16)]
17#[derive(Clone)]
18pub struct PyGammaRenewalNeuron {
19    inner: neurons::GammaRenewalNeuron,
20}
21
22#[pymethods]
23impl PyGammaRenewalNeuron {
24    #[new]
25    #[pyo3(signature = (rate_hz=50.0, shape_k=3, seed=42))]
26    fn new(rate_hz: f64, shape_k: u32, seed: u64) -> Self {
27        Self {
28            inner: neurons::GammaRenewalNeuron::new(rate_hz, shape_k, seed),
29        }
30    }
31
32    #[pyo3(signature = (rate_override=-1.0))]
33    fn step(&mut self, rate_override: f64) -> i32 {
34        self.inner.step(rate_override)
35    }
36
37    fn reset(&mut self) {
38        self.inner.reset();
39    }
40}
41
42pub(super) fn register(module: &Bound<'_, PyModule>) -> PyResult<()> {
43    module.add_class::<PyGammaRenewalNeuron>()?;
44    Ok(())
45}