use crate::binding::sequence::types::PyTrajectoryType;
use crate::distance::distance_type::DistanceType;
use pyo3::exceptions::PyValueError;
use pyo3::prelude::*;
use pyo3_stub_gen::{define_stub_info_gatherer, derive::gen_stub_pyfunction};
use std::str::FromStr;
#[gen_stub_pyfunction]
#[pyfunction]
pub fn hausdorff(
#[gen_stub(override_type(type_repr="typing.List[typing.List[float]] | numpy.ndarray", imports=("typing", "numpy")))]
t1: &Bound<'_, PyAny>,
#[gen_stub(override_type(type_repr="typing.List[typing.List[float]] | numpy.ndarray", imports=("typing", "numpy")))]
t2: &Bound<'_, PyAny>,
dist_type: String,
) -> PyResult<f64> {
let traj1 = PyTrajectoryType::try_from(t1)?;
let traj2 = PyTrajectoryType::try_from(t2)?;
let distance_type = DistanceType::from_str(&dist_type).map_err(|_| {
PyValueError::new_err(format!(
"Invalid distance type '{}'. Expected 'euclidean' or 'spherical'",
dist_type
))
})?;
let distance = crate::distance::hausdorff::hausdorff(&traj1, &traj2, distance_type);
Ok(distance)
}
define_stub_info_gatherer!(stub_info);