Revision 29:b51bf546ca3f

View differences:

multithreshold 1.46/expGUI_MT.m
1 1
% expGUI_MT = 'experimenter GUI for multiThreshold
2 2
% allows the experimenter to design experiments.
3 3
% The *running* of experiments is left to subjGUI.m
4
% 
4
%
5 5
% There are three kinds of experiments known as 'earOptions':
6
% 1. Measurements using real listeners 
6
% 1. Measurements using real listeners
7 7
%  'left', 'right',  'diotic', 'dichoticLeft', 'dichoticRight'
8 8
% 2. Measurements using the MAP model as the subject
9 9
%   'MAPmodelListen',  'MAPmodelMultiCh', 'MAPmodelSingleCh'
......
88 88
setLocationOfGUIs(handles)
89 89

  
90 90
function setLocationOfGUIs(handles)
91
global checkForPreviousGUI  % holds screen positioning across repeated calls 
91
global checkForPreviousGUI  % holds screen positioning across repeated calls
92 92
scrnsize=get(0,'screensize');
93 93
checkForPreviousGUI=[];
94 94
% if isstruct(checkForPreviousGUI)...
......
140 140
% addpath (['..' filesep 'modules'], ['..' filesep 'utilities'], ...
141 141
%     ['..' filesep 'parameterStore'],  ['..' filesep 'wavFileStore'],...
142 142
%     ['..' filesep 'testPrograms'])
143
addpath (['..' filesep 'testPrograms'])
143 144

  
144 145
% specify all variables that  need to be set on the GUI
145 146
variableNames={'stimulusDelay','maskerDuration','maskerLevel',...
......
314 315
paradigm=paradigmNames{chosenOption};
315 316
experiment.paradigm=paradigm;
316 317

  
317
        %Paradigm: read in all relevant parameters
318
%Paradigm: read in all relevant parameters
318 319
% a file must exist with this name 'paradigm_<paradigm>'
319 320
% 'handles' are only occasionally used
320 321
addpath ('paradigms')
......
347 348
eval (cmd);
348 349

  
349 350
% establish popup menus on the basis of the paradigm file
350
set(handles.popupmenuRandomize,'value', betweenRuns.randomizeSequence)	
351
set(handles.popupmenuRandomize,'value', betweenRuns.randomizeSequence)
351 352
set(handles.popupmenuPhase,'string', stimulusParameters.maskerPhase)
352 353
if stimulusParameters.includeCue
353 354
    set(handles.popupmenuCueNoCue,'value', 1)
......
383 384

  
384 385
% ------------------------------------------------------ aResetPopupMenus
385 386
function aResetPopupMenus(handles)
386
global   stimulusParameters betweenRuns variableNames 
387
global   stimulusParameters betweenRuns variableNames
387 388
global targetTypes maskerTypes experiment backgroundTypes
388 389

  
389 390
switch experiment.threshEstMethod
390 391
    case {'MaxLikelihood','oneIntervalUpDown'}
391 392
        set(handles.editstopCriteriaBox, 'string', ...
392 393
            num2str(experiment.singleIntervalMaxTrials))
393
        
394

  
394 395
    case {'2I2AFC++','2I2AFC+++'}
395 396
        set(handles.editstopCriteriaBox, 'string', ...
396 397
            num2str(experiment.stopCriteria2IFC))
......
410 411
for i=1:length(variableNames)
411 412
    if strcmp(variableNames{i},betweenRuns.variableName1)
412 413
        variableParameter1ID=i;
413
    end   
414
    end
414 415
    if strcmp(variableNames{i},betweenRuns.variableName2)
415 416
        variableParameter2ID=i;
416 417
    end
......
453 454
        set(handles.editStatsModel, 'visible', 'on')
454 455
        set(handles.textStatsModel, 'visible', 'on')
455 456
        set(handles.pushbuttonStop, 'visible', 'on')
456
showModelPushButtons(handles, 0)
457
        showModelPushButtons(handles, 0)
457 458
        set(handles.editCatchTrialRate, 'visible', 'off')
458 459
        set(handles.textCatchTrials, 'visible', 'off')
459 460
        set(handles.editcalibrationdB, 'visible', 'off')
......
462 463
        set(handles.textCue, 'visible', 'off')
463 464
        set(handles.editMusicLevel,'visible', 'off')
464 465
        set(handles.textMusicLevel,'visible', 'off')
465
        
466

  
466 467
    case {'MAPmodel',  'MAPmodelListen', 'MAPmodelMultiCh', 'MAPmodelSingleCh'}
467 468
        set(handles.popupmenuCueNoCue, 'visible', 'off')
468 469
        set(handles.editStatsModel, 'visible', 'off')
469 470
        set(handles.textStatsModel, 'visible', 'off')
470 471
        set(handles.pushbuttonStop, 'visible', 'on')
471
showModelPushButtons(handles, 1)
472
        showModelPushButtons(handles, 1)
472 473
        set(handles.editcalibrationdB, 'visible', 'off')
473 474
        set(handles.textcalibration, 'visible', 'off')
474 475
        set(handles.textCue, 'visible', 'off')
475 476
        set(handles.editMusicLevel,'visible', 'off')
476 477
        set(handles.textMusicLevel,'visible', 'off')
477
        
478

  
478 479
    otherwise
479 480
        % i.e. using real subjects (left, right, diotic, dichotic)
480 481
        set(handles.editStatsModel, 'visible', 'off')
481 482
        set(handles.textStatsModel, 'visible', 'off')
482 483
        set(handles.pushbuttonStop, 'visible', 'off')
483
showModelPushButtons(handles, 0)
484
        showModelPushButtons(handles, 0)
484 485
        set(handles.editCatchTrialRate, 'visible', 'on')
485 486
        set(handles.textCatchTrials, 'visible', 'on')
486 487
        set(handles.editcalibrationdB, 'visible', 'on')
......
497 498
        set(handles.textCue,'visible', 'on')
498 499
        set(handles.editstopCriteriaBox, 'string', ...
499 500
            num2str(experiment.singleIntervalMaxTrials))
500
        
501

  
501 502
        if stimulusParameters.includeCue==0
502 503
            set(handles.editcueTestDifference,'visible', 'off')
503 504
            set(handles.textcueTestDifference,'visible', 'off')
......
505 506
            set(handles.editcueTestDifference,'visible', 'on')
506 507
            set(handles.textcueTestDifference,'visible', 'on')
507 508
        end
508
        
509

  
509 510
    case {'2I2AFC++','2I2AFC+++'}
510 511
        set(handles.editCatchTrialRate, 'visible', 'off')
511 512
        set(handles.textCatchTrials, 'visible', 'off')
......
609 610

  
610 611
% ------------------------------------------------ pushbuttonRun_Callback
611 612
function pushbuttonRun_Callback(hObject, eventdata, handles)
612
global checkForPreviousGUI % holds screen positioning across repeated calls 
613
global checkForPreviousGUI % holds screen positioning across repeated calls
613 614
global experiment betweenRuns paradigmNames errormsg
614 615
checkForPreviousGUI.GUIposition=get(handles.figure1,'position');
615 616
experiment.singleShot=0;
......
621 622
        set(handles.edittargetDuration,'string', num2str(0.25))
622 623
        set(handles.editstopCriteriaBox,'string','10') % nTrials
623 624
        run (handles)
624
        
625
        if ~isempty(errormsg)
625

  
626
        if strcmp(errormsg,'manually stopped')
626 627
            disp(errormsg)
627 628
            optionNo=strmatch('profile',paradigmNames);
628 629
            set(handles.popupmenuParadigm,'value',optionNo);
......
630 631
            aParadigmSelection(handles)
631 632
            return
632 633
        end
633
        
634

  
634 635
        global resultsTable
635 636
        longTone=resultsTable(2:end,2:end);
636
        
637

  
637 638
        set(handles.edittargetDuration,'string', num2str(0.016))
638 639
        set(handles.editstopCriteriaBox,'string','10') % nTrials
639 640
        run (handles)
640
        if ~isempty(errormsg)
641
        if strcmp(errormsg,'manually stopped')
641 642
            disp(errormsg)
642 643
            optionNo=strmatch('profile',paradigmNames);
643 644
            set(handles.popupmenuParadigm,'value',optionNo);
......
646 647
            aParadigmSelection(handles)
647 648
            return
648 649
        end
649
        
650

  
650 651
        shortTone=resultsTable(2:end,2:end);
651 652

  
652 653
        % use these threshold for TMC
......
656 657
        aParadigmSelection(handles)
657 658
        set(handles.edittargetLevel,'string', thresholds16ms+10);
658 659
        set(handles.editstopCriteriaBox,'string','10')  % nTrials
659
        pause(.1) 
660
        pause(.1)
660 661
        run (handles)
661
        
662
        if ~isempty(errormsg)
662

  
663
        if strcmp(errormsg,'manually stopped')
663 664
            disp(errormsg)
664 665
            optionNo=strmatch('profile',paradigmNames);
665 666
            set(handles.popupmenuParadigm,'value',optionNo);
......
672 673
        TMC=resultsTable(2:end,2:end);
673 674
        gaps=resultsTable(2:end,1);
674 675
        BFs=resultsTable(1, 2:end);
675
        
676

  
676 677
        % use these threshold for IFMC
677 678
        optionNo=strmatch('IFMC',paradigmNames);
678 679
        set(handles.popupmenuParadigm,'value',optionNo);
679 680
        aParadigmSelection(handles)
680 681
        set(handles.edittargetLevel,'string', thresholds16ms+10);
681 682
        set(handles.editstopCriteriaBox,'string','10')  % nTrials
682
        pause(.1) 
683
        pause(.1)
683 684
        run (handles)
684 685

  
685
        if ~isempty(errormsg)
686

  
687
        IFMCs=resultsTable(2:end,2:end);
688
        offBFs=resultsTable(2:end,1);
689

  
690
        % reset original paradigm
691
        optionNo=strmatch('profile',paradigmNames);
692
        set(handles.popupmenuParadigm,'value',optionNo);
693
        aParadigmSelection(handles)
694

  
695
        save profile longTone shortTone gaps BFs TMC offBFs IFMCs
696
        plotProfile(longTone,shortTone,gaps,BFs,TMC,offBFs,IFMCs)
697

  
698
        if strcmp(errormsg,'manually stopped')
686 699
            disp(errormsg)
687 700
            optionNo=strmatch('profile',paradigmNames);
688 701
            set(handles.popupmenuParadigm,'value',optionNo);
......
690 703
            experiment.stop=-0;
691 704
            aParadigmSelection(handles)
692 705
            return
693
        end       
694

  
695
        IFMCs=resultsTable(2:end,2:end);
696
        offBFs=resultsTable(2:end,1);
697
        
698
        % reset original paradigm
699
        optionNo=strmatch('profile',paradigmNames);
700
        set(handles.popupmenuParadigm,'value',optionNo);
701
        aParadigmSelection(handles)
702

  
703
        save profile longTone shortTone gaps BFs TMC offBFs IFMCs
704
        plotProfile(longTone,shortTone,gaps,BFs,TMC,offBFs,IFMCs)
705
        
706
        end
706 707
    otherwise
707 708
        run (handles)
708 709
        experiment.stop=0;
......
713 714
tic
714 715
expGUIhandles=handles;
715 716
set(handles.pushbuttonStop, 'backgroundColor', [.941 .941 .941])
716
set(handles.editparamChanges,'visible','off')
717
% set(handles.editparamChanges,'visible','off')
717 718

  
718 719
% message box white (removes any previous error message)
719 720
set(handles.textMSG,...
......
742 743

  
743 744
% --- Executes on button press in pushbuttonSingleShot.
744 745
function pushbuttonSingleShot_Callback(hObject, eventdata, handles)
745
global experiment 
746
global experiment
746 747
experiment.singleShot=1;
747 748

  
748 749
% special test for spontaneous activity
......
764 765
% ------------------------------------------aReadAndCheckParameterBoxes
765 766
function errorMsg=aReadAndCheckParameterBoxes(handles)
766 767
global experiment  stimulusParameters betweenRuns  statsModel
767
global variableNames  LevittControl
768
global variableNames  LevittControl paramChanges
768 769
% When the program sets the parameters all should be well
769 770
% But when the user changes them...
770 771

  
......
780 781

  
781 782
switch experiment.ear
782 783
    case { 'MAPmodel', 'MAPmodelMultiCh', ...
783
            'MAPmodelSingleCh', 'MAPmodelListen'}         
784
        % MAPmodel writes forced parameter settings to the screen 
784
            'MAPmodelSingleCh', 'MAPmodelListen'}
785
        % MAPmodel writes forced parameter settings to the screen
785 786
        %  so that they can be read from there
786 787
        set(handles.popupmenuRandomize,'value',2)       % fixed sequence
787 788
        set(handles.editstimulusDelay,'string','0.01')  % no stimulus delay
......
840 841
end
841 842

  
842 843
% calibration
843
%  this is used to *reduce* the output signal from what it otherwise 
844
%  this is used to *reduce* the output signal from what it otherwise
844 845
%  would be
845 846
% signal values are between 1 - 2^23
846 847
%  these are interpreted as microPascals between -29 dB and 128 dB SPL
847
% calibrationdB adjusts these values to compensate for equipment 
848
% calibrationdB adjusts these values to compensate for equipment
848 849
%  characteristics
849
%  this will change the range. e.g. a 7 dB calibration will yield 
850
%  this will change the range. e.g. a 7 dB calibration will yield
850 851
%   a range of -36 to 121 dB SPL
851 852
% Calibration is not used when modelling. Values are treated as dB SPL
852 853
stimulusParameters.calibrationdB=...
......
946 947
        % start value for step until reduced
947 948
        LevittControl.startLevelStep= stimulusParameters.WRVsteps(1);
948 949
        % reduced step size
949
        LevittControl.steadyLevittStep= stimulusParameters.WRVsteps(2); 
950
        LevittControl.steadyLevittStep= stimulusParameters.WRVsteps(2);
950 951
        LevittControl.TurnsToSmallSteps= 2;
951 952
        LevittControl.useLastNturns= 2*experiment.peaksUsed;
952 953
        LevittControl.minReversals= ...
......
1006 1007

  
1007 1008
% Check WRVstartValues for length and compatibility with randomization
1008 1009
% only one start value supplied so all start values are the same
1009
if length(stimulusParameters.WRVstartValues)==1     
1010
if length(stimulusParameters.WRVstartValues)==1
1010 1011
    stimulusParameters.WRVstartValues= ...
1011 1012
        repmat(stimulusParameters.WRVstartValues, 1, ...
1012 1013
        length(betweenRuns.variableList1)...
......
1051 1052
                stimulusParameters.maskerDuration)
1052 1053
            addToMsg(...
1053 1054
                'Warning: masker and target duration not the same.',1,1)
1054
        end        
1055
        end
1055 1056
        if ~isequal(stimulusParameters.maskerLevel, ...
1056 1057
                stimulusParameters.targetLevel)
1057 1058
            addToMsg(['Warning: masker and target level different.'...
......
1059 1060
        end
1060 1061
end
1061 1062

  
1063
% identify model parameter changes if any
1064
paramChanges=get(handles.editparamChanges,'string');
1065
eval(paramChanges);
1066

  
1062 1067
% -------------------------------------------- aSetSampleRate
1063 1068
function aSetSampleRate(sampleRate, handles)
1064 1069
global  stimulusParameters
......
1106 1111
    case {'statsModelLogistic', 'statsModelRareEvent'}
1107 1112
        set(handles.editStatsModel, 'visible', 'off')
1108 1113
        set(handles.textStatsModel, 'visible', 'off')
1109
        
1114

  
1110 1115
        % default psychometric bin size and logistic slopes
1111 1116
        set(handles.popupmenuRandomize,'value',2)   % fixed sequence
1112 1117
        set(handles.editName,'string', 'statsModel')
1113 1118
        %         experiment.headphonesUsed=0;
1114
        
1119

  
1115 1120
    case {'MAPmodelListen', 'MAPmodelMultiCh', 'MAPmodelSingleCh'}
1116 1121
        stimulusParameters.includeCue=0;						 % no cue
1117 1122
        set(handles.popupmenuCueNoCue,'value', 2)
1118
        
1123

  
1119 1124
        set(handles.editCatchTrialRate,'string','0 0  2 ');%no catch trials
1120 1125
        set(handles.editName,'string', 'Normal')			% force name
1121 1126
        experiment.name=get(handles.editName,'string');	% read name back
1122
        set(handles.editcalibrationdB,'string','0')	
1123
        
1127
        set(handles.editcalibrationdB,'string','0')
1128

  
1124 1129
        set(handles.popupmenuRandomize,'value',2)       % fixed sequence
1125 1130
        set(handles.editstimulusDelay,'string','0')
1126
        
1131

  
1127 1132
        set(handles.editSaveData,'string', '0')
1128 1133
        set(handles.editSubjectFont,'string', '10');
1129 1134
        experiment.MacGThreshold=0; % num MacG spikes to exceed threshold
......
1178 1183
            case 'training'
1179 1184
                experiment.possLogSlopes=0.5;
1180 1185
        end
1181
        
1186

  
1182 1187
    case 'oneIntervalUpDown'
1183 1188
        experiment.functionEstMethod='logisticLS';
1184 1189
        set(handles.textstopCriteria,'string', 'stop criteria \ maxTrials')
......
1189 1194
            otherwise
1190 1195
                experiment.allowCatchTrials= 1;
1191 1196
        end
1192
        
1197

  
1193 1198
    case {'2I2AFC++',  '2I2AFC+++'}
1194 1199
        LevittControl.rule='++'; %  e.g. '++' or '+++'
1195 1200
        experiment.singleIntervalMaxTrials=experiment.stopCriteria2IFC;
......
1209 1214
% NB responsibility for this is now transferred to the paradigm file
1210 1215
switch experiment.threshEstMethod
1211 1216
    % only one value required for level change
1212
    case {'2I2AFC++', '2A2AIFC+++'}		
1217
    case {'2I2AFC++', '2A2AIFC+++'}
1213 1218
        stimulusParameters.subjectText=...
1214 1219
            'did the tone occur in window 1 or 2?';
1215 1220
    case {'MaxLikelihood',  'oneIntervalUpDown'};
......
1399 1404
drawnow
1400 1405

  
1401 1406
function pushbuttonOME_Callback(hObject, eventdata, handles)
1402
global experiment
1407
global experiment paramChanges
1403 1408
aReadAndCheckParameterBoxes(handles);
1404
testOME(experiment.name);
1409
testOME(experiment.name, paramChanges);
1405 1410

  
1406 1411
function pushbuttonBM_Callback(hObject, eventdata, handles)
1407
global  stimulusParameters experiment
1412
global  stimulusParameters experiment paramChanges
1408 1413
aReadAndCheckParameterBoxes(handles);
1409 1414
relativeFrequencies=[0.25    .5   .75  1  1.25 1.5    2];
1410

  
1415
AN_spikesOrProbability='probability';
1411 1416
testBM(stimulusParameters.targetFrequency, ...
1412
    experiment.name,relativeFrequencies);
1417
    experiment.name,relativeFrequencies, AN_spikesOrProbability, ...
1418
    paramChanges);
1413 1419

  
1414 1420
function pushbuttonAN_Callback(hObject, eventdata, handles)
1415
global stimulusParameters
1421
global stimulusParameters experiment paramChanges
1416 1422
aReadAndCheckParameterBoxes(handles);
1417 1423
% now carry out tests
1418 1424
showPSTHs=0;
1419 1425
targetFrequency=stimulusParameters.targetFrequency(1);
1420 1426
BFlist=targetFrequency;
1421 1427

  
1422
testAN(targetFrequency,BFlist);
1428
testAN(targetFrequency,BFlist,-10:10:90,experiment.name, paramChanges);
1423 1429

  
1424 1430
function pushbuttonPhLk_Callback(hObject, eventdata, handles)
1431
global experiment
1425 1432
aReadAndCheckParameterBoxes(handles);
1426
testPhaseLocking
1433
testPhaseLocking(experiment.name)
1427 1434

  
1428 1435
function pushbuttonSYN_Callback(hObject, eventdata, handles)
1436
global stimulusParameters experiment paramChanges
1429 1437
aReadAndCheckParameterBoxes(handles);
1430
testSynapse
1438
% now carry out tests
1439
showPSTHs=0;
1440
targetFrequency=stimulusParameters.targetFrequency(1);
1441
BFlist=targetFrequency;
1442
testSynapse(BFlist,experiment.name, paramChanges)
1431 1443

  
1432 1444
function pushbuttonFM_Callback(hObject, eventdata, handles)
1433
global stimulusParameters experiment
1445
global stimulusParameters experiment paramChanges
1434 1446
aReadAndCheckParameterBoxes(handles);
1435 1447
showPSTHs=1;
1436
testFM(stimulusParameters.targetFrequency(1),experiment.name, showPSTHs)
1448
testFM(stimulusParameters.targetFrequency(1),experiment.name, ...
1449
    showPSTHs, paramChanges)
1437 1450

  
1438 1451
function popupmenuPhase_Callback(hObject, eventdata, handles)
1439 1452
global stimulusParameters
......
1447 1460
function pushbuttonParams_Callback(hObject, eventdata, handles)
1448 1461
global experiment stimulusParameters
1449 1462
aReadAndCheckParameterBoxes(handles);
1450
% print model parameters using the 'name' box (e.g. CTa -> MAPparamsCTa)
1451 1463
showParams=1; BFlist=-1;
1452 1464
paramChanges=get(handles.editparamChanges,'string');
1453
eval(paramChanges)
1465
eval(paramChanges);
1454 1466

  
1455 1467
paramFunctionName=['method=MAPparams' experiment.name ...
1456 1468
    '(BFlist, stimulusParameters.sampleRate, showParams,paramChanges);'];
......
1459 1471

  
1460 1472
% --- Executes on button press in pushbuttonRP.
1461 1473
function pushbuttonRP_Callback(hObject, eventdata, handles)
1462
global experiment stimulusParameters
1474
global experiment stimulusParameters paramChanges
1463 1475
aReadAndCheckParameterBoxes(handles);
1464 1476
% now carry out test
1465
testRP(stimulusParameters.targetFrequency,experiment.name)
1477
testRP(stimulusParameters.targetFrequency,experiment.name, paramChanges)
1466 1478

  
1467 1479
% function handles % ??
1468 1480

  
......
1755 1767
end
1756 1768

  
1757 1769

  
1758
    
1770

  
1759 1771

  
1760 1772

  
1761 1773
function editparamChanges_Callback(hObject, eventdata, handles)
multithreshold 1.46/nextStimulus.m
7 7
errormsg='';
8 8

  
9 9
% interrupt by 'stop' button
10
if experiment.stop
11
    disp('******** experiment manually stopped  *****************')
12
    experiment.status= 'waitingForStart';
13
    errormsg='manually stopped';
14
    addToMsg(errormsg,1)
15
    return
16
end
10
% if experiment.stop
11
%     disp('******** experiment manually stopped  *****************')
12
%     experiment.status= 'waitingForStart';
13
%     errormsg='manually stopped';
14
%     addToMsg(errormsg,1)
15
%     return
16
% end
17 17

  
18 18
% -----------------------------------------choose catch trials at random
19 19
% catch trials are for subject threshold measurements only
multithreshold 1.46/old files/MAPmodel.m
4 4
global outerMiddleEarParams DRNLParams AN_IHCsynapseParams
5 5

  
6 6
savePath=path;
7
addpath('..\MAP')
7
addpath(['..' filesep 'MAP'], ['..' filesep 'utilities'])
8 8
modelResponse=[];
9 9
MacGregorResponse=[];
10 10

  
......
25 25
        MAPparamsName, AN_spikesOrProbability);
26 26
    
27 27
if showPlotsAndDetails
28
    options.showModelParameters=0;
28
    options.printModelParameters=0;
29 29
    options.showModelOutput=1;
30 30
    options.printFiringRates=1;
31 31
    options.showACF=0;
32 32
    options.showEfferent=1;
33
    UTIL_showMAP(options, paramChanges)
33
    UTIL_showMAP(options)
34 34
end
35 35

  
36 36
% No response,  probably caused by hitting 'stop' button
multithreshold 1.46/paradigms/paradigm_IFMC.m
4 4
paradigm_training(handles) % default
5 5

  
6 6
stimulusParameters.WRVname='maskerLevel';
7
stimulusParameters.WRVstartValues=-10;
7
stimulusParameters.WRVstartValues=50;
8 8
stimulusParameters.WRVsteps= [-10 -2];
9 9
stimulusParameters.WRVlimits=[-30 110];
10 10

  
multithreshold 1.46/paradigms/paradigm_TMC.m
4 4
paradigm_training(handles) % default
5 5

  
6 6
stimulusParameters.WRVname='maskerLevel';
7
stimulusParameters.WRVstartValues=-10;
7
stimulusParameters.WRVstartValues=50;
8 8
stimulusParameters.WRVsteps= [-10 -4];
9 9
stimulusParameters.WRVlimits=[-30 110];
10 10

  
multithreshold 1.46/paradigms/paradigm_profile.m
5 5

  
6 6
betweenRuns.variableName1='targetFrequency';
7 7
betweenRuns.variableList1=[250 500 1000 2000 4000 8000 ];
8
betweenRuns.variableList1=str2num(get(handles.edittargetFrequency,'string'));
9 8
betweenRuns.variableName2='targetDuration';
10 9
betweenRuns.variableList2=0.016;
11 10
betweenRuns.randomizeSequence=1; % 'random sequence'
......
15 14

  
16 15
stimulusParameters.targetType='tone';
17 16
stimulusParameters.targetPhase='sin';
18
stimulusParameters.targetFrequency=1000;
17
stimulusParameters.targetFrequency=[250 500 1000 2000 4000 8000 ];
19 18
stimulusParameters.targetDuration=0.016;
20 19
stimulusParameters.targetLevel=stimulusParameters.WRVstartValues(1);
21 20

  
multithreshold 1.46/plotProfile.m
5 5
    load profile
6 6
end
7 7

  
8
normLongTone=[	11.4	1.55	-13.5	-6.35	-6.4	7.45];
9
normShortTone=[	23.85	18.9	9.85	10.6	9.55	21.9];
8
% comparison data (e.g. participants)
9
% rows are BFs
10 10

  
11
normGaps=0.01:0.01:0.09;
12
normTMC=	[
13
28.5	35.0	49.3	70.1	80.5	85.5    NaN      NaN    NaN;			
14
31.1	44.3	48.4	59.5	56.4	76.7	70.2	82.4	76.3;
15
33.4	38.4	48.8	55.8	64.5	78.7	84.2	88.3	90.3;
16
25.4	37.0	49.2	49.7	58.2	69.6	87.7	95.8	93.0;
17
18.2	23.5	27.4	41.5	64.3	82.1	86.7	91.2	NaN;
18
32.5	35.8	43.5	52.1	69.1	78.6	86.6	86.0	NaN;
19
    ];
20
normTMC=normTMC';
11
% -------------------------------------------JSan
12
compareBFs=[250	500	1000	2000	3000
13
];
14
compareLongTone=  [67.46485	56.95655	65.01985	61.46655	73.33265
15
];
16
compareShortTone=[	72.3185	63.2818	69.0373	65.2853	76
17
];
21 18

  
22
normIFMC=[
23
50	42	34	35	34	33	37;
24
58	51	38	33	28	41	49;
25
57	41	27	20	28	37	66;
26
61	49	27	20	34	68	79;
27
67	45	27	22	46	74	87;
28
62	62	43	22	47	56	83;
19
compareGaps=[0.02 0.05 0.08];
20
compareTMC=	[
21
    84	69	77	75	93
22
88	73	81	79	97
23
95	79	85	83	98
29 24
];
30
normIFMC=normIFMC';
25

  
26
compareMaskerFreqs=[0.7  0.9 1 1.1  1.3 ];
27
compareIFMCs=[83.1698	77.3165	79.8474	82.9074	82.3294
28
80.9667	73.6653	80.9446	80.7005	79.0022
29
82.0135	71.2284	78.7345	74.3342	84.126
30
79.3348	70.3347	78.5769	79.7274	91.9849
31
79.2308	76.3164	83.6881	86.2105	NaN
32
  ];
33

  
34
% % -------------------------------------------JE
35
% BFs=[250 500 1000 2000 4000 8000];
36
% compareLongTone=  [32 30	31	40	54 NaN];
37
% compareShortTone=[	49	50	47	56	63	NaN];
38
% 
39
% compareGaps=0.01:0.01:0.09;
40
% compareTMC=	[
41
%     69	83	82	NaN	NaN	NaN	NaN	NaN	NaN
42
%     61	68	79	88	93	NaN	NaN	NaN	NaN
43
%     63	69	79	84	92	NaN	NaN	NaN	NaN
44
%     67	71	75	80	82	84	88	93	NaN
45
%     82	82	86	86	NaN	83	88	90	75
46
%     NaN	NaN	NaN	NaN	NaN	NaN	NaN	NaN	NaN
47
%     ];
48
% compareTMC=compareTMC';
49
% 
50
% compareMaskerFreqs=[0.5	0.7	0.9	1	1.1	1.3	1.6];
51
% compareIFMCs=[
52
%     64	60	58	58	57	60	64
53
%     65	63	58	55	54	59	69
54
%     68	64	60	59	62	73	79
55
%     76	75	71	67	68	71	77
56
%     79	71	68	69	73	75	77
57
%     76	73	75	75	76	80	NaN
58
%     ];
59
% compareIFMCs=compareIFMCs';
60

  
61
% -------------------------------------------CMR
62
% CMR 
63
% BFs=[250 500 1000 2000 4000 8000];
64
% compareLongTone=[	11.4	1.55	-13.5	-6.35	-6.4	7.45];
65
% compareShortTone=[	23.85	18.9	9.85	10.6	9.55	21.9];
66
% 
67
% compareGaps=0.01:0.01:0.09;
68
% compareTMC=	[
69
%     28.5	35.0	49.3	70.1	80.5	85.5    NaN      NaN    NaN;
70
%     31.1	44.3	48.4	59.5	56.4	76.7	70.2	82.4	76.3;
71
%     33.4	38.4	48.8	55.8	64.5	78.7	84.2	88.3	90.3;
72
%     25.4	37.0	49.2	49.7	58.2	69.6	87.7	95.8	93.0;
73
%     18.2	23.5	27.4	41.5	64.3	82.1	86.7	91.2	NaN;
74
%     32.5	35.8	43.5	52.1	69.1	78.6	86.6	86.0	NaN;
75
%     ];
76
% compareTMC=compareTMC';
77
% 
78
% compareMaskerFreqs=[0.5	0.7	0.9	1	1.1	1.3	1.6];
79
% compareIFMCs=[
80
%     50	42	34	35	34	33	37;
81
%     58	51	38	33	28	41	49;
82
%     57	41	27	20	28	37	66;
83
%     61	49	27	20	34	68	79;
84
%     67	45	27	22	46	74	87;
85
%     62	62	43	22	47	56	83;
86
%     ];
87
% compareIFMCs=compareIFMCs';
31 88

  
32 89
% absolute thresholds
33 90
figure(90), clf
34 91
subplot(2,1,2)
35 92
semilogx(BFs,longTone,'ko-','lineWidth',2); hold on
36 93
semilogx(BFs,shortTone,'bo-','lineWidth',2); hold on
37
semilogx(BFs,normLongTone,'ko:'); hold on
38
semilogx(BFs,normShortTone,'bo:'); hold on
94
semilogx(compareBFs,compareLongTone,'ko:'); hold on
95
semilogx(compareBFs,compareShortTone,'bo:'); hold on
39 96
ylim([0 100])
40 97

  
41 98
% TMC
42 99
for BFno=1:length(BFs)
43 100
    subplot(2,6,BFno)
44 101
    plot(gaps,TMC(:,BFno)-longTone(BFno),'r','lineWidth',3), hold on
45
    plot(normGaps,normTMC(:,BFno)-longTone(BFno),'k:')
46
    ylim([-10 90])
102
    plot(gaps,TMC(:,BFno),'b','lineWidth',3), hold on
103
    ylim([-10 110])
47 104
    xlim([0.01 0.1])
48
    grid on    
105
    grid on
49 106
    if BFno==1
50 107
        ylabel('masker dB SL')
51 108
        xlabel('gap')
52
        text(0.02,80,' TMC','backgroundColor','w')
109
%         text(0.02,80,' TMC','backgroundColor','w')
53 110
    end
54
        title([num2str(BFs(BFno)) ' Hz'])
55
        set(gca,'XTick',[ 0.1],'xTickLabel', { '0.1'})
111
    title([num2str(BFs(BFno)) ' Hz'])
112
    set(gca,'XTick',[ 0.1],'xTickLabel', { '0.1'})
56 113
end
57 114

  
58 115
% IFMCs
59 116
for BFno=1:length(BFs)
60
    BF=BFs(BFno);
61 117
    freq=offBFs'*BFs(BFno);
62 118
    subplot(2,1,2)
63 119
    semilogx(freq,IFMCs(:,BFno),'r','lineWidth',3), hold on
64
    semilogx(freq,normIFMC(:,BFno),'k:')
65 120
    ylim([0 100])
66 121
    xlim([100 12000])
67 122
    grid on
......
69 124
xlabel('frequency (Hz)')
70 125
ylabel('masker dB / probe dB')
71 126
set(gca,'XTick',BFs)
127

  
128
for BFno=1:length(compareBFs)
129
    subplot(2,6,BFno)
130
    plot(compareGaps,compareTMC(:,BFno)-longTone(BFno),'k:')
131
    plot(compareGaps,compareTMC(:,BFno),'k:')
132
    ylim([-10 110])
133
    xlim([0.01 0.1])
134
    grid on
135
    if BFno==1
136
        ylabel('masker dB SL')
137
        xlabel('gap')
138
%         text(0.02,80,' TMC','backgroundColor','w')
139
    end
140
    title([num2str(BFs(BFno)) ' Hz'])
141
    set(gca,'XTick',[ 0.1],'xTickLabel', { '0.1'})
142
end
143

  
144
% IFMCs
145
for BFno=1:length(compareBFs)
146
    compareFreq=compareMaskerFreqs'*BFs(BFno);
147
    subplot(2,1,2)
148
    semilogx(compareFreq,compareIFMCs(:,BFno),'k:')
149
    ylim([0 100])
150
    xlim([100 12000])
151
    grid on
152
end
multithreshold 1.46/printReport.m
6 6

  
7 7
global experiment stimulusParameters betweenRuns withinRuns statsModel   audio
8 8
global LevittControl expGUIhandles
9

  
9
global paramChanges
10 10

  
11 11
global inputStimulusParams OMEParams DRNLParams
12 12
global IHC_VResp_VivoParams IHCpreSynapseParams  AN_IHCsynapseParams
......
24 24
    printReportGuide.showTracks=experiment.printTracks;
25 25
    printReportGuide.fileName=[];
26 26
    if experiment.saveData
27
        saveFileName=['savedData/' experiment.name '_' experiment.date '_' experiment.paradigm];
27
        saveFileName=...
28
            ['savedData/' experiment.name '_' ...
29
            experiment.date '_' experiment.paradigm];
28 30
    else
29 31
        % save this data (just in case)
30 32
        saveFileName=['savedData/mostRecentResults'];
......
84 86
msg=printTabTable(resultsTable,  headers);
85 87
addToMsg(msg,0)
86 88
fprintf('\n')
89
disp(paramChanges)
87 90

  
88 91
% sort tracks into the same order
89 92
betweenRuns.levelTracks=betweenRuns.levelTracks(idx1);
......
181 184
end
182 185

  
183 186
fprintf('\nparadigm:\t%s\n ', experiment.paradigm)
187
disp(paramChanges)
184 188

  
185 189
% ------------------------------------------------------- sortTablesForPrinting
186 190
function table= sortTablesForPrinting(idx1,idx2, var1values,var2values, x)
multithreshold 1.46/subjGUI_MT.m
1349 1349
    %  without waiting for button press
1350 1350
    startNewRun(handles)
1351 1351

  
1352
    % show sample Rate on GUI; it must be set in MAPparams
1352
    % show sample Rate on GUI; it must be set in MAPparams ##??
1353 1353
    set(expGUIhandles.textsampleRate,'string',...
1354 1354
        num2str(stimulusParameters.sampleRate))
1355 1355

  
1356
    if experiment.singleShot
1356
    if experiment.singleShot % ##??
1357 1357
        AN_IHCsynapseParams.plotSynapseContents=1;
1358 1358
    else
1359 1359
        AN_IHCsynapseParams.plotSynapseContents=0;
......
1424 1424
function [modelResponse, MacGregorResponse]=MAPmodel
1425 1425

  
1426 1426
global experiment stimulusParameters audio withinRuns
1427
global outerMiddleEarParams DRNLParams AN_IHCsynapseParams
1427
% global outerMiddleEarParams DRNLParams AN_IHCsynapseParams
1428
global ICoutput ANdt dt savedBFlist ANprobRateOutput expGUIhandles
1429
global paramChanges
1428 1430

  
1429 1431
savePath=path;
1430 1432
addpath(['..' filesep 'MAP'], ['..' filesep 'utilities'])
......
1444 1446
% ---------------------------------------------- run Model
1445 1447
MAPparamsName=experiment.name;
1446 1448
showPlotsAndDetails=experiment.MAPplot;
1449

  
1450
% important buried constant ##??
1447 1451
AN_spikesOrProbability='spikes';
1448 1452
AN_spikesOrProbability='probability';
1449 1453

  
1450 1454
% [response, method]=MAPsequenceSeg(audio, method, 1:8);
1451
global ICoutput ANdt dt savedBFlist ANprobRateOutput expGUIhandles
1452
global stimulusParameters experiment
1453 1455

  
1454 1456
if sum(strcmp(experiment.ear,{'MAPmodelMultiCh', 'MAPmodelListen'}))
1455 1457
    % use BFlist specified in MAPparams file
......
1458 1460
    BFlist=stimulusParameters.targetFrequency;
1459 1461
end
1460 1462
paramChanges=get(expGUIhandles.editparamChanges,'string');
1461
eval(paramChanges)
1463
% convert from string to a cell array
1464
eval(paramChanges);
1462 1465

  
1463 1466
MAP1_14(audio, stimulusParameters.sampleRate, BFlist,...
1464 1467
    MAPparamsName, AN_spikesOrProbability, paramChanges);
parameterStore/MAPparamsEndo.m
129 129
%  #5 IHC_RP
130 130
IHC_cilia_RPParams.Cab=	4e-012;         % IHC capacitance (F)
131 131
% IHC_cilia_RPParams.Cab=	1e-012;         % IHC capacitance (F)
132
IHC_cilia_RPParams.Et=	0.100;          % endocochlear potential (V)
133 132
IHC_cilia_RPParams.Et=	0.05;          % endocochlear potential (V)
134 133

  
135 134
IHC_cilia_RPParams.Gk=	2e-008;         % 1e-8 potassium conductance (S)
parameterStore/MAPparamsJE.m
1
function method=MAPparamsJE ...
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=1000;     % 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.05;          % 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= [LSRtauCa 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.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/testAN.m
1
function vectorStrength=testAN(targetFrequency,BFlist, levels, ...
2
    paramsName,paramChanges)
3
% testIHC used either for IHC I/O function ...
4
%  or receptive field (doReceptiveFields=1)
5

  
6
global IHC_VResp_VivoParams  IHC_cilia_RPParams IHCpreSynapseParams
7
global AN_IHCsynapseParams
8

  
9
    global ANoutput ANdt CNoutput ICoutput ICmembraneOutput tauCas
10
    global ARattenuation MOCattenuation
11

  
12
dbstop if error
13
restorePath=path;
14

  
15
addpath (['..' filesep 'MAP'], ['..' filesep 'utilities'], ...
16
    ['..' filesep 'parameterStore'],  ['..' filesep 'wavFileStore'],...
17
    ['..' filesep 'testPrograms'])
18

  
19
if nargin<5
20
    paramChanges=[];
21
end
22

  
23
if nargin<4
24
    paramsName='Normal';
25
end
26

  
27
if nargin<3
28
    levels=-10:10:80;
29
    % levels=80:10:90;
30
end
31

  
32
nLevels=length(levels);
33

  
34
toneDuration=.2;
35
rampDuration=0.002;
36
silenceDuration=.02;
37
localPSTHbinwidth=0.001;
38

  
39
% Use only the first frequency in the GUI targetFrequency box to defineBF
40
% targetFrequency=stimulusParameters.targetFrequency(1);
41
% BFlist=targetFrequency;
42

  
43
AN_HSRonset=zeros(nLevels,1);
44
AN_HSRsaturated=zeros(nLevels,1);
45
AN_LSRonset=zeros(nLevels,1);
46
AN_LSRsaturated=zeros(nLevels,1);
47
CNLSRrate=zeros(nLevels,1);
48
CNHSRsaturated=zeros(nLevels,1);
49
ICHSRsaturated=zeros(nLevels,1);
50
ICLSRsaturated=zeros(nLevels,1);
51
vectorStrength=zeros(nLevels,1);
52

  
53
AR=zeros(nLevels,1);
54
MOC=zeros(nLevels,1);
55

  
56
% ANoutput=zeros(200,200);
57

  
58
figure(15), clf
59
set(gcf,'position',[980   356   401   321])
60
figure(5), clf
61
set(gcf,'position', [980 34 400 295])
62
drawnow
63

  
64
%% guarantee that the sample rate is at least 10 times the frequency
65
sampleRate=50000;
66
while sampleRate< 10* targetFrequency
67
    sampleRate=sampleRate+10000;
68
end
69

  
70
%% adjust sample rate so that the pure tone stimulus has an integer
71
%% numver of epochs in a period
72
dt=1/sampleRate;
73
period=1/targetFrequency;
74
ANspeedUpFactor=5;  %anticipating MAP (needs clearing up)
75
ANdt=dt*ANspeedUpFactor;
76
ANdt=period/round(period/ANdt);
77
dt=ANdt/ANspeedUpFactor;
78
sampleRate=1/dt;
79
epochsPerPeriod=sampleRate*period;
80

  
81
%% main computational loop (vary level)    
82
levelNo=0;
83
for leveldB=levels
84
    levelNo=levelNo+1;
85

  
86
    fprintf('%4.0f\t', leveldB)
87
    amp=28e-6*10^(leveldB/20);
88

  
89
    time=dt:dt:toneDuration;
90
    rampTime=dt:dt:rampDuration;
91
    ramp=[0.5*(1+cos(2*pi*rampTime/(2*rampDuration)+pi)) ...
92
        ones(1,length(time)-length(rampTime))];
93
    ramp=ramp.*fliplr(ramp);
94

  
95
    silence=zeros(1,round(silenceDuration/dt));
96

  
97
    % create signal (leveldB/ targetFrequency)
98
    inputSignal=amp*sin(2*pi*targetFrequency'*time);
99
    inputSignal= ramp.*inputSignal;
100
    inputSignal=[silence inputSignal];
101

  
102
    %% run the model
103
    AN_spikesOrProbability='spikes';
104
    showPlotsAndDetails=0;
105

  
106

  
107
    MAP1_14(inputSignal, 1/dt, BFlist, ...
108
        paramsName, AN_spikesOrProbability, paramChanges);
109

  
110
    nTaus=length(tauCas);
111

  
112
    %LSR (same as HSR if no LSR fibers present)
113
    [nANFibers nTimePoints]=size(ANoutput);
114

  
115
    numLSRfibers=nANFibers/nTaus;
116
    numHSRfibers=numLSRfibers;
117

  
118
    LSRspikes=ANoutput(1:numLSRfibers,:);
119
    PSTH=UTIL_PSTHmaker(LSRspikes, ANdt, localPSTHbinwidth);
120
    PSTHLSR=mean(PSTH,1)/localPSTHbinwidth;  % across fibers rates
121
    PSTHtime=localPSTHbinwidth:localPSTHbinwidth:...
122
        localPSTHbinwidth*length(PSTH);
123
    AN_LSRonset(levelNo)= max(PSTHLSR); % peak in 5 ms window
124
    AN_LSRsaturated(levelNo)= mean(PSTHLSR(round(length(PSTH)/2):end));
125

  
126
    % HSR
127
    HSRspikes= ANoutput(end- numHSRfibers+1:end, :);
128
    PSTH=UTIL_PSTHmaker(HSRspikes, ANdt, localPSTHbinwidth);
129
    PSTH=mean(PSTH,1)/localPSTHbinwidth; % sum across fibers (HSR only)
130
    AN_HSRonset(levelNo)= max(PSTH);
131
    AN_HSRsaturated(levelNo)= mean(PSTH(round(length(PSTH)/2): end));
132

  
133
    figure(5), subplot(2,2,2)
134
    hold off, bar(PSTHtime,PSTH, 'b')
135
    hold on,  bar(PSTHtime,PSTHLSR,'r')
136
    ylim([0 1000])
137
    xlim([0 length(PSTH)*localPSTHbinwidth])
138
    set(gcf,'name',[num2str(BFlist), ' Hz: ' num2str(leveldB) ' dB']);
139

  
140
    % AN - CV
141
    %  CV is computed 5 times. Use the middle one (3) as most typical
142
    cvANHSR=  UTIL_CV(HSRspikes, ANdt);
143

  
144
    % AN - vector strength
145
    PSTH=sum(HSRspikes);
146
    [PH, binTimes]=UTIL_periodHistogram...
147
        (PSTH, ANdt, targetFrequency);
148
    VS=UTIL_vectorStrength(PH);
149
    vectorStrength(levelNo)=VS;
150
    disp(['sat rate= ' num2str(AN_HSRsaturated(levelNo)) ...
151
        ';   phase-locking VS = ' num2str(VS)])
152
    title(['AN HSR: CV=' num2str(cvANHSR(3),'%5.2f') ...
153
        'VS=' num2str(VS,'%5.2f')])
154

  
155
    % CN - first-order neurons
156

  
157
    % CN LSR
158
    [nCNneurons c]=size(CNoutput);
159
    nLSRneurons=round(nCNneurons/nTaus);
160
    CNLSRspikes=CNoutput(1:nLSRneurons,:);
161
    PSTH=UTIL_PSTHmaker(CNLSRspikes, ANdt, localPSTHbinwidth);
162
    PSTH=sum(PSTH)/nLSRneurons;
163
    CNLSRrate(levelNo)=mean(PSTH(round(length(PSTH)/2):end))/localPSTHbinwidth;
164

  
165
    %CN HSR
166
    MacGregorMultiHSRspikes=...
167
        CNoutput(end-nLSRneurons:end,:);
168
    PSTH=UTIL_PSTHmaker(MacGregorMultiHSRspikes, ANdt, localPSTHbinwidth);
169
    PSTH=sum(PSTH)/nLSRneurons;
170
    PSTH=mean(PSTH,1)/localPSTHbinwidth; % sum across fibers (HSR only)
171

  
172
    CNHSRsaturated(levelNo)=mean(PSTH(length(PSTH)/2:end));
173

  
174
    figure(5), subplot(2,2,3)
175
    bar(PSTHtime,PSTH)
176
    ylim([0 1000])
177
    xlim([0 length(PSTH)*localPSTHbinwidth])
178
    cvMMHSR= UTIL_CV(MacGregorMultiHSRspikes, ANdt);
179
    title(['CN    CV= ' num2str(cvMMHSR(3),'%5.2f')])
180

  
181
    % IC LSR
182
    [nICneurons c]=size(ICoutput);
183
    nLSRneurons=round(nICneurons/nTaus);
184
    ICLSRspikes=ICoutput(1:nLSRneurons,:);
185
    PSTH=UTIL_PSTHmaker(ICLSRspikes, ANdt, localPSTHbinwidth);
186
    ICLSRsaturated(levelNo)=mean(PSTH(round(length(PSTH)/2):end))/localPSTHbinwidth;
187

  
188
    %IC HSR
189
    MacGregorMultiHSRspikes=...
190
        ICoutput(end-nLSRneurons:end,:);
191
    PSTH=UTIL_PSTHmaker(MacGregorMultiHSRspikes, ANdt, localPSTHbinwidth);
192
    PSTH=sum(PSTH)/nLSRneurons;
193
    PSTH=mean(PSTH,1)/localPSTHbinwidth; % sum across fibers (HSR only)
194

  
195
    ICHSRsaturated(levelNo)=mean(PSTH(length(PSTH)/2:end));
196

  
197
    AR(levelNo)=min(ARattenuation);
198
    MOC(levelNo)=min(MOCattenuation(length(MOCattenuation)/2:end));
199

  
200
    time=dt:dt:dt*size(ICmembraneOutput,2);
201
    figure(5), subplot(2,2,4)
202
    plot(time,ICmembraneOutput(2, 1:end),'k')
203
    ylim([-0.07 0])
204
    xlim([0 max(time)])
205
    title(['IC  ' num2str(leveldB,'%4.0f') 'dB'])
206
    drawnow
207

  
208
    figure(5), subplot(2,2,1)
209
    plot(20*log10(MOC), 'k'),
210
    title(' MOC'), ylabel('dB attenuation')
211
    ylim([-30 0])
212

  
213

  
214
end % level
215
figure(5), subplot(2,2,1)
216
plot(levels,20*log10(MOC), 'k'),
217
title(' MOC'), ylabel('dB attenuation')
218
ylim([-30 0])
219
xlim([0 max(levels)])
220

  
221
fprintf('\n')
222
toneDuration=2;
223
rampDuration=0.004;
224
silenceDuration=.02;
225
nRepeats=200;   % no. of AN fibers
226
fprintf('toneDuration  %6.3f\n', toneDuration)
227
fprintf(' %6.0f  AN fibers (repeats)\n', nRepeats)
228
fprintf('levels')
229
fprintf('%6.2f\t', levels)
230
fprintf('\n')
231

  
232

  
233
% ---------------------------------------------------- display parameters
234

  
235
figure(15), clf
236
nRows=2; nCols=2;
237

  
238
% AN rate - level ONSET functions
239
subplot(nRows,nCols,1)
240
plot(levels,AN_LSRonset,'ro'), hold on
241
plot(levels,AN_HSRonset,'ko'), hold off
242
ylim([0 1000]),  xlim([min(levels) max(levels)])
243
ttl=['tauCa= ' num2str(IHCpreSynapseParams.tauCa)];
244
title( ttl)
245
xlabel('level dB SPL'), ylabel('peak rate (sp/s)'), grid on
246
text(0, 800, 'AN onset', 'fontsize', 16)
247

  
248
% AN rate - level ADAPTED function
249
subplot(nRows,nCols,2)
250
plot(levels,AN_LSRsaturated, 'ro'), hold on
251
plot(levels,AN_HSRsaturated, 'ko'), hold off
252
ylim([0 400])
253
set(gca,'ytick',0:50:300)
254
xlim([min(levels) max(levels)])
255
set(gca,'xtick',[levels(1):20:levels(end)])
256
%     grid on
257
ttl=[   'spont=' num2str(mean(AN_HSRsaturated(1,:)),'%4.0f')...
258
    '  sat=' num2str(mean(AN_HSRsaturated(end,1)),'%4.0f')];
259
title( ttl)
260
xlabel('level dB SPL'), ylabel ('adapted rate (sp/s)')
261
text(0, 340, 'AN adapted', 'fontsize', 16), grid on
262

  
263
% CN rate - level ADAPTED function
264
subplot(nRows,nCols,3)
265
plot(levels,CNLSRrate, 'ro'), hold on
266
plot(levels,CNHSRsaturated, 'ko'), hold off
267
ylim([0 400])
268
set(gca,'ytick',0:50:300)
269
xlim([min(levels) max(levels)])
270
set(gca,'xtick',[levels(1):20:levels(end)])
271
%     grid on
272
ttl=[   'spont=' num2str(mean(CNHSRsaturated(1,:)),'%4.0f') '  sat=' ...
273
    num2str(mean(CNHSRsaturated(end,1)),'%4.0f')];
274
title( ttl)
275
xlabel('level dB SPL'), ylabel ('adapted rate (sp/s)')
276
text(0, 350, 'CN', 'fontsize', 16), grid on
277

  
278
% IC rate - level ADAPTED function
279
subplot(nRows,nCols,4)
280
plot(levels,ICLSRsaturated, 'ro'), hold on
281
plot(levels,ICHSRsaturated, 'ko'), hold off
282
ylim([0 400])
283
set(gca,'ytick',0:50:300)
284
xlim([min(levels) max(levels)])
285
set(gca,'xtick',[levels(1):20:levels(end)]), grid on
286

  
287

  
288
ttl=['spont=' num2str(mean(ICHSRsaturated(1,:)),'%4.0f') ...
289
    '  sat=' num2str(mean(ICHSRsaturated(end,1)),'%4.0f')];
290
title( ttl)
291
xlabel('level dB SPL'), ylabel ('adapted rate (sp/s)')
292
text(0, 350, 'IC', 'fontsize', 16)
293
set(gcf,'name',' AN CN IC rate/level')
294

  
295
peakVectorStrength=max(vectorStrength);
296

  
297
fprintf('\n')
298
disp('levels vectorStrength')
299
fprintf('%3.0f \t %6.4f \n', [levels; vectorStrength'])
300
fprintf('\n')
301
fprintf('Phase locking, max vector strength=\t %6.4f\n\n',...
302
    max(vectorStrength))
303

  
304
allData=[ levels'  AN_HSRonset AN_HSRsaturated...
305
    AN_LSRonset AN_LSRsaturated ...
306
    CNHSRsaturated CNLSRrate...
307
    ICHSRsaturated ICLSRsaturated];
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff