Mercurial > hg > map
comparison testPrograms/testEfferent.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 | |
children |
comparison
equal
deleted
inserted
replaced
37:771a643d5c29 | 38:c2204b18f4a2 |
---|---|
1 function testEfferent(probeFrequency,BFlist, levels, ... | |
2 paramsName,paramChanges) | |
3 % generates rate/level functions for AAR and MOC | |
4 % | |
5 % e.g. | |
6 % testEfferent(1000,1000, -10:10:80,'Normal',[]); | |
7 | |
8 global dtSpikes MOCattenuation ANtauCas | |
9 | |
10 tic | |
11 dbstop if error | |
12 restorePath=path; | |
13 addpath (['..' filesep 'MAP'], ['..' filesep 'utilities'], ... | |
14 ['..' filesep 'parameterStore'], ['..' filesep 'wavFileStore'],... | |
15 ['..' filesep 'testPrograms']) | |
16 | |
17 if nargin<5, paramChanges=[]; end | |
18 if nargin<4, paramsName='Normal'; end | |
19 if nargin<3, levels=-10:10:100; end | |
20 if nargin==0, | |
21 probeFrequency=1000; | |
22 probeFrequency=100:100:8000; | |
23 lowestBF=250; highestBF= 8000; numChannels=21; | |
24 % 21 chs (250-8k)includes BFs at 250 500 1000 2000 4000 8000 | |
25 BFlist=round(logspace(log10(lowestBF),log10(highestBF),numChannels)); | |
26 keyChannel=round(numChannels/2); | |
27 % BFlist=1000; | |
28 end | |
29 nLevels=length(levels); | |
30 | |
31 toneDuration=.2; rampDuration=0.002; silenceDuration=.02; | |
32 localPSTHbinwidth=0.001; | |
33 | |
34 | |
35 sampleRate=64000; dt=1/sampleRate; | |
36 | |
37 %% delare 'showMap' options to control graphical output | |
38 showMapOptions.printModelParameters=0; % prints all parameters | |
39 showMapOptions.showModelOutput=0; % plot of all stages | |
40 showMapOptions.printFiringRates=1; % prints stage activity levels | |
41 showMapOptions.showACF=0; % shows SACF (probability only) | |
42 showMapOptions.showEfferent=1; % tracks of AR and MOC | |
43 showMapOptions.surfAN=0; % 2D plot of HSR response | |
44 showMapOptions.surfSpikes=0; % 2D plot of spikes histogram | |
45 showMapOptions.ICrates=0; % IC rates by CNtauGk | |
46 | |
47 | |
48 %% pre-allocate storage | |
49 AN_HSRonset=zeros(nLevels,1); | |
50 AN_HSRsaturated=zeros(nLevels,1); | |
51 AN_LSRonset=zeros(nLevels,1); | |
52 AN_LSRsaturated=zeros(nLevels,1); | |
53 CNLSRrate=zeros(nLevels,1); | |
54 CNHSRsaturated=zeros(nLevels,1); | |
55 ICHSRsaturated=zeros(nLevels,1); | |
56 ICLSRsaturated=zeros(nLevels,1); | |
57 vectorStrength=zeros(nLevels,1); | |
58 | |
59 AR=zeros(nLevels,1); | |
60 MOC=zeros(nLevels,1); | |
61 maxMOC=[]; | |
62 | |
63 %% main computational loop (vary level) | |
64 levelNo=0; | |
65 for leveldB=levels | |
66 levelNo=levelNo+1; | |
67 amp=28e-6*10^(leveldB/20); | |
68 fprintf('%4.0f\t', leveldB) | |
69 | |
70 %% generate tone and silences | |
71 time=dt:dt:toneDuration; | |
72 rampTime=dt:dt:rampDuration; | |
73 ramp=[0.5*(1+cos(2*pi*rampTime/(2*rampDuration)+pi)) ... | |
74 ones(1,length(time)-length(rampTime))]; | |
75 ramp=ramp.*fliplr(ramp); | |
76 | |
77 silence=zeros(1,round(silenceDuration/dt)); | |
78 | |
79 inputSignal=amp*sin(2*pi*probeFrequency'*time); | |
80 inputSignal=sum(inputSignal); | |
81 inputSignal= ramp.*inputSignal; | |
82 inputSignal=[silence inputSignal]; | |
83 | |
84 %% run the model | |
85 AN_spikesOrProbability='spikes'; | |
86 % nExistingParamChanges=length(paramChanges); | |
87 % paramChanges{nExistingParamChanges+1}=... | |
88 % ['AN_IHCsynapseParams.spikesTargetSampleRate=' ... | |
89 % num2str(spikesSampleRate) ';']; | |
90 | |
91 MAP1_14(inputSignal, 1/dt, BFlist, ... | |
92 paramsName, AN_spikesOrProbability, paramChanges); | |
93 | |
94 maxMOC=[maxMOC min(MOCattenuation(keyChannel,:))]; | |
95 UTIL_showMAP(showMapOptions) | |
96 pause(0.1) | |
97 | |
98 %% Auditory nerve evaluate and display (Fig. 5) | |
99 %LSR (same as HSR if no LSR fibers present) | |
100 nTaus=length(ANtauCas); | |
101 | |
102 | |
103 end % level | |
104 | |
105 %% MOC atten/ level function | |
106 figure(21), subplot(2,1,2) | |
107 plot(levels, 20*log10(maxMOC), 'k'), hold off | |
108 title(' MOC dB attenuation'), ylabel('dB attenuation') | |
109 ylim([-30 0]) | |
110 figure(21), subplot(2,1,1) | |
111 plot(levels, maxMOC, 'k'), hold off | |
112 title(' MOC attenuation (scalar)'), ylabel('attenuation (scalar)') | |
113 ylim([0 1]) | |
114 | |
115 set(gcf,'name','MOC atten/level') | |
116 | |
117 path(restorePath) | |
118 toc |