comparison userProgramsRM/test_MAP1_14RAM.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 test_DRNL_Ruggero97
2 % test_DRNL_Ruggero97 attempts to match Ruggero's (1992 and 1997)
3 % iso-intensity data by fiddling with the parameters
4
5 % # BF is the BF of the filter to be assessed
6 BF=9000;
7
8 % # test frequencies. check that BF is one of them
9 % copy Ruggero's test tones as fara as possible
10 numFs=6; lowestF=4000; highestF= 11030;
11 toneFrequencyList=round(logspace(log10(lowestF), log10(highestF), numFs));
12
13 % # parameter file name. this is the base set of parameters
14 MAPparamsName='Normal';
15
16 % # probability representation (not directly relevant here as only
17 % the DRNL output is used
18 AN_spikesOrProbability='probability';
19
20 % # tone characteristics
21 sampleRate= 100000;
22 duration=0.0200; % Ruggero uses 5, 10, 25 ms tones
23 rampDuration=0.0015; % raised cosine ramp (seconds)
24 beginSilence=0.050;
25 endSilence=0.020;
26
27 % # levels
28 levels=[3 10:10:80];
29
30 %% # change model parameters
31 % Parameter changes can be used to change one or more model parameters
32 % *after* the MAPparams file has been read
33
34 paramChanges={};
35 % switch off all efferent effects and then play with DRNL params
36 paramChanges={...
37 'DRNLParams.rateToAttenuationFactorProb = 0.00; ',...
38 'OMEParams.rateToAttenuationFactorProb=0.0;', ...
39 'DRNLParams.ctBMdB = -20;'...
40 'DRNLParams.g=1000;'...
41 'DRNLParams.linCFs=7000;'...
42 'DRNLParams.linBWs=3500;'...
43 };
44
45 % delare 'showMap' options to control graphical output
46 % (not needed but might be useful
47 % showMapOptions.printModelParameters=0; % prints all parameters
48 % showMapOptions.showModelOutput=1; % plot of all stages
49 % showMapOptions.printFiringRates=0; % prints stage activity levels
50 % showMapOptions.showACF=0; % shows SACF (probability only)
51 % showMapOptions.showEfferent=0; % tracks of AR and MOC
52 % showMapOptions.surfProbability=0; % 2D plot of HSR response
53 % showMapOptions.surfSpikes=0; % 2D plot of spikes histogram
54 % showMapOptions.ICrates=0; % IC rates by CNtauGk
55 % showMapOptions.fileName=[];
56
57 % run the program
58 global dt DRNLoutput DRNLParams TMoutput
59 dbstop if error
60 restorePath=path;
61 addpath (['..' filesep 'MAP'], ['..' filesep 'wavFileStore'], ...
62 ['..' filesep 'utilities'])
63 figure(2), clf,figure(3), clf,figure(4), clf,
64
65 peakOutputDisp=zeros(length(levels),length(toneFrequencyList));
66 peakStapesDisp=zeros(length(levels),length(toneFrequencyList));
67
68 %% now vary level and frequency while measuring the response
69 levelNo=0;
70 for leveldBSPL=levels
71 levelNo=levelNo+1;
72 disp(['level: ' num2str(leveldBSPL)])
73
74 freqNo=0;
75 for toneFrequency=toneFrequencyList
76 freqNo=freqNo+1;
77
78 %% Generate stimuli
79 dt=1/sampleRate;
80 time=dt: dt: duration;
81 inputSignal=sum(sin(2*pi*toneFrequency'*time), 1);
82 amp=10^(leveldBSPL/20)*28e-6; % converts to Pascals (peak)
83 inputSignal=amp*inputSignal;
84 % apply ramps
85 if rampDuration>0.5*duration, rampDuration=duration/2; end
86 rampTime=dt:dt:rampDuration;
87 ramp=[0.5*(1+cos(2*pi*rampTime/(2*rampDuration)+pi)) ...
88 ones(1,length(time)-length(rampTime))];
89 inputSignal=inputSignal.*ramp;
90 ramp=fliplr(ramp);
91 inputSignal=inputSignal.*ramp;
92 % add silence
93 intialSilence= zeros(1,round(beginSilence/dt));
94 finalSilence= zeros(1,round(endSilence/dt));
95 inputSignal= [intialSilence inputSignal finalSilence];
96
97 %% run the model
98
99 MAP1_14(inputSignal, sampleRate, BF, ...
100 MAPparamsName, AN_spikesOrProbability, paramChanges);
101
102 peakOutputDisp(levelNo,freqNo)=max(DRNLoutput);
103 peakStapesDisp(levelNo,freqNo)=max(TMoutput);
104
105 % the model run is complete. Now display the results if debugging
106 % UTIL_showMAP(showMapOptions, paramChanges)
107 end % probe frequencies
108
109 % monitor progress
110 figure(2), loglog(toneFrequencyList, peakOutputDisp), hold on
111 xlabel('frequency')
112 ylabel('peak DRNL displacement (m)')
113 title ('DRNL uncorrected displacement')
114 end % levels
115 figure(2),legend(num2str(toneFrequencyList'),'location','northwest')
116
117 % convert from model BM displacement to Ruggero's velocity
118 DRNLvelocity= peakOutputDisp ...
119 .*repmat(2*pi*toneFrequencyList,length(levels),1);
120 % convert from model stapes displacement to Ruggero's velocity
121 stapesVelocity= peakStapesDisp ...
122 .*repmat(2*pi*toneFrequencyList,length(levels),1);
123 % velocity gain is increased velocity attributable to the DRNL
124 DRNLvelocityGain = DRNLvelocity./stapesVelocity;
125 DRNLvelocityGain_dB= 20*log10(DRNLvelocityGain );
126 % iso-intensity equates all functions at the same outpu for the lowest
127 % velocity tested
128 isoIntensityDRNLvel_dB= DRNLvelocityGain_dB- ...
129 repmat(DRNLvelocityGain_dB(:,1),1,length(toneFrequencyList));
130
131 % displays
132 % iso-velocity function (nrmalised by stapes velocity)
133 figure(3), clf, semilogx(toneFrequencyList, isoIntensityDRNLvel_dB)
134 ylim([-10 60])
135 xlim([2000 20000])
136 xlabel('frequency')
137 ylabel('peak DRNL velocity gain (dB)')
138 title(['CF= ' num2str(BF) ' Hz'])
139 legend(num2str(levels'),'location','northwest')
140
141 % velocity I/O function
142 figure(4), clf, semilogy(levels, (DRNLvelocity*1e6)'), hold on
143 ylim([1e0 1e4])
144 xlim([0 100])
145 xlabel('level')
146 ylabel(' velocity (microm/ s)')
147 title(['CF= ' num2str(BF) ' Hz'])
148 legend(num2str(toneFrequencyList'),'location','northwest')
149
150 % command window reports
151 disp(''), disp('***')
152 disp(AN_spikesOrProbability)
153
154 % DRNL parameter set
155 UTIL_showStructureSummary(DRNLParams, 'DRNLParams', 10)
156
157 % stimulus characteristics
158 disp(['CF=' num2str(BF)])
159 disp(['tone Duration=' num2str(rampDuration)])
160 disp(['ramp Duration=' num2str(duration)])
161
162 % particular parameter changes used on this run
163 for i=1:length(paramChanges)
164 disp(paramChanges{i})
165 end
166
167 % if required dump one or more matrices in tab spaced format
168 % (suitable for pasting directly into EXCEL.
169 % UTIL_printTabTable([toneFrequencyList' peakOutputDisp'])
170
171 % leave the path as you found it
172 path(restorePath)
173
174