Revision 30:1a502830d462

View differences:

MAP/MAP1_14.m
313 313
% Fiber types are specified in terms of tauCa
314 314
nANfiberTypes= length(IHCpreSynapseParams.tauCa);
315 315
tauCas= IHCpreSynapseParams.tauCa;
316
nChannels= nANfiberTypes*nBFs;
317
synapticCa= zeros(nChannels,segmentLength);
316
nANchannels= nANfiberTypes*nBFs;
317
synapticCa= zeros(nANchannels,segmentLength);
318 318

  
319 319
% Calcium control (more calcium, greater release rate)
320 320
ECa=IHCpreSynapseParams.ECa;
321 321
gamma=IHCpreSynapseParams.gamma;
322 322
beta=IHCpreSynapseParams.beta;
323 323
tauM=IHCpreSynapseParams.tauM;
324
mICa=zeros(nChannels,segmentLength);
324
mICa=zeros(nANchannels,segmentLength);
325 325
GmaxCa=IHCpreSynapseParams.GmaxCa;
326 326
synapse_z= IHCpreSynapseParams.z;
327 327
synapse_power=IHCpreSynapseParams.power;
......
329 329
% tauCa vector is established across channels to allow vectorization
330 330
%  (one tauCa per channel). Do not confuse with tauCas (one pre fiber type)
331 331
tauCa=repmat(tauCas, nBFs,1);
332
tauCa=reshape(tauCa, nChannels, 1);
332
tauCa=reshape(tauCa, nANchannels, 1);
333 333

  
334
% presynapse startup values (vectors, length:nChannels)
334
% presynapse startup values (vectors, length:nANchannels)
335 335
% proportion (0 - 1) of Ca channels open at IHCrestingV
336 336
mICaCurrent=((1+beta^-1 * exp(-gamma*IHCrestingV))^-1)...
337 337
    *ones(nBFs*nANfiberTypes,1);
......
349 349
% The results computed either for probabiities *or* for spikes (not both)
350 350
% Spikes are necessary if CN and IC are to be computed
351 351
nFibersPerChannel= AN_IHCsynapseParams.numFibers;
352
nANfibers= nChannels*nFibersPerChannel;
352
nANfibers= nANchannels*nFibersPerChannel;
353 353
AN_refractory_period= AN_IHCsynapseParams.refractory_period;
354 354

  
355 355
y=AN_IHCsynapseParams.y;
......
359 359
M=round(AN_IHCsynapseParams.M);
360 360

  
361 361
% probability            (NB initial 'P' on everything)
362
PAN_ydt = repmat(AN_IHCsynapseParams.y*dt, nChannels,1);
363
PAN_ldt = repmat(AN_IHCsynapseParams.l*dt, nChannels,1);
364
PAN_xdt = repmat(AN_IHCsynapseParams.x*dt, nChannels,1);
365
PAN_rdt = repmat(AN_IHCsynapseParams.r*dt, nChannels,1);
362
PAN_ydt = repmat(AN_IHCsynapseParams.y*dt, nANchannels,1);
363
PAN_ldt = repmat(AN_IHCsynapseParams.l*dt, nANchannels,1);
364
PAN_xdt = repmat(AN_IHCsynapseParams.x*dt, nANchannels,1);
365
PAN_rdt = repmat(AN_IHCsynapseParams.r*dt, nANchannels,1);
366 366
PAN_rdt_plus_ldt = PAN_rdt + PAN_ldt;
367 367
PAN_M=round(AN_IHCsynapseParams.M);
368 368

  
......
371 371
Pavailable    = Pcleft*(l+r)./kt0;
372 372
Preprocess    = Pcleft*r/x; % canbe fractional
373 373

  
374
ANprobability=zeros(nChannels,segmentLength);
375
ANprobRateOutput=zeros(nChannels,signalLength);
374
ANprobability=zeros(nANchannels,segmentLength);
375
ANprobRateOutput=zeros(nANchannels,signalLength);
376 376
lengthAbsRefractoryP= round(AN_refractory_period/dt);
377 377
% special variables for monitoring synaptic cleft (specialists only)
378
savePavailableSeg=zeros(nChannels,segmentLength);
379
savePavailable=zeros(nChannels,signalLength);
378
savePavailableSeg=zeros(nANchannels,segmentLength);
379
savePavailable=zeros(nANchannels,signalLength);
380 380

  
381 381
% spikes     % !  !  !    ! !        !   !  !
382 382
lengthAbsRefractory= round(AN_refractory_period/ANdt);
......
406 406
%% CN (first brain stem nucleus - could be any subdivision of CN)
407 407
% Input to a CN neuorn is a random selection of AN fibers within a channel
408 408
%  The number of AN fibers used is ANfibersFanInToCN
409
ANfibersFanInToCN=MacGregorMultiParams.fibersPerNeuron;
410
nCNneuronsPerChannel=MacGregorMultiParams.nNeuronsPerBF;
411 409
% CNtauGk (Potassium time constant) determines the rate of firing of
412 410
%  the unit when driven hard by a DC input (not normally >350 sp/s)
413
CNtauGk=MacGregorMultiParams.tauGk;
411
% If there is more than one value, everything is replicated accordingly
412

  
414 413
ANavailableFibersPerChan=AN_IHCsynapseParams.numFibers;
415
nCNneurons=nCNneuronsPerChannel*nChannels;
416
% nCNneuronsPerFiberType= nCNneurons/nANfiberTypes;
414
ANfibersFanInToCN=MacGregorMultiParams.fibersPerNeuron;
417 415

  
416
CNtauGk=MacGregorMultiParams.tauGk; % row vector of CN types (by tauGk)
417
nCNtauGk=length(CNtauGk);
418

  
419
% the total number of 'channels' is now greater
420
nCNchannels=nANchannels*nCNtauGk;
421

  
422
nCNneuronsPerChannel=MacGregorMultiParams.nNeuronsPerBF;
423
tauGk=repmat(CNtauGk, nCNneuronsPerChannel,1);
424
tauGk=reshape(tauGk,nCNneuronsPerChannel*nCNtauGk,1);
425

  
426
% Now the number of neurons has been increased
427
nCNneurons=nCNneuronsPerChannel*nCNchannels;
418 428
CNmembranePotential=zeros(nCNneurons,reducedSegmentLength);
419 429

  
420 430
% establish which ANfibers (by name) feed into which CN nuerons
421
CNinputfiberLists=zeros(nChannels*nCNneuronsPerChannel, ANfibersFanInToCN);
431
CNinputfiberLists=zeros(nANchannels*nCNneuronsPerChannel, ANfibersFanInToCN);
422 432
unitNo=1;
423
for ch=1:nChannels
433
for ch=1:nANchannels
424 434
    % Each channel contains a number of units =length(listOfFanInValues)
425 435
    for idx=1:nCNneuronsPerChannel
426
        fibersUsed=(ch-1)*ANavailableFibersPerChan + ...
427
            ceil(rand(1,ANfibersFanInToCN)* ANavailableFibersPerChan);
428
        CNinputfiberLists(unitNo,:)=fibersUsed;
429
        unitNo=unitNo+1;
436
        for idx2=1:nCNtauGk
437
            fibersUsed=(ch-1)*ANavailableFibersPerChan + ...
438
                ceil(rand(1,ANfibersFanInToCN)* ANavailableFibersPerChan);
439
            CNinputfiberLists(unitNo,:)=fibersUsed;
440
            unitNo=unitNo+1;
441
        end
430 442
    end
431 443
end
432 444

  
......
468 480
CNtimeSinceLastSpike=zeros(nCNneurons,1);
469 481
% tauGk is the main distinction between neurons
470 482
%  in fact they are all the same in the standard model
471
tauGk=repmat(CNtauGk,nChannels*nCNneuronsPerChannel,1);
483
tauGk=repmat(tauGk,nANchannels,1);
472 484

  
473
CN_PSTH=zeros(nChannels,reducedSegmentLength);
474 485
CNoutput=false(nCNneurons,reducedSignalLength);
475 486

  
476 487

  
477 488
%% MacGregor (IC - second nucleus) --------
478
nICcells=nChannels;  % one cell per channel
489
nICcells=nANchannels*nCNtauGk;  % one cell per channel
490
CN_PSTH=zeros(nICcells ,reducedSegmentLength);
479 491

  
480 492
ICspikeWidth=0.00015;   % this may need revisiting
481 493
epochsPerSpike=round(ICspikeWidth/ANdt);
......
515 527
ICtrailingAlphas=zeros(nICcells, length(IC_CNalphaFunction));
516 528

  
517 529
ICfiberTypeRates=zeros(nANfiberTypes,reducedSignalLength);
518
ICoutput=false(nChannels,reducedSignalLength);
530
ICoutput=false(nICcells,reducedSignalLength);
519 531

  
520 532
ICmembranePotential=zeros(nICcells,reducedSegmentLength);
521 533
ICmembraneOutput=zeros(nICcells,signalLength);
......
799 811
                % releaseProb is the release probability per channel
800 812
                %  but each channel has many synapses
801 813
                releaseProb=repmat(releaseProb',nFibersPerChannel,1);
802
                releaseProb=reshape(releaseProb, nFibersPerChannel*nChannels,1);
814
                releaseProb=reshape(releaseProb, nFibersPerChannel*nANchannels,1);
803 815

  
804 816
                % AN_available=round(AN_available); % vesicles must be integer, (?needed)
805 817
                M_q=AN_M- AN_available;     % number of missing vesicles
......
883 895
            % Create the dendritic current for that neuron
884 896
            % First get input spikes to this neuron
885 897
            synapseNo=1;
886
            for ch=1:nChannels
898
            for ch=1:nCNchannels
887 899
                for idx=1:nCNneuronsPerChannel
888 900
                    % determine candidate fibers for this unit
889 901
                    fibersUsed=CNinputfiberLists(synapseNo,:);
......
992 1004
            %% IC ----------------------------------------------
993 1005
                %  MacGregor or some other second order neurons
994 1006

  
995
                % combine CN neurons in same channel, i.e. same BF & same tauCa
1007
                % combine CN neurons in same channel, 
1008
                %  i.e. same BF & same tauCa
996 1009
                %  to generate inputs to single IC unit
997 1010
                channelNo=0;
998 1011
                for idx=1:nCNneuronsPerChannel:nCNneurons-nCNneuronsPerChannel+1;
multithreshold 1.46/expGUI_MT.m
85 85
% Get default command line output from handles structure
86 86
initializeGUI(handles)
87 87
varargout{1} = handles.output;
88
setLocationOfGUIs(handles)
89 88

  
90
function setLocationOfGUIs(handles)
91
global checkForPreviousGUI  % holds screen positioning across repeated calls
92
scrnsize=get(0,'screensize');
93
checkForPreviousGUI=[];
94
% if isstruct(checkForPreviousGUI)...
95
%         && checkForPreviousGUI.GUIalreadyStarted==1 ...
96
%         && isfield(checkForPreviousGUI,'GUIposition')
97
%     set(handles.figure1,'position',checkForPreviousGUI.GUIposition)
98
% else
99
%     % relocate the GUI only if this is the first time of use
100
%     set(0, 'units','pixels')
101
%     % occupies top to bottom of screen but only 60% width
102
%     % [left bottom width height]
103
%     firstPos=[0.01*scrnsize(4) 0.03*scrnsize(3) 0.6*scrnsize(3) 0.92*scrnsize(4)];
104
%     firstPos=[4 0.045*scrnsize(4) 0.6*scrnsize(3) 0.93*scrnsize(4)];
105
%     set(handles.figure1, 'units','pixels')
106
%     set(handles.figure1,'position',firstPos)
107
%     checkForPreviousGUI.GUIalreadyStarted=1;
108
%     checkForPreviousGUI.GUIposition=firstPos;
109
% end
110
set(handles.figure1,'color',[.871 .961 .996])
111
set(handles.figure1,'name', pwd)
112

  
113
% MAP model figure; sits alongside GUI if requested
114
figure(99)
115
% [left bottom width height]
116
MAPpos=[0.615*scrnsize(3) 0.05*scrnsize(4) 0.15*scrnsize(3) 0.85*scrnsize(4)];
117
% visible only on request.
118
set(gcf,'position',MAPpos , 'visible','off')
119

  
89
% function setLocationOfGUIs(handles)
90
% global checkForPreviousGUI  % holds screen positioning across repeated calls
91
% scrnsize=get(0,'screensize');
92
% checkForPreviousGUI=[];
93
% % if isstruct(checkForPreviousGUI)...
94
% %         && checkForPreviousGUI.GUIalreadyStarted==1 ...
95
% %         && isfield(checkForPreviousGUI,'GUIposition')
96
% %     set(handles.figure1,'position',checkForPreviousGUI.GUIposition)
97
% % else
98
% %     % relocate the GUI only if this is the first time of use
99
% %     set(0, 'units','pixels')
100
% %     % occupies top to bottom of screen but only 60% width
101
% %     % [left bottom width height]
102
% %     firstPos=[0.01*scrnsize(4) 0.03*scrnsize(3) 0.6*scrnsize(3) 0.92*scrnsize(4)];
103
% %     firstPos=[4 0.045*scrnsize(4) 0.6*scrnsize(3) 0.93*scrnsize(4)];
104
% %     set(handles.figure1, 'units','pixels')
105
% %     set(handles.figure1,'position',firstPos)
106
% %     checkForPreviousGUI.GUIalreadyStarted=1;
107
% %     checkForPreviousGUI.GUIposition=firstPos;
108
% % end
109
% set(handles.figure1,'color',[.871 .961 .996])
110
% set(handles.figure1,'name', pwd)
111
% 
112
% % MAP model figure; sits alongside GUI if requested
113
% figure(99)
114
% % [left bottom width height]
115
% MAPpos=[0.615*scrnsize(3) 0.05*scrnsize(4) 0.15*scrnsize(3) 0.85*scrnsize(4)];
116
% % visible only on request.
117
% set(gcf,'position',MAPpos , 'visible','off')
118
% 
120 119

  
121 120
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
122 121

  
......
128 127
global targetTypes maskerTypes backgroundTypes
129 128
global variableNames paradigmNames threshEstNames  cueNames
130 129

  
131
% dbstop if error         % allow for debugging and user error reporting
132
% dbstop if warning
133

  
134
% specify structure fields for pretty automatic printing
135
% It also initialises some simple variables
130
% Specify order of fields in main structures
131
% identify as empty values or empty strings only
136 132
orderGlobals
137 133

  
138
addpath ('paradigms')   % preset paradigm informations is stored here
139
% filesep is usd to be compatible with other operating systems
140
% addpath (['..' filesep 'modules'], ['..' filesep 'utilities'], ...
141
%     ['..' filesep 'parameterStore'],  ['..' filesep 'wavFileStore'],...
142
%     ['..' filesep 'testPrograms'])
143
addpath (['..' filesep 'testPrograms'])
134
addpath ('paradigms')   %paradigm informations is stored here
135
addpath (['..' filesep 'testPrograms']) % model physiology tests
144 136

  
145 137
% specify all variables that  need to be set on the GUI
146 138
variableNames={'stimulusDelay','maskerDuration','maskerLevel',...
......
149 141
    'cueTestDifference', 'WRVstartValues', 'WRVsteps', 'WRVlimits'};
150 142

  
151 143
% Variable variables
152
% (specifies paradigm paramaters that can changed on a 'between runs' basis)
153
% make them options in the two between runs variable menus
154
% NB 'numOHIOtones' is used only to solve a problem; it should not be
155
% selected manually
144
%  (names of variable that can changed between runs)
156 145
betweenRunsVariables={'stimulusDelay','maskerDuration','maskerLevel',...
157 146
    'maskerRelativeFrequency','targetFrequency', 'gapDuration',...
158 147
    'targetDuration','targetLevel','numOHIOtones'};
148
% populate the 'between runs variable' menus
159 149
set(handles.popupmenuVaryParameter1,'string',betweenRunsVariables)
160 150
set(handles.popupmenuVaryParameter2,'string',betweenRunsVariables)
161 151

  
162
% NB 'Warning: popupmenu control requires a scalar Value'
163
% indicates that an inappropriate 'value' is being set.
164
% when testing for this, always clear the GUI before running
165

  
166 152
% Trial presentation order - randomize at startup
167 153
presentationOrderNames={'randomize within blocks', 'fixed sequence', ...
168 154
    'randomize across blocks'};
......
184 170
    '16TalkerBabble','8TalkerBabble','4TalkerBabble',...
185 171
    '4TalkerReversedBabble','2TalkerBabble','1TalkerBabble'};
186 172
set(handles.popupmenuBackgroundType, 'string', backgroundTypes);
187
set(handles.editBackgroundLevel,'string',...
188
    num2str(stimulusParameters.backgroundLevel))
173
set(handles.editBackgroundLevel,'string', '0')
189 174

  
190 175
% Establish available paradigms by scanning paradigms folder
191 176
paradigmNames= what('paradigms');
192
paradigmNames=paradigmNames.m;       % m files only
193
for i=1:length(paradigmNames), paradigmNames{i}=paradigmNames{i}(10:end-2); end
177
paradigmNames= paradigmNames.m; % select m files only
178
for i=1:length(paradigmNames)   % strip off file extension
179
    paradigmNames{i}=paradigmNames{i}(10:end-2); 
180
end
194 181
set(handles.popupmenuParadigm,'string', paradigmNames)
195 182

  
196 183
% startup paradigm, 'training' (could be anywhere on the list)
......
199 186
if ~isempty(idx)
200 187
    set(handles.popupmenuParadigm,'value', idx)
201 188
else
202
    % training paradigm is always the startup paradigm
189
    % training paradigm must exist
203 190
    error(['expGUI_MT\initializeGUI: No ' startupParadigm...
204 191
        ' paradigm found in paradigms folder'])
205 192
end
......
213 200
set(handles.popupmenuEar,'value', defaultOption)    % 'left' is deafult
214 201
set(handles.pushbuttonSingleShot, 'visible', 'off') % use only for MAP
215 202

  
216
% masker phase box- value must be set in paradigm
203
% phase
217 204
phaseOptions={'sin','cos','alt','rand'};
218 205
set(handles.popupmenuPhase,'string', phaseOptions)
206
set(handles.popupmenuPhase,'value', 1)
219 207

  
220 208
% Cue
221 209
cueNames={'cued', 'noCue'};
222 210
set(handles.popupmenuCueNoCue, 'string', cueNames);
211
set(handles.popupmenuCueNoCue, 'value', 1);
223 212

  
224 213
% threshold assessment method - value must be set in paradigm
225 214
threshEstNames={'oneIntervalUpDown', 'MaxLikelihood', ...
......
265 254

  
266 255
% message box
267 256
set(handles.textMSG,'backgroundcolor', 'w', 'ForegroundColor', 'b', 'string', '')
268
set(handles.editMsgFont,'string','7')
257
set(handles.editMsgFont,'string','10')
269 258
set(handles.editSubjectFont,'string','14')
270 259

  
271 260
% default psychometric bin size and logistic slopes
......
328 317
end
329 318
rmpath ('paradigms')
330 319

  
331
switch experiment.paradigm
332
    % identify masker free paradigms
333
    case {'training', 'discomfort','absThreshold', 'absThreshold_8',...
334
            'absThreshold_16','TENtest', 'threshold_duration','SRT'...
335
            'paradigm_thr_IFMC'}
336
        experiment.maskerInUse=0;
337
    otherwise
338
        experiment.maskerInUse=1;
320
if ~isfield(experiment,'maskerInUse')
321
    error('selected paradigm does not specify if masker is used')
322
end
323

  
324

  
325
if ~experiment.maskerInUse
326
    stimulusParameters.maskerType='tone';
327
    stimulusParameters.maskerPhase='sin';
328
    stimulusParameters.maskerDuration=0.0;
329
    stimulusParameters.maskerLevel= -50;
330
    stimulusParameters.maskerRelativeFrequency= 1 ;
339 331
end
340 332

  
341 333
% if a variable is subject to change, specify list of values here
......
348 340
eval (cmd);
349 341

  
350 342
% establish popup menus on the basis of the paradigm file
351
set(handles.popupmenuRandomize,'value', betweenRuns.randomizeSequence)
352
set(handles.popupmenuPhase,'string', stimulusParameters.maskerPhase)
343
% set(handles.popupmenuRandomize,'value', betweenRuns.randomizeSequence)
344
sequenceOptions=get(handles.popupmenuRandomize,'string');
345
idx=find(strcmp(betweenRuns.randomizeSequence, sequenceOptions)==1);
346
set(handles.popupmenuRandomize,'value', idx)
347

  
348
phaseOptions=get(handles.popupmenuPhase,'string');
349
idx=find(strcmp(stimulusParameters.maskerPhase, phaseOptions)==1);
350
set(handles.popupmenuPhase,'value', idx)
351

  
353 352
if stimulusParameters.includeCue
354 353
    set(handles.popupmenuCueNoCue,'value', 1)
355 354
else
......
614 613
global experiment betweenRuns paradigmNames errormsg
615 614
checkForPreviousGUI.GUIposition=get(handles.figure1,'position');
616 615
experiment.singleShot=0;
616
experiment.stop=0;
617

  
617 618
switch experiment.paradigm
618 619
    case 'profile'
619 620
        %% special option for two successive and linked measurements
......
784 785
            'MAPmodelSingleCh', 'MAPmodelListen'}
785 786
        % MAPmodel writes forced parameter settings to the screen
786 787
        %  so that they can be read from there
788
        % {'randomize within blocks', 'fixed sequence',...
789
        %  'randomize across blocks'}
787 790
        set(handles.popupmenuRandomize,'value',2)       % fixed sequence
788 791
        set(handles.editstimulusDelay,'string','0.01')  % no stimulus delay
789 792
        stimulusParameters.includeCue=0;                % no cue for MAP
......
1301 1304
experiment.threshEstMethod=	'';
1302 1305
experiment.functionEstMethod=	'';
1303 1306
experiment.psyBinWidth=	[];
1304
experiment.maxLogisticK=2;
1305
experiment.numPossLogisticK=100;
1307
experiment.maxLogisticK=[];
1308
experiment.numPossLogisticK=[];
1306 1309
experiment.possLogSlopes=	[];
1307 1310
experiment.meanSearchStep=	[];
1308 1311
experiment.psyFunSlope=	[];
......
1311 1314
experiment.buttonBoxType=	'';
1312 1315
experiment.buttonBoxStatus=	'';
1313 1316
experiment.status=	'';
1314
experiment.stop=	0;
1317
experiment.stop=	[];
1315 1318
experiment.pleaseRepeat=	[];
1316 1319
experiment.justInitialized=[];
1317 1320

  
......
1334 1337
betweenRuns.randomizeSequence=[];
1335 1338
betweenRuns.timeNow=	[];
1336 1339
betweenRuns.runNumber=	[];
1337
% betweenRuns.variableCount1=	[];
1338
% betweenRuns.variableCount2=	[];
1339 1340
betweenRuns.thresholds=	[];
1340 1341
betweenRuns.forceThresholds=	[];
1341 1342
betweenRuns.observationCount=	[];
......
1357 1358

  
1358 1359
withinRuns=[];
1359 1360
withinRuns.trialNumber=[];
1360
withinRuns.nowInPhase2=0;
1361
withinRuns.beginningOfPhase2=0;
1361
withinRuns.nowInPhase2=[];
1362
withinRuns.beginningOfPhase2=[];
1362 1363
withinRuns.variableValue=[];
1363 1364
withinRuns.direction='';
1364 1365
withinRuns.peaks=[];
......
1375 1376
withinRuns.caughtOut=[];
1376 1377
withinRuns.catchTrialCount=[];
1377 1378
withinRuns.wrongButton=	[];
1378
withinRuns.babblePlaying=0;
1379
withinRuns.babblePlaying=[];
1379 1380

  
1380 1381
% --- Executes on selection change in popupmenuBackgroundType.
1381 1382
function popupmenuBackgroundType_Callback(hObject, eventdata, handles)
multithreshold 1.46/nextStimulus.m
560 560
duration(3)=precedingSilence+maskerDuration+ terminalSilence;
561 561
globalStimParams.overallDuration=max(duration);
562 562
globalStimParams.nSignalPoints=...
563
    round(globalStimParams.overallDuration/globalStimParams.dt);
563
    round(globalStimParams.overallDuration*globalStimParams.FS);
564 564

  
565 565
%           ----------------------------------------------cue stimulus
566 566
% cue masker
multithreshold 1.46/paradigms/paradigm_GOM.m
16 16
betweenRuns.variableList1=25: 5: 70;
17 17
betweenRuns.variableName2='maskerRelativeFrequency';
18 18
betweenRuns.variableList2=[1 0.5];
19
betweenRuns.randomizeSequence=1; % 'random sequence'
20 19

  
20
experiment.maskerInUse=1;
21 21
stimulusParameters.maskerType='tone';
22 22
stimulusParameters.maskerPhase='sin';
23 23
stimulusParameters.maskerDuration=0.104;
multithreshold 1.46/paradigms/paradigm_IFMC.m
16 16
betweenRuns.variableName2='targetFrequency';
17 17
% keep old list of target frequencies
18 18
betweenRuns.variableList2=str2num(get(handles.edittargetFrequency,'string'));
19
betweenRuns.randomizeSequence=1; % 'random sequence'
20 19

  
20
experiment.maskerInUse=1;
21
stimulusParameters.maskerType='tone';
22
stimulusParameters.maskerPhase='sin';
21 23
stimulusParameters.maskerDuration=0.108;
22 24
stimulusParameters.maskerLevel=stimulusParameters.WRVstartValues(1);
23 25
stimulusParameters.maskerRelativeFrequency=betweenRuns.variableList1;
multithreshold 1.46/paradigms/paradigm_SRT.m
28 28
betweenRuns.variableList1=1000;
29 29
betweenRuns.variableName2='maskerDuration';
30 30
betweenRuns.variableList2=0.1 ;
31
% 1='fixed sequence', 2='randomize within blocks', 3='randomize across
32
% blocks'
33
betweenRuns.randomizeSequence=1; % 'random sequence'
34 31

  
35 32
% delay > masker > gap > target
36

  
37 33
stimulusParameters.stimulusDelay=0.3;
38 34

  
39 35
% maskerTypes={'tone','noise', 'pinkNoise','TEN','whiteNoise'};
40
stimulusParameters.maskerType='tone';
41
stimulusParameters.maskerPhase='sin';
42
stimulusParameters.maskerDuration=0.0;
43
stimulusParameters.maskerLevel= -50;
44
stimulusParameters.maskerRelativeFrequency= 1 ;  % not used
36
experiment.maskerInUse=0;
45 37

  
46 38
stimulusParameters.gapDuration=0.0;
47 39

  
multithreshold 1.46/paradigms/paradigm_TENtest.m
12 12
betweenRuns.variableList1=[250 500 1000 2000 4000 8000 ];
13 13
betweenRuns.variableName2='targetDuration';
14 14
betweenRuns.variableList2= 0.25;
15
betweenRuns.randomizeSequence=1; % 'random sequence'
15

  
16
experiment.maskerInUse=0;
16 17

  
17 18
stimulusParameters.targetType='tone';
18 19
stimulusParameters.targetPhase='sin';
multithreshold 1.46/paradigms/paradigm_TMC.m
17 17
betweenRuns.variableName2='targetFrequency';
18 18
% retain existing targetFrequencies
19 19
betweenRuns.variableList2=str2num(get(handles.edittargetFrequency,'string'));
20
betweenRuns.randomizeSequence=1; % 'random sequence'
21 20

  
21
experiment.maskerInUse=1;
22 22
stimulusParameters.maskerType='tone';
23 23
stimulusParameters.maskerPhase='sin';
24 24
stimulusParameters.maskerDuration=0.108;
multithreshold 1.46/paradigms/paradigm_absThreshold.m
8 8
betweenRuns.variableName2='targetDuration';
9 9
betweenRuns.variableList2= 0.25;
10 10

  
11
experiment.maskerInUse=0;
12

  
11 13
stimulusParameters.targetFrequency=betweenRuns.variableList1;
12 14
stimulusParameters.targetDuration=betweenRuns.variableList2;
13 15
stimulusParameters.targetLevel=stimulusParameters.WRVstartValues(1);
multithreshold 1.46/paradigms/paradigm_absThreshold_16.m
8 8
betweenRuns.variableList1=str2num(get(handles.edittargetFrequency,'string'));
9 9
betweenRuns.variableName2='targetDuration';
10 10
betweenRuns.variableList2=0.016;
11
betweenRuns.randomizeSequence=1; % 'random sequence'
12 11

  
13
% delay > masker > gap > target
14

  
12
experiment.maskerInUse=0;
15 13

  
16 14
stimulusParameters.targetType='tone';
17 15
stimulusParameters.targetPhase='sin';
multithreshold 1.46/paradigms/paradigm_discomfort.m
12 12
betweenRuns.variableList1=[1000];
13 13
betweenRuns.variableName2='targetDuration';
14 14
betweenRuns.variableList2=0.5 ;
15
betweenRuns.randomizeSequence=2; % 'fixed sequence'
15
% 'randomize within blocks', 'fixed sequence', 'randomize across blocks'
16
betweenRuns.randomizeSequence='fixed sequence'; 
16 17

  
17 18
stimulusParameters.stimulusDelay=0;
18 19

  
20
experiment.maskerInUse=0;
21

  
19 22
stimulusParameters.targetType='tone';
20 23
stimulusParameters.targetPhase='sin';
21 24
stimulusParameters.targetFrequency=1000;
multithreshold 1.46/paradigms/paradigm_forwardMasking.m
11 11
betweenRuns.variableName1='gapDuration';
12 12
betweenRuns.variableList1=[.005 0.01 0.02 0.04];
13 13
betweenRuns.variableName2='maskerLevel';
14
betweenRuns.variableList2=[20 40 60 80];
15
betweenRuns.randomizeSequence=1; % 'random sequence'
14
betweenRuns.variableList2=[80 60 40 20];
16 15

  
16
experiment.maskerInUse=1;
17 17
stimulusParameters.maskerType='tone';
18
stimulusParameters.maskerPhase='sin';
18
stimulusParameters.maskerPhase='cos';
19 19
stimulusParameters.maskerDuration=0.108;
20
stimulusParameters.maskerLevel=betweenRuns.variableList2;
20
stimulusParameters.maskerLevel=20;
21 21
stimulusParameters.maskerRelativeFrequency=1;
22 22

  
23 23
stimulusParameters.gapDuration=betweenRuns.variableList1;
multithreshold 1.46/paradigms/paradigm_overShoot.m
1 1
function paradigm_overShoot(handles)
2
global stimulusParameters  betweenRuns
2
global stimulusParameters  betweenRuns experiment
3 3

  
4 4
paradigm_training(handles) % default
5 5

  
......
14 14
% betweenRuns.variableList1=[-.350 -.238 -.213 -.180 -.160 -.100 -.040 -.020 0 .010 .040 .140];
15 15
betweenRuns.variableName2='maskerLevel';
16 16
betweenRuns.variableList2=50;
17
betweenRuns.randomizeSequence=1; % 'random sequence'
18 17

  
19 18
% delay > masker > gap > target
20 19
stimulusParameters.stimulusDelay=0.3;
21 20

  
21
experiment.maskerInUse=1;
22 22
stimulusParameters.maskerType='tone';
23 23
stimulusParameters.maskerPhase='sin';
24 24
stimulusParameters.maskerDuration=0.4;
multithreshold 1.46/paradigms/paradigm_profile.m
7 7
betweenRuns.variableList1=[250 500 1000 2000 4000 8000 ];
8 8
betweenRuns.variableName2='targetDuration';
9 9
betweenRuns.variableList2=0.016;
10
betweenRuns.randomizeSequence=1; % 'random sequence'
11

  
12
% delay > masker > gap > target
13

  
14 10

  
15 11
stimulusParameters.targetType='tone';
16 12
stimulusParameters.targetPhase='sin';
multithreshold 1.46/paradigms/paradigm_psychometric.m
15 15
betweenRuns.variableList1=1000.01:0.01:1000.05;
16 16
betweenRuns.variableName2='targetDuration';
17 17
betweenRuns.variableList2=0.1 ;
18
betweenRuns.randomizeSequence=1; % 'random sequence'
18

  
19
experiment.maskerInUse=0;
19 20

  
20 21
stimulusParameters.targetType='tone';
21 22
stimulusParameters.targetPhase='sin';
multithreshold 1.46/paradigms/paradigm_threshold_duration.m
12 12
betweenRuns.variableList1=[ .016 .032 .064 .128 .256 .512];
13 13
betweenRuns.variableName2='targetFrequency';
14 14
betweenRuns.variableList2=1000;
15
betweenRuns.randomizeSequence=1; % 'random sequence'
15

  
16
experiment.maskerInUse=0;
16 17

  
17 18
stimulusParameters.targetType='tone';
18 19
stimulusParameters.targetPhase='sin';
multithreshold 1.46/paradigms/paradigm_training.m
30 30
betweenRuns.variableList1=1000;
31 31
betweenRuns.variableName2='targetDuration';
32 32
betweenRuns.variableList2=0.1 ;
33
% 1='fixed sequence', 2='randomize within blocks', 3='randomize across
34
% blocks'
35
betweenRuns.randomizeSequence=1; % 'random sequence'
33
% 'randomize within blocks', 'fixed sequence', 'randomize across blocks'
34
betweenRuns.randomizeSequence='randomize within blocks'; 
36 35

  
37 36
% delay > masker > gap > target
38 37

  
39 38
stimulusParameters.stimulusDelay=0.3;
40 39

  
41 40
% maskerTypes={'tone','noise', 'pinkNoise','TEN','whiteNoise'};
41
experiment.maskerInUse=0;
42 42
stimulusParameters.maskerType='tone';
43
stimulusParameters.maskerPhase='sin';
43
stimulusParameters.maskerPhase='cos';
44 44
stimulusParameters.maskerDuration=0.0;
45 45
stimulusParameters.maskerLevel= -50;
46
stimulusParameters.maskerRelativeFrequency= 1 ;  % not used
46
stimulusParameters.maskerRelativeFrequency= 1 ; 
47 47

  
48 48
stimulusParameters.gapDuration=0.0;
49 49

  
50 50
% targetTypes={'tone','noise', 'pinkNoise','whiteNoise','OHIO'};
51 51
stimulusParameters.targetType='tone';
52
stimulusParameters.targetPhase='sin';
52
stimulusParameters.targetPhase='cos'; %{'sin','cos','alt','rand'}
53 53
stimulusParameters.targetFrequency=1000;
54 54
stimulusParameters.targetDuration=0.1;
55 55
stimulusParameters.targetLevel=stimulusParameters.WRVstartValues(1);
multithreshold 1.46/paradigms/paradigm_trainingIFMC.m
17 17
betweenRuns.variableName2='targetFrequency';
18 18
% keep old list of target frequencies
19 19
betweenRuns.variableList2=str2num(get(handles.edittargetFrequency,'string'));
20
betweenRuns.randomizeSequence=1; % 'random sequence'
21 20

  
21
experiment.maskerInUse=1;
22 22
stimulusParameters.maskerType='tone';
23 23
stimulusParameters.maskerPhase='sin';
24 24
stimulusParameters.maskerDuration=0.108;
multithreshold 1.46/subjGUI_MT.m
200 200
% Create two sequence vectors to represent the sequence of var1 and var2
201 201
% values. 'var1' changes most rapidly.
202 202
switch betweenRuns.randomizeSequence
203
    % {'randomize within blocks', 'fixed sequence',...
204
    %  'randomize across blocks'}
203 205
    case 'fixed sequence'
204 206
        var1Sequence=repmat(betweenRuns.variableList1, 1,nVar2);
205 207
        var2Sequence=reshape(repmat(betweenRuns.variableList2, ...
parameterStore/MAPparamsNormalIC.m
1
function method=MAPparamsNormalIC ...
2
    (BFlist, sampleRate, showParams, paramChanges)
3
% MAPparams<> establishes a complete set of MAP parameters
4
% Parameter file names must be of the form <MAPparams> <name>
5
%
6
% input arguments
7
%  BFlist     (optional) specifies the desired list of channel BFs
8
%    otherwise defaults set below
9
%  sampleRate (optional), default is 50000.
10
%  showParams (optional) =1 prints out the complete set of parameters
11
% output argument
12
%  method passes a miscelleny of values
13

  
14
global inputStimulusParams OMEParams DRNLParams IHC_cilia_RPParams
15
global IHC_VResp_VivoParams IHCpreSynapseParams  AN_IHCsynapseParams
16
global MacGregorParams MacGregorMultiParams  filteredSACFParams
17
global experiment % used by calls from multiThreshold only
18

  
19

  
20
currentFile=mfilename;                      % i.e. the name of this mfile
21
method.parameterSource=currentFile(10:end); % for the record
22

  
23
efferentDelay=0.010;
24
method.segmentDuration=efferentDelay;
25

  
26
if nargin<3, showParams=0; end
27
if nargin<2, sampleRate=50000; end
28
if nargin<1 || BFlist(1)<0 % if BFlist= -1, set BFlist to default
29
    lowestBF=250; 	highestBF= 8000; 	numChannels=21;
30
    % 21 chs (250-8k)includes BFs at 250 500 1000 2000 4000 8000
31
    BFlist=round(logspace(log10(lowestBF),log10(highestBF),numChannels));
32
end
33
% BFlist=1000;
34

  
35
% preserve for backward campatibility
36
method.nonlinCF=BFlist; 
37
method.dt=1/sampleRate; 
38

  
39
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
40
% set  model parameters
41
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
42

  
43
%%  #1 inputStimulus
44
inputStimulusParams=[];
45
inputStimulusParams.sampleRate= sampleRate; 
46

  
47
%%  #2 outerMiddleEar
48
OMEParams=[];  % clear the structure first
49
% outer ear resonances band pass filter  [gain lp order  hp]
50
OMEParams.externalResonanceFilters=      [ 10 1 1000 4000];
51
                                       
52
% highpass stapes filter  
53
%  Huber gives 2e-9 m at 80 dB and 1 kHz (2e-13 at 0 dB SPL)
54
OMEParams.OMEstapesLPcutoff= 1000;
55
OMEParams.stapesScalar=	     45e-9;
56

  
57
% Acoustic reflex: maximum attenuation should be around 25 dB Price (1966)
58
% i.e. a minimum ratio of 0.056.
59
% 'spikes' model: AR based on brainstem spiking activity (LSR)
60
OMEParams.rateToAttenuationFactor=0.006;   % * N(all ICspikes)
61
% OMEParams.rateToAttenuationFactor=0;   % * N(all ICspikes)
62

  
63
% 'probability model': Ar based on AN firing probabilities (LSR)
64
OMEParams.rateToAttenuationFactorProb=0.01;% * N(all ANrates)
65
% OMEParams.rateToAttenuationFactorProb=0;% * N(all ANrates)
66

  
67
% asymptote should be around 100-200 ms
68
OMEParams.ARtau=.05; % AR smoothing function
69
% delay must be longer than the segment length
70
OMEParams.ARdelay=efferentDelay;  %Moss gives 8.5 ms latency
71
OMEParams.ARrateThreshold=0;
72

  
73
%%  #3 DRNL
74
DRNLParams=[];  % clear the structure first
75
DRNLParams.BFlist=BFlist;
76

  
77
% DRNL nonlinear path
78
DRNLParams.a=5e4;     % DRNL.a=0 means no OHCs (no nonlinear path)
79
DRNLParams.a=2e4;     % DRNL.a=0 means no OHCs (no nonlinear path)
80

  
81
DRNLParams.b=8e-6;    % *compression threshold raised compression
82
% DRNLParams.b=1;    % b=1 means no compression
83

  
84
DRNLParams.c=0.2;     % compression exponent
85
% nonlinear filters
86
DRNLParams.nonlinCFs=BFlist;
87
DRNLParams.nonlinOrder=	3;           % order of nonlinear gammatone filters
88
p=0.2895;   q=170;  % human  (% p=0.14;   q=366;  % cat)
89
DRNLParams.nlBWs=  p * BFlist + q;
90
DRNLParams.p=p;   DRNLParams.q=q;   % save p and q for printing only
91

  
92
% DRNL linear path:
93
DRNLParams.g=100;     % linear path gain factor
94
% linCF is not necessarily the same as nonlinCF
95
minLinCF=153.13; coeffLinCF=0.7341;   % linCF>nonlinBF for BF < 1 kHz
96
DRNLParams.linCFs=minLinCF+coeffLinCF*BFlist;
97
DRNLParams.linOrder=	3;           % order of linear gammatone filters
98
minLinBW=100; coeffLinBW=0.6531;
99
DRNLParams.linBWs=minLinBW + coeffLinBW*BFlist; % bandwidths of linear  filters
100

  
101
% DRNL MOC efferents
102
DRNLParams.MOCdelay = efferentDelay;            % must be < segment length!
103

  
104
% 'spikes' model: MOC based on brainstem spiking activity (HSR)
105
DRNLParams.rateToAttenuationFactor = .01;  % strength of MOC
106
%      DRNLParams.rateToAttenuationFactor = 0;  % strength of MOC
107
% 'probability' model: MOC based on AN spiking activity (HSR)
108
DRNLParams.rateToAttenuationFactorProb = .0055;  % strength of MOC
109
% DRNLParams.rateToAttenuationFactorProb = .0;  % strength of MOC
110
DRNLParams.MOCrateThresholdProb =70;                % spikes/s probability only
111

  
112
DRNLParams.MOCtau =.1;                         % smoothing for MOC
113

  
114

  
115
%% #4 IHC_cilia_RPParams
116

  
117
IHC_cilia_RPParams.tc=	0.0003;   % 0.0003 filter time simulates viscocity
118
% IHC_cilia_RPParams.tc=	0.0005;   % 0.0003 filter time simulates viscocity
119
IHC_cilia_RPParams.C=	0.03;      % 0.1 scalar (C_cilia ) 
120
IHC_cilia_RPParams.u0=	5e-9;       
121
IHC_cilia_RPParams.s0=	30e-9;
122
IHC_cilia_RPParams.u1=	1e-9;
123
IHC_cilia_RPParams.s1=	1e-9;
124

  
125
IHC_cilia_RPParams.Gmax= 6e-9;    % 2.5e-9 maximum conductance (Siemens)
126
IHC_cilia_RPParams.Ga=	1e-9;  % 4.3e-9 fixed apical membrane conductance
127
IHC_cilia_RPParams.Ga=	.8e-9;  % 4.3e-9 fixed apical membrane conductance
128

  
129
%  #5 IHC_RP
130
IHC_cilia_RPParams.Cab=	4e-012;         % IHC capacitance (F)
131
% IHC_cilia_RPParams.Cab=	1e-012;         % IHC capacitance (F)
132
IHC_cilia_RPParams.Et=	0.100;          % endocochlear potential (V)
133

  
134
IHC_cilia_RPParams.Gk=	2e-008;         % 1e-8 potassium conductance (S)
135
IHC_cilia_RPParams.Ek=	-0.08;          % -0.084 K equilibrium potential
136
IHC_cilia_RPParams.Rpc=	0.04;           % combined resistances
137

  
138

  
139
%%  #5 IHCpreSynapse
140
IHCpreSynapseParams=[];
141
IHCpreSynapseParams.GmaxCa=	14e-9;% maximum calcium conductance
142
IHCpreSynapseParams.GmaxCa=	12e-9;% maximum calcium conductance
143
IHCpreSynapseParams.ECa=	0.066;  % calcium equilibrium potential
144
IHCpreSynapseParams.beta=	400;	% determine Ca channel opening
145
IHCpreSynapseParams.gamma=	100;	% determine Ca channel opening
146
IHCpreSynapseParams.tauM=	0.00005;	% membrane time constant ?0.1ms
147
IHCpreSynapseParams.power=	3;
148
% reminder: changing z has a strong effect on HF thresholds (like Et)
149
IHCpreSynapseParams.z=	    2e42;   % scalar Ca -> vesicle release rate
150

  
151
LSRtauCa=35e-6;            HSRtauCa=85e-6;            % seconds
152
% LSRtauCa=35e-6;            HSRtauCa=70e-6;            % seconds
153
IHCpreSynapseParams.tauCa= [ HSRtauCa]; %LSR and HSR fiber
154

  
155
%%  #6 AN_IHCsynapse
156
% c=kym/(y(l+r)+kl)	(spontaneous rate)
157
% c=(approx)  ym/l  (saturated rate)
158
AN_IHCsynapseParams=[];             % clear the structure first
159
AN_IHCsynapseParams.M=	12;         % maximum vesicles at synapse
160
AN_IHCsynapseParams.y=	4;          % depleted vesicle replacement rate
161
AN_IHCsynapseParams.y=	6;          % depleted vesicle replacement rate
162

  
163
AN_IHCsynapseParams.x=	30;         % replenishment from re-uptake store
164
AN_IHCsynapseParams.x=	60;         % replenishment from re-uptake store
165

  
166
% reduce l to increase saturated rate
167
AN_IHCsynapseParams.l=	100; % *loss rate of vesicles from the cleft
168
AN_IHCsynapseParams.l=	250; % *loss rate of vesicles from the cleft
169

  
170
AN_IHCsynapseParams.r=	500; % *reuptake rate from cleft into cell
171
% AN_IHCsynapseParams.r=	300; % *reuptake rate from cleft into cell
172

  
173
AN_IHCsynapseParams.refractory_period=	0.00075;
174
% number of AN fibers at each BF (used only for spike generation)
175
AN_IHCsynapseParams.numFibers=	100; 
176
AN_IHCsynapseParams.TWdelay=0.004;  % ?delay before stimulus first spike
177

  
178
AN_IHCsynapseParams.ANspeedUpFactor=5; % longer epochs for computing spikes.
179

  
180
%%  #7 MacGregorMulti (first order brainstem neurons)
181
MacGregorMultiParams=[];
182
MacGregorMultiType='chopper'; % MacGregorMultiType='primary-like'; %choose
183
switch MacGregorMultiType
184
    case 'primary-like'
185
        MacGregorMultiParams.nNeuronsPerBF=	10;   % N neurons per BF
186
        MacGregorMultiParams.type = 'primary-like cell';
187
        MacGregorMultiParams.fibersPerNeuron=4;   % N input fibers
188
        MacGregorMultiParams.dendriteLPfreq=200;  % dendritic filter
189
        MacGregorMultiParams.currentPerSpike=0.11e-6; % (A) per spike
190
        MacGregorMultiParams.Cap=4.55e-9;   % cell capacitance (Siemens)
191
        MacGregorMultiParams.tauM=5e-4;     % membrane time constant (s)
192
        MacGregorMultiParams.Ek=-0.01;      % K+ eq. potential (V)
193
        MacGregorMultiParams.dGkSpike=3.64e-5; % K+ cond.shift on spike,S
194
        MacGregorMultiParams.tauGk=	0.0012; % K+ conductance tau (s)
195
        MacGregorMultiParams.Th0=	0.01;   % equilibrium threshold (V)
196
        MacGregorMultiParams.c=	0.01;       % threshold shift on spike, (V)
197
        MacGregorMultiParams.tauTh=	0.015;  % variable threshold tau
198
        MacGregorMultiParams.Er=-0.06;      % resting potential (V)
199
        MacGregorMultiParams.Eb=0.06;       % spike height (V)
200

  
201
    case 'chopper'
202
        MacGregorMultiParams.nNeuronsPerBF=	10;   % N neurons per BF
203
        MacGregorMultiParams.type = 'chopper cell';
204
        MacGregorMultiParams.fibersPerNeuron=10;  % N input fibers
205
%         MacGregorMultiParams.fibersPerNeuron=6;  % N input fibers
206

  
207
        MacGregorMultiParams.dendriteLPfreq=50;   % dendritic filter
208
        MacGregorMultiParams.currentPerSpike=35e-9; % *per spike
209
%         MacGregorMultiParams.currentPerSpike=30e-9; % *per spike
210
        
211
        MacGregorMultiParams.Cap=1.67e-8; % ??cell capacitance (Siemens)
212
        MacGregorMultiParams.tauM=0.002;  % membrane time constant (s)
213
        MacGregorMultiParams.Ek=-0.01;    % K+ eq. potential (V)
214
        MacGregorMultiParams.dGkSpike=1.33e-4; % K+ cond.shift on spike,S
215
        MacGregorMultiParams.tauGk=	[0.001 0.0005];% K+ conductance tau (s)
216
        MacGregorMultiParams.Th0=	0.01; % equilibrium threshold (V)
217
        MacGregorMultiParams.c=	0;        % threshold shift on spike, (V)
218
        MacGregorMultiParams.tauTh=	0.02; % variable threshold tau
219
        MacGregorMultiParams.Er=-0.06;    % resting potential (V)
220
        MacGregorMultiParams.Eb=0.06;     % spike height (V)
221
        MacGregorMultiParams.PSTHbinWidth=	1e-4;
222
end
223

  
224
%%  #8 MacGregor (second-order neuron). Only one per channel
225
MacGregorParams=[];                 % clear the structure first
226
MacGregorParams.type = 'chopper cell';
227
MacGregorParams.fibersPerNeuron=10; % N input fibers
228
MacGregorParams.dendriteLPfreq=100; % dendritic filter
229
MacGregorParams.currentPerSpike=120e-9;% *(A) per spike
230
MacGregorParams.currentPerSpike=40e-9;% *(A) per spike
231

  
232
MacGregorParams.Cap=16.7e-9;        % cell capacitance (Siemens)
233
MacGregorParams.tauM=0.002;         % membrane time constant (s)
234
MacGregorParams.Ek=-0.01;           % K+ eq. potential (V)
235
MacGregorParams.dGkSpike=1.33e-4;   % K+ cond.shift on spike,S
236
MacGregorParams.tauGk=	0.0005;     % K+ conductance tau (s)
237
MacGregorParams.Th0=	0.01;       % equilibrium threshold (V)
238
MacGregorParams.c=	0;              % threshold shift on spike, (V)
239
MacGregorParams.tauTh=	0.02;       % variable threshold tau
240
MacGregorParams.Er=-0.06;           % resting potential (V)
241
MacGregorParams.Eb=0.06;            % spike height (V)
242
MacGregorParams.debugging=0;        % (special)
243
% wideband accepts input from all channels (of same fiber type)
244
% use wideband to create inhibitory units
245
MacGregorParams.wideband=0;         % special for wideband units
246
% MacGregorParams.saveAllData=0;
247

  
248
%%  #9 filteredSACF
249
minPitch=	300; maxPitch=	3000; numPitches=60;    % specify lags
250
pitches=100*log10(logspace(minPitch/100, maxPitch/100, numPitches));
251
filteredSACFParams.lags=1./pitches;     % autocorrelation lags vector
252
filteredSACFParams.acfTau=	.003;       % time constant of running ACF
253
filteredSACFParams.lambda=	0.12;       % slower filter to smooth ACF
254
filteredSACFParams.plotFilteredSACF=1;  % 0 plots unfiltered ACFs
255
filteredSACFParams.plotACFs=0;          % special plot (see code)
256
%  filteredSACFParams.usePressnitzer=0; % attenuates ACF at  long lags
257
filteredSACFParams.lagsProcedure=  'useAllLags';
258
% filteredSACFParams.lagsProcedure=  'useBernsteinLagWeights';
259
% filteredSACFParams.lagsProcedure=  'omitShortLags';
260
filteredSACFParams.criterionForOmittingLags=3;
261

  
262
% checks
263
if AN_IHCsynapseParams.numFibers<MacGregorMultiParams.fibersPerNeuron
264
    error('MacGregorMulti: too few input fibers for input to MacG unit')
265
end
266

  
267

  
268
%% now accept last minute parameter changes required by the calling program
269
% paramChanges
270
if nargin>3 && ~isempty(paramChanges)
271
    nChanges=length(paramChanges);
272
    for idx=1:nChanges
273
        eval(paramChanges{idx})
274
    end
275
end
276

  
277

  
278
%% write all parameters to the command window
279
% showParams is currently set at the top of htis function
280
if showParams
281
    fprintf('\n %%%%%%%%\n')
282
    fprintf('\n%s\n', method.parameterSource)
283
    fprintf('\n')
284
    nm=UTIL_paramsList(whos);
285
    for i=1:length(nm)
286
        %         eval(['UTIL_showStruct(' nm{i} ', ''' nm{i} ''')'])
287
        if ~strcmp(nm(i), 'method')
288
            eval(['UTIL_showStructureSummary(' nm{i} ', ''' nm{i} ''', 10)'])
289
        end
290
    end
291

  
292
    % highlight parameter changes made locally
293
    if nargin>3 && ~isempty(paramChanges)
294
        fprintf('\n Local parameter changes:\n')
295
        for i=1:length(paramChanges)
296
            disp(paramChanges{i})
297
        end
298
    end
299
end
300

  
301
% for backward compatibility
302
experiment.comparisonData=[];
testPrograms/test_MAP1_14x.m
1
function test_MAP1_14x
2
% 'x' is a trial file
3
% test_MAP1_14 is a general purpose test routine that can be adjusted to
4
% test a number of different applications of MAP1_14
5
%
6
% A range of options are supplied in the early part of the program
7
%
8
% One use of the function is to create demonstrations; filenames <demoxx>
9
%  to illustrate particular features
10
%
11
% #1
12
% Identify the file (in 'MAPparamsName') containing the model parameters
13
%
14
% #2
15
% Identify the kind of model required (in 'AN_spikesOrProbability').
16
%  A full brainstem model (spikes) can be computed or a shorter model
17
%  (probability) that computes only so far as the auditory nerve
18
%
19
% #3
20
% Choose between a tone signal or file input (in 'signalType')
21
%
22
% #4
23
% Set the signal rms level (in leveldBSPL)
24
%
25
% #5
26
% Identify the channels in terms of their best frequencies in the vector
27
%  BFlist.
28
%
29
% Last minute changes to the parameters fetched earlier can be made using
30
%  the cell array of strings 'paramChanges'.
31
%  Each string must have the same format as the corresponding line in the
32
%  file identified in 'MAPparamsName'
33
%
34
% When the demonstration is satisfactory, freeze it by renaming it <demoxx>
35

  
36
dbstop if error
37
restorePath=path;
38
addpath (['..' filesep 'MAP'],    ['..' filesep 'wavFileStore'], ...
39
    ['..' filesep 'utilities'])
40

  
41
%%  #1 parameter file name
42
MAPparamsName='NormalIC';
43

  
44

  
45
%% #2 probability (fast) or spikes (slow) representation
46
AN_spikesOrProbability='spikes';
47

  
48
% or
49
% NB probabilities are not corrected for refractory effects
50
% AN_spikesOrProbability='probability';
51

  
52

  
53
%% #3 pure tone, harmonic sequence or speech file input
54
signalType= 'tones';
55
sampleRate= 50000;
56
duration=0.250;                 % seconds
57
toneFrequency= 250:250:8000;    % harmonic sequence (Hz)
58
% toneFrequency= 1000;            % or a pure tone (Hz8
59
rampDuration=.005;              % seconds
60

  
61
% or
62

  
63
% signalType= 'file';
64
% fileName='twister_44kHz';
65

  
66

  
67
%% #4 rms level
68
% signal details
69
leveldBSPL= 30;                  % dB SPL
70

  
71

  
72
%% #5 number of channels in the model
73
%   21-channel model (log spacing)
74
numChannels=21;
75
lowestBF=250; 	highestBF= 8000;
76
BFlist=round(logspace(log10(lowestBF), log10(highestBF), numChannels));
77

  
78
%   or specify your own channel BFs
79
% numChannels=1;
80
% BFlist=toneFrequency;
81

  
82

  
83
%% #6 change model parameters
84
paramChanges=[];
85

  
86
% or
87
% Parameter changes can be used to change one or more model parameters
88
%  *after* the MAPparams file has been read
89
% This example declares only one fiber type with a calcium clearance time
90
% constant of 80e-6 s (HSR fiber) when the probability option is selected.
91

  
92
% paramChanges={'AN_IHCsynapseParams.ANspeedUpFactor=5;', ...
93
%     'IHCpreSynapseParams.tauCa=86e-6;'};
94

  
95
% paramChanges={'DRNLParams.rateToAttenuationFactorProb = 0;'};
96

  
97
% paramChanges={'IHCpreSynapseParams.tauCa=86e-6;',
98
%     'AN_IHCsynapseParams.numFibers=	1000;'};
99

  
100
% fixed MOC attenuation(using negative factor)
101
paramChanges={'DRNLParams.rateToAttenuationFactorProb=-0.005;'};
102

  
103
%% delare 'showMap' options to control graphical output
104

  
105
showMapOptions.printModelParameters=1;   % prints all parameters
106
showMapOptions.showModelOutput=1;       % plot of all stages
107
showMapOptions.printFiringRates=1;      % prints stage activity levels
108
showMapOptions.showACF=0;               % shows SACF (probability only)
109
showMapOptions.showEfferent=1;          % tracks of AR and MOC
110
showMapOptions.surfProbability=1;       % 2D plot of HSR response 
111
showMapOptions.surfSpikes=1;            % 2D plot of spikes histogram
112

  
113
% disable certain silly options
114
if strcmp(AN_spikesOrProbability, 'spikes')
115
    % avoid nonsensical options
116
    showMapOptions.surfProbability=0;
117
    showMapOptions.showACF=0;
118
else
119
    showMapOptions.surfSpikes=0;
120
end
121
if strcmp(signalType, 'file')
122
    % needed for labeling plot
123
    showMapOptions.fileName=fileName;
124
else
125
    showMapOptions.fileName=[];
126
end
127

  
128
%% Generate stimuli
129

  
130
switch signalType
131
    case 'tones'
132
        inputSignal=createMultiTone(sampleRate, toneFrequency, ...
133
            leveldBSPL, duration, rampDuration);
134

  
135
    case 'file'
136
        %% file input simple or mixed
137
        [inputSignal sampleRate]=wavread(fileName);
138
        dt=1/sampleRate;
139
        inputSignal=inputSignal(:,1);
140
        targetRMS=20e-6*10^(leveldBSPL/20);
141
        rms=(mean(inputSignal.^2))^0.5;
142
        amp=targetRMS/rms;
143
        inputSignal=inputSignal*amp;
144
        silence= zeros(1,round(0.1/dt));
145
        inputSignal= [silence inputSignal' silence];
146
end
147

  
148

  
149
%% run the model
150
tic
151

  
152
fprintf('\n')
153
disp(['Signal duration= ' num2str(length(inputSignal)/sampleRate)])
154
disp([num2str(numChannels) ' channel model'])
155
disp('Computing ...')
156

  
157
MAP1_14(inputSignal, sampleRate, BFlist, ...
158
    MAPparamsName, AN_spikesOrProbability, paramChanges);
159

  
160

  
161
% the model run is now complete. Now display the results
162
UTIL_showMAP(showMapOptions, paramChanges)
163

  
164
toc
165
path(restorePath)
166

  
167

  
168
function inputSignal=createMultiTone(sampleRate, toneFrequency, ...
169
    leveldBSPL, duration, rampDuration)
170
% Create pure tone stimulus
171
dt=1/sampleRate; % seconds
172
time=dt: dt: duration;
173
inputSignal=sum(sin(2*pi*toneFrequency'*time), 1);
174
amp=10^(leveldBSPL/20)*28e-6;   % converts to Pascals (peak)
175
inputSignal=amp*inputSignal;
176

  
177
% apply ramps
178
% catch rampTime error
179
if rampDuration>0.5*duration, rampDuration=duration/2; end
180
rampTime=dt:dt:rampDuration;
181
ramp=[0.5*(1+cos(2*pi*rampTime/(2*rampDuration)+pi)) ...
182
    ones(1,length(time)-length(rampTime))];
183
inputSignal=inputSignal.*ramp;
184
ramp=fliplr(ramp);
185
inputSignal=inputSignal.*ramp;
186

  
187
% add 10 ms silence
188
silence= zeros(1,round(0.05/dt));
189
inputSignal= [silence inputSignal silence];
190

  
utilities/stimulusCreate.m
1471 1471

  
1472 1472

  
1473 1473
%--------------------------------------------------------------------checkDescriptors
1474
function [globalStimParams, stimComponents]=checkDescriptors(globalStimParams, stimComponents);
1474
function [globalStimParams, stimComponents]=...
1475
    checkDescriptors(globalStimParams, stimComponents)
1475 1476

  
1476 1477
try
1477 1478
    % if FS exists, it takes priority
......
1481 1482
    globalStimParams.FS=1/globalStimParams.dt;
1482 1483
end
1483 1484

  
1484
globalStimParams.nSignalPoints=round(globalStimParams.overallDuration/globalStimParams.dt);
1485
sampleRate=globalStimParams.FS;
1486

  
1487
globalStimParams.nSignalPoints=...
1488
    round(globalStimParams.overallDuration* sampleRate);
1485 1489

  
1486 1490
% optional field (ears)
1487 1491
try
......
1514 1518
    globalStimParams.doPlot=0;
1515 1519
end
1516 1520

  
1517

  
1518

  
1519 1521
[ears nComponentSounds]=size(stimComponents);
1520 1522

  
1521 1523
for ear=1:2 % 1=left/ 2=right
......
1567 1569

  
1568 1570
        % end silence is measured to fit into the global duration
1569 1571
        if stimComponents(ear,componentNo).endSilence==-1,
1570
            endSilenceNpoints=...
1571
                globalStimParams.nSignalPoints ...
1572
                -round(stimComponents(ear,componentNo).beginSilence*globalStimParams.FS)...
1573
                -round(stimComponents(ear,componentNo).toneDuration*globalStimParams.FS);
1574
            stimComponents(ear,componentNo).endSilence=endSilenceNpoints/globalStimParams.FS;
1575
            % if endSilence < 0, we have a problem
1576
            if stimComponents(ear,componentNo).endSilence<0
1577
                globalStimParams
1578
                descriptorError( 'component durations greater than overallDuration', stimComponents, ear, componentNo)
1579
            end
1572
            stimComponents(ear,componentNo).endSilence=...
1573
                globalStimParams.overallDuration-...
1574
                stimComponents(ear,componentNo).beginSilence -...
1575
                stimComponents(ear,componentNo).toneDuration;
1576
            
1577
            endSilenceNpoints=stimComponents(ear,componentNo).endSilence...
1578
                *sampleRate;
1579
        end
1580
        if stimComponents(ear,componentNo).endSilence<0
1581
            globalStimParams
1582
            descriptorError( 'component durations greater than overallDuration', stimComponents, ear, componentNo)
1580 1583
        end
1581 1584

  
1582 1585
        % check overall duration of this component against global duration
......
1590 1593
            globalStimParams.overallDuration= totalDuration;
1591 1594
        end
1592 1595

  
1593

  
1594
        if round(totalDuration*globalStimParams.FS)>round(globalStimParams.overallDuration*globalStimParams.FS)
1595
            globalStimParams
1596
            descriptorError( 'Component durations greater than overallDuration', stimComponents, ear, componentNo)
1597
        end
1598

  
1599 1596
        % check total duration
1600
        totalSignalPoints= round((stimComponents(ear,componentNo).beginSilence+ stimComponents(ear,componentNo).toneDuration+...
1601
            stimComponents(ear,componentNo).endSilence)/globalStimParams.dt);
1597
        totalSignalPoints= round(totalDuration* sampleRate);
1602 1598
        if totalSignalPoints  >globalStimParams.nSignalPoints
1603 1599
            descriptorError( 'Signal component duration does not match overall duration ', stimComponents, ear, componentNo)
1604 1600
        end
1605 1601

  
1606
        % no ramps for clicks please!
1607
        %         if strcmp(stimComponents(ear,componentNo).type, 'clicks') & stimComponents(ear,componentNo).clickRepeatFrequency==-1
1608
        %         if strcmp(stimComponents(ear,componentNo).type, 'clicks')
1609
        %             stimComponents(ear,componentNo).rampOnDur=0;
1610
        %             stimComponents(ear,componentNo).rampOffDur=0;
1611
        %         end
1612

  
1613 1602
        if isfield(stimComponents(ear,componentNo), 'filter')
1614 1603
            if ~isequal(length(stimComponents(ear,componentNo).filter), 3)
1615 1604
                descriptorError( 'Filter parameter must have three elements ', stimComponents, ear, componentNo)

Also available in: Unified diff