Skip to main content

sc_neurocore_engine/bindings/stochastic/
inhomogeneous_poisson.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 — Inhomogeneous Poisson neuron PyO3 binding
8
9use pyo3::prelude::*;
10
11use crate::neurons;
12
13#[pyclass(
14    name = "InhomogeneousPoissonNeuron",
15    module = "sc_neurocore_engine.sc_neurocore_engine"
16)]
17#[derive(Clone)]
18pub struct PyInhomogeneousPoissonNeuron {
19    inner: neurons::InhomogeneousPoissonNeuron,
20}
21
22#[pymethods]
23impl PyInhomogeneousPoissonNeuron {
24    #[new]
25    #[pyo3(signature = (dt_ms=1.0, seed=42))]
26    fn new(dt_ms: f64, seed: u64) -> Self {
27        Self {
28            inner: neurons::InhomogeneousPoissonNeuron::new(dt_ms, seed),
29        }
30    }
31
32    fn step(&mut self, rate_hz: f64) -> i32 {
33        self.inner.step(rate_hz)
34    }
35
36    fn reset(&mut self) {
37        self.inner.reset();
38    }
39}
40
41pub(super) fn register(module: &Bound<'_, PyModule>) -> PyResult<()> {
42    module.add_class::<PyInhomogeneousPoissonNeuron>()?;
43    Ok(())
44}