Created
September 5, 2017 09:59
-
-
Save pietromarchesi/8003fa5164b0352f9c6e6ba05ff12d20 to your computer and use it in GitHub Desktop.
This file contains 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
import numpy as np | |
n_stim = 3 | |
n_responses = 2 | |
trial_size = 10 | |
n_trials_per_stimtype = 50 | |
n_neurons = 84 | |
single_trial_data = np.zeros([n_trials_per_stimtype, n_neurons, n_stim, n_responses, trial_size]) | |
single_trial_data.fill(np.NaN) | |
for stim in [0, 1, 2]: | |
for trial in range(n_trials_per_stimtype): | |
decision = np.random.randint(2) | |
single_trial_data[trial, :, stim, decision, :] = np.random.uniform(size=[n_neurons, trial_size]) | |
trial_average_data = np.nanmean(single_trial_data,0) | |
trial_average_data -= np.mean(trial_average_data.reshape((n_neurons,-1)),1)[:,None,None,None] | |
from dPCA import dPCA | |
dpca = dPCA.dPCA(labels='srt',regularizer='auto', n_components=1) | |
dpca.protect = ['t'] | |
Z = dpca.fit_transform(trial_average_data, trialX=single_trial_data) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment