-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathBpodImager_checkGFP.m
408 lines (343 loc) · 17.5 KB
/
BpodImager_checkGFP.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
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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
function BpodImager_checkGFP(reload)
if ~exist('reload','var') || isempty(reload)
reload = false;
end
%% select data sets
[dataOverview, ~, sensorLabels, cogLabels, ~, segLabels, ~, cPath] = delayDecRecordings;
dataOverview(:,4) = {'Ai93'};
[dataOverview1, ~, sensorLabels, cogLabels, ~, segLabels, ~, cPath] = delayDecRecordings_GFP;
dataOverview = [dataOverview; dataOverview1];
animals = dataOverview(:,1);
modTypes = {'shCurrent' 'shOther' 'shOtherMotor'};
orgVars = {'fastPupil', 'slowPupil', 'whisk', 'nose', 'face', 'lLick', 'rLick', ...
'pupils', 'licks', 'bhvVideo', 'Move', 'allMove', 'motorNoVideo', 'motor'}; %make sure to load original version during shOther condition to avoid false results from orthogonalization.
visExp = ismember(dataOverview(:,2),'Visual'); %index for visual experts
audExp = ismember(dataOverview(:,2),'Audio'); %index for auditory experts
GFPidx = ismember(dataOverview(:,4),'GFP'); %index for GFP controls
CamKidx = ismember(dataOverview(:,4),'gcamp'); %index for gcamp controls
Ai93idx = ismember(dataOverview(:,4),'Ai93'); %index for Ai93 animals
load('allenDorsalMapSM.mat')
areaIdx = {'VISp' 'SSp-ul'}; % V1 - FL
leftHS = ismember(dorsalMaps.sidesSplit,'L'); %index for labels on the left HS
for x = 1:length(areaIdx)
ind = ismember(dorsalMaps.labelsSplit,areaIdx{x}) & leftHS;
areaCoord{x} = poly2mask(dorsalMaps.edgeOutlineSplit{ind}(:,2), dorsalMaps.edgeOutlineSplit{ind}(:,1),size(dorsalMaps.hsMask,1),size(dorsalMaps.hsMask,2));
end
leftHS = find(leftHS); %index for labels on the left HS
var1 = 'nose'; %first variable to show unique exp. variance
var2 = 'rGrab'; %second variable to show unique exp. variance
var3 = 'piezo'; %third variable to show unique exp. variance
%% general variables
Paradigm = 'SpatialDisc';
% cPath = 'Y:\data\BpodImager\Animals\'; %Widefield data path on nlsas server
sPath = 'Y:\data\predVariance\'; %local data path to save down results
%% load data
check = true;
if ~reload %check for a saved dataset
if ~exist(sPath,'dir')
check = false;
else
try
load([sPath 'fullVarMaps_GFP.mat'],'fullVarMaps', 'meanModel', 'allenMask');
load([sPath 'fullMaps_GFP.mat'],'fullMaps');
load([sPath 'noseMaps_GFP.mat'],'noseMaps');
load([sPath 'handleMaps_GFP.mat'],'handleMaps');
load([sPath 'pawMaps_GFP.mat'],'pawMaps');
load([sPath 'expHemo_GFP.mat'],'expHemo');
load([sPath 'betaTraces_GFP.mat'],'visBeta', 'handleBeta');
catch
check = false;
end
end
if ~check
reload = true;
disp('Could not find saved results. Load predVariance data instead. Maybe go get a coffe in the meantime.')
end
end
%% go through predVariance folders if reloading that data
% check animal count
animalCnt = size(dataOverview,1);
if reload
animals = dataOverview(:,1);
Cnt = 0;
for iAnimals = 1:length(animals)
if Ai93idx(iAnimals)
cPath = 'U:\smusall\BpodImager\Animals\'; %Widefield data path on grid server
else
cPath = 'Y:\data\BpodImager\Animals\'; %Widefield data path on grid server
end
Cnt = Cnt + 1;
fPath = [cPath animals{iAnimals} filesep Paradigm filesep dataOverview{iAnimals,3} filesep];
disp(fPath); tic;
%load design matrix and check for regressors that were used in the model
load([fPath 'Snapshot_1.mat']); %load snapshot
load([fPath 'mask.mat']); %load mask
allOpts(Cnt) = load([fPath 'opts2.mat']); %load allen alignment file
if Cnt == 1
% create mask from allen coordinates
allenMask = ~dorsalMaps.cutMaskScaled; %mask that is used for all datasets
[x1, y1] = size(allenMask);
[x2, y2] = size(mask);
allenMask = allenMask(1:min([x1 x2]), 1:min([y1 y2])); %cut allen mask to size
redMask = ~dorsalMaps.hsMask(1:min([x1 x2]), 1:min([y1 y2])); %cut reduced mask to size
[x1, y1] = size(allenMask);
% pre-allocate data matrices
fullVarMaps = NaN(sum(~allenMask(:)), animalCnt, 'single'); %full data variance map
fullMaps = NaN(sum(~allenMask(:)), animalCnt, 'single'); %full model map
noseMaps = NaN(sum(~allenMask(:)), animalCnt, 'single'); %maps for right vis stim
handleMaps = NaN(sum(~allenMask(:)), animalCnt, 'single'); %maps for right handle grab
pawMaps = NaN(sum(~allenMask(:)), animalCnt, 'single'); %maps for right handle grab
expHemo = NaN(1, animalCnt, 'single'); %variance explained by hemo correction
meanModel = NaN(1, animalCnt, 'single'); %mean model variance
end
% load model data
load([fPath 'predVariance' filesep 'shCurrent' filesep 'fullcorr.mat'], 'cMap'); %load current maps
cMap = arrayShrink(cMap.^2,mask,'split');
cMap = alignAllenTransIm(cMap,allOpts(Cnt).opts.transParams);
fullMaps(:, Cnt) = arrayShrink(cMap(1:x1,1:y1), allenMask, 'merge');
cMap = arrayShrink(cMap(1:x1,1:y1),redMask);
meanModel(1,Cnt) = nanmean(cMap(:));
% load nose map
load([fPath 'predVariance' filesep 'shCurrent' filesep var1 'corr.mat'], 'cMap'); %load current visual map
cMap = arrayShrink(cMap.^2,mask,'split');
cMap = alignAllenTransIm(cMap,allOpts(Cnt).opts.transParams);
noseMaps(:, Cnt) = fullMaps(:, Cnt) - arrayShrink(cMap(1:x1,1:y1), allenMask, 'merge');
% load handle map
load([fPath 'predVariance' filesep 'shCurrent' filesep var2 'corr.mat'], 'cMap'); %load current visual map
cMap = arrayShrink(cMap.^2,mask,'split');
cMap = alignAllenTransIm(cMap,allOpts(Cnt).opts.transParams);
handleMaps(:, Cnt) = fullMaps(:, Cnt) - arrayShrink(cMap(1:x1,1:y1), allenMask, 'merge');
% load paw map
load([fPath 'predVariance' filesep 'shCurrent' filesep var3 'corr.mat'], 'cMap'); %load current visual map
cMap = arrayShrink(cMap.^2,mask,'split');
cMap = alignAllenTransIm(cMap,allOpts(Cnt).opts.transParams);
pawMaps(:, Cnt) = fullMaps(:, Cnt) - arrayShrink(cMap(1:x1,1:y1), allenMask, 'merge');
% load beta maps
load([fPath 'Vc.mat'], 'U');
U = alignAllenTransIm(U,allOpts(Cnt).opts.transParams);
U = U(1:size(allenMask,1), 1:size(allenMask,2), :);
load([fPath 'dimBeta.mat'], 'dimBeta'); %load current maps
load([fPath 'regData.mat'], 'idx' ,'trialIdx', 'recIdx', 'recLabels','gaussShift');
temp = dimBeta(recIdx(~idx) == find(ismember(recLabels, var1)), :);
visBeta(1:size(temp,1), Cnt) = nanmean(arrayShrink(U, ~areaCoord{1}, 'merge') * temp');
temp = dimBeta(recIdx(~idx) == find(ismember(recLabels, var2)), :);
handleBeta(1:size(temp,1), Cnt) = nanmean(arrayShrink(U, ~areaCoord{2}, 'merge') * temp');
% load explaiend hemo var
load([fPath 'HemoCorrection.mat'], 'hemoVar'); %load current visual map
expHemo(Cnt) = hemoVar;
% load explaiend hemo var
load([fPath 'HemoCorrection.mat'], 'hemoVar'); %load current visual map
% load data and compute its variance
load([fPath 'Vc.mat'], 'U', 'Vc'); %load current data
Vc = reshape(Vc,size(Vc,1),[]);
U = alignAllenTransIm(U,allOpts(Cnt).opts.transParams);
U = arrayShrink(U(1:x1,1:y1,:), allenMask);
covVc = cov(Vc'); % S x S
fullVarMaps(:, Cnt) = sum((U * covVc) .* U, 2)'; % 1 x P
toc;
end
clear cMap Vc U
%% save down results
if ~exist(sPath,'dir')
mkdir(sPath);
end
save([sPath 'fullVarMaps_GFP.mat'],'fullVarMaps', 'meanModel', 'allenMask');
save([sPath 'fullMaps_GFP.mat'],'fullMaps');
save([sPath 'noseMaps_GFP.mat'],'noseMaps');
save([sPath 'handleMaps_GFP.mat'],'handleMaps');
save([sPath 'pawMaps_GFP.mat'],'pawMaps');
save([sPath 'expHemo_GFP.mat'],'expHemo');
save([sPath 'betaTraces_GFP.mat'],'visBeta', 'handleBeta');
end
%% average hemo correction performance
h = figure;
% errorbar([mean(expHemo(GFPidx)) mean(expHemo(Ai93idx)) mean(expHemo(CamKidx))],[sem(expHemo(GFPidx)) sem(expHemo(Ai93idx)) sem(expHemo(CamKidx))], 'k.', 'linewidth',2)
% hold; bar([mean(expHemo(GFPidx)) mean(expHemo(Ai93idx)) mean(expHemo(CamKidx))]);
temp = NaN(size(expHemo,2), 3);
temp(GFPidx, 1) = expHemo(GFPidx);
temp(Ai93idx, 2) = expHemo(Ai93idx);
temp(CamKidx, 3) = expHemo(CamKidx);
boxplot(temp);
axis square;
set(h.Children,'xTick',1:3)
set(h.Children,'xTickLabel',{'GFP' 'Ai93' 'CamK'})
ylabel('Avg. explained variance');
title('Hemodynamic correction performance'); ylim([0 100]);
%% full model plot
figure;
maxRange = 0.5;
% maxRange = prctile(nanmean(fullMaps(:, Ai93idx),2),99);
subplot(1,3,1);
mapImg = imshow(arrayShrink(squeeze(nanmean(fullMaps(:, GFPidx),2)), allenMask, 'split'),[0 maxRange]);
set(mapImg,'AlphaData',~isnan(mapImg.CData)); %make NaNs transparent.
colormap(mapImg.Parent,inferno(256)); axis image
title(['GFP mice - full model'])
hold(mapImg.Parent, 'on');
for x = 1: length(dorsalMaps.edgeOutlineSplit)
plot(dorsalMaps.edgeOutlineSplit{(x)}(:,2), dorsalMaps.edgeOutlineSplit{(x)}(:,1), 'w', 'LineWidth', 0.2);axis image
end
subplot(1,3,2);
mapImg = imshow(arrayShrink(squeeze(nanmean(fullMaps(:, Ai93idx),2)), allenMask, 'split'),[0 maxRange]);
set(mapImg,'AlphaData',~isnan(mapImg.CData)); %make NaNs transparent.
colormap(mapImg.Parent,inferno(256)); axis image
title(['GFP mice - full model'])
hold(mapImg.Parent, 'on');
for x = 1: length(dorsalMaps.edgeOutlineSplit)
plot(dorsalMaps.edgeOutlineSplit{(x)}(:,2), dorsalMaps.edgeOutlineSplit{(x)}(:,1), 'w', 'LineWidth', 0.2);axis image
end
subplot(1,3,3);
mapImg = imshow(arrayShrink(squeeze(nanmean(fullMaps(:, CamKidx),2)), allenMask, 'split'),[0 maxRange]);
set(mapImg,'AlphaData',~isnan(mapImg.CData)); %make NaNs transparent.
colormap(mapImg.Parent,inferno(256)); axis image
title(['GFP mice - full model'])
hold(mapImg.Parent, 'on');
for x = 1: length(dorsalMaps.edgeOutlineSplit)
plot(dorsalMaps.edgeOutlineSplit{(x)}(:,2), dorsalMaps.edgeOutlineSplit{(x)}(:,1), 'w', 'LineWidth', 0.2);axis image
end
%% full model average R2
h = figure;
% errorbar([mean(meanModel(GFPidx)) mean(meanModel(Ai93idx)) mean(meanModel(CamKidx))],[sem(meanModel(GFPidx)) sem(meanModel(Ai93idx)) sem(meanModel(CamKidx))], 'k.', 'linewidth',2)
% hold; bar([mean(meanModel(GFPidx)) mean(meanModel(Ai93idx)) mean(meanModel(CamKidx))]);
temp = NaN(size(meanModel,2), 3);
temp(GFPidx, 1) = meanModel(GFPidx);
temp(Ai93idx, 2) = meanModel(Ai93idx);
temp(CamKidx, 3) = meanModel(CamKidx);
boxplot(temp);
axis square;
set(h.Children,'xTick',1:3)
set(h.Children,'xTickLabel',{'GFP' 'Ai93' 'CamK'})
ylabel('Avg. explained variance');
title('Full model comparison')
%% full variance plot
figure;
% maxRange = 0.5;
maxRange = prctile(nanmean(fullVarMaps(:, Ai93idx),2),99);
subplot(1,3,1);
mapImg = imshow(arrayShrink(squeeze(nanmean(fullVarMaps(:, GFPidx),2)), allenMask, 'split'),[0 maxRange]);
set(mapImg,'AlphaData',~isnan(mapImg.CData)); %make NaNs transparent.
colormap(mapImg.Parent,inferno(256)); axis image
title(['GFP mice - all variance'])
subplot(1,3,2);
mapImg = imshow(arrayShrink(squeeze(nanmean(fullVarMaps(:, Ai93idx),2)), allenMask, 'split'),[0 maxRange]);
set(mapImg,'AlphaData',~isnan(mapImg.CData)); %make NaNs transparent.
colormap(mapImg.Parent,inferno(256)); axis image
title(['GFP mice - all variance'])
subplot(1,3,3);
mapImg = imshow(arrayShrink(squeeze(nanmean(fullVarMaps(:, CamKidx),2)), allenMask, 'split'),[0 maxRange]);
set(mapImg,'AlphaData',~isnan(mapImg.CData)); %make NaNs transparent.
colormap(mapImg.Parent,inferno(256)); axis image
title(['GFP mice - all variance'])
%% full model explained variance plot
figure;
% maxRange = 0.5;
maxRange = prctile(nanmean(fullMaps(:, Ai93idx).*fullVarMaps(:, Ai93idx),2),99);
subplot(1,3,1);
mapImg = imshow(arrayShrink(squeeze(nanmean(fullMaps(:, GFPidx).*fullVarMaps(:, GFPidx),2)), allenMask, 'split'),[0 maxRange]);
set(mapImg,'AlphaData',~isnan(mapImg.CData)); %make NaNs transparent.
colormap(mapImg.Parent,inferno(256)); axis image
title(['GFP mice - absolute explained variance'])
subplot(1,3,2);
mapImg = imshow(arrayShrink(squeeze(nanmean(fullMaps(:, Ai93idx).*fullVarMaps(:, Ai93idx),2)), allenMask, 'split'),[0 maxRange]);
set(mapImg,'AlphaData',~isnan(mapImg.CData)); %make NaNs transparent.
colormap(mapImg.Parent,inferno(256)); axis image
title(['GFP mice - absolute explained variance'])
subplot(1,3,3);
mapImg = imshow(arrayShrink(squeeze(nanmean(fullMaps(:, CamKidx).*fullVarMaps(:, CamKidx),2)), allenMask, 'split'),[0 maxRange]);
set(mapImg,'AlphaData',~isnan(mapImg.CData)); %make NaNs transparent.
colormap(mapImg.Parent,inferno(256)); axis image
title(['GFP mice - absolute explained variance'])
%% nose unique variance
figure;
maxRange = 0.03;
% maxRange = prctile(nanmean(noseMaps(:, Ai93idx),2),99);
subplot(1,3,1);
mapImg = imshow(arrayShrink(squeeze(nanmean(noseMaps(:, GFPidx),2)), allenMask, 'split'),[0 maxRange]);
set(mapImg,'AlphaData',~isnan(mapImg.CData)); %make NaNs transparent.
colormap(mapImg.Parent,inferno(256)); axis image
title('GFP mice - nose exp. variance')
subplot(1,3,2);
mapImg = imshow(arrayShrink(squeeze(nanmean(noseMaps(:, Ai93idx),2)), allenMask, 'split'),[0 maxRange]);
set(mapImg,'AlphaData',~isnan(mapImg.CData)); %make NaNs transparent.
colormap(mapImg.Parent,inferno(256)); axis image
title('Ai93 mice - nose exp. variance')
subplot(1,3,3);
mapImg = imshow(arrayShrink(squeeze(nanmean(noseMaps(:, CamKidx),2)), allenMask, 'split'),[0 maxRange]);
set(mapImg,'AlphaData',~isnan(mapImg.CData)); %make NaNs transparent.
colormap(mapImg.Parent,inferno(256)); axis image
title('CamK mice - nose exp. variance')
%% handle unique variance
figure;
maxRange = 0.02;
% maxRange = prctile(nanmean(handleMaps(:, Ai93idx),2),99);
subplot(1,3,1);
mapImg = imshow(arrayShrink(squeeze(nanmean(handleMaps(:, GFPidx),2)), allenMask, 'split'),[0 maxRange]);
set(mapImg,'AlphaData',~isnan(mapImg.CData)); %make NaNs transparent.
colormap(mapImg.Parent,inferno(256)); axis image
title('GFP mice - handle exp. variance')
hold(mapImg.Parent, 'on');
for x = 1: length(dorsalMaps.edgeOutlineSplit)
plot(dorsalMaps.edgeOutlineSplit{(x)}(:,2), dorsalMaps.edgeOutlineSplit{(x)}(:,1), 'w', 'LineWidth', 0.2);axis image
end
subplot(1,3,2);
mapImg = imshow(arrayShrink(squeeze(nanmean(handleMaps(:, Ai93idx),2)), allenMask, 'split'),[0 maxRange]);
set(mapImg,'AlphaData',~isnan(mapImg.CData)); %make NaNs transparent.
colormap(mapImg.Parent,inferno(256)); axis image
title('Ai93 mice - handle exp. variance')
hold(mapImg.Parent, 'on');
for x = 1: length(dorsalMaps.edgeOutlineSplit)
plot(dorsalMaps.edgeOutlineSplit{(x)}(:,2), dorsalMaps.edgeOutlineSplit{(x)}(:,1), 'w', 'LineWidth', 0.2);axis image
end
subplot(1,3,3);
mapImg = imshow(arrayShrink(squeeze(nanmean(handleMaps(:, CamKidx),2)), allenMask, 'split'),[0 maxRange]);
set(mapImg,'AlphaData',~isnan(mapImg.CData)); %make NaNs transparent.
colormap(mapImg.Parent,inferno(256)); axis image
title('CamK mice - handle exp. variance')
hold(mapImg.Parent, 'on');
for x = 1: length(dorsalMaps.edgeOutlineSplit)
plot(dorsalMaps.edgeOutlineSplit{(x)}(:,2), dorsalMaps.edgeOutlineSplit{(x)}(:,1), 'w', 'LineWidth', 0.2);axis image
end
%% hindpaw unique variance
figure;
maxRange = 0.01;
% maxRange = prctile(nanmean(handleMaps(:, Ai93idx),2),99);
subplot(1,3,1);
mapImg = imshow(arrayShrink(squeeze(nanmean(pawMaps(:, GFPidx),2)), allenMask, 'split'),[0 maxRange]);
set(mapImg,'AlphaData',~isnan(mapImg.CData)); %make NaNs transparent.
colormap(mapImg.Parent,inferno(256)); axis image
title('GFP mice - hindpaw exp. variance')
hold(mapImg.Parent, 'on');
for x = 1: length(dorsalMaps.edgeOutlineSplit)
plot(dorsalMaps.edgeOutlineSplit{(x)}(:,2), dorsalMaps.edgeOutlineSplit{(x)}(:,1), 'w', 'LineWidth', 0.2);axis image
end
subplot(1,3,2);
mapImg = imshow(arrayShrink(squeeze(nanmean(pawMaps(:, Ai93idx),2)), allenMask, 'split'),[0 maxRange]);
set(mapImg,'AlphaData',~isnan(mapImg.CData)); %make NaNs transparent.
colormap(mapImg.Parent,inferno(256)); axis image
title('Ai93 mice - hindpaw exp. variance')
hold(mapImg.Parent, 'on');
for x = 1: length(dorsalMaps.edgeOutlineSplit)
plot(dorsalMaps.edgeOutlineSplit{(x)}(:,2), dorsalMaps.edgeOutlineSplit{(x)}(:,1), 'w', 'LineWidth', 0.2);axis image
end
subplot(1,3,3);
mapImg = imshow(arrayShrink(squeeze(nanmean(pawMaps(:, CamKidx),2)), allenMask, 'split'),[0 maxRange]);
set(mapImg,'AlphaData',~isnan(mapImg.CData)); %make NaNs transparent.
colormap(mapImg.Parent,inferno(256)); axis image
title('CamK mice - hindpaw exp. variance')
hold(mapImg.Parent, 'on');
for x = 1: length(dorsalMaps.edgeOutlineSplit)
plot(dorsalMaps.edgeOutlineSplit{(x)}(:,2), dorsalMaps.edgeOutlineSplit{(x)}(:,1), 'w', 'LineWidth', 0.2);axis image
end
%% beta traces
figure;
subplot(1,2,1); hold on;
stdshade((visBeta(2:45, GFPidx) - visBeta(1, GFPidx))', 'b', (1:44)*(1/30), 0.5);
stdshade((visBeta(2:45, Ai93idx) - visBeta(1, Ai93idx))', 'k', (1:44)*(1/30), 0.5);
stdshade((visBeta(2:45, CamKidx) - visBeta(1, CamKidx))', 'r', (1:44)*(1/30), 0.5);
legend({'GFP' 'Ai93' 'CamK'}); axis square;
xlabel('Time (s)'); ylabel('dF/F');
subplot(1,2,2); hold on;
stdshade((handleBeta(2:45, GFPidx) - handleBeta(1, GFPidx))', 'b', (1:44)*(1/30), 0.5);
stdshade((handleBeta(2:45, Ai93idx) - handleBeta(1, Ai93idx))', 'k', (1:44)*(1/30), 0.5);
stdshade((handleBeta(2:45, CamKidx) - handleBeta(1, CamKidx))', 'r', (1:44)*(1/30), 0.5);
legend({'GFP' 'Ai93' 'CamK'}); axis square
xlabel('Time (s)'); ylabel('dF/F');