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 / multithreshold 1.46 / testRP.m @ 29:b51bf546ca3f

History | View | Annotate | Download (6.41 KB)

1
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, paramChanges=[]; end
17

    
18
levels=-20:10:100;
19
nLevels=length(levels);
20
toneDuration=.05;
21
silenceDuration=.01;
22
sampleRate=50000;
23
dt=1/sampleRate;
24

    
25
allIHC_RP_peak=[];
26
allIHC_RP_dc=[];
27

    
28
changes{1}=[];
29
% changes{1}='IHC_cilia_RPParams.Et=	0.100;';
30
% changes{2}='IHC_cilia_RPParams.Et=	0.070;';
31

    
32
for changeNo=1:length(changes)
33
    if isempty(changes{1})
34
        paramChanges=[];
35
    else
36
        paramChanges{1}=changes{changeNo};
37
    end
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
    plot(levels, IHC_cilia_min,'r', 'linewidth',2)
143
    hold on,
144
    plot([min(levels) max(levels)], ...
145
        [restingIHC_cilia restingIHC_cilia], 'g')
146
    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
hold on, plot(sndLevel,RPanimal,'o')
187

    
188
    grid on
189
    title(['Et= ' num2str(IHC_cilia_RPParams.Et) ':  RP data 7 kHz Patuzzi'])
190
    ylabel ('RP(V)'), xlabel('dB SPL')
191
    ylim([-0.08 -0.04])
192
    allIHC_RP_peak=[allIHC_RP_peak IHC_RP_peak];
193
    allIHC_RP_dc=[allIHC_RP_dc IHC_RP_dc];
194

    
195
    fprintf('level\t peak\t DC\n')
196
    UTIL_printTabTable([levels' IHC_RP_peak IHC_RP_dc])
197
    % disp(['restingIHC_cilia= ' num2str(restingIHC_cilia)])
198
    fprintf('peakRP= \t%6.3f', peakRP)
199
    fprintf('\nrestingRP= \t%6.3f', restingRP)
200
    fprintf('\ndifference= \t%6.3f\n', (peakRP-restingRP))
201
    drawnow
202
end
203
end
204
% UTIL_showStruct(IHC_VResp_VivoParams, 'IHC_VResp_VivoParams')
205
UTIL_showStruct(IHC_cilia_RPParams, 'IHC_cilia_RPParams')
206
    fprintf('level\t peak\n')
207
    UTIL_printTabTable([levels' allIHC_RP_peak])
208
    fprintf('level\t DC\n')
209
    UTIL_printTabTable([levels' allIHC_RP_dc])
210

    
211
path(savePath);
212
disp(paramChanges)