pub struct SpikeTrain<T: Float + Debug + Send + Sync + 'static> {
pub neuron_id: usize,
pub spike_times: Vec<T>,
pub inter_spike_intervals: Vec<T>,
pub firing_rate: T,
pub duration: T,
pub spike_count: usize,
}Expand description
Spike train representation
Fields§
§neuron_id: usizeNeuron ID
spike_times: Vec<T>Spike times
inter_spike_intervals: Vec<T>Inter-spike intervals
firing_rate: TFiring rate (Hz)
duration: TSpike train duration (ms)
spike_count: usizeSpike count
Implementations§
Source§impl<T: Float + Debug + Send + Sync + 'static + Sum> SpikeTrain<T>
impl<T: Float + Debug + Send + Sync + 'static + Sum> SpikeTrain<T>
Sourcepub fn new(neuron_id: usize, spike_times: Vec<T>) -> Self
pub fn new(neuron_id: usize, spike_times: Vec<T>) -> Self
Create a new spike train from spike times
Sourcepub fn coefficient_of_variation(&self) -> T
pub fn coefficient_of_variation(&self) -> T
Calculate coefficient of variation of inter-spike intervals
Sourcepub fn local_variation(&self) -> T
pub fn local_variation(&self) -> T
Calculate local variation measure
Sourcepub fn record_spike(&mut self, time: T)
pub fn record_spike(&mut self, time: T)
Append a new spike at time and recompute duration, firing_rate
and inter_spike_intervals from the updated spike history (F51).
Previously callers pushed directly onto spike_times/spike_count
without ever recomputing firing_rate, so homeostatic scaling (and
anything else reading firing_rate) always saw a permanently stale
value (0.0 for a train built from a single initial spike). This
mirrors Self::new’s math incrementally.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for SpikeTrain<T>where
T: Freeze,
impl<T> RefUnwindSafe for SpikeTrain<T>where
T: RefUnwindSafe,
impl<T> Send for SpikeTrain<T>
impl<T> Sync for SpikeTrain<T>
impl<T> Unpin for SpikeTrain<T>where
T: Unpin,
impl<T> UnsafeUnpin for SpikeTrain<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for SpikeTrain<T>where
T: UnwindSafe,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
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.