Created
May 7, 2018 17:25
-
-
Save edeno/7080628c6ff51ecf09ed18c78ab40bee to your computer and use it in GitHub Desktop.
Joint Peristimulus Time Histogram in Python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def jspth(spikes1, spikes2): | |
'''Joint Peristimulus Time Histogram | |
Parameters | |
---------- | |
spikes1, spikes2: ndarray, shape (n_time, n_trials) | |
Returns | |
------- | |
joint_histogram : ndarray, shape (n_time, n_time) | |
''' | |
n_time = spikes1.shape[0] | |
joint_histogram = np.zeros((n_time, n_time)) | |
for single_trial_spikes1, single_trial_spikes2 in zip(spikes1.T, spikes2.T): | |
joint_histogram += (single_trial_spikes1[:, np.newaxis] | |
* single_trial_spikes2[:, np.newaxis].T) | |
return joint_histogram |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment