comparison userProgramsRM/test_MAP1_14RAMworks.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_MAP1_14RAM
2
3 global dt DRNLoutput
4 global DRNLParams TMoutput
5 global peakOutputDisp alignedOutput toneFrequencyList levels leveldBSPL logOutput
6
7
8 dbstop if error
9 restorePath=path;
10 addpath (['..' filesep 'MAP'], ['..' filesep 'wavFileStore'], ...
11 ['..' filesep 'utilities'])
12 figure(2), clf
13
14 %% # BFlist is the BF of the filter to be assessed
15 BFlist=8000;
16 numChannels=1;
17
18 % define probe frequencies
19 numFs=6;
20 lowestF=BFlist/5; highestF= BFlist*1.4;
21 lowestF=4000; highestF= 12600;
22 toneFrequencyList=round(logspace(log10(lowestF), log10(highestF), numFs));
23
24 %% # parameter file name
25 MAPparamsName='Normal';
26
27 %% # probability representation
28 AN_spikesOrProbability='probability';
29
30 %% # tone duration
31 sampleRate= 100000;
32 duration=0.0200; % seconds
33 rampDuration=.005; % raised cosine ramp (seconds)
34 beginSilence=0.050;
35 endSilence=0.050;
36
37 %% # levels
38 % probe details
39 levels=0:10:80;
40 % levels=80;
41
42 %% # change model parameters
43 % Parameter changes can be used to change one or more model parameters
44 % *after* the MAPparams file has been read
45
46 % adjust linear path gain (previously g=100)
47 % switch off all efferent effects
48 paramChanges={...
49 'DRNLParams.rateToAttenuationFactorProb = 0.00; ',...
50 'OMEParams.rateToAttenuationFactorProb=0.0;', ...
51 'DRNLParams.ctBMdB = -10;'...
52 'DRNLParams.g=200;'...
53 'DRNLParams.linCFs=6500;'...
54 'DRNLParams.linBWs=2000;'...
55 };
56 % 'DRNLParams.a=0;'...
57
58
59 %% delare 'showMap' options to control graphical output
60 showMapOptions.printModelParameters=0; % prints all parameters
61 showMapOptions.showModelOutput=1; % plot of all stages
62 showMapOptions.printFiringRates=0; % prints stage activity levels
63 showMapOptions.showACF=0; % shows SACF (probability only)
64 showMapOptions.showEfferent=0; % tracks of AR and MOC
65 showMapOptions.surfProbability=0; % 2D plot of HSR response
66 showMapOptions.surfSpikes=0; % 2D plot of spikes histogram
67 showMapOptions.ICrates=0; % IC rates by CNtauGk
68 showMapOptions.fileName=[];
69
70
71 %% now vary level and frequency
72 peakOutputDisp=zeros(length(levels),length(toneFrequencyList));
73 peakStapesDisp=zeros(length(levels),length(toneFrequencyList));
74 levelNo=0;
75 for leveldBSPL=levels
76 levelNo=levelNo+1;
77 disp(['level: ' num2str(leveldBSPL)])
78 freqNo=0;
79 for toneFrequency=toneFrequencyList
80 freqNo=freqNo+1;
81
82 %% Generate stimuli
83 dt=1/sampleRate;
84 time=dt: dt: duration;
85 inputSignal=sum(sin(2*pi*toneFrequency'*time), 1);
86 amp=10^(leveldBSPL/20)*28e-6; % converts to Pascals (peak)
87 inputSignal=amp*inputSignal;
88 % apply ramps
89 if rampDuration>0.5*duration, rampDuration=duration/2; end
90 rampTime=dt:dt:rampDuration;
91 ramp=[0.5*(1+cos(2*pi*rampTime/(2*rampDuration)+pi)) ...
92 ones(1,length(time)-length(rampTime))];
93 inputSignal=inputSignal.*ramp;
94 ramp=fliplr(ramp);
95 inputSignal=inputSignal.*ramp;
96 % add silence
97 intialSilence= zeros(1,round(beginSilence/dt));
98 finalSilence= zeros(1,round(endSilence/dt));
99 inputSignal= [intialSilence inputSignal finalSilence];
100
101 %% run the model
102 % fprintf('\n')
103 % disp([num2str(numChannels) ' channel model: ' AN_spikesOrProbability])
104 % disp('Computing ...')
105
106 MAP1_14(inputSignal, sampleRate, BFlist, ...
107 MAPparamsName, AN_spikesOrProbability, paramChanges);
108
109 peakOutputDisp(levelNo,freqNo)=max(DRNLoutput);
110 peakStapesDisp(levelNo,freqNo)=max(TMoutput);
111
112 %% the model run is complete. Now display the results
113 % UTIL_showMAP(showMapOptions, paramChanges)
114 end % probe frequencies
115 figure(2), loglog(toneFrequencyList, peakOutputDisp), hold on
116 xlabel('frequency')
117 ylabel('peak DRNL displacement (m)')
118
119 end % levels
120 %% alignmed plot
121
122
123 x=peakOutputDisp./peakStapesDisp;
124 logOutput=20*log10(x.*repmat((2*pi*toneFrequencyList),length(levels),1));
125 alignedOutput=logOutput-repmat(logOutput(:,1), 1, length(toneFrequencyList));
126 figure(3), clf, semilogx(toneFrequencyList, alignedOutput), hold on
127 ylim([-20 80])
128 xlim([2000 20000])
129 % legend(num2str(levels'))
130 xlabel('frequency')
131 ylabel('peak DRNL velocity (dB)')
132 title(['level ' num2str(leveldBSPL) ' dB SPL'])
133
134 disp(['level=' num2str(leveldBSPL)])
135 disp(['toneFrequency=' num2str(toneFrequency)])
136
137 disp(['attenuation factor =' ...
138 num2str(DRNLParams.rateToAttenuationFactor, '%5.3f') ])
139 disp(['attenuation factor (probability)=' ...
140 num2str(DRNLParams.rateToAttenuationFactorProb, '%5.3f') ])
141 disp(AN_spikesOrProbability)
142 disp(paramChanges)
143
144 % UTIL_printTabTable([toneFrequencyList' peakOutputDisp'])
145
146 path(restorePath)
147