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 @ 0:f233164f4c86

History | View | Annotate | Download (6.28 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
    restingRP=IHCrestingV;
157
    toPlot= [fliplr(IHC_RP_min(:,1)') IHC_RP_peak(:,1)'];
158
    microPa=   28e-6*10.^(levels/20);
159
    microPa=[-fliplr(microPa) microPa];
160
    plot(microPa,toPlot, drawColors(BFno), 'linewidth',2)
161
    % ylim([0 300])
162

    
163
    %% Dallos and Harris data
164
    dallosx=[-0.9	-0.1	-0.001	0.001	0.01	0.9];
165
    dallosy=[-8	-7.8	-6.5	11	16.5	22]/1000 + restingRP;
166
    hold on, plot(dallosx,dallosy, 'o')
167
    plot([-1 1], [restingRP restingRP], 'r')
168
    title(' Dallos(86) data at 800 Hz')
169
    ylabel ('receptor potential(V)'), xlabel('Pa')
170
    ylim([-0.08 -0.02]), xlim([-1 1])
171
    grid on
172

    
173
    %% RP I/O function min and max
174
    figure(4)
175
    subplot(2,2,4)
176
    restingRP=IHC_RP_peak(1);
177
    peakRP=max(IHC_RP_peak);
178
    plot(levels, IHC_RP_peak,drawColors(BFno), 'linewidth',2)
179
    hold on
180
    plot(levels, IHC_RP_dc, [drawColors(BFno) ':'], 'linewidth',2)
181
    hold on,
182
    plot([min(levels) max(levels)], [restingRP restingRP], 'r')
183
    xlim([min(levels) max(levels)])
184
    grid on
185
    title(['Et= ' num2str(IHC_cilia_RPParams.Et) ':  RP (AC- / DC:'])
186
    ylabel ('RP(V)'), xlabel('dB SPL')
187
    ylim([-0.08 -0.02])
188
    allIHC_RP_peak=[allIHC_RP_peak IHC_RP_peak];
189
    allIHC_RP_dc=[allIHC_RP_dc IHC_RP_dc];
190

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

    
207
path(savePath);
208
disp(paramChanges)