pub struct StreamingDetectionConfig {Show 13 fields
pub batch_duration_sec: f64,
pub calibration_duration_sec: f64,
pub calibration_chunks: usize,
pub threshold_factor: f32,
pub refractory_ms: f64,
pub polarity: SpikePolarity,
pub distance_rule: DistanceRule,
pub spatial_radius_um: f32,
pub k_neighbors: usize,
pub pre_ms: f64,
pub post_ms: f64,
pub apply_sinc_shift: bool,
pub locate: bool,
}Expand description
Configuration for super::StreamingDetector.
Fields§
§batch_duration_sec: f64Duration of each valid interior streaming batch in seconds (default: 10.0 s).
calibration_duration_sec: f64Total duration of the noise-floor calibration in seconds (default: 5.0 s), split into
calibration_chunks chunks spread evenly over the recording.
calibration_chunks: usizeNumber of calibration chunks; σ per channel is the median of the per-chunk estimates
(default: 5).
threshold_factor: f32Threshold multiplier in units of Quiroga $\sigma_n$ (default: 5.0).
refractory_ms: f64Refractory period in milliseconds (default: 1.0 ms).
polarity: SpikePolarityWhich extrema are spikes (default: negative troughs).
distance_rule: DistanceRuleHow crossings nearer than the refractory period are resolved (default:
DistanceRule::LocallyExclusive, for which streaming equals whole-recording detection;
DistanceRule::Scipy can differ at batch edges).
spatial_radius_um: f32Spatial deduplication radius in micrometers (default: 150.0 $\mu\text{m}$).
k_neighbors: usizeNumber of $K$-nearest neighbor channels extracted per waveform snippet (default: 4).
pre_ms: f64Pre-trough snippet window in milliseconds (default: 1.0 ms).
post_ms: f64Post-trough snippet window in milliseconds (default: 2.0 ms).
apply_sinc_shift: boolWhether to apply sub-sample windowed-sinc (Blackman-Harris) realignment (default: true).
locate: boolWhether to locate every spike: the centre of mass of its snippet’s peak-to-peak heights
over its K neighbours (default: true; else locations are unknown, NaN).
Implementations§
Source§impl StreamingDetectionConfig
impl StreamingDetectionConfig
Sourcepub fn threshold_detector(&self) -> ThresholdSpikeDetector
pub fn threshold_detector(&self) -> ThresholdSpikeDetector
The threshold detector’s settings these detections use (factor, polarity, refractory period, spacing rule).
Sourcepub fn refractory_samples(&self, sample_rate: f64) -> usize
pub fn refractory_samples(&self, sample_rate: f64) -> usize
Refractory period in samples at sample_rate Hz.
Sourcepub fn pre_samples(&self, sample_rate: f64) -> usize
pub fn pre_samples(&self, sample_rate: f64) -> usize
Pre-trough snippet length in samples at sample_rate Hz.
Sourcepub fn post_samples(&self, sample_rate: f64) -> usize
pub fn post_samples(&self, sample_rate: f64) -> usize
Post-trough snippet length in samples at sample_rate Hz.
Sourcepub fn snippet_samples(&self, sample_rate: f64) -> usize
pub fn snippet_samples(&self, sample_rate: f64) -> usize
Total snippet length (pre_samples + post_samples) at sample_rate Hz.
Sourcepub fn batch_samples(&self, sample_rate: f64) -> u64
pub fn batch_samples(&self, sample_rate: f64) -> u64
Valid interior batch size in samples at sample_rate Hz.
Sourcepub fn detection_range(
&self,
sample_rate: f64,
total_samples: u64,
) -> Range<u64> ⓘ
pub fn detection_range( &self, sample_rate: f64, total_samples: u64, ) -> Range<u64> ⓘ
Global sample range where spikes are detected: a full snippet plus the realignment margin fits inside the recording.
Sourcepub fn calibration_chunks(
&self,
sample_rate: f64,
total_samples: u64,
) -> Vec<Range<u64>>
pub fn calibration_chunks( &self, sample_rate: f64, total_samples: u64, ) -> Vec<Range<u64>>
Calibration chunks: calibration_chunks ranges totalling calibration_duration_sec,
spread evenly across 0..total_samples (fewer / shorter for short recordings).
Sourcepub fn compute_halos(
&self,
sample_rate: f64,
pipeline: &Pipeline,
) -> DspResult<(u64, u64)>
pub fn compute_halos( &self, sample_rate: f64, pipeline: &Pipeline, ) -> DspResult<(u64, u64)>
Computes the required (left_halo, right_halo) in samples at sample_rate Hz
given the filter stages in pipeline:
left_halo = settling_left + pre_samples(fs) + refractory_samples(fs) + SINC_RESAMPLE_MARGINright_halo = settling_right + post_samples(fs) + refractory_samples(fs) + SINC_RESAMPLE_MARGIN
where (settling_left, settling_right) = pipeline.settling(fs) (forward-backward filters need
both sides).
§Errors
DspError::InvalidConfig when a filter stage’s design is invalid at sample_rate.
Trait Implementations§
Source§impl Clone for StreamingDetectionConfig
impl Clone for StreamingDetectionConfig
Source§impl Debug for StreamingDetectionConfig
impl Debug for StreamingDetectionConfig
Auto Trait Implementations§
impl Forget for StreamingDetectionConfig
impl Freeze for StreamingDetectionConfig
impl Move for StreamingDetectionConfig
impl RefUnwindSafe for StreamingDetectionConfig
impl Send for StreamingDetectionConfig
impl Sync for StreamingDetectionConfig
impl Unpin for StreamingDetectionConfig
impl UnsafeUnpin for StreamingDetectionConfig
impl UnwindSafe for StreamingDetectionConfig
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneExpand for Twhere
T: Clone,
impl<T> CloneExpand for Twhere
T: Clone,
fn __expand_clone_method(&self, _: &Scope) -> T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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