Skip to main content

cells.compute_log_acg

cells.compute_log_acg(
    spike_times,
    fs,
    spike_clusters=None,
    bin_size=0.0002,
    win_size=2.0,
    n_log_bins=512,
    log_trim=0.001,
)

Compute a long autocorrelogram with log-spaced bins.

Parameters

Name Type Description Default
spike_times numpy.ndarray Spike times in seconds. required
fs float Sampling rate of the recording in Hz. required
spike_clusters numpy.ndarray Cluster label for each spike. If provided, the function computes one ACG per unique cluster and returns a 2-D array whose rows are ordered by np.unique(spike_clusters). If None (default), spike_times is treated as a single cluster and a 1-D array is returned. None
bin_size float Base bin resolution in seconds. Default 0.2e-3 s. 0.0002
win_size float One-sided window length in seconds. Default 2.0 s. 2.0
n_log_bins int Number of log-spaced output bins between log_trim and win_size. Default 512. Bins narrower than bin_size (near log_trim) will be zero due to the refractory period, which is physically correct. 512
log_trim float Start of the output lag axis in seconds; bins below this lag are excluded. Default 1e-3 s (refractory period). 0.001

Returns

Name Type Description
acg_log numpy.ndarray Log-binned ACG in spike pairs · s⁻¹ (raw coincident pair counts divided by log-bin width; not normalised by recording duration or firing rate). The asymptotic value at long lags (τ ≫ any temporal correlation) is λ² × T = λ × n_spikes, where λ is the firing rate and T the recording duration. To obtain sp/s units with an asymptote equal to the firing rate, divide by n_spikes; to obtain a dimensionless ACG, divide by n_spikes × λ. Shape (n_log_bins,) when spike_clusters is None, or (n_unique_clusters, n_log_bins) otherwise.
t_log numpy.ndarray Geometric centre of each log bin in seconds, shape (n_log_bins,).