Skip to main content

cells.spike_triggered_population_coupling_df

cells.spike_triggered_population_coupling_df(
    spikes,
    df_clusters,
    radius_um=500,
    lags=0.08,
    binsize=BINSIZE,
    lowpass_hz=20.0,
    good_units_only=True,
    file_stpc=None,
)

df_clusters / spikes-Bunch convenience wrapper around :func:spike_triggered_population_coupling, for interoperability with the rest of the ephys-atlas cell-features pipeline.

The population that couplings are computed against always includes every cluster in df_clusters regardless of QC – matching Bimbard et al. 2025’s use of “the summed activity of all neurons” as the reference population – irrespective of good_units_only, which only restricts which clusters are reported.

Parameters

Name Type Description Default
spikes dict - like Must expose times (s) and clusters (cluster id, matching df_clusters’s index). required
df_clusters pandas.DataFrame Cluster metadata, indexed by cluster id. Must contain lateral_um, axial_um and bitwise_fail (QC flag, 0 == good). required
radius_um see :func:spike_triggered_population_coupling. 500
lags see :func:spike_triggered_population_coupling. 500
binsize see :func:spike_triggered_population_coupling. 500
lowpass_hz see :func:spike_triggered_population_coupling. 500
good_units_only bool If True (default, matching this module’s existing cell-features pipeline), only report rows for clusters with bitwise_fail == 0. Set to False to report every cluster. file_stpc, if given, only ever holds the reported rows, so a cache written with one setting cannot be reused with the other. True
file_stpc Path If given and it exists, load stpc (already restricted to the reported clusters) from it instead of recomputing; otherwise compute and save it there. None

Returns

Name Type Description
iblutil.util.Bunch Same as :func:spike_triggered_population_coupling, restricted to the reported clusters, plus: df_clusters : pandas.DataFrame df_clusters with coupling_strength / coupling_delay columns added/overwritten (nan for clusters not reported or with no neighbours). i_reported : numpy.ndarray Positional index into df_clusters of the rows reported in stpc etc.