update of solutions for sta

This commit is contained in:
Jan Grewe 2014-11-01 17:06:28 +01:00
parent cc0d00a621
commit 92eaa8740b
2 changed files with 5 additions and 26 deletions

View File

@ -12,7 +12,7 @@ for i = 1:numel(spike_times)
valid_spikes = valid_spikes + 1;
end
snippets(end-(end-valid_spikes):end,:) = [];
snippets(valid_spikes:end,:) = [];
st_avg = mean(snippets, 1);
std_sta = std(snippets,[],1);

View File

@ -25,11 +25,11 @@ ylabel('stimulus')
%% reverse reconstruction
% make binary representation of the spike times
binary_spikes = zeros(size(stimulus, 1), length(spike_times));
estimated_stims = zeros(size(binary_spikes));
estimated_stims = zeros(size(stimulus, 1), length(spike_times));
for i = 1:length(spike_times)
binary_spikes(round(spike_times{i}*sample_rate), i) = 1;
estimated_stims(:,i) = conv(binary_spikes(:,i), st_average, 'same');
binary_spikes = zeros(size(stimulus, 1));
binary_spikes(round(spike_times{i}*sample_rate)) = 1;
estimated_stims(:,i) = conv(binary_spikes, st_average, 'same');
end
fig = figure();
@ -44,24 +44,3 @@ xlabel('time [s]')
ylabel('stimulus')
legend show
%% calculate STC
% we need to downsample the data otherwise the covariance matrixs gets too
% large 20Khz to 1kHz
% downsampled_binary = zeros(size(stimulus, 1)/20, length(spike_times));
downsampled_stim = zeros(size(stimulus,1)/20,1);
% for i = 1:length(spike_times)
% indices = round(spike_times{i}.*1000);
% indices(indices < 1) = [];
% downsampled_binary(indices, i) = 1;
% end
for i = 1:length(downsampled_stim)
start_index = (i-1) * 20 + 1;
downsampled_stim(i) = mean(stimulus(start_index:start_index+19,2));
end
[st_average, ~, ~] = sta(downsampled_stim, all_times, 50, 1000);