comparison testPrograms/testPeriphery.m @ 29:b51bf546ca3f

physiologyProb
author Ray Meddis <rmeddis@essex.ac.uk>
date Fri, 08 Jul 2011 13:48:27 +0100
parents
children
comparison
equal deleted inserted replaced
28:02aa9826efe0 29:b51bf546ca3f
1 function testPeriphery (BMlocations, paramsName)
2 % testBM generates input output functions for DRNL model for any number
3 % of locations.
4 % Computations are bast on a single channel model (channelBFs=BF)
5 % peak displacement (peakAmp) is measured.
6 % if DRNLParams.useMOC is chosen, the full model is run (slow)
7 % otherwise only DRNL is computed.
8 % Tuning curves are generated based on a range of frequencies reletove to
9 % the BF of the location.
10 %
11
12 global DRNLParams
13
14 savePath=path;
15
16 addpath (['..' filesep 'utilities'],['..' filesep 'MAP'])
17
18 levels=-10:10:90; nLevels=length(levels);
19 % levels= 50; nLevels=length(levels);
20
21 % relativeFrequencies=[0.25 .5 .75 1 1.25 1.5 2];
22 relativeFrequencies=1;
23
24 % refBMdisplacement is the displacement of the BM at threshold
25 % 1 nm disp at threshold (9 kHz, Ruggero)
26 refBMdisplacement= 1e-8; % adjusted for 10 nm at 1 kHz
27
28 toneDuration=.200;
29 rampDuration=0.01;
30 silenceDuration=0.01;
31
32 sampleRate=30000;
33
34 dbstop if error
35 figure(3), clf
36 % set(gcf,'position',[276 33 331 645])
37 set(gcf,'name','DRNL - BM')
38
39 finalSummary=[];
40 nBFs=length(BMlocations);
41 BFno=0; plotCount=0;
42 for BF=BMlocations
43 BFno=BFno+1;
44 plotCount=plotCount+nBFs;
45 stimulusFrequencies=BF* relativeFrequencies;
46 nFrequencies=length(stimulusFrequencies);
47
48 peakAmpBM=zeros(nLevels,nFrequencies);
49 peakAmpBMdB=NaN(nLevels,nFrequencies);
50 peakEfferent=NaN(nLevels,nFrequencies);
51 peakAREfferent=NaN(nLevels,nFrequencies);
52
53
54 levelNo=0;
55 for leveldB=levels
56 disp(['level= ' num2str(leveldB)])
57 levelNo=levelNo+1;
58
59 freqNo=0;
60 for frequency=stimulusFrequencies
61 freqNo=freqNo+1;
62
63 % Generate stimuli
64 globalStimParams.FS=sampleRate;
65 globalStimParams.overallDuration=...
66 toneDuration+silenceDuration; % s
67 stim.type='tone';
68 stim.phases='sin';
69 stim.toneDuration=toneDuration;
70 stim.frequencies=frequency;
71 stim.amplitudesdB=leveldB;
72 stim.beginSilence=silenceDuration;
73 stim.rampOnDur=rampDuration;
74 stim.rampOffDur=rampDuration;
75 doPlot=0;
76 inputSignal=stimulusCreate(globalStimParams, stim, doPlot);
77 inputSignal=inputSignal(:,1)';
78
79 %% run the model
80 MAPparamsName=paramsName;
81 AN_spikesOrProbability='probability';
82 % spikes are slow but can be used to study MOC using IC units
83 % AN_spikesOrProbability='spikes';
84
85 global DRNLoutput MOCattenuation ARattenuation IHCoutput
86 MAP1_14(inputSignal, sampleRate, BF, ...
87 MAPparamsName, AN_spikesOrProbability);
88
89 DRNLresponse=IHCoutput;
90 peakAmp=max(max(...
91 DRNLresponse(:, end-round(length(DRNLresponse)/2):end)));
92 peakAmpBM(levelNo,freqNo)=peakAmp;
93 if peakAmp>0
94 peakAmpBMdB(levelNo,freqNo)=...
95 20*log10(peakAmp/refBMdisplacement);
96 else
97 peakAmpBMdB(levelNo,freqNo)=peakAmp;
98 end
99 peakEfferent(levelNo,freqNo)=min(min(MOCattenuation));
100 peakAREfferent(levelNo,freqNo)=min(min(ARattenuation));
101
102 end % tone frequency
103 end % level
104
105 %% analyses results and plot
106
107 % BM I/O plot (top panel)
108 figure(3)
109 subplot(3,nBFs,BFno), cla
110 plot(levels,peakAmpBMdB, 'linewidth',2)
111 hold on, plot(levels, repmat(refBMdisplacement,1,length(levels)))
112 hold off
113 title(['BF=' num2str(BF,'%5.0f') ' - ' paramsName])
114 xlabel('level')
115 % set(gca,'xtick',levels), grid on
116 if length(levels)>1,xlim([min(levels) max(levels)]), end
117 ylabel(['dB re:' num2str(refBMdisplacement,'%6.1e') 'm'])
118 ylim([-20 50])
119 set(gca,'ytick',[-10 0 10 20 40])
120 % legend({num2str(stimulusFrequencies')}, 'location', 'EastOutside')
121 UTIL_printTabTable([levels' peakAmpBMdB], ...
122 num2str([0 stimulusFrequencies]','%5.0f'), '%5.0f')
123 finalSummary=[finalSummary peakAmpBMdB];
124
125 % Tuning curve
126 if length(relativeFrequencies)>2
127 figure(3), subplot(3,nBFs, nBFs+BFno)
128 % contour(stimulusFrequencies,levels,peakAmpBM,...
129 % [refBMdisplacement refBMdisplacement],'r')
130 contour(stimulusFrequencies,levels,peakAmpBM,...
131 refBMdisplacement.*[1 5 10 50 100])
132 title(['tuning curve at ' num2str(refBMdisplacement) 'm']);
133 ylabel('level (dB) at reference')
134 xlim([100 10000])
135 hold on
136 set(gca,'xscale','log')
137 end
138
139
140 % MOC contribution
141 figure(3)
142 subplot(3,nBFs,2*nBFs+BFno), cla
143 plot(levels,20*log10(peakEfferent), 'linewidth',2)
144 ylabel('MOC (dB attenuation)'), xlabel('level')
145 title(['peak MOC: model= ' AN_spikesOrProbability])
146 grid on
147 if length(levels)>1, xlim([min(levels) max(levels)]), end
148
149 % AR contribution
150 hold on
151 plot(levels,20*log10(peakAREfferent), 'r')
152 hold off
153
154 end % best frequency
155
156 UTIL_showStructureSummary(DRNLParams, 'DRNLParams', 10)
157
158 UTIL_printTabTable([levels' finalSummary], ...
159 num2str([0 stimulusFrequencies]','%5.0f'), '%5.0f')
160
161 path(savePath);