Mercurial > hg > map
comparison testPrograms/testFM.m @ 38:c2204b18f4a2 tip
End nov big change
author | Ray Meddis <rmeddis@essex.ac.uk> |
---|---|
date | Mon, 28 Nov 2011 13:34:28 +0000 |
parents | 25d53244d5c8 |
children |
comparison
equal
deleted
inserted
replaced
37:771a643d5c29 | 38:c2204b18f4a2 |
---|---|
10 % | 10 % |
11 | 11 |
12 | 12 |
13 global inputStimulusParams outerMiddleEarParams DRNLParams | 13 global inputStimulusParams outerMiddleEarParams DRNLParams |
14 global IHC_VResp_VivoParams IHCpreSynapseParams AN_IHCsynapseParams | 14 global IHC_VResp_VivoParams IHCpreSynapseParams AN_IHCsynapseParams |
15 global ANprobRateOutput ANoutput ANtauCas ANdt | 15 global ANprobRateOutput ANoutput ANtauCas dtSpikes |
16 dbstop if error | 16 dbstop if error |
17 restorePath=path; | 17 restorePath=path; |
18 addpath (['..' filesep 'MAP'], ['..' filesep 'utilities'], ... | 18 addpath (['..' filesep 'MAP'], ['..' filesep 'utilities'], ... |
19 ['..' filesep 'parameterStore'], ['..' filesep 'wavFileStore'],... | 19 ['..' filesep 'parameterStore'], ['..' filesep 'wavFileStore'],... |
20 ['..' filesep 'testPrograms']) | 20 ['..' filesep 'testPrograms']) |
24 paramsName=('Normal'); | 24 paramsName=('Normal'); |
25 AN_spikesOrProbability='spikes'; | 25 AN_spikesOrProbability='spikes'; |
26 paramChanges=[]; | 26 paramChanges=[]; |
27 else | 27 else |
28 if nargin<3 | 28 if nargin<3 |
29 paramChanges=[]; | 29 paramChanges=[]; |
30 end | 30 end |
31 end | 31 end |
32 | 32 |
33 % masker and probe levels are relative to this threshold | 33 % masker and probe levels are relative to this threshold |
34 thresholdAtCF=10; % dB SPL | 34 thresholdAtCF=10; % dB SPL |
142 time=dt: dt: gapDuration; | 142 time=dt: dt: gapDuration; |
143 gap=zeros(1,length(time)); | 143 gap=zeros(1,length(time)); |
144 | 144 |
145 inputSignal=... | 145 inputSignal=... |
146 [initialSilence maskerPa gap probe finalSilence]; | 146 [initialSilence maskerPa gap probe finalSilence]; |
147 % time=dt:dt:length(inputSignal)*dt; | 147 % time=dt:dt:length(inputSignal)*dt; |
148 % figure(99), plot(time,inputSignal) | 148 % figure(99), plot(time,inputSignal) |
149 | 149 |
150 % ********************************** run MAP model | 150 % ********************************** run MAP model |
151 % showPlotsAndDetails=0; | 151 % showPlotsAndDetails=0; |
152 nChanges=length(paramChanges); | 152 nChanges=length(paramChanges); |
153 paramChanges{nChanges+1}='AN_IHCsynapseParams.numFibers= 500;'; | 153 paramChanges{nChanges+1}='AN_IHCsynapseParams.numFibers= 500;'; |
154 MAP1_14(inputSignal, 1/dt, targetFrequency, ... | 154 MAP1_14(inputSignal, 1/dt, targetFrequency, ... |
155 paramsName, AN_spikesOrProbability, paramChanges); | 155 paramsName, AN_spikesOrProbability, paramChanges); |
156 | 156 |
157 if strcmp(AN_spikesOrProbability,'probability') | 157 if strcmp(AN_spikesOrProbability,'probability') |
158 [nFibers c]=size(ANprobRateOutput); | 158 [nFibers c]=size(ANprobRateOutput); |
159 nLSRfibers=nFibers/length(ANtauCas); | 159 nLSRfibers=nFibers/length(ANtauCas); |
160 ANresponse=ANprobRateOutput(end-nLSRfibers:end,:); | 160 ANresponse=ANprobRateOutput(end-nLSRfibers:end,:); |
161 ANdt=dt; % no adjustment for spikes speedup | 161 dtSpikes=dt; % no adjustment for spikes speedup |
162 else | 162 else |
163 [nFibers c]=size(ANoutput); | 163 [nFibers c]=size(ANoutput); |
164 nLSRfibers=nFibers/length(ANtauCas); | 164 nLSRfibers=nFibers/length(ANtauCas); |
165 ANresponse=ANoutput(end-nLSRfibers:end,:); | 165 ANresponse=ANoutput(end-nLSRfibers:end,:); |
166 end | 166 end |
167 | 167 |
168 ANresponse=sum(ANresponse); | 168 ANresponse=sum(ANresponse); |
169 % ANresponseTimes=ANdt:ANdt:length(ANresponse)*ANdt; | 169 % ANresponseTimes=dtSpikes:dtSpikes:length(ANresponse)*dtSpikes; |
170 % figure(99), plot(ANresponseTimes,ANresponse) | 170 % figure(99), plot(ANresponseTimes,ANresponse) |
171 | 171 |
172 % analyse results | 172 % analyse results |
173 probeStart=initialSilenceDuration+maskerDuration+gapDuration; | 173 probeStart=initialSilenceDuration+maskerDuration+gapDuration; |
174 PSTHbinWidth=ANdt; | 174 PSTHbinWidth=dtSpikes; |
175 responseDelay=0.005; | 175 responseDelay=0.005; |
176 probeTimes=probeStart+responseDelay:... | 176 probeTimes=probeStart+responseDelay:... |
177 PSTHbinWidth:probeStart+probeDuration+responseDelay; | 177 PSTHbinWidth:probeStart+probeDuration+responseDelay; |
178 probeIDX=round(probeTimes/PSTHbinWidth); | 178 probeIDX=round(probeTimes/PSTHbinWidth); |
179 probePSTH=ANresponse(probeIDX); | 179 probePSTH=ANresponse(probeIDX); |
187 if showPSTHs | 187 if showPSTHs |
188 nLevels=length(maskerLevels); | 188 nLevels=length(maskerLevels); |
189 nDurations=length(gapDurations); | 189 nDurations=length(gapDurations); |
190 figure(8) | 190 figure(8) |
191 PSTHbinWidth=1e-3; | 191 PSTHbinWidth=1e-3; |
192 PSTH=UTIL_PSTHmaker(ANresponse, ANdt, PSTHbinWidth); | 192 PSTH=UTIL_PSTHmaker(ANresponse, dtSpikes, PSTHbinWidth); |
193 PSTH=PSTH*ANdt/PSTHbinWidth; | 193 PSTH=PSTH*dtSpikes/PSTHbinWidth; |
194 PSTHplotCount=PSTHplotCount+1; | 194 PSTHplotCount=PSTHplotCount+1; |
195 subplot(nLevels,nDurations,PSTHplotCount) | 195 subplot(nLevels,nDurations,PSTHplotCount) |
196 PSTHtime=PSTHbinWidth:PSTHbinWidth:... | 196 PSTHtime=PSTHbinWidth:PSTHbinWidth:... |
197 PSTHbinWidth*length(PSTH); | 197 PSTHbinWidth*length(PSTH); |
198 if strcmp(AN_spikesOrProbability, 'spikes') | 198 if strcmp(AN_spikesOrProbability, 'spikes') |
199 bar(PSTHtime, PSTH/PSTHbinWidth/nFibers) | 199 bar(PSTHtime, PSTH/PSTHbinWidth/nFibers) |
200 % ylim([0 500]) | 200 % ylim([0 500]) |
201 else | 201 else |
202 bar(PSTHtime, PSTH) | 202 bar(PSTHtime, PSTH) |
203 ylim([0 500]) | 203 ylim([0 500]) |
204 end | 204 end |
205 % xlim([0 longestSignalDuration]) | 205 xlim([0 longestSignalDuration]) |
206 grid on | 206 grid on |
207 | 207 |
208 if PSTHplotCount< (nLevels-1) * nDurations+1 | 208 if PSTHplotCount< (nLevels-1) * nDurations+1 |
209 set(gca,'xticklabel',[]) | 209 set(gca,'xticklabel',[]) |
210 end | 210 end |
218 | 218 |
219 if PSTHplotCount<=nDurations | 219 if PSTHplotCount<=nDurations |
220 title([num2str(1000*gapDurations(PSTHplotCount)) 'ms']) | 220 title([num2str(1000*gapDurations(PSTHplotCount)) 'ms']) |
221 end | 221 end |
222 | 222 |
223 % figure(99), bar(PSTHtime, PSTH) | 223 % figure(99), bar(PSTHtime, PSTH) |
224 | 224 |
225 end % showPSTHs | 225 end % showPSTHs |
226 | 226 |
227 end % gapDurations duration | 227 end % gapDurations duration |
228 summaryFiringRates=[summaryFiringRates allFiringRates']; | 228 summaryFiringRates=[summaryFiringRates allFiringRates']; |