comparison testPrograms/testBM.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
1 function testBM (BFlist, paramsName,... 1 function testBM (BFlist, paramsName,...
2 relativeFrequencies, AN_spikesOrProbability, paramChanges) 2 relativeFrequencies, AN_spikesOrProbability, paramChanges)
3 % testBM generates input output functions for DRNL model for any number 3 % testBM generates input output functions for DRNL model for any number
4 % of locations. 4 % of locations (BFlist).
5 % Computations are bast on a single channel model (channelBFs=BF) 5 % Each BF is evaluated using a single channel model
6 % peak displacement (peakAmp) is measured. 6 %
7 % if DRNLParams.useMOC is chosen, the full model is run (slow) 7 % Peak displacement as a function of pure tone level(peakAmp) is displayed
8 % otherwise only DRNL is computed. 8 %
9 % Tuning curves are generated based on a range of frequencies reletove to 9 % If relative Frequencies is set to a range of values, tuning curves will
10 % the BF of the location. 10 % be computed using these stimulus frequencie.
11 %
12 % If AN_spikesOrProbability is set to 'spikes' the full model is run (slow)
13 % otherwise efferent activity is based on AN pspiking probabilities.
11 % 14 %
12 % testBM (1000, 'Normal', 1, 'probability', []) 15 % testBM (1000, 'Normal', 1, 'probability', [])
16 % for tuning curves at 6 locations:
17 % testBM ([250 500 1000 2000 4000 8000], 'Normal', [.5 .75 .9 1 1.1 1.25 1.5], 'probability', [])
13 18
14 global DRNLParams 19 global DRNLParams
15 20
16 if nargin<5, paramChanges=[]; end 21 if nargin<5, paramChanges=[]; end
17 if nargin<4, AN_spikesOrProbability='spikes'; end 22 if nargin<4, AN_spikesOrProbability='spikes'; end
18 if nargin==0, BFlist=1000; paramsName='Normal'; 23 if nargin==0, BFlist=1000; paramsName='Normal';
19 relativeFrequencies=1; end 24 relativeFrequencies=1; end
20 25
21 savePath=path; 26 savePath=path;
22 addpath (['..' filesep 'utilities'],['..' filesep 'MAP']) 27 addpath (['..' filesep 'utilities'],['..' filesep 'MAP'])
28 tic
23 29
24 levels=-10:10:90; nLevels=length(levels); 30 levels=-10:10:100; nLevels=length(levels);
25 % levels= 50; nLevels=length(levels); 31 % levels= 50; nLevels=length(levels);
26 32
27 % refBMdisplacement is the displacement of the BM at threshold 33 % refBMdisplacement is the displacement of the BM at threshold
28 % 1 nm disp at threshold (9 kHz, Ruggero) 34 % 1 nm disp at threshold (9 kHz, Ruggero)
29 % ? adjust for frequency 35 % ? adjust for frequency
122 ylabel(['dB re:' num2str(refBMdisplacement,'%6.1e') 'm']) 128 ylabel(['dB re:' num2str(refBMdisplacement,'%6.1e') 'm'])
123 ylim([-20 50]) 129 ylim([-20 50])
124 set(gca,'ytick',[-10 0 10 20 40]) 130 set(gca,'ytick',[-10 0 10 20 40])
125 grid on 131 grid on
126 % legend({num2str(stimulusFrequencies')}, 'location', 'EastOutside') 132 % legend({num2str(stimulusFrequencies')}, 'location', 'EastOutside')
127 UTIL_printTabTable([levels' peakAmpBMdB], ... 133 UTIL_printTabTable([levels' peakAmpBMdB peakAmpBM*1e9], ...
128 num2str([0 stimulusFrequencies]','%5.0f'), '%5.0f') 134 num2str([0 stimulusFrequencies]','%5.0f'), '%5.0f')
129 finalSummary=[finalSummary peakAmpBMdB]; 135 finalSummary=[finalSummary peakAmpBMdB];
130 136
131 % Tuning curve 137 % Tuning curve
132 if length(relativeFrequencies)>2 138 if length(relativeFrequencies)>2
133 figure(3), subplot(maxRows,nBFs, 2*nBFs+BFno) 139 figure(3), subplot(maxRows,nBFs, 2*nBFs+BFno)
134 % contour(stimulusFrequencies,levels,peakAmpBM,... 140 contour(stimulusFrequencies,levels,peakAmpBM,...
135 % [refBMdisplacement refBMdisplacement],'r') 141 [refBMdisplacement refBMdisplacement],'r','linewidth',4)
136 contour(stimulusFrequencies,levels,peakAmpBM,... 142 ylim([-10 40])
137 refBMdisplacement.*[1 5 10 50 100]) 143
144 % contour(stimulusFrequencies,levels,peakAmpBM,...
145 % refBMdisplacement.*[1 5 10 50 100])
146 % ylim([-10 90])
147
138 title(['tuning curve at ' num2str(refBMdisplacement) 'm']); 148 title(['tuning curve at ' num2str(refBMdisplacement) 'm']);
139 ylabel('level (dB) at reference') 149 ylabel('level (dB) at reference')
140 xlim([100 10000]) 150 xlim([100 10000])
141 grid on 151 grid on
142 hold on 152 hold on
146 156
147 % MOC contribution 157 % MOC contribution
148 figure(3) 158 figure(3)
149 subplot(maxRows,nBFs,nBFs+BFno), cla 159 subplot(maxRows,nBFs,nBFs+BFno), cla
150 plot(levels,20*log10(peakEfferent), 'linewidth',2) 160 plot(levels,20*log10(peakEfferent), 'linewidth',2)
151 ylabel('MOC (dB attenuation)'), xlabel('level') 161 ylabel('MOC (dB attenuation)'), xlabel('level (dB SPL)')
152 title(['MOC: (' AN_spikesOrProbability ') duration= ' ... 162 title(['MOC: (' AN_spikesOrProbability ') duration= ' ...
153 num2str(1000*toneDuration,'%5.0f') ' ms']) 163 num2str(1000*toneDuration,'%5.0f') ' ms'])
154 grid on 164 grid on
155 if length(levels)>1, xlim([min(levels) max(levels)]), end 165 if length(levels)>1, xlim([min(levels) max(levels)]), end
156 166
159 plot(levels,20*log10(peakAREfferent), 'r') 169 plot(levels,20*log10(peakAREfferent), 'r')
160 hold off 170 hold off
161 171
162 end % best frequency 172 end % best frequency
163 173
174
164 UTIL_showStructureSummary(DRNLParams, 'DRNLParams', 10) 175 UTIL_showStructureSummary(DRNLParams, 'DRNLParams', 10)
165 176
166 UTIL_printTabTable([levels' finalSummary], ... 177 UTIL_printTabTable([levels' finalSummary], ...
167 num2str([0 stimulusFrequencies]','%5.0f'), '%5.0f') 178 num2str([0 stimulusFrequencies]','%5.0f'), '%5.0f')
168 diff(finalSummary) 179 diff(finalSummary)
169 if ~isempty(paramChanges) 180 if ~isempty(paramChanges)
170 disp(paramChanges) 181 disp(paramChanges)
171 end 182 end
172 183
173 184 toc
174 path(savePath); 185 path(savePath);