-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathrunAndSaveAllInformation.m
More file actions
149 lines (98 loc) · 5.76 KB
/
Copy pathrunAndSaveAllInformation.m
File metadata and controls
149 lines (98 loc) · 5.76 KB
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
% run and save all information values
% for each response cell saved, we will save four information arrays: three
% will be through our first line of analysis (formal, attribute and
% time-specific information); fourth is the "I-temporal" which is the newer
% metric we are using that is more reasonable.
% Sunreeta - 05/12/21
% Vidhi Modified - 05/12/21
clear; clc;
addpath('N:\Projects\AttributeSpecificInformationProject\codes\software');
folderSaveString = 'N:\Projects\AttributeSpecificInformationProject\preMadeData\InfoData';
ResponseCellFolder = 'N:\Projects\AttributeSpecificInformationProject\preMadeData\ResponseCell';
%%%%%%%%%%%%%%%%%%%%%%%%%%%% Choose whether to save ResponseCell %%%%%%%%%%%%%%%%%%
saveDataFlag = 1;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
subjectNameList = {'alpaH', 'kesariH'};
responseTypeList = {'spikes', 'lfp', 'ecog'};
stimulusTypeList = {'FlickeringGratings', 'NaturalImages'};
categoryList = {'Contrast100', 'Flora', 'Fauna', 'Texture', 'Landscape', 'Face'};
% responseCellNumber = {'1', '2'};
tRangeListMS = {[0,500], [0,250], [250,500]};
analysisTypeList = {'SingleElectrode', 'NaiveAverage', 'LDATimeAverage'};
optsAtt.method = 'dr';
optsAtt.bias = 'qe';
optsAtt.btsp = 10;
optsTime.method = 'dr';
optsTime.bias = 'qe';
optsTime.btsp = 10;
optsFormal.method = 'dr';
optsFormal.bias = 'qe';
optsFormal.btsp = 10;
optsTemporal.method = 'dr';
optsTemporal.bias = 'qe';
optsTemporal.btsp = 10;
nb = 7;
binningOpt = 'eqspace';
opts.Att = optsAtt;
opts.Time = optsTime;
opts.Formal = optsFormal;
opts.Temporal = optsTemporal;
tic;
for iSubjectName = [2,1]
subjectName = subjectNameList{iSubjectName};
for iResponseType = 1:length(responseTypeList)
responseType = responseTypeList{iResponseType};
for iStimulusType = [2,1]
stimulusType = stimulusTypeList{iStimulusType};
if iStimulusType == 1
% FG
categoryIDX = 1;
elseif iStimulusType == 2
% NI
categoryIDX = 2:length(categoryList);
end
for iCategory = categoryIDX
categoryName = categoryList{iCategory};
[~,~,~,catNums] = getCategoryInformation(subjectName,stimulusType,categoryName);
for RespCellNum = 1:length(catNums)
for iEpoch = 1:length(tRangeListMS)
epoch = tRangeListMS{iEpoch};
fileName = ['RCell' num2str(RespCellNum) '_' num2str(epoch(1)) '_' num2str(epoch(2)) 'ms.mat'];
filePath = fullfile(ResponseCellFolder, subjectName, responseType, stimulusType, categoryName);
R = load(fullfile(filePath, fileName), 'ResponseCell');
ResponseCell = R.ResponseCell;
numElecs = size(ResponseCell, 1);
for iAnalysis = 1:length(analysisTypeList)
analysisType = analysisTypeList{iAnalysis};
if strcmp(analysisType, 'SingleElectrode')
[ResponseCell] = ResponseCell;
end
if strcmp(analysisType, 'NaiveAverage')
[ResponseCell,~] = populationAnalysis(ResponseCell,3,0);
end
if strcmp(analysisType, 'LDATimeAverage')
[ResponseCell,~] = populationAnalysis(ResponseCell,1,0);
end
[IFormal, IAtt, ITime, ITemporal] = getAllInformation(ResponseCell, opts, nb, binningOpt, responseType);
% save info values
if saveDataFlag
saveFileName1 = ['IFormal_' num2str(RespCellNum) '_' num2str(epoch(1)) '_' num2str(epoch(2)) 'ms.mat' ];
saveFileName2 = ['IAtt_' num2str(RespCellNum) '_' num2str(epoch(1)) '_' num2str(epoch(2)) 'ms.mat' ];
saveFileName3 = ['ITime_' num2str(RespCellNum) '_' num2str(epoch(1)) '_' num2str(epoch(2)) 'ms.mat' ];
saveFileName4 = ['ITemporal_' num2str(RespCellNum) '_' num2str(epoch(1)) '_' num2str(epoch(2)) 'ms.mat' ];
saveFilePath = fullfile(folderSaveString,subjectName,responseType,stimulusType,categoryName,analysisType);
makeDirectory(saveFilePath);
save(fullfile(saveFilePath,saveFileName1),'IFormal');
save(fullfile(saveFilePath,saveFileName2),'IAtt');
save(fullfile(saveFilePath,saveFileName3),'ITime');
save(fullfile(saveFilePath,saveFileName4),'ITemporal');
disp([saveFilePath]);
toc;
end
end
end
end
end
end
end
end