-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgetExpVal_trig.m
More file actions
21 lines (19 loc) · 913 Bytes
/
getExpVal_trig.m
File metadata and controls
21 lines (19 loc) · 913 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
function [expval_trig, corr_trig, winSamps] = getExpVal_trig(PSTH_f, predicted, t_r, eventTimes, tWin)
%[expval_trig, corr_trig] = getExpVal_trig(PSTH_f, predicted, t_r, eventTimes, tWin)
% returns explained variance of triggered events, each moment in time from the event
%
% output:
% expval_trig: [kernel type x time]
% corr_trig: [kernel type x time]
% 13/6/24 created from getExpVal_tgt
%% event-triggered traces
[~, ~, resp] = eventLockedAvg(PSTH_f', t_r, eventTimes, [], tWin);
[~, winSamps, resp_predicted] = eventLockedAvg(predicted', t_r, eventTimes, [], tWin);
%% explained variance for each moment in time
expval_trig = zeros(size(predicted,2),numel(winSamps));
corr_trig = zeros(size(predicted,2),numel(winSamps));
for ivar = 1:size(predicted,2)
for it = 1:numel(winSamps)
[expval_trig(ivar, it), ~, corr_trig(ivar, it)] = getExpVal(resp(:,1,it), resp_predicted(:,ivar,it));
end
end