-
Notifications
You must be signed in to change notification settings - Fork 0
/
compute_tuning.m
111 lines (84 loc) · 2.83 KB
/
compute_tuning.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
%function compute_tuning
%function compute_tuning
% Compute tuning from laminar data
%
% Corentin Massot
% Cognition and Sensorimotor Integration Lab, Neeraj J. Gandhi
% University of Pittsburgh
% created 10/16/2016 last modified 01/09/2017
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear all
%set paths
[root_path data_path save_path]=set_paths;
%screen size
scrsz = get(groot,'ScreenSize');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%parameters
%alignement
%alignlist={'no' 'targ' 'go' 'sacc'};
alignlist={'sacc'};
%window of analysis
%wind=[100 170];%targ
wind=[-25 50];%sacc
%sigma FR
sigma_FR=6;
%display
disp=0;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%get datalist
datalist=load_data_gandhilab(data_path);
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%analyzing data
dlist=get_dlist;
data=[];
info=[];
for d=dlist%1:numel(datalist)
%get data and info
info.datafile=datalist{d};
load ([data_path info.datafile]);
display(info.datafile)
if disp
%getting channel mapping and discard selected bad channels
[info.chmap info.nchannels info.depths]=get_chmap(data(1).info.electrode{2},[]);
end
%getting trial type
info.trialtype=data(1).sequence(1);
%getting list of targets
targslist=data(1).offline.targslist;
%targets index
targs_ind=get_targsindex(targslist,info);
%select trials
seltrials=get_seltrials(data,'rpt');
if disp
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%get spk data for tuning
info.align=alignlist{1};
[alltrials_spk_tuning info.aligntime]=get_alltrials_align(data,seltrials,[],'fr',info,targslist,sigma_FR,1);
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%display all targets
figtrials=figure('Position',[scrsz(1)+300 300 scrsz(3)-500 scrsz(4)-500]);
hdlfig=subplot(1,2,1);hold on;
display_alltargets(targslist,info,hdlfig);
if disp
%compute target tuning
hdlfig=subplot(1,2,2);hold on;
titlestr={info.datafile ; ['Target tuning ' info.align ]};
plot_targtuning(alltrials_spk_tuning,targs_ind,info,hdlfig,titlestr);
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%selection of target tuning
%yn=[];
%while ~strcmp(yn,'y')
targ_tuning=input(['select tuning target (' num2str(length(targslist)) ' total):']);
%targ_tuning=6
%yn=input('sure (y/n)?','s');
%end
display(['Selected target tuning: ' num2str(targ_tuning)])
%%
%%%%%%%%%%%%%%%%%%
%Update data: tuning
update_data(1,1,0,data,data_path,info.datafile,'targ_tuning',targ_tuning);
%close(figtrials)
end