Skip to content

ndi.fun.probe.import.kilosort.meanwaveform

  NDI.FUN.PROBE.IMPORT.KILOSORT.MEANWAVEFORM - amplitude-weighted mean waveform for a cluster

  MEANWF = NDI.FUN.PROBE.IMPORT.KILOSORT.MEANWAVEFORM(CID, SPIKE_CLUSTERS, ...
        SPIKE_TEMPLATES, AMPLITUDES, TEMPLATES, WINV)

  Computes the mean waveform (NumSamples x NumChannels) for curated cluster CID.

  Because a curated cluster may span several kilosort templates (after merges), the
  waveform is computed as the AMPLITUDE-WEIGHTED AVERAGE of every template that
  contributes spikes to the cluster: each contributing template is weighted by the
  sum of the spike amplitudes assigned to it within this cluster. The result is then
  scaled by the cluster's mean spike amplitude so the waveform has a meaningful
  magnitude, and, if an inverse whitening matrix WINV is provided, un-whitened into
  (approximately) physical units.

  Inputs:
    CID             - the cluster id to compute
    SPIKE_CLUSTERS  - cluster id of every spike
    SPIKE_TEMPLATES - template id (0-based) of every spike
    AMPLITUDES      - amplitude of every spike
    TEMPLATES       - nTemplates x nSamples x nChannels template shapes
    WINV            - inverse whitening matrix (nChannels x nChannels) or []

  See also: NDI.FUN.PROBE.IMPORT.KILOSORT.PROBE