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.

Statistics Download as Zip
| Branch: | Revision:

root / testPrograms / testRP.m @ 38:c2204b18f4a2

History | View | Annotate | Download (6.44 KB)

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