Skip to content

Commit 1a77d0d

Browse files
committed
plots and clarity
1 parent 21039a8 commit 1a77d0d

2 files changed

Lines changed: 32 additions & 38 deletions

File tree

Analysis/SK/AnnotatedScripts/Velocity_VoltageAtt_180913.m

Lines changed: 32 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -102,28 +102,43 @@
102102
% Grab stimuli based on velocityStim (second output from IdAnalysis)
103103
% Just example stim from one trace
104104
% Should this be photodiode trace? (if so don't forget to zero it)
105-
stimTrace{1} = ephysData.FAT214.data{3,18}(:,2);
106-
stimTrace{2} = ephysData.FAT214.data{3,11}(:,2);
107-
stimTrace{3} = ephysData.FAT214.data{3,12}(:,3);
108-
stimTrace{4} = ephysData.FAT214.data{3,12}(:,4);
109-
stimTrace{5} = ephysData.FAT214.data{3,11}(:,3);
110-
105+
stimTrace = cell(0);
106+
stimTrace{1} = ephysData.FAT214.data{2,18}(:,2);
107+
stimTrace{2} = ephysData.FAT214.data{2,11}(:,2);
108+
stimTrace{3} = ephysData.FAT214.data{2,12}(:,3);
109+
stimTrace{4} = ephysData.FAT214.data{2,12}(:,4);
110+
stimTrace{5} = ephysData.FAT214.data{2,17}(:,5);
111+
112+
%pad to same length
113+
sweepLengths = cellfun('length',stimTrace);
114+
maxLength = max(sweepLengths);
115+
stimTrace = cellfun(@(x)cat(1,x,NaN(maxLength-length(x),1)),stimTrace,'UniformOutput',false);
116+
stimTrace = cell2mat(stimTrace);
117+
stimZero = mean(stimTrace(1:100,:),1);
118+
stimTrace = stimTrace - repmat(stimZero,[10000 1]);
119+
stimTrace = stimTrace/0.408;
120+
tVec = (1:length(velocityMRCs{1,2}))/10; % time in ms
111121

112122

113123
figure();
114124
axh(1)=subplot(2,1,1);
115125
for i = 1:5
116-
plot(stimTrace{i})
117-
hold on
126+
plot(tVec,stimTrace);
118127
end
119-
tVec = (1:length(velocityMRCs{1,2}))/10; % time in ms
128+
cmapline('ax',gca,'colormap','copper');
129+
chH = get(gca,'children');
130+
set(gca,'children',flipud(chH));
131+
132+
axh(2)=subplot(2,1,2);
120133
plot(tVec,velocityMRCs{1,2}([2 5 6 10 12],:)');
134+
linkaxes(axh,'x');
121135
cmapline('ax',gca,'colormap','copper');
122136
chH = get(gca,'children');
123137
set(gca,'children',flipud(chH));
138+
ylim([-10e-11 1e-11]);
124139
plotfixer();
125140

126-
%% Pull out and combine relevant data for plot
141+
%% Pull out and combine data to plot one particular velocity vs. distance
127142

128143
% Voltage attenuation data comes from the length constant fitting done in
129144
% Igor, which gives a voltage attenuation factor at the location of the
@@ -192,7 +207,7 @@
192207

193208
clear a iCell thisCell whichMRCs whichStep thisName hasAtt distVPeak
194209

195-
%% Make correction to I for space clamp error
210+
%% Make correction to I for space clamp error for one particular velocity
196211
% (Note: this is an approximation, assuming that the majority of the
197212
% current is happening at the stimulus site, which we know is not entirely
198213
% true, and channels at different points along the neurite will experience
@@ -226,7 +241,7 @@
226241
distVPeak_Off(:,4) = (Im * (Vc-Ena)) ./ (Vm-Ena);
227242

228243

229-
%% Plot on and off currents vs distance
244+
%% Plot on and off currents vs distance for one velocity
230245

231246
figure();
232247
scatter(distVPeak_On(:,1),distVPeak_On(:,4),'b');
@@ -239,16 +254,16 @@
239254
legend({'On current','Off current'});
240255

241256

242-
%% Correct all sizes and export for Igor fitting of Boltzmann to each recording
257+
%% Correct all velocities and export for Igor fitting of Boltzmann to each recording
243258

244259
% Set the filename
245-
fname = 'PatchData/attCorrectedVel_times(181002).xls';
260+
fname = 'PatchData/attCorrectedVel(181004).xls';
246261
noCorr = 0;
247262

248263
for i = 1:2
249264
whichRamp = i; % 1 for on currents, 2 for off currents
250265
normFlag = 0; %normalize to 40mm/s ramp (highest velocity "step")
251-
peakCol = 9; % 6 for peak current, 11 for integrated current/charge
266+
peakCol = 6; % 6 for peak current, 11 for integrated current/charge
252267
% 8 for tauAct, 9 for tauDecay
253268
switch peakCol
254269
case 6
@@ -371,6 +386,8 @@
371386
end
372387

373388
out = out(~cellfun(@isempty,out(:,1)),:);
389+
out(1,:) = cellfun(@(x) regexprep(x,'stim1','ratio'),out(1,:),'un',0);
390+
374391
xlswrite(fname,out,sprintf('velPeak_ratio'));
375392

376393

Analysis/SK/IdAnalysis.m

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -562,29 +562,6 @@
562562
% TODO: have column 2 of sortedLeakSub be the stim trace used to find stim, for easy
563563
% plotting access, and col 3 = PD trace, once you have that set up.
564564

565-
% keyboard;
566-
567-
%
568-
%
569-
% if calibFlag==1
570-
% mechPeaks{iCell,1} = [eachSize(~isnan(eachSize)) meanPDSize(~isnan(eachSize)) ...
571-
% pkOn pkOff onsetTau offsetTau pkOnLoc pkOffLoc nReps];
572-
% mechPeaks{iCell,2} = meansByParam;
573-
% mechPeaks{iCell,3} = meanPDTrace;
574-
% mechPeaks{iCell,4} = repmat(cellName,[size(pkOn),1]);
575-
% mechPeaks{iCell,5} = theseIDs;
576-
% else
577-
% mechPeaks{iCell,1} = ...
578-
% [eachSize(~isnan(eachSize)) nan(size(eachSize(~isnan(eachSize))))...
579-
% pkOn pkOff onsetTau offsetTau pkOnLoc pkOffLoc nReps];
580-
% mechPeaks{iCell,2} = meansByParam;
581-
% mechPeaks{iCell,4} = repmat(cellName,[size(pkOn),1]);
582-
% mechPeaks{iCell,5} = theseIDs;
583-
% end
584-
% % TODO: Figure out how to fit this to the four-parameter sigmoidal
585-
% % function used in O'Hagan: @(X,a,b,c,d) ((a-d)/(1+((X/c)^b)))+d
586-
% % Using optimtool? fmincon? nlinfit if you add the statistics toolbox.
587-
588565
% reset calibFlag to true if it was unset for a particular cell
589566
if calibFlag == 2
590567
calibFlag = 1;

0 commit comments

Comments
 (0)