spike_psth

syncopy.spike_psth(data, binsize='rice', output='rate', latency='maxperiod', keeptrials=True, parallel=None, select=None, **kwargs)[source]

Peristimulus time histogram

The parameters listed below can be provided as is or a via a cfg configuration ‘structure’, see Notes for details.

Parameters:
  • data (SpikeData) – A non-empty Syncopy SpikeData object

  • binsize (float or one of {'rice', 'sqrt'}, optional) – Binsize in seconds or get optimal bin width via Rice rule (‘rice’) or square root of number of observations (‘sqrt’)

  • output ({'rate', 'spikecount', 'proportion'}, optional) – Set to ‘rate’ to convert the output to firing rates (spikes/sec), ‘spikecount’ to count the number spikes per trial or ‘proportion’ to normalize the area under the PSTH to 1.

  • vartriallen (bool, optional) – True (default): accept variable trial lengths and use all available trials and the samples in every trial. Missing values (empty bins) will be ignored in the computation and results stored as NaNs False : only select those trials that fully cover the window as specified by latency and discard those trials that do not.

  • latency (array_like or {'maxperiod', 'minperiod', 'prestim', 'poststim'}) – Either set desired time window ([begin, end]) for spike counting in seconds, ‘maxperiod’ (default) for the maximum period available or ‘minperiod’ for minimal time-window all trials share, or `’prestim’ (all t < 0) or ‘poststim’ (all t > 0)

  • keeptrials (bool, optional) – If True the psth’s of individual trials are returned, otherwise

  • parallel (None or bool) – If None (recommended), processing is automatically performed in parallel (i.e., concurrently across trials/channel-groups), provided a dask parallel processing client is running and available. Parallel processing can be manually disabled by setting parallel to False. If parallel is True but no parallel processing client is running, computing will be performed sequentially.

  • select (dict or StructDict or str) – In-place selection of subset of input data for processing. Please refer to syncopy.selectdata() for further usage details. results are averaged across trials.