Revision 23:6cce421531e2 testPrograms/test_MAP1_14.m
| testPrograms/test_MAP1_14.m | ||
|---|---|---|
| 22 | 22 |
% Set the signal rms level (in leveldBSPL) |
| 23 | 23 |
% |
| 24 | 24 |
% #5 |
| 25 |
% Indentify the channels in terms of their best frequencies in the vector
|
|
| 25 |
% Identify the channels in terms of their best frequencies in the vector |
|
| 26 | 26 |
% BFlist. |
| 27 | 27 |
% |
| 28 | 28 |
% Last minute changes to the parameters fetched earlier can be made using |
| ... | ... | |
| 39 | 39 |
|
| 40 | 40 |
%% #2 probability (fast) or spikes (slow) representation |
| 41 | 41 |
AN_spikesOrProbability='spikes'; |
| 42 |
|
|
| 42 | 43 |
% or |
| 44 |
% NB probabilities are not corrected for refractory effects |
|
| 43 | 45 |
AN_spikesOrProbability='probability'; |
| 44 | 46 |
|
| 45 | 47 |
|
| 46 | 48 |
%% #3 pure tone, harmonic sequence or speech file input |
| 47 | 49 |
signalType= 'tones'; |
| 48 |
duration=0.100; % seconds |
|
| 49 |
% duration=0.020; % seconds |
|
| 50 |
sampleRate= 64000; |
|
| 50 |
sampleRate= 100000; |
|
| 51 |
duration=0.010; % seconds |
|
| 51 | 52 |
% toneFrequency= 250:250:8000; % harmonic sequence (Hz) |
| 52 |
toneFrequency= 1000; % or a pure tone (Hz8 |
|
| 53 |
|
|
| 53 |
toneFrequency= 4000; % or a pure tone (Hz8 |
|
| 54 | 54 |
rampDuration=.005; % seconds |
| 55 | 55 |
|
| 56 | 56 |
% or |
| 57 |
signalType= 'file'; |
|
| 58 |
fileName='twister_44kHz'; |
|
| 59 |
% fileName='new-da-44khz'; |
|
| 57 |
% signalType= 'file'; |
|
| 58 |
% fileName='twister_44kHz'; |
|
| 60 | 59 |
|
| 61 |
% ? and mix with an optional second file? |
|
| 62 |
mixerFile=[]; |
|
| 63 |
%or |
|
| 64 |
mixerFile='babble'; |
|
| 65 |
leveldBSPL2=60; |
|
| 66 | 60 |
|
| 67 | 61 |
%% #4 rms level |
| 68 | 62 |
% signal details |
| ... | ... | |
| 91 | 85 |
% 'IHCpreSynapseParams.tauCa=86e-6;'}; |
| 92 | 86 |
% paramChanges={'DRNLParams.rateToAttenuationFactorProb = 0;'};
|
| 93 | 87 |
|
| 94 |
%% delare showMap options |
|
| 95 |
showMapOptions=[]; % use defaults |
|
| 88 |
|
|
| 89 |
%% delare 'showMap' options to control graphical output |
|
| 90 |
global showMapOptions |
|
| 96 | 91 |
|
| 97 | 92 |
% or (example: show everything including an smoothed SACF output |
| 98 |
showMapOptions.showModelParameters=1; |
|
| 99 |
showMapOptions.showModelOutput=1; |
|
| 100 |
showMapOptions.printFiringRates=1; |
|
| 101 |
showMapOptions.showACF=0; |
|
| 102 |
showMapOptions.showEfferent=1; |
|
| 103 |
if strcmp(AN_spikesOrProbability, 'probability') |
|
| 104 |
showMapOptions.surfProbability=1; |
|
| 93 |
showMapOptions.printModelParameters=1; % prints all parameters |
|
| 94 |
showMapOptions.showModelOutput=1; % plot of all stages |
|
| 95 |
showMapOptions.printFiringRates=1; % prints stage activity levels |
|
| 96 |
showMapOptions.showACF=0; % shows SACF (probability only) |
|
| 97 |
showMapOptions.showEfferent=1; % tracks of AR and MOC |
|
| 98 |
showMapOptions.surfProbability=1; % 2D plot of HSR response |
|
| 99 |
if strcmp(AN_spikesOrProbability, 'spikes') |
|
| 100 |
% avoid nonsensical options |
|
| 101 |
showMapOptions.surfProbability=0; |
|
| 102 |
showMapOptions.showACF=0; |
|
| 105 | 103 |
end |
| 106 | 104 |
if strcmp(signalType, 'file') |
| 105 |
% needed for labeling plot |
|
| 107 | 106 |
showMapOptions.fileName=fileName; |
| 107 |
else |
|
| 108 |
showMapOptions.fileName=[]; |
|
| 108 | 109 |
end |
| 109 | 110 |
|
| 110 | 111 |
%% Generate stimuli |
| ... | ... | |
| 116 | 117 |
case 'tones' |
| 117 | 118 |
inputSignal=createMultiTone(sampleRate, toneFrequency, ... |
| 118 | 119 |
leveldBSPL, duration, rampDuration); |
| 119 |
|
|
| 120 |
|
|
| 120 | 121 |
case 'file' |
| 121 | 122 |
%% file input simple or mixed |
| 122 | 123 |
[inputSignal sampleRate]=wavread(fileName); |
| 123 |
dt=1/sampleRate;
|
|
| 124 |
dt=1/sampleRate; |
|
| 124 | 125 |
inputSignal=inputSignal(:,1); |
| 125 | 126 |
targetRMS=20e-6*10^(leveldBSPL/20); |
| 126 | 127 |
rms=(mean(inputSignal.^2))^0.5; |
| ... | ... | |
| 128 | 129 |
inputSignal=inputSignal*amp; |
| 129 | 130 |
silence= zeros(1,round(0.1/dt)); |
| 130 | 131 |
inputSignal= [silence inputSignal' silence]; |
| 131 |
|
|
| 132 |
if ~isempty(mixerFile) |
|
| 133 |
[inputSignal2 sampleRate2]=wavread(mixerFile); |
|
| 134 |
if ~isequal(sampleRate,sampleRate2) |
|
| 135 |
error... |
|
| 136 |
('file and mixer file have different sample rates')
|
|
| 137 |
end |
|
| 138 |
inputSignal2=inputSignal2(:,1); |
|
| 139 |
[r c]=size(inputSignal); |
|
| 140 |
inputSignal2=inputSignal2(1:r); |
|
| 141 |
targetRMS=20e-6*10^(leveldBSPL2/20); |
|
| 142 |
rms=(mean(inputSignal2.^2))^0.5; |
|
| 143 |
amp=targetRMS/rms; |
|
| 144 |
inputSignal2=inputSignal2*amp; |
|
| 145 |
rampDuration=dt*length(inputSignal2)/3; |
|
| 146 |
if rampDuration>0.5*duration, rampDuration=duration/2; end |
|
| 147 |
rampTime=dt:dt:rampDuration; |
|
| 148 |
time=dt*(1:length(inputSignal2)); |
|
| 149 |
ramp=[0.5*(1+cos(2*pi*rampTime/(2*rampDuration)+pi)) ... |
|
| 150 |
ones(1,length(time)-length(rampTime))]; |
|
| 151 |
inputSignal2=inputSignal2.*ramp'; |
|
| 152 |
ramp=fliplr(ramp); |
|
| 153 |
inputSignal2=inputSignal2.*ramp'; |
|
| 154 |
end |
|
| 155 |
|
|
| 156 |
inputSignal=inputSignal+inputSignal2; |
|
| 157 | 132 |
end |
| 158 | 133 |
|
| 159 | 134 |
|
| ... | ... | |
| 167 | 142 |
|
| 168 | 143 |
restorePath=path; |
| 169 | 144 |
addpath (['..' filesep 'MAP']) |
| 145 |
addpath (['..' filesep 'utilities']) |
|
| 170 | 146 |
|
| 171 | 147 |
MAP1_14(inputSignal, sampleRate, BFlist, ... |
| 172 | 148 |
MAPparamsName, AN_spikesOrProbability, paramChanges); |
| 173 |
path(restorePath) |
|
| 174 | 149 |
toc |
| 175 | 150 |
|
| 176 | 151 |
% the model run is now complete. Now display the results |
| 177 |
showMAP(showMapOptions)
|
|
| 152 |
disp(' param changes to list of parameters below')
|
|
| 178 | 153 |
for i=1:length(paramChanges) |
| 179 | 154 |
disp(paramChanges{i})
|
| 180 | 155 |
end |
| 156 |
UTIL_showMAP(showMapOptions) |
|
| 157 |
|
|
| 181 | 158 |
|
| 182 | 159 |
toc |
| 183 | 160 |
path(restorePath) |
| ... | ... | |
| 204 | 181 |
|
| 205 | 182 |
% add 10 ms silence |
| 206 | 183 |
silence= zeros(1,round(0.03/dt)); |
| 184 |
silence= zeros(1,round(0.01/dt)); |
|
| 207 | 185 |
inputSignal= [silence inputSignal silence]; |
| 208 | 186 |
|
Also available in: Unified diff