Skip to content

Commit f389e5c

Browse files
committed
Velocity: added photodiode stimulus traces using calibration for representative traces, Sine: added shorter simulated linker tau to summary plots, Calib: testing calibration usefulness for non-step protocols, Charge: new script for exploring charge asymmetry
1 parent 2abe741 commit f389e5c

5 files changed

Lines changed: 84 additions & 23 deletions

File tree

Analysis/SK/AnnotatedScripts/Velocity_VoltageAtt_180913.m

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
clear projects;
1717

1818
ephysMetaData = ImportMetaData(); %Recording Database.xlsx
19-
attenuationData = ImportMetaData(); %AttenuationCalcs.xlsx
19+
attenuationData = ImportMetaData(); %AttenuationCalcs_IC2_180810.xlsx
2020

2121
%% Analyze capacity transient for C, Rs, and tau
2222

@@ -69,7 +69,7 @@
6969

7070
[velocityMRCs, velocityStim] = IdAnalysis(ephysData,protList,velocityCells,'num','matchType',matchType, ...
7171
'tauType','thalfmax', 'sortSweepsBy', sortSweeps, 'integrateCurrent',1 , ...
72-
'recParameters', ephysMetaData,'sepByStimDistance',1);
72+
'recParameters', ephysMetaData,'sepByStimDistance',1,'pdCompare',1);
7373

7474
clear protList sortSweeps matchType
7575

@@ -100,20 +100,46 @@
100100
figure();
101101
plot(velocityMRCs{1,2}');
102102
cmapline('ax',gca,'colormap','copper');
103+
103104
%% Plot selected representative traces and stimuli
104105
% FAT214 with on ramps for 106, 785, 1560, 7230, 39740 um/s
105106
whichTraces = [3 5 6 10 12];
106107

107108
% Grab stimuli based on velocityStim (second output from IdAnalysis)
108-
% Just example stim from one trace
109-
% Should this be photodiode trace? (if so don't forget to zero it)
109+
% Just example stim from one single trace, not averaged
110110
stimTrace = cell(0);
111111
stimTrace{1} = ephysData.FAT214.data{2,18}(:,2);
112112
stimTrace{2} = ephysData.FAT214.data{2,11}(:,2);
113113
stimTrace{3} = ephysData.FAT214.data{2,12}(:,3);
114114
stimTrace{4} = ephysData.FAT214.data{2,12}(:,4);
115115
stimTrace{5} = ephysData.FAT214.data{2,17}(:,5);
116116

117+
% Plot calibrated photodiode trace as alternative
118+
a = ephysData.FAT214.data{3,24}; % probe steps
119+
a = a-mean(a(1:3000));
120+
b = ephysData.FAT214.data{3,25}-ephysData.FAT214.data{3,26}; %pd steps minus worm only pd steps
121+
b = b-mean(b(1:3000));
122+
c = [0 2.5 5 7.5 10 12.5];
123+
124+
% calibCells = {'FAT214'};
125+
% calibData = cell(0);
126+
% calibData{1} = b;
127+
%
128+
% clear handles;
129+
% plotData = calibData{:,1};
130+
% handles = selectCalibSteps(plotData,calibCells{1});
131+
% stepIdx = handles.cursorPoints(:,1);
132+
% stepIdx = reshape(stepIdx,2,[])';
133+
% for j = 1:size(stepIdx,1)
134+
% stepValues(1,j) = mean(plotData(stepIdx(j,1):stepIdx(j,2)))';
135+
% end
136+
% close;
137+
% d = stepValues(1:6);
138+
d = [0.000254495420305394,-0.0837948030556295,-0.321306248450060,-0.664159366423493,-1.04265743523145,-1.44646508446994];
139+
e = velocityStim{1,3};
140+
f = interp1(-d,c,-e,'pchip');
141+
pdTrace = f(whichTraces,:);
142+
117143
%pad to same length
118144
sweepLengths = cellfun('length',stimTrace);
119145
maxLength = max(sweepLengths);
@@ -126,7 +152,7 @@
126152

127153
figure();
128154
axh(1)=subplot(2,1,1);
129-
plot(tVec,stimTrace);
155+
plot(tVec,pdTrace);
130156
cmapline('ax',gca,'colormap','copper');
131157
chH = get(gca,'children');
132158
set(gca,'children',flipud(chH));
@@ -156,7 +182,7 @@
156182
offH{2} = vline(offBox(:,2),'b:');
157183
cmapline('lines',offH{1}','colormap','bone');
158184
cmapline('lines',offH{2}','colormap','bone');
159-
185+
160186
%% Plot representative trace expansions
161187
figure();
162188
axh(1)=subplot(2,1,1);

Analysis/SK/PDCalibTest.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,15 @@
3333
%% Select ranges from calibration protocol
3434
for iCell = 1:length(calibCells)
3535
clear handles;
36-
plotData = calibData(:,iCell);
36+
plotData = calibData{:,iCell};
3737

3838
% Run GUI for selecting ranges (hit Begin Selection, then place data
3939
% cursors in pairs around your ranges. shift-Click for each new data
4040
% cursor, and click to move the most recently active cursor, or move
4141
% any cursor at a later time, but be sure to keep them paired with the
4242
% same start/end cursor).
4343
%TODO: Fix the datatip labels.
44-
handles = selectCalibSteps(plotData);
44+
handles = selectCalibSteps(plotData,calibCells{iCell});
4545

4646
% Pull out the mean value of the signal between the indices set by the
4747
% user's cursor placement. Store in stepValues with [recordings, steps]
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
% ChargeExploration.m
2+
%
3+
%
4+
% Exploring asymmetry in charge with multi-rep noise analysis traces.
5+
% Variation in charge asymmetry with small steps, and whether charge
6+
% actually returns to zero by the end of the on step even if there is no
7+
% current detectable above noise.
8+
9+
strainList = {'TU2769'};
10+
internalList = {'IC6'};
11+
stimPosition = {'anterior'};
12+
13+
wormPrep = {'dissected'};
14+
cellDist = [40 200];
15+
resistCutoff = '<250';
16+
extFilterFreq = [2.5 5];
17+
18+
noiseTrapCells = FilterRecordings(ephysData, ephysMetaData,...
19+
'strain', strainList, 'internal', internalList, ...
20+
'stimLocation', stimPosition, 'wormPrep', wormPrep, ...
21+
'cellStimDistUm',cellDist, 'RsM', resistCutoff, ...
22+
'stimFilterFrequencykHz', extFilterFreq, 'included', 1);

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
stimPosition = {'posterior'};
77

88
wormPrep = {'dissected'};
9-
cellDist = [40 100];
9+
cellDist = [40 90];
1010
resistCutoff = '<250';
1111
extFilterFreq = [2.5 5];
1212

@@ -32,6 +32,9 @@
3232
%as new file.
3333

3434
%% Running analysis
35+
protList ={'WC_Probe8','WC_Probe4','WC_Probe3','WC_Probe12'};
36+
37+
matchType = 'first';
3538

3639
noisePre = NonStatNoiseAnalysis(ephysData,protList,noisePreCells,...
3740
'matchType',matchType,'recParameters',ephysMetaData);

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

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,6 @@
7878

7979
% sine_allExt_ant_PDfiltered(180923).xls for all
8080

81-
% okay we're just going to plot the power spectrum in the morning and
82-
% ignore the bode plot because I don't know what a "system" object really
83-
% is in matlab or if my data can be one, or what a linear time-invariant
84-
% system is or why a Bode plot is useful
8581
%% Calculate PSD
8682
figure();
8783
eachFreq = [0 10 30 100 200 500 1000];
@@ -156,21 +152,31 @@
156152
meanPSDByFreqI = meanPSDByFreq;
157153

158154
%% Read in simulated power spectra and steady-state/rms
159-
sim_path = 'C:\Users\Sammy\Dropbox\Goodman Lab\Posters Papers Proposals\2018-Katta-SpatiotemporalDynamics\source-data\temporal-frequency\figure_4c_stimulus.txt';
155+
freqSim_path = 'C:\Users\Sammy\Dropbox\Goodman Lab\Posters Papers Proposals\2018-Katta-SpatiotemporalDynamics\source-data\temporal-frequency\';
156+
157+
sim_path = fullfile(freqSim_path,'figure_4c_stimulus.txt');
160158
sim_stim = dlmread(sim_path,'\t',1,0);
161159
sim_f = sim_stim(:,1);
162160
sim_stim = sim_stim(:,2:end);
163161

164-
sim_path = 'C:\Users\Sammy\Dropbox\Goodman Lab\Posters Papers Proposals\2018-Katta-SpatiotemporalDynamics\source-data\temporal-frequency\figure_4c_response.txt';
162+
sim_path = fullfile(freqSim_path,'figure_4c_response.txt');
165163
sim_resp = dlmread(sim_path,'\t',1,1);
166164

167-
sim_path = 'C:\Users\Sammy\Dropbox\Goodman Lab\Posters Papers Proposals\2018-Katta-SpatiotemporalDynamics\source-data\temporal-frequency\figure_4d.txt';
168-
sim_steady = dlmread(sim_path,'\t',1,0);
169-
sim_sum_f = sim_steady(:,1);
170-
sim_steady = sim_steady(:,2:end);
165+
sim_path = fullfile(freqSim_path, 'figure_4d.txt');
166+
sim_steady_t2p9 = dlmread(sim_path,'\t',1,0);
167+
sim_sum_f = sim_steady_t2p9(:,1);
168+
sim_steady_t2p9 = sim_steady_t2p9(:,2:end);
169+
170+
sim_path = fullfile(freqSim_path, 'figure_4e.txt');
171+
sim_rms_t2p9 = dlmread(sim_path,'\t',1,1);
172+
173+
sim_path = fullfile(freqSim_path, 'figure_7d.txt');
174+
sim_steady_t0p6 = dlmread(sim_path,'\t',1,0);
175+
sim_sum_f_t0p6 = sim_steady_t0p6(:,1);
176+
sim_steady_t0p6 = sim_steady_t0p6(:,2:end);
171177

172-
sim_path = 'C:\Users\Sammy\Dropbox\Goodman Lab\Posters Papers Proposals\2018-Katta-SpatiotemporalDynamics\source-data\temporal-frequency\figure_4e.txt';
173-
sim_rms = dlmread(sim_path,'\t',1,1);
178+
sim_path = fullfile(freqSim_path, 'figure_7e.txt');
179+
sim_rms_t0p6 = dlmread(sim_path,'\t',1,1);
174180

175181
%% Plot stacked power spectra for sim and experimental
176182

@@ -287,10 +293,12 @@
287293
figure(); clear axh;
288294
yyh = cell(0);
289295

290-
yyh = plotyy(eachFreq,meanSteadyByFreq(:,1),sim_sum_f,sim_steady,@semilogx);
296+
yyh = plotyy(eachFreq,meanSteadyByFreq(:,1),sim_sum_f,sim_steady_t2p9,@semilogx);
291297
set(yyh(1),'YLim',[0 60],'YTick',(0:20:60));
292298
hold(yyh(1),'on');
293299
errorbar(yyh(1),eachFreq,meanSteadyByFreq(:,1),meanSteadyByFreq(:,3),'bo');
300+
hold(yyh(2),'on');
301+
plot(yyh(2),sim_sum_f_t0p6,sim_steady_t0p6);
294302
set(yyh,'box','off');
295303
xlabel('Frequency (Hz)')
296304
ylabel(yyh(1),'Steady-state current (pA)');
@@ -299,10 +307,12 @@
299307
figure(); clear axh;
300308
yyh = cell(0);
301309

302-
yyh = plotyy(eachFreq,meanRMSByFreq(:,1),sim_sum_f,sim_rms,@semilogx);
310+
yyh = plotyy(eachFreq,meanRMSByFreq(:,1),sim_sum_f,sim_rms_t2p9,@semilogx);
303311
set(yyh(1),'YLim',[0 8],'YTick',(0:2:8));
304312
hold(yyh(1),'on');
305313
errorbar(yyh(1),eachFreq,meanRMSByFreq(:,1),meanRMSByFreq(:,3),'bo');
314+
hold(yyh(2),'on');
315+
plot(yyh(2),sim_sum_f_t0p6,sim_rms_t0p6);
306316
set(yyh, 'box','off');
307317
xlabel('Frequency (Hz)')
308318
ylabel(yyh(1),'Steady-state RMS (pA)');

0 commit comments

Comments
 (0)