Mercurial > hg > map
comparison testPrograms/testLibermanMOC_DPOAE.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 testLibermanMOC_DPOAE | |
2 | |
3 % compares MOC response to LIberman's 1996 data for DPOAE reduction with | |
4 % contralateral tone stimulation. | |
5 % This program is used mainly as a check on the time constants involved. | |
6 % | |
7 % NB very different time constants are required for 'spikes' and | |
8 % 'probability' | |
9 | |
10 % global dt ANdt savedBFlist saveAN_spikesOrProbability saveMAPparamsName... | |
11 % savedInputSignal OMEextEarPressure TMoutput OMEoutput ARattenuation ... | |
12 % DRNLoutput IHC_cilia_output IHCrestingCiliaCond IHCrestingV... | |
13 % IHCoutput ANprobRateOutput ANoutput savePavailable ANtauCas ... | |
14 % CNtauGk CNoutput ICoutput ICmembraneOutput ICfiberTypeRates ... | |
15 % MOCattenuation | |
16 global dt dtSpikes saveAN_spikesOrProbability ANprobRateOutput ICoutput | |
17 | |
18 global DRNLParams | |
19 | |
20 LibermanData=[ | |
21 2 0.2; | |
22 2.1 0.19;2.2 0.18;2.3 0.18;2.4 0.16;2.5 0.15;2.6 0.15;2.7 0.15; | |
23 2.8 0.12;2.9 0.12;3 0.1;3.1 0.1;3.2 0.05;3.3 0.05;3.4 0;3.5 -0.1; | |
24 3.6 -0.4;3.7 -1.2;3.8 -1.6;3.9 -1.8;4 -1.85;4.1 -2;4.2 -2.05; | |
25 4.3 -2.05;4.4 -2.15;4.5 -2.2;4.6 -2.15;4.7 -2.1;4.8 -2.15;4.9 -2.2; | |
26 5 -2.1;5.1 -2.1;5.2 -2.25;5.3 -2.1;5.4 -2.15;5.5 -2.1;5.6 -2.15; | |
27 5.7 -2.1;5.8 -2.2;5.9 -2.05;6 -2.15;6.1 -2.05;6.2 -2;6.3 -2.2;6.4 -2.1; | |
28 6.5 -2.05;6.6 -2.05;6.7 -2.05;6.8 -2.2;6.9 -2.1;7 -2.05;7.1 -2.05;7.2 -0.7; | |
29 7.3 -0.1;7.4 0;7.5 0.1;7.6 0.2;7.7 0.35;7.8 0.2;7.9 0.15;8 0.2;8.1 0.15;8.2 0.15; | |
30 8.3 0.15;8.4 0.12;8.5 0.1;8.6 0.09;8.7 0.08;8.8 0.07;8.9 0.06;9 0.05; | |
31 ]; | |
32 | |
33 % Backus2006Data: time bilateral contralateral ipsilateral | |
34 % all % max microPascals | |
35 Backus2006Data=[ | |
36 100 20 15 10; | |
37 200 36 24 14; | |
38 300 44 30 18; | |
39 400 46 32 20; | |
40 500 48 34 22; | |
41 1000 50 36 24; | |
42 1500 52 37 25; | |
43 2000 54 38 27 | |
44 ]; | |
45 | |
46 steadyMinimum=mean(LibermanData(LibermanData(:,1)>4 & LibermanData(:,1)<7,2)); | |
47 | |
48 restorePath=path; | |
49 addpath (['..' filesep 'MAP'], ['..' filesep 'wavFileStore'], ... | |
50 ['..' filesep 'utilities']) | |
51 | |
52 %% #1 parameter file name | |
53 MAPparamsName='Normal'; | |
54 | |
55 | |
56 %% #2 probability (fast) or spikes (slow) representation | |
57 AN_spikesOrProbability='spikes'; | |
58 % or | |
59 AN_spikesOrProbability='probability'; | |
60 | |
61 | |
62 %% #3 pure tone, harmonic sequence or speech file input | |
63 signalType= 'tones'; | |
64 sampleRate= 50000; | |
65 rampDuration=.005; % raised cosine ramp (seconds) | |
66 toneFrequency= 1000; % or a pure tone (Hz) | |
67 duration=3.6; % Lieberman test | |
68 beginSilence=1; % 1 for Lieberman | |
69 endSilence=1; % 1 for Lieberman | |
70 | |
71 %% #4 rms level | |
72 % signal details | |
73 leveldBSPL= 80; % dB SPL (80 for Lieberman) | |
74 | |
75 | |
76 %% #5 number of channels in the model | |
77 | |
78 numChannels=1; | |
79 BFlist=toneFrequency; | |
80 | |
81 | |
82 %% #6 change model parameters | |
83 paramChanges={}; | |
84 | |
85 %% delare 'showMap' options to control graphical output | |
86 showMapOptions.printModelParameters=1; % prints all parameters | |
87 showMapOptions.showModelOutput=1; % plot of all stages | |
88 showMapOptions.printFiringRates=1; % prints stage activity levels | |
89 showMapOptions.showACF=0; % shows SACF (probability only) | |
90 showMapOptions.showEfferent=1; % tracks of AR and MOC | |
91 showMapOptions.surfAN=1; % 2D plot of HSR response | |
92 showMapOptions.surfSpikes=0; % 2D plot of spikes histogram | |
93 showMapOptions.ICrates=0; % IC rates by CNtauGk | |
94 | |
95 %% Generate stimuli | |
96 | |
97 % Create pure tone stimulus | |
98 dt=1/sampleRate; % seconds | |
99 time=dt: dt: duration; | |
100 inputSignal=sum(sin(2*pi*toneFrequency'*time), 1); | |
101 amp=10^(leveldBSPL/20)*28e-6; % converts to Pascals (peak) | |
102 inputSignal=amp*inputSignal; | |
103 % apply ramps | |
104 % catch rampTime error | |
105 if rampDuration>0.5*duration, rampDuration=duration/2; end | |
106 rampTime=dt:dt:rampDuration; | |
107 ramp=[0.5*(1+cos(2*pi*rampTime/(2*rampDuration)+pi)) ... | |
108 ones(1,length(time)-length(rampTime))]; | |
109 inputSignal=inputSignal.*ramp; | |
110 ramp=fliplr(ramp); | |
111 inputSignal=inputSignal.*ramp; | |
112 % add silence | |
113 intialSilence= zeros(1,round(beginSilence/dt)); | |
114 finalSilence= zeros(1,round(endSilence/dt)); | |
115 inputSignal= [intialSilence inputSignal finalSilence]; | |
116 | |
117 %% run the model | |
118 tic | |
119 fprintf('\n') | |
120 disp(['Signal duration= ' num2str(length(inputSignal)/sampleRate)]) | |
121 disp([num2str(numChannels) ' channel model: ' AN_spikesOrProbability]) | |
122 disp('Computing ...') | |
123 | |
124 MAP1_14(inputSignal, sampleRate, BFlist, ... | |
125 MAPparamsName, AN_spikesOrProbability, paramChanges); | |
126 | |
127 | |
128 %% the model run is now complete. Now display the results | |
129 UTIL_showMAP(showMapOptions) | |
130 | |
131 if strcmp(signalType,'tones') | |
132 disp(['duration=' num2str(duration)]) | |
133 disp(['level=' num2str(leveldBSPL)]) | |
134 disp(['toneFrequency=' num2str(toneFrequency)]) | |
135 disp(['attenuation factor =' ... | |
136 num2str(DRNLParams.rateToAttenuationFactor, '%5.3f') ]) | |
137 disp(['attenuation factor (probability)=' ... | |
138 num2str(DRNLParams.rateToAttenuationFactorProb, '%5.3f') ]) | |
139 disp(AN_spikesOrProbability) | |
140 end | |
141 disp(paramChanges) | |
142 | |
143 | |
144 | |
145 %% superimpose Lieberman (1996) data | |
146 | |
147 global MOCattenuation | |
148 MOCdB=20*log10(MOCattenuation); | |
149 MOCtime=dt:dt:dt*length(MOCdB); | |
150 | |
151 % scale up DPOAE results to the running maximum MOC dB | |
152 steadyMOCminimum=mean(MOCdB(MOCtime>2 & MOCtime<4.5)); | |
153 scalar=steadyMOCminimum/steadyMinimum; | |
154 | |
155 figure(90), clf | |
156 plot(MOCtime,MOCdB), hold on | |
157 plot(LibermanData(:,1)-2.5,scalar*LibermanData(:,2),'r:','linewidth',4) | |
158 legend({'MAP', 'DPOAE'},'location', 'east') | |
159 title('Compare Liberman (1996) DPOAE data with MAP MOC') | |
160 xlabel('time (s)'), ylabel('MOC attenuation/ DPOAE reduction') | |
161 if strcmp(saveAN_spikesOrProbability,'probability') | |
162 text(0,2,['MOCtau= ' num2str(DRNLParams.MOCtauProb)]) | |
163 else | |
164 text(0,2,['MOCtau= ' num2str(DRNLParams.MOCtau)]) | |
165 end | |
166 set(gcf, 'name', 'Liberman compare') | |
167 | |
168 PSTHbinwidth=0.001; | |
169 | |
170 % show the source of the MOC activity | |
171 figure(89) | |
172 if strcmp(saveAN_spikesOrProbability,'probability') | |
173 % brainstem activity | |
174 PSTH=UTIL_PSTHmaker... | |
175 (ANprobRateOutput(2,:), dt, PSTHbinwidth)*dt/PSTHbinwidth; | |
176 else | |
177 % AN probability | |
178 PSTH=UTIL_PSTHmaker(ICoutput(2,:), dtSpikes, PSTHbinwidth)*dt/PSTHbinwidth; | |
179 end | |
180 | |
181 time=PSTHbinwidth:PSTHbinwidth:PSTHbinwidth*length(PSTH); | |
182 plot(time, PSTH) | |
183 set(gcf,'name', 'Lieberman') | |
184 title(saveAN_spikesOrProbability) | |
185 | |
186 toc | |
187 path(restorePath) | |
188 | |
189 % figure(88), plot(MOCattenuation) |