To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.
The primary repository for this project is hosted at git://github.com/rmeddis/MAP.git .
This repository is a read-only copy which is updated automatically every hour.
root / testPrograms / testANprob.m @ 33:161913b595ae
History | View | Annotate | Download (5.48 KB)
| 1 |
function vectorStrength=testANprob(targetFrequency,BFlist, levels, ... |
|---|---|
| 2 |
paramsName, paramChanges) |
| 3 |
|
| 4 |
global IHC_VResp_VivoParams IHC_cilia_RPParams IHCpreSynapseParams |
| 5 |
global AN_IHCsynapseParams |
| 6 |
global ANprobRateOutput dt ANtauCas |
| 7 |
global ARattenuation MOCattenuation |
| 8 |
|
| 9 |
AN_spikesOrProbability='probability'; |
| 10 |
|
| 11 |
dbstop if error |
| 12 |
addpath (['..' filesep 'MAP'], ['..' filesep 'utilities'], ... |
| 13 |
['..' filesep 'parameterStore'], ['..' filesep 'wavFileStore'],... |
| 14 |
['..' filesep 'testPrograms']) |
| 15 |
|
| 16 |
if nargin<5 |
| 17 |
paramChanges=[]; |
| 18 |
end |
| 19 |
|
| 20 |
if nargin<4 |
| 21 |
paramsName='Normal'; |
| 22 |
end |
| 23 |
|
| 24 |
if nargin<3 |
| 25 |
levels=-10:10:80; |
| 26 |
end |
| 27 |
|
| 28 |
nLevels=length(levels); |
| 29 |
|
| 30 |
toneDuration=.2; |
| 31 |
rampDuration=0.002; |
| 32 |
silenceDuration=.02; |
| 33 |
localPSTHbinwidth=0.001; |
| 34 |
|
| 35 |
% Use only the first frequency in the GUI targetFrequency box to defineBF |
| 36 |
% targetFrequency=stimulusParameters.targetFrequency(1); |
| 37 |
% BFlist=targetFrequency; |
| 38 |
|
| 39 |
AN_HSRonset=zeros(nLevels,1); |
| 40 |
AN_HSRsaturated=zeros(nLevels,1); |
| 41 |
AN_LSRonset=zeros(nLevels,1); |
| 42 |
AN_LSRsaturated=zeros(nLevels,1); |
| 43 |
|
| 44 |
AR=zeros(nLevels,1); |
| 45 |
MOC=zeros(nLevels,1); |
| 46 |
|
| 47 |
figure(15), clf |
| 48 |
set(gcf,'position',[607 17 368 321]) |
| 49 |
drawnow |
| 50 |
|
| 51 |
%% guarantee that the sample rate is at least 10 times the frequency |
| 52 |
sampleRate=50000; |
| 53 |
while sampleRate< 10* targetFrequency |
| 54 |
sampleRate=sampleRate+10000; |
| 55 |
end |
| 56 |
|
| 57 |
%% adjust sample rate so that the pure tone stimulus has an integer |
| 58 |
%% numver of epochs in a period |
| 59 |
dt=1/sampleRate; |
| 60 |
period=1/targetFrequency; |
| 61 |
|
| 62 |
%% main computational loop (vary level) |
| 63 |
levelNo=0; |
| 64 |
for leveldB=levels |
| 65 |
levelNo=levelNo+1; |
| 66 |
|
| 67 |
fprintf('%4.0f\t', leveldB)
|
| 68 |
amp=28e-6*10^(leveldB/20); |
| 69 |
|
| 70 |
time=dt:dt:toneDuration; |
| 71 |
rampTime=dt:dt:rampDuration; |
| 72 |
ramp=[0.5*(1+cos(2*pi*rampTime/(2*rampDuration)+pi)) ... |
| 73 |
ones(1,length(time)-length(rampTime))]; |
| 74 |
ramp=ramp.*fliplr(ramp); |
| 75 |
|
| 76 |
silence=zeros(1,round(silenceDuration/dt)); |
| 77 |
|
| 78 |
% create signal (leveldB/ targetFrequency) |
| 79 |
inputSignal=amp*sin(2*pi*targetFrequency'*time); |
| 80 |
inputSignal= ramp.*inputSignal; |
| 81 |
inputSignal=[silence inputSignal]; |
| 82 |
|
| 83 |
%% run the model |
| 84 |
showPlotsAndDetails=0; |
| 85 |
|
| 86 |
|
| 87 |
MAP1_14(inputSignal, 1/dt, BFlist, ... |
| 88 |
paramsName, AN_spikesOrProbability, paramChanges); |
| 89 |
|
| 90 |
nTaus=length(ANtauCas); |
| 91 |
|
| 92 |
%LSR (same as HSR if no LSR fibers present) |
| 93 |
[nANFibers nTimePoints]=size(ANprobRateOutput); |
| 94 |
|
| 95 |
numLSRfibers=1; |
| 96 |
numHSRfibers=numLSRfibers; |
| 97 |
|
| 98 |
LSRspikes=ANprobRateOutput(1:numLSRfibers,:); |
| 99 |
PSTH=UTIL_PSTHmaker(LSRspikes, dt, localPSTHbinwidth); |
| 100 |
PSTHLSR=PSTH/(localPSTHbinwidth/dt); % across fibers rates |
| 101 |
PSTHtime=localPSTHbinwidth:localPSTHbinwidth:... |
| 102 |
localPSTHbinwidth*length(PSTH); |
| 103 |
AN_LSRonset(levelNo)= max(PSTHLSR); % peak in 5 ms window |
| 104 |
AN_LSRsaturated(levelNo)= mean(PSTHLSR(round(length(PSTH)/2):end)); |
| 105 |
|
| 106 |
% HSR |
| 107 |
HSRspikes= ANprobRateOutput(end- numHSRfibers+1:end, :); |
| 108 |
PSTH=UTIL_PSTHmaker(HSRspikes, dt, localPSTHbinwidth); |
| 109 |
PSTH=PSTH/(localPSTHbinwidth/dt); % sum across fibers (HSR only) |
| 110 |
AN_HSRonset(levelNo)= max(PSTH); |
| 111 |
AN_HSRsaturated(levelNo)= mean(PSTH(round(length(PSTH)/2): end)); |
| 112 |
|
| 113 |
figure(15), subplot(2,2,4) |
| 114 |
hold off, bar(PSTHtime,PSTH, 'b') |
| 115 |
hold on, bar(PSTHtime,PSTHLSR,'r') |
| 116 |
ylim([0 1000]) |
| 117 |
xlim([0 length(PSTH)*localPSTHbinwidth]) |
| 118 |
set(gcf,'name',[num2str(BFlist), ' Hz: ' num2str(leveldB) ' dB']); |
| 119 |
|
| 120 |
AR(levelNo)=min(ARattenuation); |
| 121 |
MOC(levelNo)=min(MOCattenuation(length(MOCattenuation)/2:end)); |
| 122 |
|
| 123 |
|
| 124 |
figure(15), subplot(2,2,3) |
| 125 |
plot(20*log10(MOC), 'k'), |
| 126 |
title(' MOC'), ylabel('dB attenuation')
|
| 127 |
ylim([-30 0]) |
| 128 |
|
| 129 |
|
| 130 |
end % level |
| 131 |
figure(15), subplot(2,2,3) |
| 132 |
plot(levels,20*log10(MOC), 'k'), |
| 133 |
title(' MOC'), ylabel('dB attenuation')
|
| 134 |
ylim([-30 0]) |
| 135 |
xlim([0 max(levels)]) |
| 136 |
|
| 137 |
fprintf('\n')
|
| 138 |
toneDuration=2; |
| 139 |
rampDuration=0.004; |
| 140 |
silenceDuration=.02; |
| 141 |
nRepeats=200; % no. of AN fibers |
| 142 |
fprintf('toneDuration %6.3f\n', toneDuration)
|
| 143 |
fprintf(' %6.0f AN fibers (repeats)\n', nRepeats)
|
| 144 |
fprintf('levels')
|
| 145 |
fprintf('%6.2f\t', levels)
|
| 146 |
fprintf('\n')
|
| 147 |
|
| 148 |
|
| 149 |
% ---------------------------------------------------- display parameters |
| 150 |
|
| 151 |
|
| 152 |
nRows=2; nCols=2; |
| 153 |
|
| 154 |
% AN rate - level ONSET functions |
| 155 |
subplot(nRows,nCols,1) |
| 156 |
plot(levels,AN_LSRonset,'ro'), hold on |
| 157 |
plot(levels,AN_HSRonset,'ko'), hold off |
| 158 |
ylim([0 1000]), xlim([min(levels) max(levels)]) |
| 159 |
ttl=['tauCa= ' num2str(IHCpreSynapseParams.tauCa)]; |
| 160 |
title( ttl) |
| 161 |
xlabel('level dB SPL'), ylabel('peak rate (sp/s)'), grid on
|
| 162 |
text(0, 800, 'AN onset', 'fontsize', 16) |
| 163 |
|
| 164 |
% AN rate - level ADAPTED function |
| 165 |
subplot(nRows,nCols,2) |
| 166 |
plot(levels,AN_LSRsaturated, 'ro'), hold on |
| 167 |
plot(levels,AN_HSRsaturated, 'ko'), hold off |
| 168 |
ylim([0 400]) |
| 169 |
set(gca,'ytick',0:50:300) |
| 170 |
xlim([min(levels) max(levels)]) |
| 171 |
set(gca,'xtick',[levels(1):20:levels(end)]) |
| 172 |
% grid on |
| 173 |
ttl=[ 'spont=' num2str(mean(AN_HSRsaturated(1,:)),'%4.0f')... |
| 174 |
' sat=' num2str(mean(AN_HSRsaturated(end,1)),'%4.0f')]; |
| 175 |
title( ttl) |
| 176 |
xlabel('level dB SPL'), ylabel ('adapted rate (sp/s)')
|
| 177 |
text(0, 340, 'AN adapted', 'fontsize', 16), grid on |
| 178 |
|
| 179 |
allData=[ levels' AN_HSRonset AN_HSRsaturated... |
| 180 |
AN_LSRonset AN_LSRsaturated ]; |
| 181 |
fprintf('\n levels \tANHSR Onset \tANHSR adapted\tANLSR Onset \tANLSR adapted\tCNHSR\tCNLSR\tICHSR \tICLSR \n');
|
| 182 |
UTIL_printTabTable(round(allData)) |
| 183 |
|
| 184 |
|
| 185 |
UTIL_showStruct(IHC_cilia_RPParams, 'IHC_cilia_RPParams') |
| 186 |
UTIL_showStruct(IHCpreSynapseParams, 'IHCpreSynapseParams') |
| 187 |
UTIL_showStruct(AN_IHCsynapseParams, 'AN_IHCsynapseParams') |
| 188 |
|
| 189 |
fprintf('\n')
|
| 190 |
disp('levels vectorStrength')
|
| 191 |
|
| 192 |
allData=[ levels' AN_HSRonset AN_HSRsaturated... |
| 193 |
AN_LSRonset AN_LSRsaturated ]; |
| 194 |
fprintf('\n levels \tANHSR Onset \tANHSR adapted\tANLSR Onset \tANLSR adapted\tCNHSR\tCNLSR\tICHSR \tICLSR \n');
|
| 195 |
UTIL_printTabTable(round(allData)) |
| 196 |
|