pub struct PyEnergyTracker {
pub history: Vec<(f64, f64, f64, f64)>,
pub capacity: usize,
pub anomaly_threshold: f64,
pub anomalies: Vec<(usize, f64)>,
}Expand description
Tracks kinetic, potential, and total energy over time.
Fields§
§history: Vec<(f64, f64, f64, f64)>Time series of (time, KE, PE, total).
capacity: usizeMaximum history size.
anomaly_threshold: f64Jump threshold for anomaly detection (energy change ratio).
anomalies: Vec<(usize, f64)>Detected energy anomalies (step_index, delta_energy).
Implementations§
Source§impl PyEnergyTracker
impl PyEnergyTracker
Sourcepub fn mean_total(&self) -> f64
pub fn mean_total(&self) -> f64
Mean total energy.
Sourcepub fn latest_total(&self) -> f64
pub fn latest_total(&self) -> f64
Latest total energy (or 0).
Sourcepub fn has_anomalies(&self) -> bool
pub fn has_anomalies(&self) -> bool
True if any anomalies were detected.
Trait Implementations§
Source§impl Clone for PyEnergyTracker
impl Clone for PyEnergyTracker
Source§fn clone(&self) -> PyEnergyTracker
fn clone(&self) -> PyEnergyTracker
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PyEnergyTracker
impl Debug for PyEnergyTracker
Source§impl Default for PyEnergyTracker
impl Default for PyEnergyTracker
Source§fn default() -> PyEnergyTracker
fn default() -> PyEnergyTracker
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for PyEnergyTracker
impl<'de> Deserialize<'de> for PyEnergyTracker
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for PyEnergyTracker
impl RefUnwindSafe for PyEnergyTracker
impl Send for PyEnergyTracker
impl Sync for PyEnergyTracker
impl Unpin for PyEnergyTracker
impl UnsafeUnpin for PyEnergyTracker
impl UnwindSafe for PyEnergyTracker
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.