def calculatePSTH(self, cluster_id, **kwargs):
    '\n        Calculate the PSTH of event_ts against the spiking of a cell\n\n        Parameters\n        ----------\n        cluster_id : int\n            The cluster for which to calculate the psth\n\n        Returns\n        -------\n        x, y : list\n            The list of time differences between the spikes of the cluster\n            and the events (x) and the trials (y)\n        '
    if (self._event_ts is None):
        raise Exception('Need some event timestamps! Aborting')
    if (self._spk_clusters is None):
        raise Exception('Need cluster identities! Aborting')
    event_ts = self.event_ts
    event_ts.sort()
    if (type(event_ts) == list):
        event_ts = np.array(event_ts)
    spike_times = self.spike_times[(self.spk_clusters == cluster_id)]
    irange = (event_ts[:, np.newaxis] + self.event_window[np.newaxis, :])
    dts = np.searchsorted(spike_times, irange)
    x = []
    y = []
    for (i, t) in enumerate(dts):
        tmp = (spike_times[t[0]:t[1]] - event_ts[i])
        x.extend(tmp)
        y.extend(np.repeat(i, len(tmp)))
    return (x, y)
Calculate the PSTH of event_ts against the spiking of a cell

Parameters
----------
cluster_id : int
    The cluster for which to calculate the psth

Returns
-------
x, y : list
    The list of time differences between the spikes of the cluster
    and the events (x) and the trials (y)
def calculatePSTH(self, cluster_id, **kwargs):
    '\n        Calculate the PSTH of event_ts against the spiking of a cell\n\n        Parameters\n        ----------\n        cluster_id : int\n            The cluster for which to calculate the psth\n\n        Returns\n        -------\n        x, y : list\n            The list of time differences between the spikes of the cluster\n            and the events (x) and the trials (y)\n        '
    if (self._event_ts is None):
        raise Exception('Need some event timestamps! Aborting')
    if (self._spk_clusters is None):
        raise Exception('Need cluster identities! Aborting')
    event_ts = self.event_ts
    event_ts.sort()
    if (type(event_ts) == list):
        event_ts = np.array(event_ts)
    spike_times = self.spike_times[(self.spk_clusters == cluster_id)]
    irange = (event_ts[:, np.newaxis] + self.event_window[np.newaxis, :])
    dts = np.searchsorted(spike_times, irange)
    x = []
    y = []
    for (i, t) in enumerate(dts):
        tmp = (spike_times[t[0]:t[1]] - event_ts[i])
        x.extend(tmp)
        y.extend(np.repeat(i, len(tmp)))
    return (x, y)