Skip to main content

elata_eeg_models/
lib.rs

1//! EEG Analysis Models
2//!
3//! This crate provides analysis models that process EEG data from the HAL.
4//! Currently implemented models:
5//!
6//! - **Alpha Bump Detection**: Detects changes in alpha band power, indicating
7//!   transitions between relaxed (eyes closed) and alert (eyes open) states.
8//!
9//! - **Alpha Peak Model**: Finds the dominant frequency within the alpha band
10//!   (8-13 Hz) and reports its power and signal-to-noise ratio.
11//!
12//! - **Calmness Model**: Computes a continuous calmness score based on the
13//!   ratio of relaxation-associated frequencies (alpha, theta) to
14//!   alertness-associated frequencies (beta).
15//!
16//! # Usage
17//!
18//! ```no_run
19//! use elata_eeg_models::{Model, AlphaBumpDetector, AlphaPeakModel, CalmnessModel};
20//! use elata_eeg_hal::SampleBuffer;
21//!
22//! // Create models
23//! let mut alpha_detector = AlphaBumpDetector::new(256);
24//! let mut alpha_peak = AlphaPeakModel::new(256);
25//! let mut calmness = CalmnessModel::new(256);
26//!
27//! // Process data (assuming buffer is filled from a device)
28//! let buffer = SampleBuffer::new(256, 4);
29//! // ... fill buffer ...
30//!
31//! // Get analysis results
32//! // let alpha_result = alpha_detector.process(&buffer);
33//! // let alpha_peak_result = alpha_peak.process(&buffer);
34//! // let calmness_result = calmness.process(&buffer);
35//! ```
36
37mod alpha_bump;
38mod alpha_peak;
39mod calmness;
40mod model;
41
42pub use alpha_bump::{AlphaBumpDetector, AlphaBumpOutput, AlphaState};
43pub use alpha_peak::{AlphaPeakModel, AlphaPeakOutput};
44pub use calmness::{CalmnessModel, CalmnessOutput};
45pub use model::{Model, ModelOutput};