#[derive(Debug, Clone, Copy)]
pub(crate) struct PriorSignalModel {
pub lrt: f32,
pub flatness_threshold: f32,
pub template_diff_threshold: f32,
pub lrt_weighting: f32,
pub flatness_weighting: f32,
pub difference_weighting: f32,
}
impl PriorSignalModel {
pub(crate) fn new(lrt_initial_value: f32) -> Self {
Self {
lrt: lrt_initial_value,
flatness_threshold: 0.5,
template_diff_threshold: 0.5,
lrt_weighting: 1.0,
flatness_weighting: 0.0,
difference_weighting: 0.0,
}
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn default_values() {
let m = PriorSignalModel::new(1.0);
assert_eq!(m.lrt, 1.0);
assert_eq!(m.flatness_threshold, 0.5);
assert_eq!(m.template_diff_threshold, 0.5);
assert_eq!(m.lrt_weighting, 1.0);
assert_eq!(m.flatness_weighting, 0.0);
assert_eq!(m.difference_weighting, 0.0);
}
#[test]
fn weightings_sum_to_one_initially() {
let m = PriorSignalModel::new(0.0);
let sum = m.lrt_weighting + m.flatness_weighting + m.difference_weighting;
assert_eq!(sum, 1.0);
}
}