Revision 18:e9e263e4fcde testPrograms/showMAP.m
| testPrograms/showMAP.m | ||
|---|---|---|
| 1 | 1 |
function showMAP (options) |
| 2 | 2 |
% defaults |
| 3 |
% options.showModelParameters=1; |
|
| 4 |
% options.showModelOutput=1; |
|
| 5 |
% options.printFiringRates=1; |
|
| 6 |
% options.showACF=1; |
|
| 7 |
% options.showEfferent=1; |
|
| 3 |
% options.showModelParameters=1; |
|
| 4 |
% options.showModelOutput=1; |
|
| 5 |
% options.printFiringRates=1; |
|
| 6 |
% options.showACF=1; |
|
| 7 |
% options.showEfferent=1; |
|
| 8 |
% options.surfProbability=0; |
|
| 9 |
% options.fileName=[]; |
|
| 8 | 10 |
|
| 9 | 11 |
dbstop if warning |
| 10 | 12 |
|
| ... | ... | |
| 13 | 15 |
DRNLoutput IHC_cilia_output IHCrestingCiliaCond IHCrestingV... |
| 14 | 16 |
IHCoutput ANprobRateOutput ANoutput savePavailable tauCas ... |
| 15 | 17 |
CNoutput ICoutput ICmembraneOutput ICfiberTypeRates MOCattenuation |
| 18 |
global OMEParams DRNLParams IHC_cilia_RPParams IHCpreSynapseParams |
|
| 19 |
global AN_IHCsynapseParams MacGregorParams MacGregorMultiParams |
|
| 20 |
|
|
| 16 | 21 |
|
| 17 | 22 |
restorePath=path; |
| 18 | 23 |
addpath ( ['..' filesep 'utilities'], ['..' filesep 'parameterStore']) |
| ... | ... | |
| 21 | 26 |
options.showModelParameters=1; |
| 22 | 27 |
options.showModelOutput=1; |
| 23 | 28 |
options.printFiringRates=1; |
| 24 |
options.showACF=1;
|
|
| 29 |
options.showACF=0;
|
|
| 25 | 30 |
options.showEfferent=1; |
| 31 |
options.surfProbability=0; |
|
| 32 |
options.fileName=[]; |
|
| 26 | 33 |
end |
| 27 | 34 |
|
| 28 | 35 |
if options.showModelParameters |
| ... | ... | |
| 46 | 53 |
duration=size(TMoutput,2)*dt; |
| 47 | 54 |
disp(['AN: ' num2str(sum(sum(ANoutput(end-nHSRfibers+1:end,:)))/... |
| 48 | 55 |
(nHSRfibers*duration))]) |
| 49 |
|
|
| 56 |
|
|
| 50 | 57 |
nCNneurons=size(CNoutput,1); |
| 51 | 58 |
nHSRCNneuronss=nCNneurons/nANfiberTypes; |
| 52 | 59 |
disp(['CN: ' num2str(sum(sum(CNoutput(end-nHSRCNneuronss+1:end,:)))... |
| 53 | 60 |
/(nHSRCNneuronss*duration))]) |
| 54 |
disp(['IC: ' num2str(sum(sum(ICoutput)))]) |
|
| 55 |
disp(['IC by type: ' num2str(mean(ICfiberTypeRates,2)')]) |
|
| 61 |
disp(['IC: ' num2str(sum(sum(ICoutput))/duration)])
|
|
| 62 |
% disp(['IC by type: ' num2str(mean(ICfiberTypeRates,2)')])
|
|
| 56 | 63 |
else |
| 57 | 64 |
disp(['AN: ' num2str(mean(mean(ANprobRateOutput)))]) |
| 58 | 65 |
end |
| ... | ... | |
| 64 | 71 |
plotInstructions.figureNo=99; |
| 65 | 72 |
signalRMS=mean(savedInputSignal.^2)^0.5; |
| 66 | 73 |
signalRMSdb=20*log10(signalRMS/20e-6); |
| 67 |
|
|
| 74 |
|
|
| 68 | 75 |
% plot signal (1) |
| 69 | 76 |
plotInstructions.displaydt=dt; |
| 70 | 77 |
plotInstructions.numPlots=6; |
| ... | ... | |
| 74 | 81 |
r=size(savedInputSignal,1); |
| 75 | 82 |
if r==1, savedInputSignal=savedInputSignal'; end |
| 76 | 83 |
UTIL_plotMatrix(savedInputSignal', plotInstructions); |
| 77 |
|
|
| 84 |
|
|
| 78 | 85 |
% stapes (2) |
| 79 | 86 |
plotInstructions.subPlotNo=2; |
| 80 | 87 |
plotInstructions.title= ['stapes displacement']; |
| 81 | 88 |
UTIL_plotMatrix(OMEoutput, plotInstructions); |
| 82 |
|
|
| 89 |
|
|
| 83 | 90 |
% DRNL (3) |
| 84 | 91 |
plotInstructions.subPlotNo=3; |
| 85 | 92 |
plotInstructions.title= ['BM displacement']; |
| 86 | 93 |
plotInstructions.yValues= savedBFlist; |
| 87 | 94 |
UTIL_plotMatrix(DRNLoutput, plotInstructions); |
| 88 |
|
|
| 95 |
|
|
| 89 | 96 |
switch saveAN_spikesOrProbability |
| 90 | 97 |
case 'spikes' |
| 91 | 98 |
% AN (4) |
| ... | ... | |
| 100 | 107 |
plotInstructions.rasterDotSize=3; |
| 101 | 108 |
end |
| 102 | 109 |
UTIL_plotMatrix(ANoutput, plotInstructions); |
| 103 |
|
|
| 110 |
|
|
| 104 | 111 |
% CN (5) |
| 105 | 112 |
plotInstructions.displaydt=ANdt; |
| 106 | 113 |
plotInstructions.subPlotNo=5; |
| ... | ... | |
| 109 | 116 |
plotInstructions.rasterDotSize=3; |
| 110 | 117 |
end |
| 111 | 118 |
UTIL_plotMatrix(CNoutput, plotInstructions); |
| 112 |
|
|
| 119 |
|
|
| 113 | 120 |
% IC (6) |
| 114 | 121 |
plotInstructions.displaydt=ANdt; |
| 115 | 122 |
plotInstructions.subPlotNo=6; |
| ... | ... | |
| 126 | 133 |
plotInstructions.zValuesRange= [-.1 0]; |
| 127 | 134 |
UTIL_plotMatrix(ICmembraneOutput, plotInstructions); |
| 128 | 135 |
end |
| 129 |
|
|
| 136 |
|
|
| 130 | 137 |
otherwise % probability (4-6) |
| 131 | 138 |
plotInstructions.displaydt=dt; |
| 132 | 139 |
plotInstructions.numPlots=2; |
| ... | ... | |
| 153 | 160 |
plotInstructions.title= ['AR strength. Signal level= ' ... |
| 154 | 161 |
num2str(signalRMSdb,'%4.0f') ' dB SPL']; |
| 155 | 162 |
UTIL_plotMatrix(20*log10(ARattenuation), plotInstructions); |
| 156 |
|
|
| 163 |
|
|
| 157 | 164 |
plotInstructions.subPlotNo=2; |
| 158 | 165 |
plotInstructions.yValues= savedBFlist; |
| 159 | 166 |
plotInstructions.yLabel= 'BF'; |
| ... | ... | |
| 165 | 172 |
colorbar |
| 166 | 173 |
end |
| 167 | 174 |
|
| 175 |
%% surface plot of probability |
|
| 176 |
if options.surfProbability |
|
| 177 |
figure(97), clf |
|
| 178 |
% select only HSR fibers at the bottom of the matrix |
|
| 179 |
ANprobRateOutput= ANprobRateOutput(end-length(savedBFlist)+1:end,:); |
|
| 180 |
[nY nX]=size(ANprobRateOutput); |
|
| 181 |
time=dt*(1:nX); |
|
| 182 |
surf(time, savedBFlist, ANprobRateOutput) |
|
| 183 |
shading interp |
|
| 184 |
set(gca, 'yScale','log') |
|
| 185 |
xlim([0 max(time)]), ylim([0 max(savedBFlist)]), zlim([0 1000]) |
|
| 186 |
xlabel('time (s)')
|
|
| 187 |
ylabel('best frequency (Hz)')
|
|
| 188 |
zlabel('spike rate')
|
|
| 189 |
view([-20 60]) |
|
| 190 |
title ([options.fileName ': ' num2str(signalRMSdb,'% 3.0f') ' dB']) |
|
| 191 |
end |
|
| 192 |
|
|
| 168 | 193 |
|
| 169 | 194 |
%% ACF plot if required |
| 170 | 195 |
if options.showACF |
| ... | ... | |
| 172 | 197 |
method.dt=dt; |
| 173 | 198 |
method.segmentNo=1; |
| 174 | 199 |
method.nonlinCF=savedBFlist; |
| 175 |
|
|
| 200 |
|
|
| 176 | 201 |
minPitch= 80; maxPitch= 4000; numPitches=100; % specify lags |
| 177 | 202 |
pitches=10.^ linspace(log10(minPitch), log10(maxPitch),numPitches); |
| 178 | 203 |
pitches=fliplr(pitches); |
| ... | ... | |
| 180 | 205 |
filteredSACFParams.acfTau= .003; % time constant of running ACF |
| 181 | 206 |
filteredSACFParams.lambda= 0.12; % slower filter to smooth ACF |
| 182 | 207 |
filteredSACFParams.lambda= 0.01; % slower filter to smooth ACF |
| 183 |
|
|
| 208 |
|
|
| 184 | 209 |
filteredSACFParams.plotACFs=0; % special plot (see code) |
| 185 | 210 |
filteredSACFParams.plotFilteredSACF=0; % 0 plots unfiltered ACFs |
| 186 | 211 |
filteredSACFParams.plotMoviePauses=.3; % special plot (see code) |
| 187 |
|
|
| 212 |
|
|
| 188 | 213 |
filteredSACFParams.usePressnitzer=0; % attenuates ACF at long lags |
| 189 | 214 |
filteredSACFParams.lagsProcedure= 'useAllLags'; |
| 190 | 215 |
% filteredSACFParams.lagsProcedure= 'useBernsteinLagWeights'; |
| 191 | 216 |
% filteredSACFParams.lagsProcedure= 'omitShortLags'; |
| 192 | 217 |
filteredSACFParams.criterionForOmittingLags=3; |
| 193 | 218 |
filteredSACFParams.plotACFsInterval=200; |
| 194 |
|
|
| 219 |
|
|
| 195 | 220 |
if filteredSACFParams.plotACFs |
| 196 | 221 |
% plot original waveform on ACF plot |
| 197 | 222 |
figure(13), clf |
| ... | ... | |
| 201 | 226 |
xlim([0 t(end)]) |
| 202 | 227 |
title(['stimulus: ' num2str(signalRMSdb, '%4.0f') ' dB SPL']); |
| 203 | 228 |
end |
| 204 |
|
|
| 229 |
|
|
| 205 | 230 |
% plot original waveform on summary/smoothed ACF plot |
| 206 |
figure(97), clf
|
|
| 231 |
figure(96), clf
|
|
| 207 | 232 |
subplot(2,1,1) |
| 208 | 233 |
t=dt*(1:length(savedInputSignal)); |
| 209 | 234 |
plot(t,savedInputSignal) |
| 210 | 235 |
xlim([0 t(end)]) |
| 211 | 236 |
title(['stimulus: ' num2str(signalRMSdb, '%4.0f') ' dB SPL']); |
| 212 |
|
|
| 213 |
|
|
| 237 |
|
|
| 238 |
|
|
| 214 | 239 |
% compute ACF |
| 215 | 240 |
switch saveAN_spikesOrProbability |
| 216 | 241 |
case 'probability' |
| ... | ... | |
| 218 | 243 |
otherwise |
| 219 | 244 |
inputToACF=ANoutput; |
| 220 | 245 |
end |
| 221 |
|
|
| 246 |
|
|
| 222 | 247 |
disp ('computing ACF...')
|
| 223 | 248 |
[P, BFlist, sacf, boundaryValue] = ... |
| 224 | 249 |
filteredSACF(inputToACF, method, filteredSACFParams); |
| 225 | 250 |
disp(' ACF done.')
|
| 226 |
|
|
| 251 |
|
|
| 227 | 252 |
% SACF |
| 228 | 253 |
subplot(2,1,2) |
| 229 | 254 |
imagesc(P) |
| ... | ... | |
| 237 | 262 |
set(gca,'xtickLabel', round(100*t(tt))/100) |
| 238 | 263 |
end |
| 239 | 264 |
|
| 240 |
path(restorePath) |
|
| 265 |
path(restorePath) |
|
Also available in: Unified diff