Skip to main content

sc_neurocore_engine/neurons/
biophysical.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 — Biophysical Neuron Models
8
9//! Compatibility facade for biophysical and conductance-based neuron models.
10//!
11//! Each model owns its implementation and tests in a bounded child module
12//! while the historical public re-exports and `safe_rate` path remain stable.
13
14mod av_ron_cardiac;
15mod bertram_phantom;
16mod connor_stevens;
17mod de_schutter_purkinje;
18mod destexhe_thalamic;
19mod durstewitz_dopamine;
20mod gif_population;
21mod glif;
22mod golomb_fs;
23mod hill_tononi;
24mod hodgkin_huxley;
25mod huber_braun;
26mod mainen_sejnowski;
27mod mihalas_niebur;
28mod plant_r15;
29mod pospischil;
30mod prescott;
31mod reexports;
32mod sc_four_state_glif;
33mod sc_scaled_reset_adaptive_if;
34mod sc_six_state_thalamocortical;
35mod traub_miles;
36mod wang_buzsaki;
37mod yamada;
38pub use reexports::*;
39// ── Helper: safe alpha/beta kinetics avoiding division-by-zero ──
40
41pub fn safe_rate(
42    number_factor: f64,
43    v_offset: f64,
44    v: f64,
45    denom_scale: f64,
46    fallback: f64,
47) -> f64 {
48    let d = v + v_offset;
49    if d.abs() < 1e-7 {
50        fallback
51    } else {
52        number_factor * d / (1.0 - (-d / denom_scale).exp())
53    }
54}