To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.
The primary repository for this project is hosted at git://github.com/rmeddis/MAP.git .
This repository is a read-only copy which is updated automatically every hour.
root / testPrograms / testRP.m @ 29:b51bf546ca3f
History | View | Annotate | Download (6.26 KB)
| 1 | 29:b51bf546ca3f | rmeddis | function testRP(BFs,MAPparamsName,paramChanges) |
|---|---|---|---|
| 2 | % testIHC used for IHC I/O function |
||
| 3 | |||
| 4 | global experiment method inputStimulusParams |
||
| 5 | global stimulusParameters IHC_VResp_VivoParams IHC_cilia_RPParams |
||
| 6 | savePath=path; |
||
| 7 | addpath (['..' filesep 'utilities'],['..' filesep 'MAP']) |
||
| 8 | dbstop if error |
||
| 9 | |||
| 10 | figure(4), clf, |
||
| 11 | set (gcf, 'name', ['IHC']) |
||
| 12 | set(gcf,'position',[613 354 360 322]) |
||
| 13 | drawColors='rgbkmcy'; |
||
| 14 | drawnow |
||
| 15 | |||
| 16 | if nargin<3 |
||
| 17 | paramChanges=[]; |
||
| 18 | end |
||
| 19 | |||
| 20 | levels=-20:10:100; |
||
| 21 | nLevels=length(levels); |
||
| 22 | toneDuration=.05; |
||
| 23 | silenceDuration=.01; |
||
| 24 | sampleRate=50000; |
||
| 25 | dt=1/sampleRate; |
||
| 26 | |||
| 27 | allIHC_RP_peak=[]; |
||
| 28 | allIHC_RP_dc=[]; |
||
| 29 | |||
| 30 | for BFno=1:length(BFs) |
||
| 31 | BF=BFs(BFno); |
||
| 32 | targetFrequency=BF; |
||
| 33 | % OR |
||
| 34 | %Patuzzi and Sellick test (see ELP & AEM, 2006) |
||
| 35 | % targetFrequency=100; |
||
| 36 | |||
| 37 | IHC_RP_peak=zeros(nLevels,1); |
||
| 38 | IHC_RP_min=zeros(nLevels,1); |
||
| 39 | IHC_RP_dc=zeros(nLevels,1); |
||
| 40 | |||
| 41 | time=dt:dt:toneDuration; |
||
| 42 | |||
| 43 | rampDuration=0.004; |
||
| 44 | rampTime=dt:dt:rampDuration; |
||
| 45 | ramp=[0.5*(1+cos(2*pi*rampTime/(2*rampDuration)+pi)) ... |
||
| 46 | ones(1,length(time)-length(rampTime))]; |
||
| 47 | ramp=ramp.*fliplr(ramp); |
||
| 48 | |||
| 49 | silence=zeros(1,round(silenceDuration/dt)); |
||
| 50 | |||
| 51 | toneStartptr=length(silence)+1; |
||
| 52 | toneMidptr=toneStartptr+round(toneDuration/(2*dt)) -1; |
||
| 53 | toneEndptr=toneStartptr+round(toneDuration/dt) -1; |
||
| 54 | |||
| 55 | levelNo=0; |
||
| 56 | for leveldB=levels |
||
| 57 | levelNo=levelNo+1; |
||
| 58 | % replicate at all levels |
||
| 59 | amp=28e-6*10^(leveldB/20); |
||
| 60 | |||
| 61 | %% create signal (leveldB/ frequency) |
||
| 62 | inputSignal=amp*sin(2*pi*targetFrequency'*time); |
||
| 63 | inputSignal= ramp.*inputSignal; |
||
| 64 | inputSignal=[silence inputSignal silence]; |
||
| 65 | inputStimulusParams.sampleRate=1/dt; |
||
| 66 | % global IHC_ciliaParams |
||
| 67 | |||
| 68 | %% disable efferent for fast processing |
||
| 69 | method.DRNLSave=1; |
||
| 70 | method.IHC_cilia_RPSave=1; |
||
| 71 | method.IHCpreSynapseSave=1; |
||
| 72 | method.IHC_cilia_RPSave=1; |
||
| 73 | method.segmentDuration=-1; |
||
| 74 | moduleSequence=1:4; |
||
| 75 | |||
| 76 | %% run the model |
||
| 77 | global DRNLoutput IHC_cilia_output IHCrestingCiliaCond IHCrestingV... |
||
| 78 | IHCoutput |
||
| 79 | AN_spikesOrProbability='probability'; |
||
| 80 | |||
| 81 | MAP1_14(inputSignal, sampleRate, BF, ... |
||
| 82 | MAPparamsName, AN_spikesOrProbability, paramChanges); |
||
| 83 | |||
| 84 | % DRNL |
||
| 85 | DRNLoutput=DRNLoutput; |
||
| 86 | DRNL_peak(levelNo,1)=max(DRNLoutput(toneMidptr:toneEndptr)); |
||
| 87 | DRNL_min(levelNo,1)=min(DRNLoutput(toneMidptr:toneEndptr)); |
||
| 88 | DRNL_dc(levelNo,1)=mean(DRNLoutput(toneMidptr:toneEndptr)); |
||
| 89 | |||
| 90 | % cilia |
||
| 91 | IHC_ciliaData=IHC_cilia_output; |
||
| 92 | IHC_ciliaData=IHC_ciliaData; |
||
| 93 | IHC_cilia_peak(levelNo,1)=... |
||
| 94 | max(IHC_ciliaData(toneMidptr:toneEndptr)); |
||
| 95 | IHC_cilia_min(levelNo,1)=... |
||
| 96 | min(IHC_ciliaData(toneMidptr:toneEndptr)); |
||
| 97 | IHC_cilia_dc(levelNo,1)=... |
||
| 98 | mean(IHC_ciliaData(toneMidptr:toneEndptr)); |
||
| 99 | |||
| 100 | % RP |
||
| 101 | IHC_RPData=IHCoutput; |
||
| 102 | IHC_RPData=IHC_RPData; |
||
| 103 | IHC_RP_peak(levelNo,1)=... |
||
| 104 | max(IHC_RPData(toneMidptr:toneEndptr)); |
||
| 105 | IHC_RP_min(levelNo,1)=... |
||
| 106 | min(IHC_RPData(toneMidptr:toneEndptr)); |
||
| 107 | IHC_RP_dc(levelNo,1)=... |
||
| 108 | mean(IHC_RPData(toneMidptr:toneEndptr)); |
||
| 109 | |||
| 110 | end % level |
||
| 111 | |||
| 112 | |||
| 113 | disp(['parameter file was: ' MAPparamsName]) |
||
| 114 | fprintf('\n')
|
||
| 115 | |||
| 116 | %% plot DRNL |
||
| 117 | subplot(2,2,1) |
||
| 118 | % referenceDisp= 9e-9*1000/targetFrequency; |
||
| 119 | % plot(levels,20*log10(DRNL_peak/referenceDisp), drawColors(BFno), ... |
||
| 120 | % 'linewidth',2), hold on |
||
| 121 | referenceDisp=10e-9; |
||
| 122 | plot(levels,20*log10(DRNL_peak/referenceDisp), drawColors(BFno), ... |
||
| 123 | 'linewidth',2), hold on |
||
| 124 | title([' DRNL peak: ' num2str(BFs) ' Hz']) |
||
| 125 | ylabel ('log10DRNL(m)'), xlabel('dB SPL')
|
||
| 126 | xlim([min(levels) max(levels)]), ylim([-10 50]) |
||
| 127 | grid on |
||
| 128 | |||
| 129 | %% plot cilia displacement |
||
| 130 | figure(4) |
||
| 131 | subplot(2,2,2) |
||
| 132 | restingIHC_cilia=IHCrestingCiliaCond; |
||
| 133 | plot(levels, IHC_cilia_peak,'k', 'linewidth',2), hold on |
||
| 134 | plot(levels, IHC_cilia_min,'r', 'linewidth',2) |
||
| 135 | hold on, |
||
| 136 | plot([min(levels) max(levels)], ... |
||
| 137 | [restingIHC_cilia restingIHC_cilia], 'g') |
||
| 138 | title(' IHC apical cond.')
|
||
| 139 | ylabel ('IHCcilia(conductance)'), xlabel('dB SPL')
|
||
| 140 | xlim([min(levels) max(levels)]) |
||
| 141 | grid on |
||
| 142 | |||
| 143 | %% plot receptor potentials |
||
| 144 | figure(4) |
||
| 145 | subplot(2,2,3) |
||
| 146 | % RP I/O function min and max |
||
| 147 | restingRP=IHC_RP_peak(1); |
||
| 148 | toPlot= [fliplr(IHC_RP_min(:,1)') IHC_RP_peak(:,1)']; |
||
| 149 | microPa= 28e-6*10.^(levels/20); |
||
| 150 | microPa=[-fliplr(microPa) microPa]; |
||
| 151 | plot(microPa,toPlot, drawColors(BFno), 'linewidth',2) |
||
| 152 | % ylim([0 300]) |
||
| 153 | |||
| 154 | %% Dallos and Harris data |
||
| 155 | dallosx=[-0.9 -0.1 -0.001 0.001 0.01 0.9]; |
||
| 156 | dallosy=[-8 -7.8 -6.5 11 16.5 22]/1000 + restingRP; |
||
| 157 | hold on, plot(dallosx,dallosy, 'o') |
||
| 158 | plot([-1 1], [restingRP restingRP], 'r') |
||
| 159 | title(' Dallos(86) data at 800 Hz')
|
||
| 160 | ylabel ('receptor potential(V)'), xlabel('Pa')
|
||
| 161 | ylim([-0.08 -0.02]), xlim([-1 1]) |
||
| 162 | grid on |
||
| 163 | |||
| 164 | %% RP I/O function min and max |
||
| 165 | figure(4) |
||
| 166 | subplot(2,2,4) |
||
| 167 | restingRP=IHC_RP_peak(1); |
||
| 168 | peakRP=max(IHC_RP_peak); |
||
| 169 | plot(levels, IHC_RP_peak,drawColors(BFno), 'linewidth',2) |
||
| 170 | hold on |
||
| 171 | plot(levels, IHC_RP_dc, [drawColors(BFno) ':'], 'linewidth',2) |
||
| 172 | hold on, |
||
| 173 | plot([min(levels) max(levels)], [restingRP restingRP], 'r') |
||
| 174 | xlim([min(levels) max(levels)]) |
||
| 175 | % animal data |
||
| 176 | sndLevel=[5 15 25 35 45 55 65 75]; |
||
| 177 | RPanimal=restingRP+[0.5 2 4.6 5.8 6.4 7.2 8 10.2]/1000; |
||
| 178 | % could be misleading when restingRP changes |
||
| 179 | RPanimal=-0.060+[0.5 2 4.6 5.8 6.4 7.2 8 10.2]/1000; |
||
| 180 | hold on, plot(sndLevel,RPanimal,'o') |
||
| 181 | |||
| 182 | grid on |
||
| 183 | title(['Et= ' num2str(IHC_cilia_RPParams.Et) ': RP data 7 kHz Patuzzi']) |
||
| 184 | ylabel ('RP(V)'), xlabel('dB SPL')
|
||
| 185 | ylim([-0.08 -0.04]) |
||
| 186 | allIHC_RP_peak=[allIHC_RP_peak IHC_RP_peak]; |
||
| 187 | allIHC_RP_dc=[allIHC_RP_dc IHC_RP_dc]; |
||
| 188 | |||
| 189 | fprintf('level\t peak\t DC\n')
|
||
| 190 | UTIL_printTabTable([levels' IHC_RP_peak IHC_RP_dc]) |
||
| 191 | % disp(['restingIHC_cilia= ' num2str(restingIHC_cilia)]) |
||
| 192 | fprintf('peakRP= \t%6.3f', peakRP)
|
||
| 193 | fprintf('\nrestingRP= \t%6.3f', restingRP)
|
||
| 194 | fprintf('\ndifference= \t%6.3f\n', (peakRP-restingRP))
|
||
| 195 | drawnow |
||
| 196 | end |
||
| 197 | % UTIL_showStruct(IHC_VResp_VivoParams, 'IHC_VResp_VivoParams') |
||
| 198 | UTIL_showStruct(IHC_cilia_RPParams, 'IHC_cilia_RPParams') |
||
| 199 | fprintf('level\t peak\n')
|
||
| 200 | UTIL_printTabTable([levels' allIHC_RP_peak]) |
||
| 201 | fprintf('level\t DC\n')
|
||
| 202 | UTIL_printTabTable([levels' allIHC_RP_dc]) |
||
| 203 | |||
| 204 | path(savePath); |
||
| 205 | disp(paramChanges) |