use pkg_version::{pkg_version_major, pkg_version_minor};
use std::ops::Deref;
use std::time::Duration;
pub const LASP_VERSION_MAJOR: u32 = pkg_version_major! {};
pub const LASP_VERSION_MINOR: u32 = pkg_version_minor! {};
pub const LIB_NAME: &str = "lasprs";
pub const MEASUREMENT_EXTENSION: &str = "h5";
pub(crate) const PRECAP_DURATION: Duration = Duration::from_secs(3);
#[expect(dead_code)]
pub(crate) const MAX_CHANNELS: usize = 64;
pub(crate) const TYPICAL_CHANNELS: usize = 8;
pub(crate) const SLM_LT_DECIMATION_FRACTION: Flt = 0.1;
cfg_select! {
all(any(feature="f64",target_pointer_width = "64"), not(feature="f32"))=> {
pub type Flt = f64;
pub const pi: Flt = std::f64::consts::PI;
pub const sq2: Flt = std::f64::consts::SQRT_2;
pub const FltInf: Flt = f64::INFINITY;
}
all(any(feature="f32", target_pointer_width = "32"), not(feature="f64")) =>{
pub type Flt = f32;
pub const pi: Flt = std::f32::consts::PI;
pub const sq2: Flt = std::f32::consts::SQRT_2;
pub const FltInf: Flt = f32::INFINITY;
}
_ => {
std::compile_error!("feature should be f32 or f64");
}
}
pub const twopi: Flt = pi * 2.;
cfg_select! {
any(feature = "python-bindings")=> {
pub(crate) use numpy::{IntoPyArray,PyArray, PyArray1, PyArray2, PyArray3, PyArrayDyn, PyArrayLike1,
PyArrayLike2,PyArrayLike3,PyReadonlyArrayDyn,PyReadonlyArray1, convert::ToPyArray};
pub(crate) use pyo3::prelude::*;
pub(crate) use pyo3::exceptions::PyValueError;
pub(crate) use pyo3::{pymodule, types::PyModule, PyResult};
pub(crate) use pyo3_stub_gen::derive::*;
pub(crate) use pyo3_stub_gen::*;
pub(crate) use pyo3::types::IntoPyDict;
pub(crate) use pyo3::exceptions::PyException;
}
_ => {}
}
pub use ndarray::prelude::*;
pub use ndarray::{Array1, Array2, ArrayView1, ArrayViewMut1};
pub use ndarray::Zip;
use num::complex::Complex;
pub use num::complex::ComplexFloat;
use serde::{Deserialize, Serialize};
pub type VdView<'a> = ArrayView1<'a, Flt>;
pub type VcView<'a> = ArrayView1<'a, Cflt>;
pub type Cflt = Complex<Flt>;
pub const I: Cflt = Cflt::new(0., 1.);
pub const C0: Cflt = Cflt::new(0., 0.);
pub type Vd = Vec<Flt>;
pub type Vc = Vec<Cflt>;
pub type Dcol = Array1<Flt>;
pub type Ccol = Array1<Cflt>;
pub type Dmat = Array2<Flt>;
pub type Cmat = Array2<Cflt>;
cfg_select! {
any(feature = "python-bindings") => {
pub type PyArr1<'py, T> = Bound<'py, PyArray<T, ndarray::Dim<[usize; 1]>>>;
pub type PyArr1Flt<'py> = PyArr1<'py, Flt>;
pub type PyArr1Cflt<'py> = PyArr1<'py, Cflt>;
}
_ => {}
}