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 / multiThreshold.m

History | View | Annotate | Download (66.2 KB)

1 36:3ea506487b3b rmeddis
% multiThreshold = '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 = multiThreshold(varargin)
26
%MULTITHRESHOLD M-file for multiThreshold.fig
27
%      MULTITHRESHOLD, by itself, creates a new MULTITHRESHOLD or raises the existing
28
%      singleton*.
29
%
30
%      H = MULTITHRESHOLD returns the handle to a new MULTITHRESHOLD or the handle to
31
%      the existing singleton*.
32
%
33
%      MULTITHRESHOLD('Property','Value',...) creates a new MULTITHRESHOLD using the
34
%      given property value pairs. Unrecognized properties are passed via
35
%      varargin to multiThreshold_OpeningFcn.  This calling syntax produces a
36
%      warning when there is an existing singleton*.
37
%
38
%      MULTITHRESHOLD('CALLBACK') and MULTITHRESHOLD('CALLBACK',hObject,...) call the
39
%      local function named CALLBACK in MULTITHRESHOLD.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 multiThreshold
48
49 38:c2204b18f4a2 rmeddis
% Last Modified by GUIDE v2.5 25-Oct-2011 07:51:14
50 36:3ea506487b3b rmeddis
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', @multiThreshold_OpeningFcn, ...
56
    'gui_OutputFcn',  @multiThreshold_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
% --------------------------------------------------  multiThreshold_OpeningFcn
71
function multiThreshold_OpeningFcn(hObject, eventdata, handles, varargin)
72
73
% Choose default command line output for multiThreshold
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 = multiThreshold_OutputFcn(hObject, eventdata, handles)
85
% Get default command line output from handles structure
86
initializeGUI(handles)
87
varargout{1} = handles.output;
88
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
89
90
% -----------------------------------------------------initializeGUI
91
function initializeGUI(handles)
92
% Populate the edit boxes and popup menus on the GUI
93
% Then wait for user action
94
global stimulusParameters experiment betweenRuns
95
global targetTypes maskerTypes backgroundTypes
96 38:c2204b18f4a2 rmeddis
global variableNames paradigmNames threshEstNames  cueNames betweenRunsVariables
97 36:3ea506487b3b rmeddis
98
% Specify order of fields in main structures
99
% identify as empty values or empty strings only
100
orderGlobals
101
102
addpath ('paradigms')   %paradigm informations is stored here
103
addpath (['..' filesep 'testPrograms']) % model physiology tests
104
105
% specify all variables that  need to be set on the GUI
106
variableNames={'stimulusDelay','maskerDuration','maskerLevel',...
107
    'maskerRelativeFrequency', 'targetFrequency', 'gapDuration',...
108
    'targetDuration','targetLevel','rampDuration',...
109 38:c2204b18f4a2 rmeddis
    'cueTestDifference', 'WRVstartValues', 'WRVsteps', 'WRVlimits',...
110
    'OHIOnTones'};
111 36:3ea506487b3b rmeddis
112
% Variable variables
113
%  (names of variable that can changed between runs)
114
betweenRunsVariables={'stimulusDelay','maskerDuration','maskerLevel',...
115
    'maskerRelativeFrequency','targetFrequency', 'gapDuration',...
116 38:c2204b18f4a2 rmeddis
    'targetDuration','targetLevel','OHIOnTones'};
117 36:3ea506487b3b rmeddis
% populate the 'between runs variable' menus
118
set(handles.popupmenuVaryParameter1,'string',betweenRunsVariables)
119
set(handles.popupmenuVaryParameter2,'string',betweenRunsVariables)
120
121
% Trial presentation order - randomize at startup
122
presentationOrderNames={'randomize within blocks', 'fixed sequence', ...
123
    'randomize across blocks'};
124
set(handles.popupmenuRandomize,'string', presentationOrderNames)
125
126
% targetType- value must be set in paradigm
127
targetTypes={'tone','noise', 'pinkNoise','whiteNoise','24TalkerBabble',...
128
    'speech', 'Twister','digitStrings'};
129
set(handles.popupmenuTargetType, 'string', targetTypes);
130
131
% maskerType - value must be set in paradigm
132
maskerTypes={'tone','noise', 'pinkNoise','TEN','whiteNoise','24TalkerBabble', ...
133
    'speech'};
134
set(handles.popupmenuMaskerType, 'string', maskerTypes);
135
136
% background Type- value must be set in paradigm (default = 1, 'none')
137
backgroundTypes={'none','noise', 'pinkNoise', 'TEN','noiseDich',...
138
    'pinkNoiseDich','whiteNoise','24TalkerBabble',...
139
    '16TalkerBabble','8TalkerBabble','4TalkerBabble',...
140
    '4TalkerReversedBabble','2TalkerBabble','1TalkerBabble'};
141
set(handles.popupmenuBackgroundType, 'string', backgroundTypes);
142
set(handles.editBackgroundLevel,'string', '0')
143
144
% Establish available paradigms by scanning paradigms folder
145
paradigmNames= what('paradigms');
146
paradigmNames= paradigmNames.m; % select m files only
147 38:c2204b18f4a2 rmeddis
idx=strmatch('paradigm_', paradigmNames); % with 'paradigm_'
148
paradigmNames=paradigmNames(idx);
149 36:3ea506487b3b rmeddis
for i=1:length(paradigmNames)   % strip off file extension
150
    paradigmNames{i}=paradigmNames{i}(10:end-2);
151
end
152
set(handles.popupmenuParadigm,'string', paradigmNames)
153
154
% startup paradigm, 'training' (could be anywhere on the list)
155
startupParadigm='training';
156
idx= find(strcmp(paradigmNames,startupParadigm));
157
if ~isempty(idx)
158
    set(handles.popupmenuParadigm,'value', idx)
159
else
160
    % training paradigm must exist
161
    error(['expGUI_MT\initializeGUI: No ' startupParadigm...
162
        ' paradigm found in paradigms folder'])
163
end
164
165
earOptions={'left', 'right',  'diotic', 'dichoticLeft', 'dichoticRight',...
166
    'MAPmodelListen',  'MAPmodelMultiCh', 'MAPmodelSingleCh'...
167
    'statsModelLogistic','statsModelRareEvent'};
168
set(handles.popupmenuEar,'string', earOptions)
169
defaultOption=1;
170
experiment.ear=earOptions{defaultOption};
171
set(handles.popupmenuEar,'value', defaultOption)    % 'left' is deafult
172
set(handles.pushbuttonSingleShot, 'visible', 'off') % use only for MAP
173
174
% phase
175
phaseOptions={'sin','cos','alt','rand'};
176
set(handles.popupmenuPhase,'string', phaseOptions)
177
set(handles.popupmenuPhase,'value', 1)
178
179
% Cue
180
cueNames={'cued', 'noCue'};
181
set(handles.popupmenuCueNoCue, 'string', cueNames);
182
set(handles.popupmenuCueNoCue, 'value', 1);
183
184
% threshold assessment method - value must be set in paradigm
185
threshEstNames={'oneIntervalUpDown', 'MaxLikelihood', ...
186
    '2I2AFC++', '2I2AFC+++'};
187
set(handles.popupmenuThreshEst, 'string', threshEstNames);
188
experiment.stopCriteria2IFC=[75 3 5];
189 38:c2204b18f4a2 rmeddis
experiment.stopCriteriaSI=20;
190 36:3ea506487b3b rmeddis
191
% ** editBoxes that are only set by hand
192
% music (relative) level, 'tada!' (manual setting only)
193
% increase for the hard of hearing
194
set(handles.editMusicLevel,'string','0')
195
196
% Catch Trial Rate
197 38:c2204b18f4a2 rmeddis
set(handles.editCatchTrialRate,'string','0.2   0.1  ');
198 36:3ea506487b3b rmeddis
199
% calibration
200
stimulusParameters.restoreCalibration=7;
201
set(handles.editcalibrationdB,'string',...
202
    stimulusParameters.restoreCalibration)
203
204
% a MAPplot
205
experiment.MAPplot=0;	%default
206
set(handles.editMAPplot,'string',num2str(experiment.MAPplot))
207
208
% saveData
209
experiment.saveData=1;
210
set(handles.editSaveData,'string',num2str(experiment.saveData))
211 38:c2204b18f4a2 rmeddis
set(handles.pushbuttonSave,'visible','off')
212 36:3ea506487b3b rmeddis
213
% printTracks
214
experiment.printTracks=0;
215
set(handles.editPrintTracks,'string',num2str(experiment.printTracks))
216
217
% standard delay between button press and initiation of next stimulus
218
experiment.clickToStimulusPause=1;
219
220
% buttonBoxType: NB no problem if mouse is used instead
221
experiment.buttonBoxType='square';
222
223
% estimation of the mean
224
% {'logisticLS', 'logisticML', 'rareEvent'}
225
experiment.functionEstMethod='logisticLS';
226
227
% message box
228
set(handles.textMSG,'backgroundcolor', 'w', 'ForegroundColor', 'b', 'string', '')
229
set(handles.editMsgFont,'string','10')
230
set(handles.editSubjectFont,'string','14')
231
232
% default psychometric bin size and logistic slopes
233
experiment.psyBinWidth=1;  % dB
234
maxLogisticK=2; % steepest slope contemplated
235
experiment.maxLogisticK=maxLogisticK;
236
experiment.numPossLogisticK=100;
237
experiment.possLogSlopes= ...
238
    0.01: maxLogisticK/experiment.numPossLogisticK: maxLogisticK;
239
experiment.meanSearchStep=0.25; % dB
240
241
% indicate that this is the first run and the GUI should be located in
242
% default location.
243
experiment.justInitialized=1;
244
245
% set up GUI based on training paradigm
246
aParadigmSelection(handles);
247
earSetUp(handles)
248
aThresholdAssessmentMethod(handles)
249
aShowRelevantObjects(handles)
250
251
% Done. Now wait for action
252
253
% -------------------------------------------- popupmenuMaskerType_Callback
254
function popupmenuMaskerType_Callback(hObject, eventdata, handles)
255
% show or remove masker frequency box
256
aShowRelevantObjects(handles)
257
258
% -------------------------------------------- popupmenuTargetType_Callback
259
function popupmenuTargetType_Callback(hObject, eventdata, handles)
260
% show or remove target frequency box
261
aShowRelevantObjects(handles)
262
263
% -------------------------------------------- popupmenuParadigm_Callback
264
function popupmenuParadigm_Callback(hObject, eventdata, handles)
265
% Any change to the paradigm selection causes all boxes to be shown
266
% showParameters(handles)
267
aParadigmSelection(handles);
268
269
% -------------------------------------------- aParadigmSelection
270
function aParadigmSelection(handles)
271
global experiment stimulusParameters betweenRuns  paradigmNames
272
global variableNames
273
274
% identify paradigm selected
275
chosenOption=get(handles.popupmenuParadigm,'value');
276
paradigm=paradigmNames{chosenOption};
277
experiment.paradigm=paradigm;
278
279
%Paradigm: read in all relevant parameters
280
% a file must exist with this name 'paradigm_<paradigm>'
281
% 'handles' are only occasionally used
282
addpath ('paradigms')
283
cmd=['paradigm_' paradigm '(handles);'];
284
try
285
    eval(cmd)
286
catch
287
    error(['ExpGUI\aParadigmSelection:'...
288
        'paradigm file not found or error in file'])
289
end
290
rmpath ('paradigms')
291
292
if ~isfield(experiment,'maskerInUse')
293
    error('selected paradigm does not specify if masker is used')
294
end
295
296
297
if ~experiment.maskerInUse
298
    stimulusParameters.maskerType='tone';
299
    stimulusParameters.maskerPhase='sin';
300
    stimulusParameters.maskerDuration=0.0;
301
    stimulusParameters.maskerLevel= -50;
302
    stimulusParameters.maskerRelativeFrequency= 1 ;
303
end
304
305
% if a variable is subject to change, specify list of values here
306
% eg. stimulusParameters.targetFrequency=betweenRuns.variableList1;
307
cmd=['stimulusParameters.' ...
308
    betweenRuns.variableName1 '=betweenRuns.variableList1;'];
309
eval (cmd);
310
cmd=['stimulusParameters.' ...
311
    betweenRuns.variableName2 '=betweenRuns.variableList2;'];
312
eval (cmd);
313
314
% establish popup menus on the basis of the paradigm file
315
% set(handles.popupmenuRandomize,'value', betweenRuns.randomizeSequence)
316
sequenceOptions=get(handles.popupmenuRandomize,'string');
317
idx=find(strcmp(betweenRuns.randomizeSequence, sequenceOptions)==1);
318
set(handles.popupmenuRandomize,'value', idx)
319
320
phaseOptions=get(handles.popupmenuPhase,'string');
321
idx=find(strcmp(stimulusParameters.maskerPhase, phaseOptions)==1);
322
set(handles.popupmenuPhase,'value', idx)
323
324
if stimulusParameters.includeCue
325
    set(handles.popupmenuCueNoCue,'value', 1)
326
else
327
    set(handles.popupmenuCueNoCue,'value', 2)
328
end
329
330
set(handles.text34, 'string', stimulusParameters.WRVname)
331
332
% Put the new data values into the edit boxes on the GUI
333
for i=1:length(variableNames)
334
    cmd=(['set(handles.edit' variableNames{i} ...
335
        ',''string'', num2str(stimulusParameters.' ...
336
        variableNames{i} '));']);
337
    eval(cmd);
338
end
339
% backgroundLevel is not a variableName (?!)
340
set(handles.editBackgroundLevel,'string', num2str...
341
    (stimulusParameters.backgroundLevel))
342
343 38:c2204b18f4a2 rmeddis
% values related to assessment method
344
switch experiment.threshEstMethod
345
    case {'MaxLikelihood','oneIntervalUpDown'}
346
        set(handles.editstopCriteriaBox, 'string', ...
347
            num2str(experiment.singleIntervalMaxTrials))
348
    case {'2I2AFC++','2I2AFC+++'}
349
        set(handles.editstopCriteriaBox, 'string', ...
350
            num2str(experiment.stopCriteria2IFC))
351
    otherwise
352
        error([' aResetPopupMenus:  threshEstMethod not recognised -> ' ...
353
            experiment.threshEstMethod])
354
end
355
% assessment method popup may be changed between paradigms
356
%  e.g. SRT must be one interval
357
x=get(handles.popupmenuThreshEst, 'string');
358
set(handles.popupmenuThreshEst, 'value', ...
359
    strmatch(experiment.threshEstMethod, x));
360
361
362 36:3ea506487b3b rmeddis
% on RUN the sample rate will be picked from the text box
363
% However, MAP overrules the sample rate and sets its own
364
aSetSampleRate(stimulusParameters.subjectSampleRate, handles);
365
366
367
% used for plotting functions (NB affected by paradigm settings)
368
experiment.predictionLevels=stimulusParameters.WRVlimits(1):...
369
    experiment.meanSearchStep:stimulusParameters.WRVlimits(2);
370
experiment.possLogSlopes=abs(experiment.possLogSlopes)*...
371
    sign(experiment.psyFunSlope);
372
373
aResetPopupMenus(handles)
374
375
% ------------------------------------------------------ aResetPopupMenus
376
function aResetPopupMenus(handles)
377
global   stimulusParameters betweenRuns variableNames
378 38:c2204b18f4a2 rmeddis
global targetTypes maskerTypes experiment backgroundTypes betweenRunsVariables
379 36:3ea506487b3b rmeddis
380
switch experiment.threshEstMethod
381
    case {'MaxLikelihood','oneIntervalUpDown'}
382
        set(handles.editstopCriteriaBox, 'string', ...
383
            num2str(experiment.singleIntervalMaxTrials))
384
385
    case {'2I2AFC++','2I2AFC+++'}
386
        set(handles.editstopCriteriaBox, 'string', ...
387
            num2str(experiment.stopCriteria2IFC))
388
    otherwise
389
        error([' aResetPopupMenus:  threshEstMethod not recognised -> ' ...
390
            experiment.threshEstMethod])
391
end
392
393
% forced noCue
394
switch experiment.paradigm
395
    case 'discomfort'
396
        set(handles.popupmenuCueNoCue,'value', 2)
397
end
398
399
%set variables popupmenus as specified in betweenRuns
400
variableParameter1ID=0; variableParameter2ID=0;
401 38:c2204b18f4a2 rmeddis
for i=1:length(betweenRunsVariables) %  variableNames
402
    if strcmp(betweenRunsVariables{i},betweenRuns.variableName1)
403 36:3ea506487b3b rmeddis
        variableParameter1ID=i;
404
    end
405 38:c2204b18f4a2 rmeddis
    if strcmp(betweenRunsVariables{i},betweenRuns.variableName2)
406 36:3ea506487b3b rmeddis
        variableParameter2ID=i;
407
    end
408
end
409
if variableParameter1ID==0 || variableParameter2ID==0;
410
    Error('a ResetPopMenu: variableParameter not identified')
411
end
412
413
% display popupmenus
414
set(handles.popupmenuVaryParameter1, 'value',round(variableParameter1ID))
415
set(handles.popupmenuVaryParameter2, 'value',round(variableParameter2ID))
416
417
% targetType
418
idx= find(strcmp(stimulusParameters.targetType, targetTypes));
419
set(handles.popupmenuTargetType,'value', idx)
420
421
% paradigm selection may alter the maskerType
422
idx= find(strcmp(stimulusParameters.maskerType, maskerTypes));
423
set(handles.popupmenuMaskerType,'value', idx)
424
425
aShowRelevantObjects(handles)
426
427
% % backgroundType popup
428
idx= find(strcmp(stimulusParameters.backgroundType, backgroundTypes));
429
set(handles.popupmenuBackgroundType,'value', idx)
430
set(handles.editBackgroundLevel,'string', ...
431
    num2str(stimulusParameters.backgroundLevel))
432
433
% ---------------------------------------------- aShowRelevantObjects
434
function aShowRelevantObjects(handles)
435
global experiment stimulusParameters
436
% called from aShowRelevantObjects
437
% always on
438
set(handles.edittargetLevel, 'visible', 'on')
439
set(handles.edittargetDuration, 'visible', 'on')
440
set(handles.edittargetFrequency, 'visible', 'on')
441
442 38:c2204b18f4a2 rmeddis
switch experiment.paradigm(1:3)
443
    case 'OHI'
444
        set(handles.editOHIOnTones, 'visible', 'on')
445
        set(handles.textOHIOnTones, 'visible', 'on')
446
    otherwise
447
        set(handles.editOHIOnTones, 'visible', 'off')
448
        set(handles.textOHIOnTones, 'visible', 'off')
449
end
450
451 36:3ea506487b3b rmeddis
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 stimulusParameters 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  successive and linked measurements
621
        global resultsTable
622
        experiment.paradigm='threshold_16ms';
623
        set(handles.edittargetDuration,'string', num2str(0.25))
624
        set(handles.editstopCriteriaBox,'string','10') % nTrials
625
        run (handles)
626
        if experiment.stop
627
            optionNo=strmatch('profile',paradigmNames);
628
            set(handles.popupmenuParadigm,'value',optionNo);
629
            experiment.paradigm='profile';
630
            aParadigmSelection(handles)
631
            return
632
        end
633
634
        longTone=resultsTable(2:end,2:end);
635
        set(handles.edittargetDuration,'string', num2str(0.016))
636
        set(handles.editstopCriteriaBox,'string','30') % nTrials
637
        run (handles)
638
        if experiment.stop
639
            disp(errormsg)
640
            optionNo=strmatch('profile',paradigmNames);
641
            set(handles.popupmenuParadigm,'value',optionNo);
642
            experiment.paradigm='profile';
643
            experiment.stop=-0;
644
            aParadigmSelection(handles)
645
            return
646
        end
647
        shortTone=resultsTable(2:end,2:end);
648
649
        % use 16ms thresholds for TMC
650
        thresholds16ms=betweenRuns.thresholds;
651
        optionNo=strmatch('TMC',paradigmNames);
652
        set(handles.popupmenuParadigm,'value',optionNo);
653
        aParadigmSelection(handles)
654
        set(handles.edittargetLevel,'string', thresholds16ms+10);
655
        set(handles.editstopCriteriaBox,'string','30')  % nTrials
656
        pause(.1)
657
        run (handles)
658
        if experiment.stop
659
            disp(errormsg)
660
            optionNo=strmatch('profile',paradigmNames);
661
            set(handles.popupmenuParadigm,'value',optionNo);
662
            experiment.paradigm='profile';
663
            experiment.stop=-0;
664
            aParadigmSelection(handles)
665
            return
666
        end
667
        TMC=resultsTable(2:end,2:end);
668
        gaps=resultsTable(2:end,1);
669
        BFs=resultsTable(1, 2:end);
670
671
        % use 16ms threshold for IFMC
672
        optionNo=strmatch('IFMC',paradigmNames);
673
        set(handles.popupmenuParadigm,'value',optionNo);
674
        aParadigmSelection(handles)
675
        set(handles.edittargetLevel,'string', thresholds16ms+10);
676
        set(handles.editstopCriteriaBox,'string','30')  % nTrials
677
        pause(.1)
678
        run (handles)
679
        if experiment.stop
680
            disp(errormsg)
681
            optionNo=strmatch('profile',paradigmNames);
682
            set(handles.popupmenuParadigm,'value',optionNo);
683
            experiment.paradigm='profile';
684
            experiment.stop=-0;
685
            aParadigmSelection(handles)
686
            return
687
        end
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 data and plot profile
697
698
%         save profile longTone shortTone gaps BFs TMC offBFs IFMCs
699
fileName=['MTprofile' Util_timeStamp];
700
profile2mFile(longTone, shortTone, gaps, BFs, TMC, offBFs, IFMCs,...
701
    fileName)
702
while ~fopen(fileName), end
703
plotProfile(fileName, 'profile_CMA_L')
704
%% xx
705
        if strcmp(errormsg,'manually stopped')
706
            disp(errormsg)
707
            optionNo=strmatch('profile',paradigmNames);
708
            set(handles.popupmenuParadigm,'value',optionNo);
709
            experiment.paradigm='profile';
710
            experiment.stop=-0;
711
            aParadigmSelection(handles)
712
            return
713
        end
714
    otherwise
715
        run (handles)
716
        experiment.stop=0;
717
end
718
719
function run (handles)
720
global experiment expGUIhandles stimulusParameters
721
tic
722
expGUIhandles=handles;
723 38:c2204b18f4a2 rmeddis
set(handles.pushbuttonSave,'visible','off')
724
725 36:3ea506487b3b rmeddis
set(handles.pushbuttonStop, 'backgroundColor', [.941 .941 .941])
726
% set(handles.editparamChanges,'visible','off')
727
728
% message box white (removes any previous error message)
729
set(handles.textMSG,...
730
    'backgroundcolor', 'w', 'ForegroundColor', 'b', 'string', '')
731
732
errorMsg=aReadAndCheckParameterBoxes(handles);
733
if ~isempty(errorMsg)
734
    append=0;
735
    warning=1;
736
    addToMsg(['error message:' errorMsg], append, warning)
737
    return
738
end
739
740
if isnan(stimulusParameters.targetLevel)
741
    addToMsg('Error: targetlevel not set', 1)
742
    error('Error: targetlevel not set')
743
end
744
745
set(handles.textMSG,'backgroundcolor', 'w')
746
set(handles.textMSG,'string', ' ')
747
748
% leave the program and start up multiThreshold
749
subjGUI_MT % leave the program and start up multiThreshold
750
experiment.justInitialized=0;% prevents moving subjectGUI
751
toc
752
753
% --- Executes on button press in pushbuttonSingleShot.
754
function pushbuttonSingleShot_Callback(hObject, eventdata, handles)
755 38:c2204b18f4a2 rmeddis
global experiment paradigmNames
756 36:3ea506487b3b rmeddis
experiment.singleShot=1;
757
758 38:c2204b18f4a2 rmeddis
% startup paradigm, 'training' (could be anywhere on the list)
759
startupParadigm='training';
760
idx= find(strcmp(paradigmNames,startupParadigm));
761
set(handles.popupmenuParadigm,'value', idx)
762
aParadigmSelection(handles);
763
764 36:3ea506487b3b rmeddis
% special test for spontaneous activity
765
x=get(handles.editWRVstartValues, 'string');
766
y=get(handles.edittargetDuration, 'string');
767
set(handles.editWRVstartValues, 'string', '-20')
768
set(handles.edittargetDuration, 'string', '1')
769
770
MAPplot=get(handles.editMAPplot, 'string');
771
set(handles.editMAPplot, 'string', '1')
772
drawnow
773
774
run (handles)
775
776
set(handles.editMAPplot, 'string', MAPplot)
777
set(handles.editWRVstartValues, 'string', x)
778
set(handles.edittargetDuration, 'string', y)
779
780
% ------------------------------------------aReadAndCheckParameterBoxes
781
function errorMsg=aReadAndCheckParameterBoxes(handles)
782
global experiment  stimulusParameters betweenRuns  statsModel
783 38:c2204b18f4a2 rmeddis
global variableNames  LevittControl paramChanges betweenRunsVariables
784 36:3ea506487b3b rmeddis
% When the program sets the parameters all should be well
785
% But when the user changes them...
786
787
errorMsg='';
788
789
% name
790
experiment.name=get(handles.editName,'string');
791
792
% ear/models
793
option=get(handles.popupmenuEar,'value');
794
strings=get(handles.popupmenuEar,'string');
795
experiment.ear=strings{option};
796
797
switch experiment.ear
798
    case { 'MAPmodel', 'MAPmodelMultiCh', ...
799
            'MAPmodelSingleCh', 'MAPmodelListen'}
800
        % MAPmodel writes forced parameter settings to the screen
801
        %  so that they can be read from there
802
        % {'randomize within blocks', 'fixed sequence',...
803
        %  'randomize across blocks'}
804
        set(handles.popupmenuRandomize,'value',2)       % fixed sequence
805
        set(handles.editstimulusDelay,'string','0.01')  % no stimulus delay
806
        stimulusParameters.includeCue=0;                % no cue for MAP
807
end
808
809
% find tone type
810
option=get(handles.popupmenuTargetType,'value');
811
strings=get(handles.popupmenuTargetType,'string');
812
stimulusParameters.targetType=strings{option};
813
814
% find masker type
815
option=get(handles.popupmenuMaskerType,'value');
816
strings=get(handles.popupmenuMaskerType,'string');
817
stimulusParameters.maskerType=strings{option};
818
819
% find background type and level
820
option=get(handles.popupmenuBackgroundType,'value');
821
strings=get(handles.popupmenuBackgroundType,'string');
822
stimulusParameters.backgroundTypeValue=option;
823
stimulusParameters.backgroundLevel=...
824
    str2num(get(handles.editBackgroundLevel,'string'));
825
stimulusParameters.backgroundType=strings{option};
826
827
% Read all stimulus parameter boxes
828
for i=1:length(variableNames)
829
    cmd=['stimulusParameters.' variableNames{i} ...
830
        '= str2num(get(handles.edit' variableNames{i} ',''string'' ));'];
831
    eval(cmd);
832
end
833
% for multiple levels
834
stimulusParameters.targetLevels=stimulusParameters.targetLevel;
835
836
% check that all required values are in the edit boxes
837
for i=1:length(variableNames)-3 % do not include 'level limits'
838
    eval([ 'variableValues=stimulusParameters.' variableNames{i} ';'])
839
    if isempty(variableValues), errorMsg=[ variableNames{i} ...
840
            ' is an empty box']; return, end
841
end
842
843
chosenOption=get(handles.popupmenuVaryParameter1,'value');
844 38:c2204b18f4a2 rmeddis
betweenRuns.variableName1=betweenRunsVariables{chosenOption};
845 36:3ea506487b3b rmeddis
eval(['betweenRuns.variableList1 = stimulusParameters.' ...
846
    betweenRuns.variableName1 ';']);
847
848
chosenOption=get(handles.popupmenuVaryParameter2,'value');
849
betweenRuns.variableName2=variableNames{chosenOption};
850
eval(['betweenRuns.variableList2 = stimulusParameters.' ...
851
    betweenRuns.variableName2 ';']);
852
853
% Check that variable parameters 1 & 2 have different names
854
if strcmp(betweenRuns.variableName1,betweenRuns.variableName2) ...
855
        && ~strcmp(betweenRuns.variableName1,'none')
856
    errorMsg='variable parameters have the same name';
857
    return
858
end
859
860
% calibration
861
%  this is used to *reduce* the output signal from what it otherwise
862
%  would be
863
% signal values are between 1 - 2^23
864
%  these are interpreted as microPascals between -29 dB and 128 dB SPL
865
% calibrationdB adjusts these values to compensate for equipment
866
%  characteristics
867
%  this will change the range. e.g. a 7 dB calibration will yield
868
%   a range of -36 to 121 dB SPL
869
% Calibration is not used when modelling. Values are treated as dB SPL
870
stimulusParameters.calibrationdB=...
871
    str2num(get(handles.editcalibrationdB,'string'));
872
873
% check on cue
874
cueSetUp(handles)
875
876
stimulusParameters.WRVinitialStep=stimulusParameters.WRVsteps(1);
877
stimulusParameters.WRVsmallStep=stimulusParameters.WRVsteps(2);
878
879
% jitter start value set after reading in new parameters
880
switch experiment.paradigm
881
    case 'discomfort'
882
        stimulusParameters.jitterStartdB=0;
883
    otherwise
884
        stimulusParameters.jitterStartdB=abs(stimulusParameters.WRVsteps(1));
885
end
886
887
888
% stats model mean and slope
889
statsModelParameters= str2num(get(handles.editStatsModel,'string'));
890
switch experiment.ear
891
    case {'statsModelLogistic'}
892
        statsModel.logisticMean=statsModelParameters(1) ;
893
        statsModel.logisticSlope=statsModelParameters(2);
894
        statsModel.rareEvenGain=NaN ;
895
        statsModel.rareEventVmin=NaN;
896
    case 'statsModelRareEvent'
897
        statsModel.logisticMean=NaN ;
898
        statsModel.logisticSlope=NaN;
899
        statsModel.rareEvenGain=statsModelParameters(2) ;
900
        statsModel.rareEventVmin=statsModelParameters(1);
901
end
902
903
% MAP plotting
904
experiment.MAPplot=str2num(get(handles.editMAPplot,'string'));
905
% if ~isequal(experiment.MAPplot, 0),
906
%     % any other character will do it
907
%     experiment.MAPplot=1;
908
% end
909
910
% save data
911
experiment.saveData=str2num(get(handles.editSaveData,'string'));
912
if ~isequal(experiment.saveData, 0),
913
    % any other character will do it
914
    experiment.saveData=1;
915
end
916
917
% print tracks
918
experiment.printTracks=str2num(get(handles.editPrintTracks,'string'));
919
if ~isequal(experiment.printTracks, 0),
920
    % any other character will do it
921
    experiment.printTracks=1;
922
end
923
924
% catch trial rate
925
% (1)= start rate,   (2)= base rate,   (3)= time constant (trials)
926
stimulusParameters.catchTrialRates=...
927
    str2num(get(handles.editCatchTrialRate,'string'));
928
if stimulusParameters.catchTrialRates(1) ...
929
        < stimulusParameters.catchTrialRates(2)
930
    errorMsg=...
931
        'catch trial base rates must be less than catch trial start rate';
932
    return,
933
end
934 38:c2204b18f4a2 rmeddis
% force the decay rate for catchTrialRate
935
%  to avoid having to explain it to the user
936
stimulusParameters.catchTrialRates(3)=2;
937 36:3ea506487b3b rmeddis
938
% sample rate
939
% The sample rate is set in the paradigm file.
940
% Normally this is set in the startUp paradigm file and then left
941
% When the model is used, the multiThreshold sample rate
942
% overrules anything in the model
943
stimulusParameters.sampleRate=...
944
    str2num(get(handles.textsampleRate,'string'));
945
946
% music level
947
stimulusParameters.musicLeveldB=...
948
    str2num(get(handles.editMusicLevel,'string'));
949
950
%  set message box font size
951
experiment.msgFontSize=str2num(get(handles.editMsgFont,'string'));
952
experiment.subjGUIfontSize=str2num(get(handles.editSubjectFont,'string'));
953
954
% stop criteria
955
experiment.singleIntervalMaxTrials=...
956
    str2num(get(handles.editstopCriteriaBox,'string'));
957
experiment.maxTrials=experiment.singleIntervalMaxTrials(1);
958
959
% set up 2IFC is required (? better in atrhesholdAssessmentMethod)
960
switch experiment.threshEstMethod
961
    case {'2I2AFC++', '2A2AIFC+++'}
962
        experiment.peaksUsed=experiment.singleIntervalMaxTrials(2);
963
        experiment.PeakTroughCriterionSD=...
964
            experiment.singleIntervalMaxTrials(3);
965
        experiment.trialsToBeUsed= 5;
966
        LevittControl.maxTrials=experiment.singleIntervalMaxTrials(1);
967
        % start value for step until reduced
968
        LevittControl.startLevelStep= stimulusParameters.WRVsteps(1);
969
        % reduced step size
970
        LevittControl.steadyLevittStep= stimulusParameters.WRVsteps(2);
971
        LevittControl.TurnsToSmallSteps= 2;
972
        LevittControl.useLastNturns= 2*experiment.peaksUsed;
973
        LevittControl.minReversals= ...
974
            LevittControl.TurnsToSmallSteps+2*experiment.peaksUsed;
975
        LevittControl.targetsdPT = experiment.PeakTroughCriterionSD;
976
        LevittControl.maxLevittValue= stimulusParameters.WRVlimits(2);
977
        Levitt2;
978
end
979
980
% What kind of randomisation is required?
981
idx=get(handles.popupmenuRandomize,'value');
982
s=get(handles.popupmenuRandomize,'string');
983
betweenRuns.randomizeSequence=s{idx};
984
985
% Make small adjustments to variable values
986
%  to keep values unique against later sorting
987
x=betweenRuns.variableList1;
988
[y idx]= sort(x);
989
for i=1:length(y)-1, if y(i+1)==y(i); y(i+1)=y(i)*1.001; end, end
990
x(idx)=y;
991
betweenRuns.variableList1=x;
992
993
x=betweenRuns.variableList2;
994
[y idx]= sort(x);
995
for i=1:length(y)-1, if y(i+1)==y(i); y(i+1)=y(i)*1.001; end, end
996
x(idx)=y;
997
betweenRuns.variableList2=x;
998
999
% Checks: after reading and setting parameters  ------------------------------------------
1000
% check for finger trouble (more checks possible
1001
if stimulusParameters.maskerDuration>10
1002
    errorMsg='maskerDuration is too long'; return, end
1003
if stimulusParameters.gapDuration>10
1004
    errorMsg='gapDuration is too long'; return, end
1005
if stimulusParameters.targetDuration>10
1006
    errorMsg='targetDuration is too long'; return, end
1007
1008
% rare event slope check
1009
if experiment.psyFunSlope<0 ...
1010
        && strcmp(experiment.functionEstMethod,'rareEvent')
1011
    errorMsg='cannot use rareEvent option for negative psychometr slopes';
1012
    return
1013
end
1014
1015
% check ramps
1016
if stimulusParameters.rampDuration*2> stimulusParameters.targetDuration
1017
    errorMsg=' ramp duration is too long for the target';
1018
    return
1019
end
1020
1021
if max(stimulusParameters.maskerDuration)>0 ...
1022
        && max(stimulusParameters.rampDuration...
1023
        *2> stimulusParameters.maskerDuration)
1024
    errorMsg=' ramp duration is too long for the masker';
1025
    return
1026
end
1027
1028
% Check WRVstartValues for length and compatibility with randomization
1029
% only one start value supplied so all start values are the same
1030
if length(stimulusParameters.WRVstartValues)==1
1031
    stimulusParameters.WRVstartValues= ...
1032
        repmat(stimulusParameters.WRVstartValues, 1, ...
1033
        length(betweenRuns.variableList1)...
1034
        *length(betweenRuns.variableList2));
1035
elseif ~isequal(length(stimulusParameters.WRVstartValues), ...
1036
        length(betweenRuns.variableList1)...
1037
        *length(betweenRuns.variableList2))
1038
    % otherwise we need one value for each combination of var1/ var2
1039
    errorMsg='WRVstartValues not the same length as number of runs';
1040
    return
1041
elseif strcmp(betweenRuns.randomizeSequence, 'randomize within blocks')...
1042
        && length(stimulusParameters.WRVstartValues)>1
1043
    errorMsg='multiple WRVstartValues inappropriate';
1044
    return
1045
end
1046
1047
% set the target level in advance for every wnticipated run
1048
switch experiment.paradigm
1049
    case {'trainingIFMC', 'TMC','TMC_16ms', 'TMC - ELP', ...
1050
            'IFMC', 'IFMC_16ms'}
1051
        % For TMC and IFMC multiple target levels can be set
1052
        if length(stimulusParameters.targetLevel)==1
1053
            betweenRuns.targetLevels=...
1054
                repmat(stimulusParameters.targetLevel, 1, ...
1055
                length(betweenRuns.variableList1)...
1056
                *length(betweenRuns.variableList2));
1057
        elseif length(stimulusParameters.targetLevel)==...
1058
                length(betweenRuns.variableList2)
1059
            % only one level specified, so use this throughout
1060
            x=stimulusParameters.targetLevel;
1061
            x=repmat(x,length(betweenRuns.variableList1),1);
1062
            x=reshape(x,1,length(betweenRuns.variableList1)*length(betweenRuns.variableList2));
1063
            betweenRuns.targetLevels=x;
1064
        else
1065
            errorMsg='targetLevels not the same length as number of targetFrequencies';
1066
        end
1067
end
1068
1069
switch experiment.paradigm
1070
    case  {'gapDetection', 'frequencyDiscrimination'}
1071
        if ~isequal(stimulusParameters.targetDuration, ...
1072
                stimulusParameters.maskerDuration)
1073
            addToMsg(...
1074
                'Warning: masker and target duration not the same.',1,1)
1075
        end
1076
        if ~isequal(stimulusParameters.maskerLevel, ...
1077
                stimulusParameters.targetLevel)
1078
            addToMsg(['Warning: masker and target level different.'...
1079
                'They will be changed to be equal',1,1]);
1080
        end
1081
end
1082
1083
% identify model parameter changes if any
1084
paramChanges=get(handles.editparamChanges,'string');
1085
if ~strcmp(paramChanges, ';'), paramChanges=[paramChanges ';']; end
1086 38:c2204b18f4a2 rmeddis
try
1087 36:3ea506487b3b rmeddis
eval(paramChanges);
1088 38:c2204b18f4a2 rmeddis
catch
1089
    error('Problems with suggested parameter changes')
1090
end
1091
1092 36:3ea506487b3b rmeddis
1093
% -------------------------------------------- aSetSampleRate
1094
function aSetSampleRate(sampleRate, handles)
1095
global  stimulusParameters
1096
stimulusParameters.sampleRate=sampleRate;
1097
set(handles.textsampleRate,'string',num2str(stimulusParameters.sampleRate))
1098
1099
% -------------------------------------------- popupmenuEar_Callback
1100
function popupmenuEar_Callback(hObject, eventdata, handles)
1101
global experiment
1102
option=get(handles.popupmenuEar,'value');
1103
options=get(handles.popupmenuEar,'string');			% left/right/model
1104
experiment.ear=options{option};
1105
set(handles.editparamChanges,'visible','off')
1106
switch experiment.ear
1107
    case 'statsModelLogistic'
1108
        set(handles.editStatsModel,'string', '15, 0.5')
1109
    case 'statsModelRareEvent'
1110
        set(handles.editStatsModel,'string', '20 1')
1111
    case {'MAPmodelListen',  'MAPmodelMultiCh', 'MAPmodelSingleCh'}
1112
        set(handles.editparamChanges,'visible','on')
1113
end
1114
earSetUp(handles)
1115
1116
% -------------------------------------------- earSetUp
1117
function	earSetUp(handles)
1118
global experiment stimulusParameters
1119
% option=get(handles.popupmenuEar,'value');
1120
% options=get(handles.popupmenuEar,'string');			% left/right/model
1121
% experiment.ear=options{option};
1122
1123
switch experiment.ear
1124
    case {'statsModelLogistic'}
1125
        statsModel.logisticSlope=0.5;
1126
        statsModel.logisticMean=15;
1127
        set(handles.editStatsModel,'string', ...
1128
            num2str([statsModel.logisticMean statsModel.logisticSlope]))
1129
        set(handles.textStatsModel,...
1130
            'string', {'statsModel',' logistic threshold\ slope'})
1131
    case 'statsModelRareEvent'
1132
        set(handles.textStatsModel,'string', ...
1133
            {'statsModel',' rareEvent Vmin\ gain'})
1134
end
1135
1136
switch experiment.ear
1137
    case {'statsModelLogistic', 'statsModelRareEvent'}
1138
        set(handles.editStatsModel, 'visible', 'off')
1139
        set(handles.textStatsModel, 'visible', 'off')
1140
1141
        % default psychometric bin size and logistic slopes
1142
        set(handles.popupmenuRandomize,'value',2)   % fixed sequence
1143
        set(handles.editName,'string', 'statsModel')
1144
        %         experiment.headphonesUsed=0;
1145
1146
    case {'MAPmodelListen', 'MAPmodelMultiCh', 'MAPmodelSingleCh'}
1147
        stimulusParameters.includeCue=0;						 % no cue
1148
        set(handles.popupmenuCueNoCue,'value', 2)
1149
1150 38:c2204b18f4a2 rmeddis
        set(handles.editCatchTrialRate,'string','0 0');%no catch trials
1151 36:3ea506487b3b rmeddis
        set(handles.editName,'string', 'Normal')			% force name
1152
        experiment.name=get(handles.editName,'string');	% read name back
1153
        set(handles.editcalibrationdB,'string','0')
1154
1155
        set(handles.popupmenuRandomize,'value',2)       % fixed sequence
1156
        set(handles.editstimulusDelay,'string','0')
1157
1158
        set(handles.editSaveData,'string', '0')
1159
        set(handles.editSubjectFont,'string', '10');
1160
        experiment.MacGThreshold=0; % num MacG spikes to exceed threshold
1161 38:c2204b18f4a2 rmeddis
    otherwise
1162
        set(handles.editCatchTrialRate,'string','0.2 0.1');%no catch trials
1163
1164 36:3ea506487b3b rmeddis
end
1165
aResetPopupMenus(handles)
1166
1167
% --------------------------------------------- popupmenuCueNoCue_Callback
1168
function popupmenuCueNoCue_Callback(hObject, eventdata, handles)
1169
cueSetUp(handles)
1170
1171
% ------------------------------------------------------------- cueSetUp
1172
function cueSetUp(handles)
1173 38:c2204b18f4a2 rmeddis
global stimulusParameters experiment
1174 36:3ea506487b3b rmeddis
1175 38:c2204b18f4a2 rmeddis
switch experiment.threshEstMethod
1176
    case {'oneIntervalUpDown', 'MaxLikelihood'}
1177
        chosenOption=get(handles.popupmenuCueNoCue,'value');
1178
        if chosenOption==1
1179
            stimulusParameters.includeCue=1;
1180
            set(handles.editcueTestDifference,'visible', 'on')
1181
            set(handles.textcueTestDifference,'visible', 'on')
1182
            stimulusParameters.subjectText=stimulusParameters.instructions{2};
1183
        else
1184
            stimulusParameters.includeCue=0;
1185
            set(handles.editcueTestDifference,'visible', 'off')
1186
            set(handles.textcueTestDifference,'visible', 'off')
1187
            stimulusParameters.subjectText= stimulusParameters.instructions{1};
1188
        end
1189 36:3ea506487b3b rmeddis
end
1190
1191
% -------------------------------------------- popupmenuThreshEst_Callback
1192
function popupmenuThreshEst_Callback(hObject, eventdata, handles)
1193
aThresholdAssessmentMethod(handles);
1194
1195
%  --------------------------------------------- aThresholdAssessmentMethod
1196
function aThresholdAssessmentMethod(handles)
1197
% identify the threshold assessment method
1198
%  and set various parameters on the GUI appropriately
1199
global stimulusParameters experiment  threshEstNames LevittControl
1200
1201
chosenOption=get(handles.popupmenuThreshEst,'value');
1202
experiment.threshEstMethod=threshEstNames{chosenOption};
1203
set(handles.editCatchTrialRate, 'visible', 'on')
1204
set(handles.textCatchTrials, 'visible', 'on')
1205
1206
% establish appropriate stop criterion and post on GUI
1207
switch experiment.threshEstMethod
1208
    case 'MaxLikelihood'
1209
        experiment.functionEstMethod='logisticML';
1210
        stimulusParameters.WRVsteps=10*experiment.psyFunSlope;  % ???
1211
        set(handles.textstopCriteria,'string', 'stop criteria \ maxTrials')
1212
        experiment.singleIntervalMaxTrials=experiment.stopCriteriaSI;
1213
        experiment.allowCatchTrials= 1;
1214
        switch experiment.paradigm
1215
            case 'training'
1216
                experiment.possLogSlopes=0.5;
1217
        end
1218
1219
    case 'oneIntervalUpDown'
1220
        experiment.functionEstMethod='logisticLS';
1221
        set(handles.textstopCriteria,'string', 'stop criteria \ maxTrials')
1222
        experiment.singleIntervalMaxTrials=experiment.stopCriteriaSI;
1223
        switch experiment.paradigm
1224
            case 'discomfort'
1225
                experiment.allowCatchTrials= 0;
1226
            otherwise
1227
                experiment.allowCatchTrials= 1;
1228
        end
1229
1230
    case {'2I2AFC++',  '2I2AFC+++'}
1231
        LevittControl.rule='++'; %  e.g. '++' or '+++'
1232
        experiment.singleIntervalMaxTrials=experiment.stopCriteria2IFC;
1233
        experiment.functionEstMethod='peaksAndTroughs';
1234
        LevittControl.maxTrials=experiment.singleIntervalMaxTrials(1);
1235
        set(handles.editWRVsteps,'string', ...
1236
            num2str(stimulusParameters.WRVsteps))
1237
        set(handles.textstopCriteria,'string', {'trials peaks sdCrit'})
1238
        experiment.allowCatchTrials= 0;
1239
end
1240
1241
set(handles.textstopCriteria,'fontSize',8)
1242
set(handles.editstopCriteriaBox,'string',...
1243
    num2str(experiment.singleIntervalMaxTrials))
1244
1245
% establish the appropriate instructions to the subject
1246
% NB responsibility for this is now transferred to the paradigm file
1247
switch experiment.threshEstMethod
1248
    % only one value required for level change
1249
    case {'2I2AFC++', '2A2AIFC+++'}
1250
        stimulusParameters.subjectText=...
1251
            'did the tone occur in window 1 or 2?';
1252
    case {'MaxLikelihood',  'oneIntervalUpDown'};
1253
        switch stimulusParameters.includeCue
1254
            case 0
1255
                stimulusParameters.subjectText=...
1256
                    stimulusParameters.instructions{1};
1257
            case 1
1258
                stimulusParameters.subjectText= ...
1259
                    stimulusParameters.instructions{2};
1260
        end
1261
end
1262
stimulusParameters.messageString={'training'};
1263
1264
aResetPopupMenus(handles)
1265
% -------------------------------------------------- function orderGlobals
1266
function orderGlobals
1267
global  stimulusParameters experiment betweenRuns withinRuns
1268
1269
stimulusParameters=[];
1270
stimulusParameters.sampleRate=		[];
1271
stimulusParameters.targetType=	'';
1272
stimulusParameters.targetFrequency=	[];
1273
stimulusParameters.targetDuration=	[];
1274
stimulusParameters.targetLevel=	[];
1275
stimulusParameters.gapDuration=	[];
1276
stimulusParameters.maskerType=	'';
1277
stimulusParameters.maskerRelativeFrequency=	[];
1278
stimulusParameters.maskerDuration=	[];
1279
stimulusParameters.maskerLevel=	[];
1280
stimulusParameters.backgroundType=	'';
1281
stimulusParameters.backgroundTypeValue=	[];
1282
stimulusParameters.backgroundLevel=	[];
1283
stimulusParameters.includeCue=	[];
1284
experiment.clickToStimulusPause=[];
1285
stimulusParameters.stimulusDelay=	[];
1286
stimulusParameters.rampDuration=	[];
1287
stimulusParameters.absThresholds=	[];
1288
stimulusParameters.numOHIOtones=	[];
1289
1290
stimulusParameters.WRVname=	'';
1291
stimulusParameters.WRVstartValues=		[];
1292
stimulusParameters.WRVsteps=	[];
1293
stimulusParameters.WRVlimits=	[];
1294
stimulusParameters.WRVinitialStep=		[];
1295
stimulusParameters.WRVsmallStep=	[];
1296
experiment.singleIntervalMaxTrials=	[];
1297
stimulusParameters.calibrationdB=	[];
1298
1299
stimulusParameters.catchTrialRates=	[];
1300
stimulusParameters.catchTrialBaseRate=	[];
1301
stimulusParameters.catchTrialRate=	[];
1302
stimulusParameters.catchTrialTimeConstant=	[];
1303
1304
stimulusParameters.dt=		[];
1305
1306
stimulusParameters.jitterStartdB=	[];
1307
stimulusParameters.restoreCalibration=	[];
1308
stimulusParameters.messageString=		[];
1309
stimulusParameters.cueTestDifference=	[];
1310
stimulusParameters.subjectText=	 '';
1311
stimulusParameters.testTargetBegins=	[];
1312
stimulusParameters.testTargetEnds=	[];
1313
stimulusParameters.musicLeveldB=	[];
1314
1315
stimulusParameters.subjectSampleRate=[];
1316
stimulusParameters.MAPSampleRate=[];
1317
1318
experiment=[];
1319
experiment.name=	'';
1320
experiment.date=	'';
1321
experiment.paradigm=	'';
1322
experiment.ear=	'';
1323
experiment.headphonesUsed=[];
1324
experiment.singleShot=	[];
1325
experiment.randomize=	'';
1326
experiment.maxTrials=	[];
1327
experiment.MacGThreshold=	[];
1328
experiment.resetCriterion=	[];
1329
experiment.runResetCriterion=	[];
1330
1331
experiment.comparisonData=	[];
1332
experiment.absThresholds=	[];
1333
experiment.threshEstMethod=	'';
1334
experiment.functionEstMethod=	'';
1335
experiment.psyBinWidth=	[];
1336
experiment.maxLogisticK=[];
1337
experiment.numPossLogisticK=[];
1338
experiment.possLogSlopes=	[];
1339
experiment.meanSearchStep=	[];
1340
experiment.psyFunSlope=	[];
1341
experiment.predictionLevels=[];
1342
1343
experiment.buttonBoxType=	'';
1344
experiment.buttonBoxStatus=	'';
1345
experiment.status=	'';
1346
experiment.stop=	[];
1347
experiment.pleaseRepeat=	[];
1348
experiment.justInitialized=[];
1349
1350
experiment.MAPplot=	    [];
1351
experiment.saveData=	[];
1352
experiment.printTracks=	[];
1353
experiment.msgFontSize=	[];
1354
experiment.subjGUIfontSize=	[];
1355
1356
experiment.timeAtStart=	'';
1357
experiment.minElapsed=	[];
1358
1359
betweenRuns=[];
1360
betweenRuns.variableName1=	'';
1361
betweenRuns.variableList1=	[];
1362
betweenRuns.variableName2=	'';
1363
betweenRuns.variableList2=	[];
1364
betweenRuns.var1Sequence=	[];
1365
betweenRuns.var2Sequence=	[];
1366
betweenRuns.randomizeSequence=[];
1367
betweenRuns.timeNow=	[];
1368
betweenRuns.runNumber=	[];
1369
betweenRuns.thresholds=	[];
1370
betweenRuns.forceThresholds=	[];
1371
betweenRuns.observationCount=	[];
1372
betweenRuns.timesOfFirstReversals=	[];
1373
betweenRuns.bestThresholdTracks='';
1374
betweenRuns.levelTracks='';
1375
betweenRuns.responseTracks='';
1376
betweenRuns.slopeKTracks=	[];
1377
betweenRuns.gainTracks=	[];
1378
betweenRuns.VminTracks=	[];
1379
betweenRuns.bestGain=	[];
1380
betweenRuns.bestVMin=	[];
1381
betweenRuns.bestPaMin=	[];
1382
betweenRuns.bestLogisticM=	[];
1383
betweenRuns.bestLogisticK=	[];
1384
betweenRuns.psychometicFunction='';
1385
betweenRuns.catchTrials=	[];
1386
betweenRuns.caughtOut=	[];
1387
1388
withinRuns=[];
1389
withinRuns.trialNumber=[];
1390
withinRuns.nowInPhase2=[];
1391
withinRuns.beginningOfPhase2=[];
1392
withinRuns.variableValue=[];
1393
withinRuns.direction='';
1394
withinRuns.peaks=[];
1395
withinRuns.troughs=	[];
1396
withinRuns.levelList=	[];
1397
withinRuns.responseList=	 [];
1398
withinRuns.meanEstTrack=	[];
1399
withinRuns.meanLogisticEstTrack=[];
1400
withinRuns.bestSlopeK=	[];
1401
withinRuns.bestGain=	[];
1402
withinRuns.bestVMin=	[];
1403
withinRuns.forceThreshold=[];
1404
withinRuns.catchTrial=	[];
1405
withinRuns.caughtOut=[];
1406
withinRuns.catchTrialCount=[];
1407
withinRuns.wrongButton=	[];
1408
withinRuns.babblePlaying=[];
1409
1410
% --- Executes on selection change in popupmenuBackgroundType.
1411
function popupmenuBackgroundType_Callback(hObject, eventdata, handles)
1412
global backgroundTypes
1413
option=get(handles.popupmenuBackgroundType,'value');
1414
selectedBackground=backgroundTypes{option};
1415
stimulusParameters.backgroundType=selectedBackground;
1416
1417
switch selectedBackground
1418
    case 'none'
1419
        set(handles.editBackgroundLevel,'visible','off')
1420
        set(handles.textBGlevel,'visible','off')
1421
    otherwise
1422
        set(handles.editBackgroundLevel,'visible','on')
1423
        set(handles.textBGlevel,'visible','on')
1424
end
1425
1426
1427
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1428
function pushbuttonStop_Callback(hObject, eventdata, handles)
1429
global experiment
1430
experiment.stop=1;
1431
disp('stop!')
1432
set(handles.pushbuttonStop, 'backgroundColor','r')
1433
pause(.1)
1434
drawnow
1435
1436
function pushbuttonOME_Callback(hObject, eventdata, handles)
1437
global experiment paramChanges
1438
aReadAndCheckParameterBoxes(handles);
1439
testOME(experiment.name, paramChanges);
1440
1441
function pushbuttonBM_Callback(hObject, eventdata, handles)
1442
global  stimulusParameters experiment paramChanges
1443
aReadAndCheckParameterBoxes(handles);
1444
relativeFrequencies=[0.25    .5   .75  1  1.25 1.5    2];
1445
relativeFrequencies=[ 1 ];
1446
AN_spikesOrProbability='probability';
1447
AN_spikesOrProbability='spikes';
1448
testBM(stimulusParameters.targetFrequency, ...
1449
    experiment.name,relativeFrequencies, AN_spikesOrProbability, ...
1450
    paramChanges);
1451
1452
function pushbuttonAN_Callback(hObject, eventdata, handles)
1453
global stimulusParameters experiment paramChanges
1454
aReadAndCheckParameterBoxes(handles);
1455
% now carry out tests
1456
showPSTHs=0;
1457
targetFrequency=stimulusParameters.targetFrequency(1);
1458
BFlist=targetFrequency;
1459
testLevels=-10:10:90;
1460
% testLevels=80:10:90;
1461
testAN(targetFrequency,BFlist,testLevels,experiment.name, paramChanges);
1462
1463
function pushbuttonPhLk_Callback(hObject, eventdata, handles)
1464
global experiment
1465
aReadAndCheckParameterBoxes(handles);
1466
testPhaseLocking(experiment.name)
1467
1468
function pushbuttonSYN_Callback(hObject, eventdata, handles)
1469
global stimulusParameters experiment paramChanges
1470
aReadAndCheckParameterBoxes(handles);
1471
% now carry out tests
1472
showPSTHs=0;
1473
targetFrequency=stimulusParameters.targetFrequency(1);
1474
BFlist=targetFrequency;
1475
testSynapse(BFlist,experiment.name, paramChanges)
1476
1477
function pushbuttonFM_Callback(hObject, eventdata, handles)
1478
global stimulusParameters experiment paramChanges
1479
aReadAndCheckParameterBoxes(handles);
1480
showPSTHs=1;
1481
testFM(stimulusParameters.targetFrequency(1),experiment.name, ...
1482
    'spikes', paramChanges)
1483
1484
function popupmenuPhase_Callback(hObject, eventdata, handles)
1485
global stimulusParameters
1486
1487
optionNo=get(handles.popupmenuPhase,'value');
1488
options=get(handles.popupmenuPhase,'string');
1489
phase=options{optionNo};
1490
stimulusParameters.maskerPhase=phase;
1491
stimulusParameters.targetPhase=phase;
1492
1493
function pushbuttonParams_Callback(hObject, eventdata, handles)
1494
global experiment stimulusParameters
1495
aReadAndCheckParameterBoxes(handles);
1496
showParams=1; BFlist=-1;
1497
paramChanges=get(handles.editparamChanges,'string');
1498
eval(paramChanges);
1499
1500
paramFunctionName=['method=MAPparams' experiment.name ...
1501
    '(BFlist, stimulusParameters.sampleRate, showParams,paramChanges);'];
1502
eval(paramFunctionName) % go and fetch the parameters requesting parameter printout
1503
1504
1505
% --- Executes on button press in pushbuttonRP.
1506
function pushbuttonRP_Callback(hObject, eventdata, handles)
1507
global experiment stimulusParameters paramChanges
1508
aReadAndCheckParameterBoxes(handles);
1509
% now carry out test
1510
testRP(stimulusParameters.targetFrequency,experiment.name, paramChanges)
1511
1512
% function handles % ??
1513
1514
1515
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1516
1517
function editmaskerDuration_Callback(hObject, eventdata, handles)
1518
1519
function editmaskerDuration_CreateFcn(hObject, eventdata, handles)
1520
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1521
    set(hObject,'BackgroundColor','white');
1522
end
1523
1524
function editmaskerLevel_Callback(hObject, eventdata, handles)
1525
1526
function editmaskerLevel_CreateFcn(hObject, eventdata, handles)
1527
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1528
    set(hObject,'BackgroundColor','white');
1529
end
1530
1531
function editmaskerRelativeFrequency_Callback(hObject, eventdata, handles)
1532
1533
function editmaskerRelativeFrequency_CreateFcn(hObject, eventdata, handles)
1534
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1535
    set(hObject,'BackgroundColor','white');
1536
end
1537
1538
function editWRVstartValues_Callback(hObject, eventdata, handles)
1539
1540
function editWRVstartValues_CreateFcn(hObject, eventdata, handles)
1541
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1542
    set(hObject,'BackgroundColor','white');
1543
end
1544
1545
function editgapDuration_Callback(hObject, eventdata, handles)
1546
1547
function editgapDuration_CreateFcn(hObject, eventdata, handles)
1548
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1549
    set(hObject,'BackgroundColor','white');
1550
end
1551
1552
function edittargetDuration_Callback(hObject, eventdata, handles)
1553
1554
function edittargetDuration_CreateFcn(hObject, eventdata, handles)
1555
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1556
    set(hObject,'BackgroundColor','white');
1557
end
1558
1559
function edittargetLevel_Callback(hObject, eventdata, handles)
1560
1561
function edittargetLevel_CreateFcn(hObject, eventdata, handles)
1562
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1563
    set(hObject,'BackgroundColor','white');
1564
end
1565
1566
function editrampDuration_Callback(hObject, eventdata, handles)
1567
1568
function editrampDuration_CreateFcn(hObject, eventdata, handles)
1569
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1570
    set(hObject,'BackgroundColor','white');
1571
end
1572
1573
function editcueTestDifference_Callback(hObject, eventdata, handles)
1574
1575
function editcueTestDifference_CreateFcn(hObject, eventdata, handles)
1576
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1577
    set(hObject,'BackgroundColor','white');
1578
end
1579
1580
1581
function editWRVsteps_Callback(hObject, eventdata, handles)
1582
1583
function editWRVsteps_CreateFcn(hObject, eventdata, handles)
1584
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1585
    set(hObject,'BackgroundColor','white');
1586
end
1587
1588
function editWRVlimits_Callback(hObject, eventdata, handles)
1589
1590
function editWRVlimits_CreateFcn(hObject, eventdata, handles)
1591
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1592
    set(hObject,'BackgroundColor','white');
1593
end
1594
1595
function edittargetFrequency_Callback(hObject, eventdata, handles)
1596
1597
function edittargetFrequency_CreateFcn(hObject, eventdata, handles)
1598
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1599
    set(hObject,'BackgroundColor','white');
1600
end
1601
1602
function editName_Callback(hObject, eventdata, handles)
1603
1604
function editName_CreateFcn(hObject, eventdata, handles)
1605
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1606
    set(hObject,'BackgroundColor','white');
1607
end
1608
1609
function editcalibrationdB_Callback(hObject, eventdata, handles)
1610
1611
function editcalibrationdB_CreateFcn(hObject, eventdata, handles)
1612
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1613
    set(hObject,'BackgroundColor','white');
1614
end
1615
1616
function editMAPplot_Callback(hObject, eventdata, handles)
1617
1618
function editMAPplot_CreateFcn(hObject, eventdata, handles)
1619
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1620
    set(hObject,'BackgroundColor','white');
1621
end
1622
1623
function editMsgFont_Callback(hObject, eventdata, handles)
1624
1625
function editMsgFont_CreateFcn(hObject, eventdata, handles)
1626
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1627
    set(hObject,'BackgroundColor','white');
1628
end
1629
1630
function editCatchTrialRate_Callback(hObject, eventdata, handles)
1631
1632
function editCatchTrialRate_CreateFcn(hObject, eventdata, handles)
1633
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1634
    set(hObject,'BackgroundColor','white');
1635
end
1636
1637
1638
function editSaveData_Callback(hObject, eventdata, handles)
1639
1640
function editSaveData_CreateFcn(hObject, eventdata, handles)
1641
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1642
    set(hObject,'BackgroundColor','white');
1643
end
1644
1645
function editStatsModel_Callback(hObject, eventdata, handles)
1646
1647
function editStatsModel_CreateFcn(hObject, eventdata, handles)
1648
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1649
    set(hObject,'BackgroundColor','white');
1650
end
1651
1652
function editBackgroundLevel_Callback(hObject, eventdata, handles)
1653
1654
function editBackgroundLevel_CreateFcn(hObject, eventdata, handles)
1655
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1656
    set(hObject,'BackgroundColor','white');
1657
end
1658
1659
function editPrintTracks_Callback(hObject, eventdata, handles)
1660
1661
function editPrintTracks_CreateFcn(hObject, eventdata, handles)
1662
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1663
    set(hObject,'BackgroundColor','white');
1664
end
1665
1666
function editstopCriteriaBox_Callback(hObject, eventdata, handles)
1667
1668
function editstopCriteriaBox_CreateFcn(hObject, eventdata, handles)
1669
1670
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1671
    set(hObject,'BackgroundColor','white');
1672
end
1673
1674
function editstimulusDelay_Callback(hObject, eventdata, handles)
1675
1676
function editstimulusDelay_CreateFcn(hObject, eventdata, handles)
1677
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1678
    set(hObject,'BackgroundColor','white');
1679
end
1680
1681
1682
function popupmenuCueNoCue_CreateFcn(hObject, eventdata, handles)
1683
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1684
    set(hObject,'BackgroundColor','white');
1685
end
1686
1687
function popupmenuEar_CreateFcn(hObject, eventdata, handles)
1688
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1689
    set(hObject,'BackgroundColor','red');
1690
end
1691
1692
function popupmenuVaryParameter1_Callback(hObject, eventdata, handles)
1693
1694
function popupmenuVaryParameter1_CreateFcn(hObject, eventdata, handles)
1695
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1696
    set(hObject,'BackgroundColor','white');
1697
end
1698
1699
function popupmenuVaryParameter2_Callback(hObject, eventdata, handles)
1700
1701
function popupmenuVaryParameter2_CreateFcn(hObject, eventdata, handles)
1702
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1703
    set(hObject,'BackgroundColor','white');
1704
end
1705
1706
function popupmenuRandomize_Callback(hObject, eventdata, handles)
1707
1708
function popupmenuRandomize_CreateFcn(hObject, eventdata, handles)
1709
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1710
    set(hObject,'BackgroundColor','white');
1711
end
1712
1713
function popupmenuParadigm_CreateFcn(hObject, eventdata, handles)
1714
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1715
    set(hObject,'BackgroundColor','white');
1716
end
1717
1718
1719
function popupmenuMaskerType_CreateFcn(hObject, eventdata, handles)
1720
1721
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1722
    set(hObject,'BackgroundColor','white');
1723
end
1724
1725
1726
function popupmenuThreshEst_CreateFcn(hObject, eventdata, handles)
1727
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1728
    set(hObject,'BackgroundColor','white');
1729
end
1730
1731
function popupmenuBackgroundType_CreateFcn(hObject, eventdata, handles)
1732
1733
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1734
    set(hObject,'BackgroundColor','white');
1735
end
1736
1737
1738
function popupmenuTargetType_CreateFcn(hObject, eventdata, handles)
1739
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1740
    set(hObject,'BackgroundColor','white');
1741
end
1742
1743
function editSubjectFont_Callback(hObject, eventdata, handles)
1744
1745
function editSubjectFont_CreateFcn(hObject, eventdata, handles)
1746
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1747
    set(hObject,'BackgroundColor','white');
1748
end
1749
1750
function editMusicLevel_Callback(hObject, eventdata, handles)
1751
1752
function editMusicLevel_CreateFcn(hObject, eventdata, handles)
1753
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1754
    set(hObject,'BackgroundColor','white');
1755
end
1756
1757
function figure1_ButtonDownFcn(hObject, eventdata, handles)
1758
1759
1760
function edit33_Callback(hObject, eventdata, handles)
1761
1762
function edit33_CreateFcn(hObject, eventdata, handles)
1763
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1764
    set(hObject,'BackgroundColor','white');
1765
end
1766
1767
1768
function popupmenuPhase_CreateFcn(hObject, eventdata, handles)
1769
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1770
    set(hObject,'BackgroundColor','white');
1771
end
1772
1773
function editsegSize_Callback(hObject, eventdata, handles)
1774
1775
function editsegSize_CreateFcn(hObject, eventdata, handles)
1776
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1777
    set(hObject,'BackgroundColor','white');
1778
end
1779
1780
1781
function editnumOHIOtones_Callback(hObject, eventdata, handles)
1782
% hObject    handle to editnumOHIOtones (see GCBO)
1783
% eventdata  reserved - to be defined in a future version of MATLAB
1784
% handles    structure with handles and user data (see GUIDATA)
1785
1786
% Hints: get(hObject,'String') returns contents of editnumOHIOtones as text
1787
%        str2double(get(hObject,'String')) returns contents of editnumOHIOtones as a double
1788
1789
1790
% --- Executes during object creation, after setting all properties.
1791
function editnumOHIOtones_CreateFcn(hObject, eventdata, handles)
1792
% hObject    handle to editnumOHIOtones (see GCBO)
1793
% eventdata  reserved - to be defined in a future version of MATLAB
1794
% handles    empty - handles not created until after all CreateFcns called
1795
1796
% Hint: edit controls usually have a white background on Windows.
1797
%       See ISPC and COMPUTER.
1798
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1799
    set(hObject,'BackgroundColor','white');
1800
end
1801
1802
1803
1804
1805
1806
function editparamChanges_Callback(hObject, eventdata, handles)
1807
1808
1809
function editparamChanges_CreateFcn(hObject, eventdata, handles)
1810
1811
% Hint: edit controls usually have a white background on Windows.
1812
%       See ISPC and COMPUTER.
1813
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1814
    set(hObject,'BackgroundColor','white');
1815
end
1816
1817
1818 38:c2204b18f4a2 rmeddis
1819
1820
function pushbuttonSave_Callback(hObject, eventdata, handles)
1821
global experiment
1822
1823
subjectName=experiment.name;
1824
if ~isdir(['savedData' filesep subjectName ])
1825
    mkdir(['savedData' filesep subjectName ])
1826
end
1827
1828
% date and time and replace ':' with '_'
1829
date=datestr(now);idx=findstr(':',date);date(idx)='_';
1830
fileName=[subjectName ' ' date '.mat'];
1831
movefile(['savedData' filesep 'mostRecentResults.mat'], ...
1832
    ['savedData' filesep subjectName filesep fileName])
1833
set(handles.pushbuttonSave,'visible','off')
1834
1835
1836
1837
function editOHIOnTones_Callback(hObject, eventdata, handles)
1838
1839
1840
function editOHIOnTones_CreateFcn(hObject, eventdata, handles)
1841
1842
% Hint: edit controls usually have a white background on Windows.
1843
%       See ISPC and COMPUTER.
1844
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1845
    set(hObject,'BackgroundColor','white');
1846
end
1847