To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.

The primary repository for this project is hosted at git://github.com/rmeddis/MAP.git .
This repository is a read-only copy which is updated automatically every hour.

Statistics Download as Zip
| Branch: | Revision:

root / multithreshold 1.46 / expGUI_MT.m @ 31:c54a34161e4a

History | View | Annotate | Download (64 KB)

1
% expGUI_MT = 'experimenter GUI for multiThreshold
2
% allows the experimenter to design experiments.
3
% The *running* of experiments is left to subjGUI.m
4
%
5
% There are three kinds of experiments known as 'earOptions':
6
% 1. Measurements using real listeners
7
%  'left', 'right',  'diotic', 'dichoticLeft', 'dichoticRight'
8
% 2. Measurements using the MAP model as the subject
9
%   'MAPmodelListen',  'MAPmodelMultiCh', 'MAPmodelSingleCh'
10
% 3. Monte Carlo simulations
11
%   'statsModelLogistic','statsModelRareEvent'
12
%
13
% There are many stimulus configurations relating to different measurement
14
% requirements. These configurations are defined in paradigm files located
15
% in the 'paradigms' folder with names of the form paradigm_<name>.m. These
16
% files specify values in the stimulusParameter and experiment structures.
17
% Some minor parameters are specified in the intialiseGUI function below.
18
% Each configuration is only a start up arrangement and the user can modify
19
% the parameters on the GUI itself.
20
%
21
% the 'RUN' button initiates the measurements and hands control over to the
22
% subjGUI program. When the measurements are complete control is handed
23
% back and the stack unwinds without any further action
24

    
25
function varargout = expGUI_MT(varargin)
26
%EXPGUI_MT M-file for expGUI_MT.fig
27
%      EXPGUI_MT, by itself, creates a new EXPGUI_MT or raises the existing
28
%      singleton*.
29
%
30
%      H = EXPGUI_MT returns the handle to a new EXPGUI_MT or the handle to
31
%      the existing singleton*.
32
%
33
%      EXPGUI_MT('Property','Value',...) creates a new EXPGUI_MT using the
34
%      given property value pairs. Unrecognized properties are passed via
35
%      varargin to expGUI_MT_OpeningFcn.  This calling syntax produces a
36
%      warning when there is an existing singleton*.
37
%
38
%      EXPGUI_MT('CALLBACK') and EXPGUI_MT('CALLBACK',hObject,...) call the
39
%      local function named CALLBACK in EXPGUI_MT.M with the given input
40
%      arguments.
41
%
42
%      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one
43
%      instance to run (singleton)".
44
%
45
% See also: GUIDE, GUIDATA, GUIHANDLES
46

    
47
% Edit the above text to modify the response to help expGUI_MT
48

    
49
% Last Modified by GUIDE v2.5 25-Jun-2011 21:41:35
50

    
51
% Begin initialization code - DO NOT EDIT
52
gui_Singleton = 1;
53
gui_State = struct('gui_Name',       mfilename, ...
54
    'gui_Singleton',  gui_Singleton, ...
55
    'gui_OpeningFcn', @expGUI_MT_OpeningFcn, ...
56
    'gui_OutputFcn',  @expGUI_MT_OutputFcn, ...
57
    'gui_LayoutFcn',  [], ...
58
    'gui_Callback',   []);
59
if nargin && ischar(varargin{1})
60
    gui_State.gui_Callback = str2func(varargin{1});
61
end
62

    
63
if nargout
64
    [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
65
else
66
    gui_mainfcn(gui_State, varargin{:});
67
end
68
% End initialization code - DO NOT EDIT
69

    
70
% --------------------------------------------------  expGUI_MT_OpeningFcn
71
function expGUI_MT_OpeningFcn(hObject, eventdata, handles, varargin)
72

    
73
% Choose default command line output for expGUI_MT
74
handles.output = hObject;
75

    
76
cla(handles.axes1)
77
cla(handles.axes2)
78
cla(handles.axes4)
79
cla(handles.axes5)
80

    
81
% Update handles structure
82
guidata(hObject, handles);
83

    
84
function varargout = expGUI_MT_OutputFcn(hObject, eventdata, handles)
85
% Get default command line output from handles structure
86
initializeGUI(handles)
87
varargout{1} = handles.output;
88

    
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
% 
119

    
120
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
121

    
122
% -----------------------------------------------------initializeGUI
123
function initializeGUI(handles)
124
% Populate the edit boxes and popup menus on the GUI
125
% Then wait for user action
126
global stimulusParameters experiment betweenRuns
127
global targetTypes maskerTypes backgroundTypes
128
global variableNames paradigmNames threshEstNames  cueNames
129

    
130
% Specify order of fields in main structures
131
% identify as empty values or empty strings only
132
orderGlobals
133

    
134
addpath ('paradigms')   %paradigm informations is stored here
135
addpath (['..' filesep 'testPrograms']) % model physiology tests
136

    
137
% specify all variables that  need to be set on the GUI
138
variableNames={'stimulusDelay','maskerDuration','maskerLevel',...
139
    'maskerRelativeFrequency', 'targetFrequency', 'gapDuration',...
140
    'targetDuration','targetLevel','rampDuration',...
141
    'cueTestDifference', 'WRVstartValues', 'WRVsteps', 'WRVlimits'};
142

    
143
% Variable variables
144
%  (names of variable that can changed between runs)
145
betweenRunsVariables={'stimulusDelay','maskerDuration','maskerLevel',...
146
    'maskerRelativeFrequency','targetFrequency', 'gapDuration',...
147
    'targetDuration','targetLevel','numOHIOtones'};
148
% populate the 'between runs variable' menus
149
set(handles.popupmenuVaryParameter1,'string',betweenRunsVariables)
150
set(handles.popupmenuVaryParameter2,'string',betweenRunsVariables)
151

    
152
% Trial presentation order - randomize at startup
153
presentationOrderNames={'randomize within blocks', 'fixed sequence', ...
154
    'randomize across blocks'};
155
set(handles.popupmenuRandomize,'string', presentationOrderNames)
156

    
157
% targetType- value must be set in paradigm
158
targetTypes={'tone','noise', 'pinkNoise','whiteNoise','24TalkerBabble',...
159
    'speech', 'Twister','digitStrings'};
160
set(handles.popupmenuTargetType, 'string', targetTypes);
161

    
162
% maskerType - value must be set in paradigm
163
maskerTypes={'tone','noise', 'pinkNoise','TEN','whiteNoise','24TalkerBabble', ...
164
    'speech'};
165
set(handles.popupmenuMaskerType, 'string', maskerTypes);
166

    
167
% background Type- value must be set in paradigm (default = 1, 'none')
168
backgroundTypes={'none','noise', 'pinkNoise', 'TEN','noiseDich',...
169
    'pinkNoiseDich','whiteNoise','24TalkerBabble',...
170
    '16TalkerBabble','8TalkerBabble','4TalkerBabble',...
171
    '4TalkerReversedBabble','2TalkerBabble','1TalkerBabble'};
172
set(handles.popupmenuBackgroundType, 'string', backgroundTypes);
173
set(handles.editBackgroundLevel,'string', '0')
174

    
175
% Establish available paradigms by scanning paradigms folder
176
paradigmNames= what('paradigms');
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
181
set(handles.popupmenuParadigm,'string', paradigmNames)
182

    
183
% startup paradigm, 'training' (could be anywhere on the list)
184
startupParadigm='training';
185
idx= find(strcmp(paradigmNames,startupParadigm));
186
if ~isempty(idx)
187
    set(handles.popupmenuParadigm,'value', idx)
188
else
189
    % training paradigm must exist
190
    error(['expGUI_MT\initializeGUI: No ' startupParadigm...
191
        ' paradigm found in paradigms folder'])
192
end
193

    
194
earOptions={'left', 'right',  'diotic', 'dichoticLeft', 'dichoticRight',...
195
    'MAPmodelListen',  'MAPmodelMultiCh', 'MAPmodelSingleCh'...
196
    'statsModelLogistic','statsModelRareEvent'};
197
set(handles.popupmenuEar,'string', earOptions)
198
defaultOption=1;
199
experiment.ear=earOptions{defaultOption};
200
set(handles.popupmenuEar,'value', defaultOption)    % 'left' is deafult
201
set(handles.pushbuttonSingleShot, 'visible', 'off') % use only for MAP
202

    
203
% phase
204
phaseOptions={'sin','cos','alt','rand'};
205
set(handles.popupmenuPhase,'string', phaseOptions)
206
set(handles.popupmenuPhase,'value', 1)
207

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

    
213
% threshold assessment method - value must be set in paradigm
214
threshEstNames={'oneIntervalUpDown', 'MaxLikelihood', ...
215
    '2I2AFC++', '2I2AFC+++'};
216
set(handles.popupmenuThreshEst, 'string', threshEstNames);
217
experiment.stopCriteria2IFC=[75 3 5];
218
experiment.stopCriteriaSI=[20];
219

    
220
% ** editBoxes that are only set by hand
221
% music (relative) level, 'tada!' (manual setting only)
222
% increase for the hard of hearing
223
set(handles.editMusicLevel,'string','0')
224

    
225
% Catch Trial Rate
226
set(handles.editCatchTrialRate,'string','0.2   0.1  2 ');
227

    
228
% calibration
229
stimulusParameters.restoreCalibration=7;
230
set(handles.editcalibrationdB,'string',...
231
    stimulusParameters.restoreCalibration)
232

    
233
% a MAPplot
234
experiment.MAPplot=0;	%default
235
set(handles.editMAPplot,'string',num2str(experiment.MAPplot))
236

    
237
% saveData
238
experiment.saveData=1;
239
set(handles.editSaveData,'string',num2str(experiment.saveData))
240

    
241
% printTracks
242
experiment.printTracks=0;
243
set(handles.editPrintTracks,'string',num2str(experiment.printTracks))
244

    
245
% standard delay between button press and initiation of next stimulus
246
experiment.clickToStimulusPause=1;
247

    
248
% buttonBoxType: NB no problem if mouse is used instead
249
experiment.buttonBoxType='square';
250

    
251
% estimation of the mean
252
% {'logisticLS', 'logisticML', 'rareEvent'}
253
experiment.functionEstMethod='logisticLS';
254

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

    
260
% default psychometric bin size and logistic slopes
261
experiment.psyBinWidth=1;  % dB
262
maxLogisticK=2; % steepest slope contemplated
263
experiment.maxLogisticK=maxLogisticK;
264
experiment.numPossLogisticK=100;
265
experiment.possLogSlopes= ...
266
    0.01: maxLogisticK/experiment.numPossLogisticK: maxLogisticK;
267
experiment.meanSearchStep=0.25; % dB
268

    
269
% indicate that this is the first run and the GUI should be located in
270
% default location.
271
experiment.justInitialized=1;
272

    
273
% set up GUI based on training paradigm
274
aParadigmSelection(handles);
275
earSetUp(handles)
276
aThresholdAssessmentMethod(handles)
277
aShowRelevantObjects(handles)
278

    
279
% Done. Now wait for action
280

    
281
% -------------------------------------------- popupmenuMaskerType_Callback
282
function popupmenuMaskerType_Callback(hObject, eventdata, handles)
283
% show or remove masker frequency box
284
aShowRelevantObjects(handles)
285

    
286
% -------------------------------------------- popupmenuTargetType_Callback
287
function popupmenuTargetType_Callback(hObject, eventdata, handles)
288
% show or remove target frequency box
289
aShowRelevantObjects(handles)
290

    
291
% -------------------------------------------- popupmenuParadigm_Callback
292
function popupmenuParadigm_Callback(hObject, eventdata, handles)
293
% Any change to the paradigm selection causes all boxes to be shown
294
% showParameters(handles)
295
aParadigmSelection(handles);
296

    
297
% -------------------------------------------- aParadigmSelection
298
function aParadigmSelection(handles)
299
global experiment stimulusParameters betweenRuns  paradigmNames
300
global variableNames
301

    
302
% identify paradigm selected
303
chosenOption=get(handles.popupmenuParadigm,'value');
304
paradigm=paradigmNames{chosenOption};
305
experiment.paradigm=paradigm;
306

    
307
%Paradigm: read in all relevant parameters
308
% a file must exist with this name 'paradigm_<paradigm>'
309
% 'handles' are only occasionally used
310
addpath ('paradigms')
311
cmd=['paradigm_' paradigm '(handles);'];
312
try
313
    eval(cmd)
314
catch
315
    error(['ExpGUI\aParadigmSelection:'...
316
        'paradigm file not found or error in file'])
317
end
318
rmpath ('paradigms')
319

    
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 ;
331
end
332

    
333
% if a variable is subject to change, specify list of values here
334
% eg. stimulusParameters.targetFrequency=betweenRuns.variableList1;
335
cmd=['stimulusParameters.' ...
336
    betweenRuns.variableName1 '=betweenRuns.variableList1;'];
337
eval (cmd);
338
cmd=['stimulusParameters.' ...
339
    betweenRuns.variableName2 '=betweenRuns.variableList2;'];
340
eval (cmd);
341

    
342
% establish popup menus on the basis of the paradigm file
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

    
352
if stimulusParameters.includeCue
353
    set(handles.popupmenuCueNoCue,'value', 1)
354
else
355
    set(handles.popupmenuCueNoCue,'value', 2)
356
end
357

    
358
set(handles.text34, 'string', stimulusParameters.WRVname)
359

    
360
% Put the new data values into the edit boxes on the GUI
361
for i=1:length(variableNames)
362
    cmd=(['set(handles.edit' variableNames{i} ...
363
        ',''string'', num2str(stimulusParameters.' ...
364
        variableNames{i} '));']);
365
    eval(cmd);
366
end
367
% backgroundLevel is not a variableName (?!)
368
set(handles.editBackgroundLevel,'string', num2str...
369
    (stimulusParameters.backgroundLevel))
370

    
371
% on RUN the sample rate will be picked from the text box
372
% However, MAP overrules the sample rate and sets its own
373
aSetSampleRate(stimulusParameters.subjectSampleRate, handles);
374

    
375

    
376
% used for plotting functions (NB affected by paradigm settings)
377
experiment.predictionLevels=stimulusParameters.WRVlimits(1):...
378
    experiment.meanSearchStep:stimulusParameters.WRVlimits(2);
379
experiment.possLogSlopes=abs(experiment.possLogSlopes)*...
380
    sign(experiment.psyFunSlope);
381

    
382
aResetPopupMenus(handles)
383

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

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

    
394
    case {'2I2AFC++','2I2AFC+++'}
395
        set(handles.editstopCriteriaBox, 'string', ...
396
            num2str(experiment.stopCriteria2IFC))
397
    otherwise
398
        error([' aResetPopupMenus:  threshEstMethod not recognised -> ' ...
399
            experiment.threshEstMethod])
400
end
401

    
402
% forced noCue
403
switch experiment.paradigm
404
    case 'discomfort'
405
        set(handles.popupmenuCueNoCue,'value', 2)
406
end
407

    
408
%set variables popupmenus as specified in betweenRuns
409
variableParameter1ID=0; variableParameter2ID=0;
410
for i=1:length(variableNames)
411
    if strcmp(variableNames{i},betweenRuns.variableName1)
412
        variableParameter1ID=i;
413
    end
414
    if strcmp(variableNames{i},betweenRuns.variableName2)
415
        variableParameter2ID=i;
416
    end
417
end
418
if variableParameter1ID==0 || variableParameter2ID==0;
419
    Error('a ResetPopMenu: variableParameter not identified')
420
end
421

    
422
% display popupmenus
423
set(handles.popupmenuVaryParameter1, 'value',round(variableParameter1ID))
424
set(handles.popupmenuVaryParameter2, 'value',round(variableParameter2ID))
425

    
426
% targetType
427
idx= find(strcmp(stimulusParameters.targetType, targetTypes));
428
set(handles.popupmenuTargetType,'value', idx)
429

    
430
% paradigm selection may alter the maskerType
431
idx= find(strcmp(stimulusParameters.maskerType, maskerTypes));
432
set(handles.popupmenuMaskerType,'value', idx)
433

    
434
aShowRelevantObjects(handles)
435

    
436
% % backgroundType popup
437
idx= find(strcmp(stimulusParameters.backgroundType, backgroundTypes));
438
set(handles.popupmenuBackgroundType,'value', idx)
439
set(handles.editBackgroundLevel,'string', ...
440
    num2str(stimulusParameters.backgroundLevel))
441

    
442
% ---------------------------------------------- aShowRelevantObjects
443
function aShowRelevantObjects(handles)
444
global experiment stimulusParameters
445
% called from aShowRelevantObjects
446
% always on
447
set(handles.edittargetLevel, 'visible', 'on')
448
set(handles.edittargetDuration, 'visible', 'on')
449
set(handles.edittargetFrequency, 'visible', 'on')
450

    
451
switch experiment.ear
452
    case {'statsModelLogistic', 'statsModelRareEvent'}
453
        set(handles.editStatsModel, 'visible', 'on')
454
        set(handles.textStatsModel, 'visible', 'on')
455
        set(handles.pushbuttonStop, 'visible', 'on')
456
        showModelPushButtons(handles, 0)
457
        set(handles.editCatchTrialRate, 'visible', 'off')
458
        set(handles.textCatchTrials, 'visible', 'off')
459
        set(handles.editcalibrationdB, 'visible', 'off')
460
        set(handles.textcalibration, 'visible', 'off')
461
        set(handles.popupmenuCueNoCue, 'visible', 'off')
462
        set(handles.textCue, 'visible', 'off')
463
        set(handles.editMusicLevel,'visible', 'off')
464
        set(handles.textMusicLevel,'visible', 'off')
465

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

    
478
    otherwise
479
        % i.e. using real subjects (left, right, diotic, dichotic)
480
        set(handles.editStatsModel, 'visible', 'off')
481
        set(handles.textStatsModel, 'visible', 'off')
482
        set(handles.pushbuttonStop, 'visible', 'off')
483
        showModelPushButtons(handles, 0)
484
        set(handles.editCatchTrialRate, 'visible', 'on')
485
        set(handles.textCatchTrials, 'visible', 'on')
486
        set(handles.editcalibrationdB, 'visible', 'on')
487
        set(handles.textcalibration, 'visible', 'on')
488
        set(handles.popupmenuCueNoCue, 'visible', 'on')
489
        set(handles.textCue, 'visible', 'on')
490
        set(handles.editMusicLevel,'visible', 'on')
491
        set(handles.textMusicLevel,'visible', 'on')
492
end
493

    
494
switch experiment.threshEstMethod
495
    case {'MaxLikelihood','oneIntervalUpDown'}
496
        set(handles.popupmenuCueNoCue,'visible', 'on')
497
        set(handles.textCue,'visible', 'on')
498
        set(handles.editstopCriteriaBox, 'string', ...
499
            num2str(experiment.singleIntervalMaxTrials))
500

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

    
509
    case {'2I2AFC++','2I2AFC+++'}
510
        set(handles.editCatchTrialRate, 'visible', 'off')
511
        set(handles.textCatchTrials, 'visible', 'off')
512
        set(handles.popupmenuCueNoCue,'visible', 'off')
513
        set(handles.textCue,'visible', 'off')
514
        set(handles.editcueTestDifference,'visible', 'off')
515
        set(handles.textcueTestDifference,'visible', 'off')
516
end
517

    
518
% show/ remove masker related boxes
519
if ~experiment.maskerInUse
520
    set(handles.editmaskerDuration,'visible', 'off')
521
    set(handles.editmaskerLevel,'visible', 'off')
522
    set(handles.editmaskerRelativeFrequency,'visible', 'off')
523
    set(handles.editgapDuration,'visible', 'off')
524
    set(handles.textmaskerDuration,'visible', 'off')
525
    set(handles.textmaskerLevel,'visible', 'off')
526
    set(handles.textmaskerRelativeFrequency,'visible', 'off')
527
    set(handles.textgapDuration,'visible', 'off')
528
    set(handles.popupmenuMaskerType,'visible', 'off')
529
    set(handles.textMaskerType,'visible', 'off')
530

    
531
    % paradigms with maskers
532
else
533
    set(handles.editmaskerDuration,'visible', 'on')
534
    set(handles.editmaskerLevel,'visible', 'on')
535
    set(handles.editmaskerRelativeFrequency,'visible', 'on')
536
    set(handles.editgapDuration,'visible', 'on')
537
    set(handles.popupmenuMaskerType,'visible', 'on')
538
    set(handles.textmaskerDuration,'visible', 'on')
539
    set(handles.textmaskerLevel,'visible', 'on')
540
    set(handles.textmaskerRelativeFrequency,'visible', 'on')
541
    set(handles.textgapDuration,'visible', 'on')
542
    set(handles.popupmenuMaskerType,'visible', 'on')
543
    set(handles.textMaskerType,'visible', 'on')
544
    % masker relative frequency /type
545
    chosenOption=get(handles.popupmenuMaskerType,'value');
546
    maskerTypes=get(handles.popupmenuMaskerType,'string');
547
    maskerType=maskerTypes{chosenOption};
548
    switch maskerType
549
        case 'tone'
550
            set(handles.editmaskerRelativeFrequency,'visible', 'on')
551
        otherwise
552
            set(handles.editmaskerRelativeFrequency,'visible', 'off')
553
    end
554
end
555

    
556
eval(['set(handles.edit' stimulusParameters.WRVname ...
557
    ',''visible'',''off'' )'])
558

    
559
% target type
560
chosenOption=get(handles.popupmenuTargetType,'value');
561
targetTypes=get(handles.popupmenuTargetType,'string');
562
targetType=targetTypes{chosenOption};
563
switch targetType
564
    case 'tone'
565
        set(handles.edittargetFrequency,'visible', 'on')
566
    otherwise
567
        set(handles.edittargetFrequency,'visible', 'off')
568
end
569

    
570
if strcmp(stimulusParameters.backgroundType,'none')
571
    set(handles.popupmenuBackgroundType, 'visible', 'on');
572
    set(handles.editBackgroundLevel,'visible','off')
573
    set(handles.textBGlevel,'visible','off')
574
else
575
    set(handles.popupmenuBackgroundType, 'visible', 'on');
576
    set(handles.editBackgroundLevel,'visible','on')
577
    set(handles.textBGlevel,'visible','on')
578
end
579

    
580
% ------------------------------------------------ showModelPushButtons
581
function showModelPushButtons(handles,on)
582
if on
583
    set(handles.pushbuttonOME, 'visible', 'on')
584
    set(handles.pushbuttonBM, 'visible', 'on')
585
    set(handles.pushbuttonRP, 'visible', 'on')
586
    set(handles.pushbuttonAN, 'visible', 'on')
587
    set(handles.pushbuttonPhLk, 'visible', 'on')
588
    set(handles.pushbuttonSYN, 'visible', 'on')
589
    set(handles.pushbuttonFM, 'visible', 'on')
590
    set(handles.pushbuttonParams, 'visible', 'on')
591
    set(handles.pushbuttonSingleShot, 'visible', 'on')
592
    set(handles.editMAPplot,'visible', 'on')
593
    set(handles.textMAPplot,'visible', 'on')
594

    
595
else
596
    set(handles.pushbuttonOME, 'visible', 'off')
597
    set(handles.pushbuttonBM, 'visible', 'off')
598
    set(handles.pushbuttonRP, 'visible', 'off')
599
    set(handles.pushbuttonAN, 'visible', 'off')
600
    set(handles.pushbuttonPhLk, 'visible', 'off')
601
    set(handles.pushbuttonSYN, 'visible', 'off')
602
    set(handles.pushbuttonFM, 'visible', 'off')
603
    set(handles.pushbuttonParams, 'visible', 'off')
604
    set(handles.pushbuttonSingleShot, 'visible', 'off')
605
    set(handles.editMAPplot,'visible', 'off')
606
    set(handles.textMAPplot,'visible', 'off')
607

    
608
end
609

    
610
% ------------------------------------------------ pushbuttonRun_Callback
611
function pushbuttonRun_Callback(hObject, eventdata, handles)
612
global checkForPreviousGUI % holds screen positioning across repeated calls
613
global experiment betweenRuns paradigmNames errormsg
614
checkForPreviousGUI.GUIposition=get(handles.figure1,'position');
615
experiment.singleShot=0;
616
experiment.stop=0;
617

    
618
switch experiment.paradigm
619
    case 'profile'
620
        %% special option for two successive and linked measurements
621
        clc
622
        experiment.paradigm='threshold_16ms';
623
        set(handles.edittargetDuration,'string', num2str(0.25))
624
        set(handles.editstopCriteriaBox,'string','10') % nTrials
625
        run (handles)
626

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

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

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

    
652
        shortTone=resultsTable(2:end,2:end);
653

    
654
        % use these threshold for TMC
655
        thresholds16ms=betweenRuns.thresholds;
656
        optionNo=strmatch('TMC',paradigmNames);
657
        set(handles.popupmenuParadigm,'value',optionNo);
658
        aParadigmSelection(handles)
659
        set(handles.edittargetLevel,'string', thresholds16ms+10);
660
        set(handles.editstopCriteriaBox,'string','10')  % nTrials
661
        pause(.1)
662
        run (handles)
663

    
664
        if strcmp(errormsg,'manually stopped')
665
            disp(errormsg)
666
            optionNo=strmatch('profile',paradigmNames);
667
            set(handles.popupmenuParadigm,'value',optionNo);
668
            experiment.paradigm='profile';
669
            experiment.stop=-0;
670
            aParadigmSelection(handles)
671
            return
672
        end
673

    
674
        TMC=resultsTable(2:end,2:end);
675
        gaps=resultsTable(2:end,1);
676
        BFs=resultsTable(1, 2:end);
677

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

    
687

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

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

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

    
699
        if strcmp(errormsg,'manually stopped')
700
            disp(errormsg)
701
            optionNo=strmatch('profile',paradigmNames);
702
            set(handles.popupmenuParadigm,'value',optionNo);
703
            experiment.paradigm='profile';
704
            experiment.stop=-0;
705
            aParadigmSelection(handles)
706
            return
707
        end
708
    otherwise
709
        run (handles)
710
        experiment.stop=0;
711
end
712

    
713
function run (handles)
714
global experiment expGUIhandles stimulusParameters
715
tic
716
expGUIhandles=handles;
717
set(handles.pushbuttonStop, 'backgroundColor', [.941 .941 .941])
718
% set(handles.editparamChanges,'visible','off')
719

    
720
% message box white (removes any previous error message)
721
set(handles.textMSG,...
722
    'backgroundcolor', 'w', 'ForegroundColor', 'b', 'string', '')
723

    
724
errorMsg=aReadAndCheckParameterBoxes(handles);
725
if ~isempty(errorMsg)
726
    append=0;
727
    warning=1;
728
    addToMsg(['error message:' errorMsg], append, warning)
729
    return
730
end
731

    
732
if isnan(stimulusParameters.targetLevel)
733
    addToMsg('Error: targetlevel not set', 1)
734
    error('Error: targetlevel not set')
735
end
736

    
737
set(handles.textMSG,'backgroundcolor', 'w')
738
set(handles.textMSG,'string', ' ')
739

    
740
% leave the program and start up multiThreshold
741
subjGUI_MT % leave the program and start up multiThreshold
742
experiment.justInitialized=0;% prevents moving subjectGUI
743
toc
744

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

    
750
% special test for spontaneous activity
751
x=get(handles.editWRVstartValues, 'string');
752
y=get(handles.edittargetDuration, 'string');
753
set(handles.editWRVstartValues, 'string', '-20')
754
set(handles.edittargetDuration, 'string', '1')
755

    
756
MAPplot=get(handles.editMAPplot, 'string');
757
set(handles.editMAPplot, 'string', '1')
758
drawnow
759

    
760
run (handles)
761

    
762
set(handles.editMAPplot, 'string', MAPplot)
763
set(handles.editWRVstartValues, 'string', x)
764
set(handles.edittargetDuration, 'string', y)
765

    
766
% ------------------------------------------aReadAndCheckParameterBoxes
767
function errorMsg=aReadAndCheckParameterBoxes(handles)
768
global experiment  stimulusParameters betweenRuns  statsModel
769
global variableNames  LevittControl paramChanges
770
% When the program sets the parameters all should be well
771
% But when the user changes them...
772

    
773
errorMsg='';
774

    
775
% name
776
experiment.name=get(handles.editName,'string');
777

    
778
% ear/models
779
option=get(handles.popupmenuEar,'value');
780
strings=get(handles.popupmenuEar,'string');
781
experiment.ear=strings{option};
782

    
783
switch experiment.ear
784
    case { 'MAPmodel', 'MAPmodelMultiCh', ...
785
            'MAPmodelSingleCh', 'MAPmodelListen'}
786
        % MAPmodel writes forced parameter settings to the screen
787
        %  so that they can be read from there
788
        % {'randomize within blocks', 'fixed sequence',...
789
        %  'randomize across blocks'}
790
        set(handles.popupmenuRandomize,'value',2)       % fixed sequence
791
        set(handles.editstimulusDelay,'string','0.01')  % no stimulus delay
792
        stimulusParameters.includeCue=0;                % no cue for MAP
793
end
794

    
795
% find tone type
796
option=get(handles.popupmenuTargetType,'value');
797
strings=get(handles.popupmenuTargetType,'string');
798
stimulusParameters.targetType=strings{option};
799

    
800
% find masker type
801
option=get(handles.popupmenuMaskerType,'value');
802
strings=get(handles.popupmenuMaskerType,'string');
803
stimulusParameters.maskerType=strings{option};
804

    
805
% find background type and level
806
option=get(handles.popupmenuBackgroundType,'value');
807
strings=get(handles.popupmenuBackgroundType,'string');
808
stimulusParameters.backgroundTypeValue=option;
809
stimulusParameters.backgroundLevel=...
810
    str2num(get(handles.editBackgroundLevel,'string'));
811
stimulusParameters.backgroundType=strings{option};
812

    
813
% Read all stimulus parameter boxes
814
for i=1:length(variableNames)
815
    cmd=['stimulusParameters.' variableNames{i} ...
816
        '= str2num(get(handles.edit' variableNames{i} ',''string'' ));'];
817
    eval(cmd);
818
end
819
% for multiple levels
820
stimulusParameters.targetLevels=stimulusParameters.targetLevel;
821

    
822
% check that all required values are in the edit boxes
823
for i=1:length(variableNames)-3 % do not include 'level limits'
824
    eval([ 'variableValues=stimulusParameters.' variableNames{i} ';'])
825
    if isempty(variableValues), errorMsg=[ variableNames{i} ...
826
            ' is an empty box']; return, end
827
end
828

    
829
chosenOption=get(handles.popupmenuVaryParameter1,'value');
830
betweenRuns.variableName1=variableNames{chosenOption};
831
eval(['betweenRuns.variableList1 = stimulusParameters.' ...
832
    betweenRuns.variableName1 ';']);
833

    
834
chosenOption=get(handles.popupmenuVaryParameter2,'value');
835
betweenRuns.variableName2=variableNames{chosenOption};
836
eval(['betweenRuns.variableList2 = stimulusParameters.' ...
837
    betweenRuns.variableName2 ';']);
838

    
839
% Check that variable parameters 1 & 2 have different names
840
if strcmp(betweenRuns.variableName1,betweenRuns.variableName2) ...
841
        && ~strcmp(betweenRuns.variableName1,'none')
842
    errorMsg='variable parameters have the same name';
843
    return
844
end
845

    
846
% calibration
847
%  this is used to *reduce* the output signal from what it otherwise
848
%  would be
849
% signal values are between 1 - 2^23
850
%  these are interpreted as microPascals between -29 dB and 128 dB SPL
851
% calibrationdB adjusts these values to compensate for equipment
852
%  characteristics
853
%  this will change the range. e.g. a 7 dB calibration will yield
854
%   a range of -36 to 121 dB SPL
855
% Calibration is not used when modelling. Values are treated as dB SPL
856
stimulusParameters.calibrationdB=...
857
    str2num(get(handles.editcalibrationdB,'string'));
858

    
859
% check on cue
860
cueSetUp(handles)
861

    
862
stimulusParameters.WRVinitialStep=stimulusParameters.WRVsteps(1);
863
stimulusParameters.WRVsmallStep=stimulusParameters.WRVsteps(2);
864

    
865
% jitter start value set after reading in new parameters
866
switch experiment.paradigm
867
    case 'discomfort'
868
        stimulusParameters.jitterStartdB=0;
869
    otherwise
870
        stimulusParameters.jitterStartdB=abs(stimulusParameters.WRVsteps(1));
871
end
872

    
873

    
874
% stats model mean and slope
875
statsModelParameters= str2num(get(handles.editStatsModel,'string'));
876
switch experiment.ear
877
    case {'statsModelLogistic'}
878
        statsModel.logisticMean=statsModelParameters(1) ;
879
        statsModel.logisticSlope=statsModelParameters(2);
880
        statsModel.rareEvenGain=NaN ;
881
        statsModel.rareEventVmin=NaN;
882
    case 'statsModelRareEvent'
883
        statsModel.logisticMean=NaN ;
884
        statsModel.logisticSlope=NaN;
885
        statsModel.rareEvenGain=statsModelParameters(2) ;
886
        statsModel.rareEventVmin=statsModelParameters(1);
887
end
888

    
889
% MAP plotting
890
experiment.MAPplot=str2num(get(handles.editMAPplot,'string'));
891
% if ~isequal(experiment.MAPplot, 0),
892
%     % any other character will do it
893
%     experiment.MAPplot=1;
894
% end
895

    
896
% save data
897
experiment.saveData=str2num(get(handles.editSaveData,'string'));
898
if ~isequal(experiment.saveData, 0),
899
    % any other character will do it
900
    experiment.saveData=1;
901
end
902

    
903
% print tracks
904
experiment.printTracks=str2num(get(handles.editPrintTracks,'string'));
905
if ~isequal(experiment.printTracks, 0),
906
    % any other character will do it
907
    experiment.printTracks=1;
908
end
909

    
910
% catch trial rate
911
% (1)= start rate,   (2)= base rate,   (3)= time constant (trials)
912
stimulusParameters.catchTrialRates=...
913
    str2num(get(handles.editCatchTrialRate,'string'));
914
if stimulusParameters.catchTrialRates(1) ...
915
        < stimulusParameters.catchTrialRates(2)
916
    errorMsg=...
917
        'catch trial base rates must be less than catch trial start rate';
918
    return,
919
end
920

    
921
% sample rate
922
% The sample rate is set in the paradigm file.
923
% Normally this is set in the startUp paradigm file and then left
924
% When the model is used, the multiThreshold sample rate
925
% overrules anything in the model
926
stimulusParameters.sampleRate=...
927
    str2num(get(handles.textsampleRate,'string'));
928

    
929
% music level
930
stimulusParameters.musicLeveldB=...
931
    str2num(get(handles.editMusicLevel,'string'));
932

    
933
%  set message box font size
934
experiment.msgFontSize=str2num(get(handles.editMsgFont,'string'));
935
experiment.subjGUIfontSize=str2num(get(handles.editSubjectFont,'string'));
936

    
937
% stop criteria
938
experiment.singleIntervalMaxTrials=...
939
    str2num(get(handles.editstopCriteriaBox,'string'));
940
experiment.maxTrials=experiment.singleIntervalMaxTrials(1);
941

    
942
% set up 2IFC is required (? better in atrhesholdAssessmentMethod)
943
switch experiment.threshEstMethod
944
    case {'2I2AFC++', '2A2AIFC+++'}
945
        experiment.peaksUsed=experiment.singleIntervalMaxTrials(2);
946
        experiment.PeakTroughCriterionSD=...
947
            experiment.singleIntervalMaxTrials(3);
948
        experiment.trialsToBeUsed= 5;
949
        LevittControl.maxTrials=experiment.singleIntervalMaxTrials(1);
950
        % start value for step until reduced
951
        LevittControl.startLevelStep= stimulusParameters.WRVsteps(1);
952
        % reduced step size
953
        LevittControl.steadyLevittStep= stimulusParameters.WRVsteps(2);
954
        LevittControl.TurnsToSmallSteps= 2;
955
        LevittControl.useLastNturns= 2*experiment.peaksUsed;
956
        LevittControl.minReversals= ...
957
            LevittControl.TurnsToSmallSteps+2*experiment.peaksUsed;
958
        LevittControl.targetsdPT = experiment.PeakTroughCriterionSD;
959
        LevittControl.maxLevittValue= stimulusParameters.WRVlimits(2);
960
        Levitt2;
961
end
962

    
963
% What kind of randomisation is required?
964
idx=get(handles.popupmenuRandomize,'value');
965
s=get(handles.popupmenuRandomize,'string');
966
betweenRuns.randomizeSequence=s{idx};
967

    
968
% Make small adjustments to variable values
969
%  to keep values unique against later sorting
970
x=betweenRuns.variableList1;
971
[y idx]= sort(x);
972
for i=1:length(y)-1, if y(i+1)==y(i); y(i+1)=y(i)*1.001; end, end
973
x(idx)=y;
974
betweenRuns.variableList1=x;
975

    
976
x=betweenRuns.variableList2;
977
[y idx]= sort(x);
978
for i=1:length(y)-1, if y(i+1)==y(i); y(i+1)=y(i)*1.001; end, end
979
x(idx)=y;
980
betweenRuns.variableList2=x;
981

    
982
% Checks: after reading and setting parameters  ------------------------------------------
983
% check for finger trouble (more checks possible
984
if stimulusParameters.maskerDuration>10
985
    errorMsg='maskerDuration is too long'; return, end
986
if stimulusParameters.gapDuration>10
987
    errorMsg='gapDuration is too long'; return, end
988
if stimulusParameters.targetDuration>10
989
    errorMsg='targetDuration is too long'; return, end
990

    
991
% rare event slope check
992
if experiment.psyFunSlope<0 ...
993
        && strcmp(experiment.functionEstMethod,'rareEvent')
994
    errorMsg='cannot use rareEvent option for negative psychometr slopes';
995
    return
996
end
997

    
998
% check ramps
999
if stimulusParameters.rampDuration*2> stimulusParameters.targetDuration
1000
    errorMsg=' ramp duration is too long for the target';
1001
    return
1002
end
1003

    
1004
if max(stimulusParameters.maskerDuration)>0 ...
1005
        && max(stimulusParameters.rampDuration...
1006
        *2> stimulusParameters.maskerDuration)
1007
    errorMsg=' ramp duration is too long for the masker';
1008
    return
1009
end
1010

    
1011
% Check WRVstartValues for length and compatibility with randomization
1012
% only one start value supplied so all start values are the same
1013
if length(stimulusParameters.WRVstartValues)==1
1014
    stimulusParameters.WRVstartValues= ...
1015
        repmat(stimulusParameters.WRVstartValues, 1, ...
1016
        length(betweenRuns.variableList1)...
1017
        *length(betweenRuns.variableList2));
1018
elseif ~isequal(length(stimulusParameters.WRVstartValues), ...
1019
        length(betweenRuns.variableList1)...
1020
        *length(betweenRuns.variableList2))
1021
    % otherwise we need one value for each combination of var1/ var2
1022
    errorMsg='WRVstartValues not the same length as number of runs';
1023
    return
1024
elseif strcmp(betweenRuns.randomizeSequence, 'randomize within blocks')...
1025
        && length(stimulusParameters.WRVstartValues)>1
1026
    errorMsg='multiple WRVstartValues inappropriate';
1027
    return
1028
end
1029

    
1030
% set the target level in advance for every wnticipated run
1031
switch experiment.paradigm
1032
    case {'trainingIFMC', 'TMC','TMC_16ms', 'TMC - ELP', ...
1033
            'IFMC', 'IFMC_16ms'}
1034
        % For TMC and IFMC multiple target levels can be set
1035
        if length(stimulusParameters.targetLevel)==1
1036
            betweenRuns.targetLevels=...
1037
                repmat(stimulusParameters.targetLevel, 1, ...
1038
                length(betweenRuns.variableList1)...
1039
                *length(betweenRuns.variableList2));
1040
        elseif length(stimulusParameters.targetLevel)==...
1041
                length(betweenRuns.variableList2)
1042
            % only one level specified, so use this throughout
1043
            x=stimulusParameters.targetLevel;
1044
            x=repmat(x,length(betweenRuns.variableList1),1);
1045
            x=reshape(x,1,length(betweenRuns.variableList1)*length(betweenRuns.variableList2));
1046
            betweenRuns.targetLevels=x;
1047
        else
1048
            errorMsg='targetLevels not the same length as number of targetFrequencies';
1049
        end
1050
end
1051

    
1052
switch experiment.paradigm
1053
    case  {'gapDetection', 'frequencyDiscrimination'}
1054
        if ~isequal(stimulusParameters.targetDuration, ...
1055
                stimulusParameters.maskerDuration)
1056
            addToMsg(...
1057
                'Warning: masker and target duration not the same.',1,1)
1058
        end
1059
        if ~isequal(stimulusParameters.maskerLevel, ...
1060
                stimulusParameters.targetLevel)
1061
            addToMsg(['Warning: masker and target level different.'...
1062
                'They will be changed to be equal',1,1]);
1063
        end
1064
end
1065

    
1066
% identify model parameter changes if any
1067
paramChanges=get(handles.editparamChanges,'string');
1068
eval(paramChanges);
1069

    
1070
% -------------------------------------------- aSetSampleRate
1071
function aSetSampleRate(sampleRate, handles)
1072
global  stimulusParameters
1073
stimulusParameters.sampleRate=sampleRate;
1074
set(handles.textsampleRate,'string',num2str(stimulusParameters.sampleRate))
1075

    
1076
% -------------------------------------------- popupmenuEar_Callback
1077
function popupmenuEar_Callback(hObject, eventdata, handles)
1078
global experiment
1079
option=get(handles.popupmenuEar,'value');
1080
options=get(handles.popupmenuEar,'string');			% left/right/model
1081
experiment.ear=options{option};
1082
set(handles.editparamChanges,'visible','off')
1083
switch experiment.ear
1084
    case 'statsModelLogistic'
1085
        set(handles.editStatsModel,'string', '15, 0.5')
1086
    case 'statsModelRareEvent'
1087
        set(handles.editStatsModel,'string', '20 1')
1088
    case {'MAPmodelListen',  'MAPmodelMultiCh', 'MAPmodelSingleCh'}
1089
        set(handles.editparamChanges,'visible','on')
1090
end
1091
earSetUp(handles)
1092

    
1093
% -------------------------------------------- earSetUp
1094
function	earSetUp(handles)
1095
global experiment stimulusParameters
1096
% option=get(handles.popupmenuEar,'value');
1097
% options=get(handles.popupmenuEar,'string');			% left/right/model
1098
% experiment.ear=options{option};
1099

    
1100
switch experiment.ear
1101
    case {'statsModelLogistic'}
1102
        statsModel.logisticSlope=0.5;
1103
        statsModel.logisticMean=15;
1104
        set(handles.editStatsModel,'string', ...
1105
            num2str([statsModel.logisticMean statsModel.logisticSlope]))
1106
        set(handles.textStatsModel,...
1107
            'string', {'statsModel',' logistic threshold\ slope'})
1108
    case 'statsModelRareEvent'
1109
        set(handles.textStatsModel,'string', ...
1110
            {'statsModel',' rareEvent Vmin\ gain'})
1111
end
1112

    
1113
switch experiment.ear
1114
    case {'statsModelLogistic', 'statsModelRareEvent'}
1115
        set(handles.editStatsModel, 'visible', 'off')
1116
        set(handles.textStatsModel, 'visible', 'off')
1117

    
1118
        % default psychometric bin size and logistic slopes
1119
        set(handles.popupmenuRandomize,'value',2)   % fixed sequence
1120
        set(handles.editName,'string', 'statsModel')
1121
        %         experiment.headphonesUsed=0;
1122

    
1123
    case {'MAPmodelListen', 'MAPmodelMultiCh', 'MAPmodelSingleCh'}
1124
        stimulusParameters.includeCue=0;						 % no cue
1125
        set(handles.popupmenuCueNoCue,'value', 2)
1126

    
1127
        set(handles.editCatchTrialRate,'string','0 0  2 ');%no catch trials
1128
        set(handles.editName,'string', 'Normal')			% force name
1129
        experiment.name=get(handles.editName,'string');	% read name back
1130
        set(handles.editcalibrationdB,'string','0')
1131

    
1132
        set(handles.popupmenuRandomize,'value',2)       % fixed sequence
1133
        set(handles.editstimulusDelay,'string','0')
1134

    
1135
        set(handles.editSaveData,'string', '0')
1136
        set(handles.editSubjectFont,'string', '10');
1137
        experiment.MacGThreshold=0; % num MacG spikes to exceed threshold
1138
end
1139
aResetPopupMenus(handles)
1140

    
1141
% --------------------------------------------- popupmenuCueNoCue_Callback
1142
function popupmenuCueNoCue_Callback(hObject, eventdata, handles)
1143
cueSetUp(handles)
1144

    
1145
% ------------------------------------------------------------- cueSetUp
1146
function cueSetUp(handles)
1147
global stimulusParameters
1148

    
1149
chosenOption=get(handles.popupmenuCueNoCue,'value');
1150
if chosenOption==1
1151
    stimulusParameters.includeCue=1;
1152
    set(handles.editcueTestDifference,'visible', 'on')
1153
    set(handles.textcueTestDifference,'visible', 'on')
1154
    stimulusParameters.subjectText=stimulusParameters.instructions{2};
1155
else
1156
    stimulusParameters.includeCue=0;
1157
    set(handles.editcueTestDifference,'visible', 'off')
1158
    set(handles.textcueTestDifference,'visible', 'off')
1159
    stimulusParameters.subjectText= stimulusParameters.instructions{1};
1160
end
1161

    
1162
% -------------------------------------------- popupmenuThreshEst_Callback
1163
function popupmenuThreshEst_Callback(hObject, eventdata, handles)
1164
aThresholdAssessmentMethod(handles);
1165

    
1166
%  --------------------------------------------- aThresholdAssessmentMethod
1167
function aThresholdAssessmentMethod(handles)
1168
% identify the threshold assessment method
1169
%  and set various parameters on the GUI appropriately
1170
global stimulusParameters experiment  threshEstNames LevittControl
1171

    
1172
chosenOption=get(handles.popupmenuThreshEst,'value');
1173
experiment.threshEstMethod=threshEstNames{chosenOption};
1174
set(handles.editCatchTrialRate, 'visible', 'on')
1175
set(handles.textCatchTrials, 'visible', 'on')
1176

    
1177
% establish appropriate stop criterion and post on GUI
1178
switch experiment.threshEstMethod
1179
    case 'MaxLikelihood'
1180
        experiment.functionEstMethod='logisticML';
1181
        stimulusParameters.WRVsteps=10*experiment.psyFunSlope;  % ???
1182
        set(handles.textstopCriteria,'string', 'stop criteria \ maxTrials')
1183
        experiment.singleIntervalMaxTrials=experiment.stopCriteriaSI;
1184
        experiment.allowCatchTrials= 1;
1185
        switch experiment.paradigm
1186
            case 'training'
1187
                experiment.possLogSlopes=0.5;
1188
        end
1189

    
1190
    case 'oneIntervalUpDown'
1191
        experiment.functionEstMethod='logisticLS';
1192
        set(handles.textstopCriteria,'string', 'stop criteria \ maxTrials')
1193
        experiment.singleIntervalMaxTrials=experiment.stopCriteriaSI;
1194
        switch experiment.paradigm
1195
            case 'discomfort'
1196
                experiment.allowCatchTrials= 0;
1197
            otherwise
1198
                experiment.allowCatchTrials= 1;
1199
        end
1200

    
1201
    case {'2I2AFC++',  '2I2AFC+++'}
1202
        LevittControl.rule='++'; %  e.g. '++' or '+++'
1203
        experiment.singleIntervalMaxTrials=experiment.stopCriteria2IFC;
1204
        experiment.functionEstMethod='peaksAndTroughs';
1205
        LevittControl.maxTrials=experiment.singleIntervalMaxTrials(1);
1206
        set(handles.editWRVsteps,'string', ...
1207
            num2str(stimulusParameters.WRVsteps))
1208
        set(handles.textstopCriteria,'string', {'trials peaks sdCrit'})
1209
        experiment.allowCatchTrials= 0;
1210
end
1211

    
1212
set(handles.textstopCriteria,'fontSize',8)
1213
set(handles.editstopCriteriaBox,'string',...
1214
    num2str(experiment.singleIntervalMaxTrials))
1215

    
1216
% establish the appropriate instructions to the subject
1217
% NB responsibility for this is now transferred to the paradigm file
1218
switch experiment.threshEstMethod
1219
    % only one value required for level change
1220
    case {'2I2AFC++', '2A2AIFC+++'}
1221
        stimulusParameters.subjectText=...
1222
            'did the tone occur in window 1 or 2?';
1223
    case {'MaxLikelihood',  'oneIntervalUpDown'};
1224
        switch stimulusParameters.includeCue
1225
            case 0
1226
                stimulusParameters.subjectText=...
1227
                    stimulusParameters.instructions{1};
1228
            case 1
1229
                stimulusParameters.subjectText= ...
1230
                    stimulusParameters.instructions{2};
1231
        end
1232
end
1233
stimulusParameters.messageString={'training'};
1234

    
1235
aResetPopupMenus(handles)
1236
% -------------------------------------------------- function orderGlobals
1237
function orderGlobals
1238
global  stimulusParameters experiment betweenRuns withinRuns
1239

    
1240
stimulusParameters=[];
1241
stimulusParameters.sampleRate=		[];
1242
stimulusParameters.targetType=	'';
1243
stimulusParameters.targetFrequency=	[];
1244
stimulusParameters.targetDuration=	[];
1245
stimulusParameters.targetLevel=	[];
1246
stimulusParameters.gapDuration=	[];
1247
stimulusParameters.maskerType=	'';
1248
stimulusParameters.maskerRelativeFrequency=	[];
1249
stimulusParameters.maskerDuration=	[];
1250
stimulusParameters.maskerLevel=	[];
1251
stimulusParameters.backgroundType=	'';
1252
stimulusParameters.backgroundTypeValue=	[];
1253
stimulusParameters.backgroundLevel=	[];
1254
stimulusParameters.includeCue=	[];
1255
experiment.clickToStimulusPause=[];
1256
stimulusParameters.stimulusDelay=	[];
1257
stimulusParameters.rampDuration=	[];
1258
stimulusParameters.absThresholds=	[];
1259
stimulusParameters.numOHIOtones=	[];
1260

    
1261
stimulusParameters.WRVname=	'';
1262
stimulusParameters.WRVstartValues=		[];
1263
stimulusParameters.WRVsteps=	[];
1264
stimulusParameters.WRVlimits=	[];
1265
stimulusParameters.WRVinitialStep=		[];
1266
stimulusParameters.WRVsmallStep=	[];
1267
experiment.singleIntervalMaxTrials=	[];
1268
stimulusParameters.calibrationdB=	[];
1269

    
1270
stimulusParameters.catchTrialRates=	[];
1271
stimulusParameters.catchTrialBaseRate=	[];
1272
stimulusParameters.catchTrialRate=	[];
1273
stimulusParameters.catchTrialTimeConstant=	[];
1274

    
1275
stimulusParameters.dt=		[];
1276

    
1277
stimulusParameters.jitterStartdB=	[];
1278
stimulusParameters.restoreCalibration=	[];
1279
stimulusParameters.messageString=		[];
1280
stimulusParameters.cueTestDifference=	[];
1281
stimulusParameters.subjectText=	 '';
1282
stimulusParameters.testTargetBegins=	[];
1283
stimulusParameters.testTargetEnds=	[];
1284
stimulusParameters.musicLeveldB=	[];
1285

    
1286
stimulusParameters.subjectSampleRate=[];
1287
stimulusParameters.MAPSampleRate=[];
1288

    
1289
experiment=[];
1290
experiment.name=	'';
1291
experiment.date=	'';
1292
experiment.paradigm=	'';
1293
experiment.ear=	'';
1294
experiment.headphonesUsed=[];
1295
experiment.singleShot=	[];
1296
experiment.randomize=	'';
1297
experiment.maxTrials=	[];
1298
experiment.MacGThreshold=	[];
1299
experiment.resetCriterion=	[];
1300
experiment.runResetCriterion=	[];
1301

    
1302
experiment.comparisonData=	[];
1303
experiment.absThresholds=	[];
1304
experiment.threshEstMethod=	'';
1305
experiment.functionEstMethod=	'';
1306
experiment.psyBinWidth=	[];
1307
experiment.maxLogisticK=[];
1308
experiment.numPossLogisticK=[];
1309
experiment.possLogSlopes=	[];
1310
experiment.meanSearchStep=	[];
1311
experiment.psyFunSlope=	[];
1312
experiment.predictionLevels=[];
1313

    
1314
experiment.buttonBoxType=	'';
1315
experiment.buttonBoxStatus=	'';
1316
experiment.status=	'';
1317
experiment.stop=	[];
1318
experiment.pleaseRepeat=	[];
1319
experiment.justInitialized=[];
1320

    
1321
experiment.MAPplot=	    [];
1322
experiment.saveData=	[];
1323
experiment.printTracks=	[];
1324
experiment.msgFontSize=	[];
1325
experiment.subjGUIfontSize=	[];
1326

    
1327
experiment.timeAtStart=	'';
1328
experiment.minElapsed=	[];
1329

    
1330
betweenRuns=[];
1331
betweenRuns.variableName1=	'';
1332
betweenRuns.variableList1=	[];
1333
betweenRuns.variableName2=	'';
1334
betweenRuns.variableList2=	[];
1335
betweenRuns.var1Sequence=	[];
1336
betweenRuns.var2Sequence=	[];
1337
betweenRuns.randomizeSequence=[];
1338
betweenRuns.timeNow=	[];
1339
betweenRuns.runNumber=	[];
1340
betweenRuns.thresholds=	[];
1341
betweenRuns.forceThresholds=	[];
1342
betweenRuns.observationCount=	[];
1343
betweenRuns.timesOfFirstReversals=	[];
1344
betweenRuns.bestThresholdTracks='';
1345
betweenRuns.levelTracks='';
1346
betweenRuns.responseTracks='';
1347
betweenRuns.slopeKTracks=	[];
1348
betweenRuns.gainTracks=	[];
1349
betweenRuns.VminTracks=	[];
1350
betweenRuns.bestGain=	[];
1351
betweenRuns.bestVMin=	[];
1352
betweenRuns.bestPaMin=	[];
1353
betweenRuns.bestLogisticM=	[];
1354
betweenRuns.bestLogisticK=	[];
1355
betweenRuns.psychometicFunction='';
1356
betweenRuns.catchTrials=	[];
1357
betweenRuns.caughtOut=	[];
1358

    
1359
withinRuns=[];
1360
withinRuns.trialNumber=[];
1361
withinRuns.nowInPhase2=[];
1362
withinRuns.beginningOfPhase2=[];
1363
withinRuns.variableValue=[];
1364
withinRuns.direction='';
1365
withinRuns.peaks=[];
1366
withinRuns.troughs=	[];
1367
withinRuns.levelList=	[];
1368
withinRuns.responseList=	 [];
1369
withinRuns.meanEstTrack=	[];
1370
withinRuns.meanLogisticEstTrack=[];
1371
withinRuns.bestSlopeK=	[];
1372
withinRuns.bestGain=	[];
1373
withinRuns.bestVMin=	[];
1374
withinRuns.forceThreshold=[];
1375
withinRuns.catchTrial=	[];
1376
withinRuns.caughtOut=[];
1377
withinRuns.catchTrialCount=[];
1378
withinRuns.wrongButton=	[];
1379
withinRuns.babblePlaying=[];
1380

    
1381
% --- Executes on selection change in popupmenuBackgroundType.
1382
function popupmenuBackgroundType_Callback(hObject, eventdata, handles)
1383
global backgroundTypes
1384
option=get(handles.popupmenuBackgroundType,'value');
1385
selectedBackground=backgroundTypes{option};
1386
stimulusParameters.backgroundType=selectedBackground;
1387

    
1388
switch selectedBackground
1389
    case 'none'
1390
        set(handles.editBackgroundLevel,'visible','off')
1391
        set(handles.textBGlevel,'visible','off')
1392
    otherwise
1393
        set(handles.editBackgroundLevel,'visible','on')
1394
        set(handles.textBGlevel,'visible','on')
1395
end
1396

    
1397

    
1398
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1399
function pushbuttonStop_Callback(hObject, eventdata, handles)
1400
global experiment
1401
experiment.stop=1;
1402
disp('stop!')
1403
set(handles.pushbuttonStop, 'backgroundColor','r')
1404
pause(.1)
1405
drawnow
1406

    
1407
function pushbuttonOME_Callback(hObject, eventdata, handles)
1408
global experiment paramChanges
1409
aReadAndCheckParameterBoxes(handles);
1410
testOME(experiment.name, paramChanges);
1411

    
1412
function pushbuttonBM_Callback(hObject, eventdata, handles)
1413
global  stimulusParameters experiment paramChanges
1414
aReadAndCheckParameterBoxes(handles);
1415
relativeFrequencies=[0.25    .5   .75  1  1.25 1.5    2];
1416
AN_spikesOrProbability='probability';
1417
testBM(stimulusParameters.targetFrequency, ...
1418
    experiment.name,relativeFrequencies, AN_spikesOrProbability, ...
1419
    paramChanges);
1420

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

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

    
1431
function pushbuttonPhLk_Callback(hObject, eventdata, handles)
1432
global experiment
1433
aReadAndCheckParameterBoxes(handles);
1434
testPhaseLocking(experiment.name)
1435

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

    
1445
function pushbuttonFM_Callback(hObject, eventdata, handles)
1446
global stimulusParameters experiment paramChanges
1447
aReadAndCheckParameterBoxes(handles);
1448
showPSTHs=1;
1449
testFM(stimulusParameters.targetFrequency(1),experiment.name, ...
1450
    showPSTHs, paramChanges)
1451

    
1452
function popupmenuPhase_Callback(hObject, eventdata, handles)
1453
global stimulusParameters
1454

    
1455
optionNo=get(handles.popupmenuPhase,'value');
1456
options=get(handles.popupmenuPhase,'string');
1457
phase=options{optionNo};
1458
stimulusParameters.maskerPhase=phase;
1459
stimulusParameters.targetPhase=phase;
1460

    
1461
function pushbuttonParams_Callback(hObject, eventdata, handles)
1462
global experiment stimulusParameters
1463
aReadAndCheckParameterBoxes(handles);
1464
showParams=1; BFlist=-1;
1465
paramChanges=get(handles.editparamChanges,'string');
1466
eval(paramChanges);
1467

    
1468
paramFunctionName=['method=MAPparams' experiment.name ...
1469
    '(BFlist, stimulusParameters.sampleRate, showParams,paramChanges);'];
1470
eval(paramFunctionName) % go and fetch the parameters requesting parameter printout
1471

    
1472

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

    
1480
% function handles % ??
1481

    
1482

    
1483
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1484

    
1485
function editmaskerDuration_Callback(hObject, eventdata, handles)
1486

    
1487
function editmaskerDuration_CreateFcn(hObject, eventdata, handles)
1488
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1489
    set(hObject,'BackgroundColor','white');
1490
end
1491

    
1492
function editmaskerLevel_Callback(hObject, eventdata, handles)
1493

    
1494
function editmaskerLevel_CreateFcn(hObject, eventdata, handles)
1495
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1496
    set(hObject,'BackgroundColor','white');
1497
end
1498

    
1499
function editmaskerRelativeFrequency_Callback(hObject, eventdata, handles)
1500

    
1501
function editmaskerRelativeFrequency_CreateFcn(hObject, eventdata, handles)
1502
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1503
    set(hObject,'BackgroundColor','white');
1504
end
1505

    
1506
function editWRVstartValues_Callback(hObject, eventdata, handles)
1507

    
1508
function editWRVstartValues_CreateFcn(hObject, eventdata, handles)
1509
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1510
    set(hObject,'BackgroundColor','white');
1511
end
1512

    
1513
function editgapDuration_Callback(hObject, eventdata, handles)
1514

    
1515
function editgapDuration_CreateFcn(hObject, eventdata, handles)
1516
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1517
    set(hObject,'BackgroundColor','white');
1518
end
1519

    
1520
function edittargetDuration_Callback(hObject, eventdata, handles)
1521

    
1522
function edittargetDuration_CreateFcn(hObject, eventdata, handles)
1523
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1524
    set(hObject,'BackgroundColor','white');
1525
end
1526

    
1527
function edittargetLevel_Callback(hObject, eventdata, handles)
1528

    
1529
function edittargetLevel_CreateFcn(hObject, eventdata, handles)
1530
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1531
    set(hObject,'BackgroundColor','white');
1532
end
1533

    
1534
function editrampDuration_Callback(hObject, eventdata, handles)
1535

    
1536
function editrampDuration_CreateFcn(hObject, eventdata, handles)
1537
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1538
    set(hObject,'BackgroundColor','white');
1539
end
1540

    
1541
function editcueTestDifference_Callback(hObject, eventdata, handles)
1542

    
1543
function editcueTestDifference_CreateFcn(hObject, eventdata, handles)
1544
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1545
    set(hObject,'BackgroundColor','white');
1546
end
1547

    
1548

    
1549
function editWRVsteps_Callback(hObject, eventdata, handles)
1550

    
1551
function editWRVsteps_CreateFcn(hObject, eventdata, handles)
1552
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1553
    set(hObject,'BackgroundColor','white');
1554
end
1555

    
1556
function editWRVlimits_Callback(hObject, eventdata, handles)
1557

    
1558
function editWRVlimits_CreateFcn(hObject, eventdata, handles)
1559
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1560
    set(hObject,'BackgroundColor','white');
1561
end
1562

    
1563
function edittargetFrequency_Callback(hObject, eventdata, handles)
1564

    
1565
function edittargetFrequency_CreateFcn(hObject, eventdata, handles)
1566
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1567
    set(hObject,'BackgroundColor','white');
1568
end
1569

    
1570
function editName_Callback(hObject, eventdata, handles)
1571

    
1572
function editName_CreateFcn(hObject, eventdata, handles)
1573
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1574
    set(hObject,'BackgroundColor','white');
1575
end
1576

    
1577
function editcalibrationdB_Callback(hObject, eventdata, handles)
1578

    
1579
function editcalibrationdB_CreateFcn(hObject, eventdata, handles)
1580
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1581
    set(hObject,'BackgroundColor','white');
1582
end
1583

    
1584
function editMAPplot_Callback(hObject, eventdata, handles)
1585

    
1586
function editMAPplot_CreateFcn(hObject, eventdata, handles)
1587
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1588
    set(hObject,'BackgroundColor','white');
1589
end
1590

    
1591
function editMsgFont_Callback(hObject, eventdata, handles)
1592

    
1593
function editMsgFont_CreateFcn(hObject, eventdata, handles)
1594
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1595
    set(hObject,'BackgroundColor','white');
1596
end
1597

    
1598
function editCatchTrialRate_Callback(hObject, eventdata, handles)
1599

    
1600
function editCatchTrialRate_CreateFcn(hObject, eventdata, handles)
1601
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1602
    set(hObject,'BackgroundColor','white');
1603
end
1604

    
1605

    
1606
function editSaveData_Callback(hObject, eventdata, handles)
1607

    
1608
function editSaveData_CreateFcn(hObject, eventdata, handles)
1609
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1610
    set(hObject,'BackgroundColor','white');
1611
end
1612

    
1613
function editStatsModel_Callback(hObject, eventdata, handles)
1614

    
1615
function editStatsModel_CreateFcn(hObject, eventdata, handles)
1616
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1617
    set(hObject,'BackgroundColor','white');
1618
end
1619

    
1620
function editBackgroundLevel_Callback(hObject, eventdata, handles)
1621

    
1622
function editBackgroundLevel_CreateFcn(hObject, eventdata, handles)
1623
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1624
    set(hObject,'BackgroundColor','white');
1625
end
1626

    
1627
function editPrintTracks_Callback(hObject, eventdata, handles)
1628

    
1629
function editPrintTracks_CreateFcn(hObject, eventdata, handles)
1630
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1631
    set(hObject,'BackgroundColor','white');
1632
end
1633

    
1634
function editstopCriteriaBox_Callback(hObject, eventdata, handles)
1635

    
1636
function editstopCriteriaBox_CreateFcn(hObject, eventdata, handles)
1637

    
1638
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1639
    set(hObject,'BackgroundColor','white');
1640
end
1641

    
1642
function editstimulusDelay_Callback(hObject, eventdata, handles)
1643

    
1644
function editstimulusDelay_CreateFcn(hObject, eventdata, handles)
1645
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1646
    set(hObject,'BackgroundColor','white');
1647
end
1648

    
1649

    
1650
function popupmenuCueNoCue_CreateFcn(hObject, eventdata, handles)
1651
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1652
    set(hObject,'BackgroundColor','white');
1653
end
1654

    
1655
function popupmenuEar_CreateFcn(hObject, eventdata, handles)
1656
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1657
    set(hObject,'BackgroundColor','red');
1658
end
1659

    
1660
function popupmenuVaryParameter1_Callback(hObject, eventdata, handles)
1661

    
1662
function popupmenuVaryParameter1_CreateFcn(hObject, eventdata, handles)
1663
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1664
    set(hObject,'BackgroundColor','white');
1665
end
1666

    
1667
function popupmenuVaryParameter2_Callback(hObject, eventdata, handles)
1668

    
1669
function popupmenuVaryParameter2_CreateFcn(hObject, eventdata, handles)
1670
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1671
    set(hObject,'BackgroundColor','white');
1672
end
1673

    
1674
function popupmenuRandomize_Callback(hObject, eventdata, handles)
1675

    
1676
function popupmenuRandomize_CreateFcn(hObject, eventdata, handles)
1677
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1678
    set(hObject,'BackgroundColor','white');
1679
end
1680

    
1681
function popupmenuParadigm_CreateFcn(hObject, eventdata, handles)
1682
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1683
    set(hObject,'BackgroundColor','white');
1684
end
1685

    
1686

    
1687
function popupmenuMaskerType_CreateFcn(hObject, eventdata, handles)
1688

    
1689
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1690
    set(hObject,'BackgroundColor','white');
1691
end
1692

    
1693

    
1694
function popupmenuThreshEst_CreateFcn(hObject, eventdata, handles)
1695
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1696
    set(hObject,'BackgroundColor','white');
1697
end
1698

    
1699
function popupmenuBackgroundType_CreateFcn(hObject, eventdata, handles)
1700

    
1701
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1702
    set(hObject,'BackgroundColor','white');
1703
end
1704

    
1705

    
1706
function popupmenuTargetType_CreateFcn(hObject, eventdata, handles)
1707
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1708
    set(hObject,'BackgroundColor','white');
1709
end
1710

    
1711
function editSubjectFont_Callback(hObject, eventdata, handles)
1712

    
1713
function editSubjectFont_CreateFcn(hObject, eventdata, handles)
1714
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1715
    set(hObject,'BackgroundColor','white');
1716
end
1717

    
1718
function editMusicLevel_Callback(hObject, eventdata, handles)
1719

    
1720
function editMusicLevel_CreateFcn(hObject, eventdata, handles)
1721
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1722
    set(hObject,'BackgroundColor','white');
1723
end
1724

    
1725
function figure1_ButtonDownFcn(hObject, eventdata, handles)
1726

    
1727

    
1728
function edit33_Callback(hObject, eventdata, handles)
1729

    
1730
function edit33_CreateFcn(hObject, eventdata, handles)
1731
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1732
    set(hObject,'BackgroundColor','white');
1733
end
1734

    
1735

    
1736
function popupmenuPhase_CreateFcn(hObject, eventdata, handles)
1737
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1738
    set(hObject,'BackgroundColor','white');
1739
end
1740

    
1741
function editsegSize_Callback(hObject, eventdata, handles)
1742

    
1743
function editsegSize_CreateFcn(hObject, eventdata, handles)
1744
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1745
    set(hObject,'BackgroundColor','white');
1746
end
1747

    
1748

    
1749
function editnumOHIOtones_Callback(hObject, eventdata, handles)
1750
% hObject    handle to editnumOHIOtones (see GCBO)
1751
% eventdata  reserved - to be defined in a future version of MATLAB
1752
% handles    structure with handles and user data (see GUIDATA)
1753

    
1754
% Hints: get(hObject,'String') returns contents of editnumOHIOtones as text
1755
%        str2double(get(hObject,'String')) returns contents of editnumOHIOtones as a double
1756

    
1757

    
1758
% --- Executes during object creation, after setting all properties.
1759
function editnumOHIOtones_CreateFcn(hObject, eventdata, handles)
1760
% hObject    handle to editnumOHIOtones (see GCBO)
1761
% eventdata  reserved - to be defined in a future version of MATLAB
1762
% handles    empty - handles not created until after all CreateFcns called
1763

    
1764
% Hint: edit controls usually have a white background on Windows.
1765
%       See ISPC and COMPUTER.
1766
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1767
    set(hObject,'BackgroundColor','white');
1768
end
1769

    
1770

    
1771

    
1772

    
1773

    
1774
function editparamChanges_Callback(hObject, eventdata, handles)
1775

    
1776

    
1777
function editparamChanges_CreateFcn(hObject, eventdata, handles)
1778

    
1779
% Hint: edit controls usually have a white background on Windows.
1780
%       See ISPC and COMPUTER.
1781
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1782
    set(hObject,'BackgroundColor','white');
1783
end
1784

    
1785