-
Notifications
You must be signed in to change notification settings - Fork 0
/
fitGain_test.m
58 lines (43 loc) · 1.96 KB
/
fitGain_test.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
54
55
56
57
58
[saveServer, rootFolder] = getReady();
saveServer = 'Z:\Shared\Daisuke\cuesaccade_data';
animal = 'hugo';% 'andy' 'ollie'
year = '2022';
figTWin = [-0.5 0.5];
onlySuccess = 0;
respWin = [0.05 0.35]; %[s]
load(fullfile(saveServer,'param20230405.mat'),'param');
saveFigFolder = fullfile(saveServer, '20230713',year,animal);
mkdir(saveFigFolder);
[loadNames, months, dates, channels] = getMonthDateCh(animal, year, rootFolder);
thisdata = find(1-cellfun(@isempty, regexp(loadNames, ...
regexptranslate('wildcard',fullfile(rootFolder, year, 'cuesaccade_data','08August','05','*_ch2*')))));
ng =[];
for idata = 1:length(channels)
try
datech = [months{idata} filesep dates{idata} filesep num2str(channels{idata})];
disp(datech);
saveSuffix = [animal replace(datech,filesep,'_') '_linear_rReg'];%'_cue'];
thisDate = [months{idata} '_' dates{idata}];
saveFolder = fullfile(saveServer, year,animal);%17/6/23
%eyeName = 'Z:\Shared\Daisuke\cuesaccade_data\2021\hugo\eyeCat_hugo08August_13.mat';
eyeName = fullfile(saveFolder,['eyeCat_' animal thisDate '.mat']);
load(eyeName,'catEvTimes');
%saveName = 'Z:\Shared\Daisuke\cuesaccade_data\2021\hugo\hugo08August_13_21_linear_rReg.mat';
saveName = fullfile(saveFolder, [saveSuffix '.mat']);
load(saveName,'PSTH_f','predicted_all','t_r','dd');
y_r = cat(2,PSTH_f,predicted_all);
%% obtain gain
gainInfo = getGainInfo(t_r, y_r(:,1:2), param.cardinalDir, catEvTimes, ...
dd, figTWin, onlySuccess, respWin);
f=showGainInfo(gainInfo);
savefigname = fullfile(saveFigFolder,[saveSuffix '_gainInfo']);
screen2png(savefigname);
close(f);
save(saveName, 'gainInfo','-append');
clear gainInfo y_r catEvTimes PSTH_f
catch err
disp(err);
ng = [ng idata];
close all;
end
end