pub struct LIFNeuron {
pub id: usize,
pub config: NeuronConfig,
pub state: NeuronState,
}Expand description
Leaky Integrate-and-Fire neuron
Fields§
§id: usizeNeuron ID
config: NeuronConfigConfiguration parameters
state: NeuronStateCurrent state
Implementations§
Source§impl LIFNeuron
impl LIFNeuron
Sourcepub fn with_config(id: usize, config: NeuronConfig) -> Self
pub fn with_config(id: usize, config: NeuronConfig) -> Self
Create a new LIF neuron with custom configuration
Sourcepub fn step(&mut self, current: f64, dt: f64, time: SimTime) -> bool
pub fn step(&mut self, current: f64, dt: f64, time: SimTime) -> bool
Integrate input current for one timestep Returns true if neuron spiked
Sourcepub fn inject_spike(&mut self, time: SimTime)
pub fn inject_spike(&mut self, time: SimTime)
Inject a direct spike (for input neurons)
Sourcepub fn time_since_spike(&self, current_time: SimTime) -> f64
pub fn time_since_spike(&self, current_time: SimTime) -> f64
Get time since last spike
Sourcepub fn is_refractory(&self) -> bool
pub fn is_refractory(&self) -> bool
Check if neuron is in refractory period
Sourcepub fn membrane_potential(&self) -> f64
pub fn membrane_potential(&self) -> f64
Get membrane potential
Sourcepub fn set_membrane_potential(&mut self, v: f64)
pub fn set_membrane_potential(&mut self, v: f64)
Set membrane potential directly
Trait Implementations§
Auto Trait Implementations§
impl Freeze for LIFNeuron
impl RefUnwindSafe for LIFNeuron
impl Send for LIFNeuron
impl Sync for LIFNeuron
impl Unpin for LIFNeuron
impl UnwindSafe for LIFNeuron
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<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 more