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 / testBM.m @ 29:b51bf546ca3f

History | View | Annotate | Download (4.9 KB)

1
function testBM (BMlocations, paramsName,relativeFrequencies)
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
% refBMdisplacement is the displacement of the BM at threshold
22
% 1 nm disp at  threshold (9 kHz, Ruggero)
23
refBMdisplacement= 1e-8;            % adjusted for 10 nm at 1 kHz
24

    
25
toneDuration=.200;
26
rampDuration=0.01;
27
silenceDuration=0.01;
28

    
29
sampleRate=30000;
30

    
31
dbstop if error
32
figure(3), clf
33
set(gcf,'position',[280   350   327   326])
34
set(gcf,'name','DRNL - BM')
35
pause(0.1)
36

    
37
finalSummary=[];
38
nBFs=length(BMlocations);
39
BFno=0; plotCount=0;
40
for BF=BMlocations
41
    BFno=BFno+1;
42
    plotCount=plotCount+nBFs;
43
    stimulusFrequencies=BF* relativeFrequencies;
44
    nFrequencies=length(stimulusFrequencies);
45

    
46
    peakAmpBM=zeros(nLevels,nFrequencies);
47
    peakAmpBMdB=NaN(nLevels,nFrequencies);
48
    peakEfferent=NaN(nLevels,nFrequencies);
49
    peakAREfferent=NaN(nLevels,nFrequencies);
50

    
51

    
52
    levelNo=0;
53
    for leveldB=levels
54
        disp(['level= ' num2str(leveldB)])
55
        levelNo=levelNo+1;
56

    
57
        freqNo=0;
58
        for frequency=stimulusFrequencies
59
            freqNo=freqNo+1;
60

    
61
            % Generate stimuli
62
            globalStimParams.FS=sampleRate;
63
            globalStimParams.overallDuration=...
64
                toneDuration+silenceDuration;  % s
65
            stim.phases='sin';
66
            stim.type='tone';
67
            stim.toneDuration=toneDuration;
68
            stim.frequencies=frequency;
69
            stim.amplitudesdB=leveldB;
70
            stim.beginSilence=silenceDuration;
71
            stim.rampOnDur=rampDuration;
72
            % no offset ramp
73
            stim.rampOffDur=rampDuration;
74
            doPlot=0;
75
            inputSignal=stimulusCreate(globalStimParams, stim, doPlot);
76
            inputSignal=inputSignal(:,1)';
77

    
78
            %% run the model
79
            MAPparamsName=paramsName;
80
            AN_spikesOrProbability='probability';
81
%             AN_spikesOrProbability='spikes';
82

    
83
            global DRNLoutput MOCattenuation ARattenuation
84
            MAP1_14(inputSignal, sampleRate, BF, ...
85
                MAPparamsName, AN_spikesOrProbability);
86

    
87
            DRNLresponse=DRNLoutput;
88
            peakAmp=max(max(...
89
                DRNLresponse(:, end-round(length(DRNLresponse)/2):end)));
90
            peakAmpBM(levelNo,freqNo)=peakAmp;
91
            peakAmpBMdB(levelNo,freqNo)=...
92
                20*log10(peakAmp/refBMdisplacement);
93
            peakEfferent(levelNo,freqNo)=min(min(MOCattenuation));
94
            peakAREfferent(levelNo,freqNo)=min(min(ARattenuation));
95

    
96
        end  % tone frequency
97
    end  % level
98

    
99
    %% analyses results and plot
100

    
101
    % BM I/O plot (top panel)
102
    figure(3)
103
    subplot(3,nBFs,BFno), cla
104
    plot(levels,peakAmpBMdB, 'linewidth',2)
105
    hold on, plot(levels, repmat(refBMdisplacement,1,length(levels)))
106
    hold off
107
    title(['BF=' num2str(BF,'%5.0f') ' - ' paramsName])
108
    xlabel('level')
109
    %     set(gca,'xtick',levels),  grid on
110
    if length(levels)>1,xlim([min(levels) max(levels)]), end
111
    ylabel(['dB re:' num2str(refBMdisplacement,'%6.1e') 'm'])
112
    ylim([-20 50])
113
    set(gca,'ytick',[-10 0 10 20 40])
114
    grid on
115
    %     legend({num2str(stimulusFrequencies')}, 'location', 'EastOutside')
116
    UTIL_printTabTable([levels' peakAmpBMdB], ...
117
        num2str([0 stimulusFrequencies]','%5.0f'), '%5.0f')
118
    finalSummary=[finalSummary peakAmpBMdB];
119

    
120
    % Tuning curve
121
    if length(relativeFrequencies)>2
122
        figure(3), subplot(3,nBFs, 2*nBFs+BFno)
123
        %         contour(stimulusFrequencies,levels,peakAmpBM,...
124
        %             [refBMdisplacement refBMdisplacement],'r')
125
        contour(stimulusFrequencies,levels,peakAmpBM,...
126
            refBMdisplacement.*[1 5 10 50 100])
127
        title(['tuning curve at ' num2str(refBMdisplacement) 'm']);
128
        ylabel('level (dB) at reference')
129
        xlim([100 10000])
130
        grid on
131
        hold on
132
        set(gca,'xscale','log')
133
    end
134

    
135

    
136
    % MOC contribution
137
    figure(3)
138
    subplot(3,nBFs,nBFs+BFno), cla
139
    plot(levels,20*log10(peakEfferent), 'linewidth',2)
140
    ylabel('MOC (dB attenuation)'), xlabel('level')
141
    title(['peak MOC: model= ' AN_spikesOrProbability])
142
    grid on
143
    if length(levels)>1, xlim([min(levels) max(levels)]), end
144

    
145
    % AR contribution
146
    hold on
147
    plot(levels,20*log10(peakAREfferent), 'r')
148
    hold off
149

    
150
end % best frequency
151

    
152
UTIL_showStructureSummary(DRNLParams, 'DRNLParams', 10)
153

    
154
    UTIL_printTabTable([levels' finalSummary], ...
155
        num2str([0 stimulusFrequencies]','%5.0f'), '%5.0f')
156

    
157
path(savePath);