1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
//! Detection utilities for time series analysis.
//!
//! This module provides tools for detecting:
//! - **Seasonal periods** — [`detect_periods`], [`detect_dominant_period`]
//! - Outliers and anomalies
//! - Spectral analysis (Welch's periodogram)
//!
//! # Period detection
//!
//! With the `seasonal-detection` feature enabled, period detection uses the
//! SAZED ensemble algorithm from [`fdars-core`](https://crates.io/crates/fdars-core)
//! for maximum robustness. Without it, a Welch-periodogram-based detector
//! with spectral-leakage suppression is used.
//!
//! ```
//! use anofox_forecast::detection::{detect_periods, detect_dominant_period, PeriodDetectionConfig};
//!
//! let signal: Vec<f64> = (0..144)
//! .map(|i| 100.0 + 10.0 * (2.0 * std::f64::consts::PI * i as f64 / 12.0).sin())
//! .collect();
//!
//! assert_eq!(detect_dominant_period(&signal), Some(12));
//! ```
// Outlier detection
pub use ;
// FFT utilities — low-level spectral estimation
pub use welch_periodogram;
// Period detection — high-level API
pub use ;