Skip to content

Commit 7f1fb19

Browse files
committed
SinePowerSpec now plots representative traces with calibrated photodiode trace, and fat ISI analysis outputs habituation for both on and off responses
1 parent e216da6 commit 7f1fb19

2 files changed

Lines changed: 49 additions & 10 deletions

File tree

Analysis/SK/Scripts-in-progress/SinePowerSpec.m

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,32 @@
339339
stimTraces = [stimTraces{:}];
340340
tVec = ((1:length(stimTraces))/sf)';
341341

342-
yyh = plotyy(tVec,respTraces,tVec,stimTraces);
342+
% Plot calibrated photodiode trace as alternative
343+
a = ephysData.FAT170.data{3,52}; % probe steps
344+
a = a-mean(a(1:1499));
345+
b = ephysData.FAT170.data{3,53}-ephysData.FAT170.data{3,54}; %pd steps minus worm only pd steps
346+
b = b-mean(b(1:1499));
347+
c = [0 2.5 5 7.5 10 12.5];
348+
349+
% calibCells = {'FAT170'};
350+
% calibData = cell(0);
351+
% calibData{1} = b;
352+
%
353+
% clear handles;
354+
% plotData = calibData{:,1};
355+
% handles = selectCalibSteps(plotData,calibCells{1});
356+
% stepIdx = handles.cursorPoints(:,1);
357+
% stepIdx = reshape(stepIdx,2,[])';
358+
% for j = 1:size(stepIdx,1)
359+
% stepValues(1,j) = mean(plotData(stepIdx(j,1):stepIdx(j,2)))';
360+
% end
361+
% close;
362+
% d = stepValues(1:6);
363+
d = [0.000719859832312041,-0.196562355775423,-0.460558335247858,-0.755470591227155,-1.11678911522346,-1.51308976348689];
364+
e = stimTraces;
365+
pdTraces = interp1(-d,c,-e,'pchip');
366+
367+
yyh = plotyy(tVec,respTraces,tVec,pdTraces);
343368
hline(respMean(1),'b'); hline(respMean(2),'r'); hline(respMean(3),'m');
344369

345370
%% Plot zoomed traces for 5 cycles
@@ -352,10 +377,10 @@
352377
yyh = cell(0);
353378
for i = 1:3
354379
figure();
355-
yyh{i} = plotyy(tVec,respTraces(:,i),tVec,stimTraces(:,i));
380+
yyh{i} = plotyy(tVec,respTraces(:,i),tVec,pdTraces(:,i));
356381
hline(respMean(i),'k:');
357382
set(yyh{i},'XLim',cycleLims(i,:));
358-
set(yyh{i}(2),'YLim',[-1 0]);
383+
set(yyh{i}(2),'YLim',[0 10]);
359384
set(yyh{i}(1),'Ylim',[respMean(i)-15e-12 respMean(i)+15e-12]);
360385
end
361386

Analysis/SK/Scripts-in-progress/wtVsFat_ISI.m

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -121,14 +121,28 @@
121121

122122
%% Plot them
123123

124-
figure(); hold on; ylim(gca,[0 1.75]);
124+
fh(1) = figure(); hold on; ylim(gca,[0 1.75]);
125125
plot(wtOnMean(1:40),'b','LineWidth',2);
126126
plot(fatOnMean(1:40),'Color',[0 1 0],'LineWidth',2);
127+
axh(1) = gca;
128+
fh(2) = figure(); hold on; ylim(gca,[0 1.75]);
129+
plot(wtOffMean(1:40),'b','LineWidth',2);
130+
plot(fatOffMean(1:40),'Color',[0 1 0],'LineWidth',2);
131+
axh(2) = gca;
127132
plotfixer;
128-
plot(wtOnNorm(1:40,:),'Color',[.7 .7 1])
129-
plot(fatOnNorm(1:40,:),'Color',[.2 .7 .2])
130-
ylabel('Normalized on current');
131-
xlabel('Stimulus #');
132-
chH = get(gca,'children');
133-
set(gca,'children',flipud(chH));
133+
134+
plot(axh(1),wtOnNorm(1:40,:),'Color',[.7 .7 1])
135+
plot(axh(1),fatOnNorm(1:40,:),'Color',[.2 .7 .2])
136+
ylabel(axh(1),'Normalized on current');
137+
xlabel(axh(1),'Stimulus #');
138+
chH = get(axh(1),'children');
139+
set(axh(1),'children',flipud(chH));
140+
141+
plot(axh(2),wtOnNorm(1:40,:),'Color',[.7 .7 1])
142+
plot(axh(2),fatOnNorm(1:40,:),'Color',[.2 .7 .2])
143+
ylabel(axh(2),'Normalized off current');
144+
xlabel(axh(2),'Stimulus #');
145+
chH = get(axh(2),'children');
146+
set(axh(2),'children',flipud(chH));
147+
134148

0 commit comments

Comments
 (0)