diff --git a/pyargus/src/semantics.rs b/pyargus/src/semantics.rs index fb02fa5..8c0e364 100644 --- a/pyargus/src/semantics.rs +++ b/pyargus/src/semantics.rs @@ -1,7 +1,7 @@ use std::collections::HashMap; use argus_core::signals::{AnySignal, Signal}; -use argus_semantics::{BooleanSemantics, Semantics, Trace}; +use argus_semantics::{BooleanSemantics, QuantitativeSemantics, Semantics, Trace}; use pyo3::exceptions::PyTypeError; use pyo3::prelude::*; use pyo3::types::{PyDict, PyString}; @@ -87,10 +87,16 @@ fn eval_bool_semantics(expr: &PyBoolExpr, trace: &PyTrace) -> PyResult PyResult> { + let sig = QuantitativeSemantics::eval(&expr.0, trace, ()).map_err(PyArgusError::from)?; + Python::with_gil(|py| Py::new(py, (FloatSignal::from(sig), FloatSignal::super_type()))) +} pub fn init(_py: Python, m: &PyModule) -> PyResult<()> { m.add_class::()?; m.add_function(wrap_pyfunction!(eval_bool_semantics, m)?)?; + m.add_function(wrap_pyfunction!(eval_robust_semantics, m)?)?; Ok(()) }