Skip to content

API Reference

Raul Montoya Cardenas edited this page Jul 29, 2026 · 2 revisions

API Reference

Wiki hero

Generated with Grok Build: Grok 4.5 · xAI Imagine (/imagine)

All functions take spike_times::AbstractVector{<:Real} unless noted. Internally, times are often sorted as Float64.

spike_count(spike_times; t_start=nothing, t_end=nothing) -> Int

Count spikes. With no bounds, returns length(spike_times). With bounds, inclusive window after sort (searchsortedfirst / searchsortedlast). If t_end < t_start, returns 0.

spike_density(spike_times; t_start=nothing, t_end=nothing) -> Float64

count / duration. Returns 0.0 if fewer than 2 spikes (cannot infer duration) or non-positive duration. Unspecified t_start/t_end use data extrema when both missing; partial bounds combine with data min/max.

isi_stats(spike_times) -> NamedTuple

(mean, std, min, max, cv) of inter-spike intervals. All non-negative. Fewer than 2 spikes → zeros. CV = std/mean (0 if mean ≤ 0). Single ISI → std = 0.

detect_bursts(spike_times; max_isi=0.02, min_spikes=3) -> Vector{UnitRange{Int}}

Contiguous runs where each ISI ≤ max_isi and length ≥ min_spikes. Indices into the sorted spike sequence.

windowed_spike_features(...; window_size, step=window_size, t_start, t_end)

Requires window_size > 0, step > 0. Returns vector of named tuples:

(t_start, t_end, count, density, isi_mean, isi_cv, burst_count)

Burst detection inside windows uses API defaults (max_isi=0.02, min_spikes=3), not fixture-only override params for standalone detect_bursts.

See Window Semantics.

normalized_feature_vector(...; t_start, t_end, max_density=1000.0) -> Vector{Float64}

Length-4 vector in [0, 1]:

Index Component Normalization
1 count 1.0 if any spikes else 0.0
2 density clamp(d / max_density, 0, 1)
3 isi CV clamp(cv / 2, 0, 1)
4 bursts clamp(burst_count / max(c, 1), 0, 1)

Uses default burst params (same as windowed features).


Last updated: July 29, 2026 Updated by: Grok Build: Grok 4.5 Package tip reference: d2229e2 (main)

Clone this wiki locally