-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreate_neuron_trains.m
53 lines (49 loc) · 1.74 KB
/
create_neuron_trains.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
% This file indiscriminately concatenates all trials for a single neuron.
% The result is a 16-cell array with only 1 concatenated train for each
% neuron. The trials for each neuron are sorted by increasing TNR
% intensity. In particular, for any neuron, there is 1 spike train, where
% the earliest times are from trials with TNR intensity 0 and the latest
% times are from trials with TNR intensity 85 (which is the highest intensity).
% Load sorted trains
% sorted_trains = load('sorted_trains.mat');
% sorted_trains = sorted_trains.sorted_trains;
% load('sorted_stimuli.mat');
%
% num_neurons = 16;
% num_tnrs = 7;
%
% % Preallocate a 16-cell array with 1 train for each neuron
% neuron_trains = cell(16,1);
% feature_intensity = cell(16,1);
%
% % For each neuron...
% for i = 1:num_neurons
% % Create empty vector for concatenated train
% A = [];
% % For each TNR intensity...
% for j = 1:num_tnrs
% % Concatenate the train associated with that intensity
% A = [A sorted_trains{i,j}];
% end
% neuron_trains{i,1} = A;
% B = [];
% for j=1:num_tnrs
% B = [B sorted_stimuli{i,j}];
% end
% feature_intensity{i,1} = B;
% % Print i
% i
% end
load('spike_trains.mat');
load('filtered_stimulus.mat');
spike_trains = spike_array;
% Remove first column (TNR intensity)
spike_trains(:,:,1) = [];
% All bins with spikes become +1
spike_trains(spike_trains > 0) = 1;
% All bins with spikes become -1
spike_trains(spike_trains == 0) = -1;
neuron_trains = reshape(permute(spike_trains, [1 3 2]), size(spike_trains, 1), []);
feature_intensity = reshape(permute(filtered_stimulus, [1 3 2]), size(filtered_stimulus, 1), []);
save('neuron_trains.mat', 'neuron_trains');
save('feature_intensity.mat', 'feature_intensity');