Skip to main content

sc_neurocore_engine/bindings/
scpn_metrics.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 — SCPN metrics PyO3 binding
8
9//! Python binding for aggregate SCPN coherence metrics.
10
11use pyo3::prelude::*;
12
13use crate::scpn;
14
15/// Register aggregate SCPN metrics with the extension module.
16pub(crate) fn register(module: &Bound<'_, PyModule>) -> PyResult<()> {
17    module.add_class::<PySCPNMetrics>()?;
18    Ok(())
19}
20
21#[pyclass(
22    name = "SCPNMetrics",
23    module = "sc_neurocore_engine.sc_neurocore_engine"
24)]
25pub struct PySCPNMetrics;
26
27#[pymethods]
28impl PySCPNMetrics {
29    #[new]
30    fn new() -> Self {
31        Self
32    }
33
34    #[staticmethod]
35    fn global_coherence(weights: [f64; 7], metrics: [f64; 7]) -> f64 {
36        scpn::SCPNMetrics::global_coherence(&weights, &metrics)
37    }
38
39    #[staticmethod]
40    fn consciousness_index(phases_l4: Vec<f64>, glyph_l7: [f64; 6]) -> f64 {
41        scpn::SCPNMetrics::consciousness_index(&phases_l4, &glyph_l7)
42    }
43}