Revision 38:c2204b18f4a2 testPrograms/oldTestPrograms

View differences:

testPrograms/oldTestPrograms/LiebermanMOCdata.m
1
function LibermanData= LiebermanMOCdata
2

  
3
LibermanData=[
4
    2	0.2;
5
2.1	0.19;
6
2.2	0.18;
7
2.3	0.18;
8
2.4	0.16;
9
2.5	0.15;
10
2.6	0.15;
11
2.7	0.15;
12
2.8	0.12;
13
2.9	0.12;
14
3	0.1;
15
3.1	0.1;
16
3.2	0.05;
17
3.3	0.05;
18
3.4	0;
19
3.5	-0.1;
20
3.6	-0.4;
21
3.7	-1.2;
22
3.8	-1.6;
23
3.9	-1.8;
24
4	-1.85;
25
4.1	-2;
26
4.2	-2.05;
27
4.3	-2.05;
28
4.4	-2.15;
29
4.5	-2.2;
30
4.6	-2.15;
31
4.7	-2.1;
32
4.8	-2.15;
33
4.9	-2.2;
34
5	-2.1;
35
5.1	-2.1;
36
5.2	-2.25;
37
5.3	-2.1;
38
5.4	-2.15;
39
5.5	-2.1;
40
5.6	-2.15;
41
5.7	-2.1;
42
5.8	-2.2;
43
5.9	-2.05;
44
6	-2.15;
45
6.1	-2.05;
46
6.2	-2;
47
6.3	-2.2;
48
6.4	-2.1;
49
6.5	-2.05;
50
6.6	-2.05;
51
6.7	-2.05;
52
6.8	-2.2;
53
6.9	-2.1;
54
7	-2.05;
55
7.1	-2.05;
56
7.2	-0.7;
57
7.3	-0.1;
58
7.4	0;
59
7.5	0.1;
60
7.6	0.2;
61
7.7	0.35;
62
7.8	0.2;
63
7.9	0.15;
64
8	0.2;
65
8.1	0.15;
66
8.2	0.15;
67
8.3	0.15;
68
8.4	0.12;
69
8.5	0.1;
70
8.6	0.09;
71
8.7	0.08;
72
8.8	0.07;
73
8.9	0.06;
74
9	0.05;
75
];
76
figure(98), subplot(2,1,2), hold on
77
scalar=-15;
78
plot(LibermanData(:,1)-2.5,scalar*LibermanData(:,2))
79

  
testPrograms/oldTestPrograms/MAPtwoToneDemo1D.m
1
% function MAPtwoToneDemo
2
% Not for distribution but code worth keeping
3
% Demonstration of two-tone suppression in the AN using a
4
%   single channel
5
%
6

  
7
dbstop if error
8
% create access to all MAP 1_8 facilities
9
% addpath ('..\modules', '..\utilities',  '..\parameterStore',  '..\wavFileStore' , '..\testPrograms')
10
addpath (['..' filesep 'modules'], ['..' filesep 'utilities'],  ['..' filesep 'parameterStore'],  ['..' filesep 'wavFileStore'] , ['..' filesep 'testPrograms'])
11

  
12
moduleSequence= 1:7;  	% up to the AN
13
figure(3), clf
14
primaryToneFrequency=2000;
15
suppressorFrequency=primaryToneFrequency*1.5;
16

  
17
primaryDB=30;
18
suppressors=20:10:80;
19
frameCount=0;
20
for suppressorDB=suppressors
21
    frameCount=frameCount+1;
22
    lowestBF=1000; 	highestBF= 5000; 	numChannels=30;
23
    BFlist=round(logspace(log10(lowestBF), log10(highestBF), numChannels));
24
    BFlist=2000;
25
    duration=.020;		      % seconds
26
    sampleRate= 40000; % Hz (higher sample rate needed for BF>8000 Hz)
27
    dt=1/sampleRate; % seconds
28
    
29
    % for conditionNo=1:3  % probe alone/ suppressor alone/ combined
30
    for conditionNo=1:3  % probe alone/ suppressor alone/ combined
31
        switch conditionNo
32
            case 1
33
                primaryLevelDB=primaryDB;
34
                suppressorLevelDB= -100;
35
                plotGuide.subPlotNo=	1;     % initialize subplot count
36
                figureTitle=['probe alone:  ' num2str(primaryToneFrequency) ' Hz;   ' num2str(primaryLevelDB) ' dB SPL'];
37
                
38
            case 2
39
                primaryLevelDB=-100;
40
                suppressorLevelDB=suppressorDB;
41
                plotGuide.subPlotNo=	2;     % initialize subplot count
42
                figureTitle=['suppressor alone:  ' num2str(suppressorFrequency) ' Hz;   ' num2str(suppressorLevelDB) ' dB SPL'];
43
            case 3
44
                primaryLevelDB=primaryDB;
45
                suppressorLevelDB=suppressorDB;
46
                plotGuide.subPlotNo=	3;     % initialize subplot count
47
                figureTitle=['probe + suppressor'];
48
        end
49
        
50
        % primary BF tone
51
        time1=dt: dt: duration;
52
        amp=10^(primaryLevelDB/20)*28e-6;
53
        inputSignal=amp*sin(2*pi*primaryToneFrequency*time1);
54
        rampDuration=.005; rampTime=dt:dt:rampDuration;
55
        ramp=[0.5*(1+cos(2*pi*rampTime/(2*rampDuration)+pi)) ones(1,length(time1)-length(rampTime))];
56
        inputSignal=inputSignal.*ramp;
57
        inputSignal=inputSignal.*fliplr(ramp);
58
        
59
        % suppressor
60
        tone2Duration=duration/2; % s
61
        time2= dt: dt: tone2Duration;
62
        % B: tone on
63
        amp=10^(suppressorLevelDB/20)*28e-6;
64
        inputSignal2=amp*sin(2*pi*suppressorFrequency*time2);
65
        rampDuration=.005; rampTime=dt:dt:rampDuration;
66
        ramp=[0.5*(1+cos(2*pi*rampTime/(2*rampDuration)+pi)) ones(1,length(time2)-length(rampTime))];
67
        inputSignal2=inputSignal2.*ramp;
68
        % A: initial silence (delay to suppressor)
69
        silence=zeros(1,length(time2));
70
        inputSignal2=[silence inputSignal2];
71
        
72
        % add tone and suppressor components
73
        inputSignal=inputSignal+inputSignal2;
74
        
75
        % specify model parameters
76
        method=MAPparamsDEMO(BFlist, sampleRate);
77
        % parameter change (must be global to take effect)
78
        global   AN_IHCsynapseParams
79
        AN_IHCsynapseParams.mode=	'probability';
80
%         method.useEfferent=0;
81
        
82
        method.plotGraphs=	1;	   % please plot
83
        
84
        figure(4), subplot(3,1,conditionNo)
85
        plot(time1, inputSignal, 'k')% *************
86
        
87
        [ANresponse, method, A]=MAPsequenceSeg(inputSignal, method, moduleSequence);
88
        response{conditionNo}=ANresponse;
89
% 	F(frameCount) = getframe(gcf);
90
    end
91
    
92
%     peakResponse=max(max([response{1} response{2} response{3}]));
93
%     figure(3), subplot(4,1,1)
94
%     mesh((response{1}), [0 peakResponse])
95
%     title(['primary: ' num2str(primaryDB) ' dB SPL'])
96
%     zlim([0 5000]), view([-28 36])
97
%     
98
%     figure(3), subplot(4,1,2)
99
%     mesh((response{2}), [0 peakResponse])
100
%     title(['suppressor: ' num2str(suppressorDB) ' dB SPL'])
101
%     zlim([0 5000]),  view([-28 36])
102
%     
103
%     figure(3), subplot(4,1,3)
104
%     mesh((response{3}), [0 peakResponse])
105
%     title([' primary + suppressor '])
106
%     zlim([0 5000]), view([-28 36])
107
%     
108
%     figure(3), subplot(4,1,4)
109
%     sum= response{3}-response{1}-response{2};
110
%     mesh(sum)
111
%     zlim([-2000 2000])
112
%     title(' difference matrix (combined - primary - suppressor)')
113
%     view([-28 20])
114
%     disp( [num2str([ suppressorDB primaryDB max(max(sum))])] )
115
%     
116
%     colormap(jet)
117
    pause(1)
118
end
119

  
120
figure(4)
121
xlabel('time (s)')
122
figure(3)
123
xlabel('time (s)')
124

  
125
%  figure(99), movie(F, 1, 1)
126
% UTIL_showAllMAPStructures

Also available in: Unified diff