pub struct RetinalGanglionCell {
pub stim_buffer: Vec<f64>,
pub stim_kernel: Vec<f64>,
pub stim_idx: usize,
pub hist_buffer: Vec<f64>,
pub hist_kernel: Vec<f64>,
pub hist_idx: usize,
pub baseline: f64,
pub on_centre: bool,
pub spike_threshold: f64,
pub dt: f64,
pub gain: f64,
}Expand description
Retinal ganglion cell — Pillow et al. 2005 GLM.
Generalized linear model (GLM) for retinal ganglion cells, the gold standard for statistical spike train models:
-
Stimulus filter (k): temporal kernel convolved with stimulus. Implemented as a causal FIR filter over a ring buffer of past stimulus values. Default: biphasic filter (fast excitatory + slow inhibitory lobe), ON-centre or OFF-centre.
-
Post-spike history filter (h): self-feedback after each spike. Models absolute/relative refractoriness and burst facilitation. Implemented as exponential basis functions applied to spike history. Default: strong inhibitory (refractory) followed by weak excitatory (burst tendency).
-
Exponential nonlinearity: λ(t) = exp(k·s(t) + h·spike_history + b) where λ is the instantaneous firing rate (Hz).
-
Spike generation: deterministic threshold on λ(t). Spike emitted when λ(t) * dt > threshold (proxy for inhomogeneous Poisson at high rate).
Pillow et al., Nature 437:1258, 2005. Pillow et al., J Neurosci 28:11003, 2008 (coupled GLM).
State: stimulus ring buffer, spike history ring buffer, filtered stimulus value, filtered history value.
Fields§
§stim_buffer: Vec<f64>§stim_kernel: Vec<f64>§stim_idx: usize§hist_buffer: Vec<f64>§hist_kernel: Vec<f64>§hist_idx: usize§baseline: f64§on_centre: bool§spike_threshold: f64§dt: f64§gain: f64Implementations§
Source§impl RetinalGanglionCell
impl RetinalGanglionCell
Sourcepub fn new() -> Self
pub fn new() -> Self
Create ON-centre RGC with default biphasic stimulus filter and post-spike history filter.
pub fn off_centre() -> Self
Sourcefn convolve(buffer: &[f64], kernel: &[f64], write_idx: usize) -> f64
fn convolve(buffer: &[f64], kernel: &[f64], write_idx: usize) -> f64
Convolve ring buffer with kernel (dot product with circular indexing).
Sourcepub fn step(&mut self, input: f64) -> i32
pub fn step(&mut self, input: f64) -> i32
Step with bipolar cell input. Returns spike (1/0).
GLM pipeline: stimulus filter → history filter → exp nonlinearity → spike
pub fn reset(&mut self)
Trait Implementations§
Source§impl Clone for RetinalGanglionCell
impl Clone for RetinalGanglionCell
Source§fn clone(&self) -> RetinalGanglionCell
fn clone(&self) -> RetinalGanglionCell
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RetinalGanglionCell
impl Debug for RetinalGanglionCell
Auto Trait Implementations§
impl Freeze for RetinalGanglionCell
impl RefUnwindSafe for RetinalGanglionCell
impl Send for RetinalGanglionCell
impl Sync for RetinalGanglionCell
impl Unpin for RetinalGanglionCell
impl UnsafeUnpin for RetinalGanglionCell
impl UnwindSafe for RetinalGanglionCell
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
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>
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>
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