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 @ 33:161913b595ae

History | View | Annotate | Download (64.1 KB)

1 0:f233164f4c86 rmeddis
% expGUI_MT = 'experimenter GUI for multiThreshold
2
% allows the experimenter to design experiments.
3
% The *running* of experiments is left to subjGUI.m
4 29:b51bf546ca3f rmeddis
%
5 0:f233164f4c86 rmeddis
% There are three kinds of experiments known as 'earOptions':
6 29:b51bf546ca3f rmeddis
% 1. Measurements using real listeners
7 0:f233164f4c86 rmeddis
%  '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 28:02aa9826efe0 rmeddis
% Last Modified by GUIDE v2.5 25-Jun-2011 21:41:35
50 0:f233164f4c86 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', @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 30:1a502830d462 rmeddis
% 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 0:f233164f4c86 rmeddis
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 30:1a502830d462 rmeddis
% Specify order of fields in main structures
131
% identify as empty values or empty strings only
132 0:f233164f4c86 rmeddis
orderGlobals
133
134 30:1a502830d462 rmeddis
addpath ('paradigms')   %paradigm informations is stored here
135
addpath (['..' filesep 'testPrograms']) % model physiology tests
136 0:f233164f4c86 rmeddis
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 30:1a502830d462 rmeddis
%  (names of variable that can changed between runs)
145 0:f233164f4c86 rmeddis
betweenRunsVariables={'stimulusDelay','maskerDuration','maskerLevel',...
146
    'maskerRelativeFrequency','targetFrequency', 'gapDuration',...
147
    'targetDuration','targetLevel','numOHIOtones'};
148 30:1a502830d462 rmeddis
% populate the 'between runs variable' menus
149 0:f233164f4c86 rmeddis
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 30:1a502830d462 rmeddis
set(handles.editBackgroundLevel,'string', '0')
174 0:f233164f4c86 rmeddis
175
% Establish available paradigms by scanning paradigms folder
176
paradigmNames= what('paradigms');
177 30:1a502830d462 rmeddis
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 0:f233164f4c86 rmeddis
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 30:1a502830d462 rmeddis
    % training paradigm must exist
190 0:f233164f4c86 rmeddis
    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 30:1a502830d462 rmeddis
% phase
204 0:f233164f4c86 rmeddis
phaseOptions={'sin','cos','alt','rand'};
205
set(handles.popupmenuPhase,'string', phaseOptions)
206 30:1a502830d462 rmeddis
set(handles.popupmenuPhase,'value', 1)
207 0:f233164f4c86 rmeddis
208
% Cue
209
cueNames={'cued', 'noCue'};
210
set(handles.popupmenuCueNoCue, 'string', cueNames);
211 30:1a502830d462 rmeddis
set(handles.popupmenuCueNoCue, 'value', 1);
212 0:f233164f4c86 rmeddis
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 30:1a502830d462 rmeddis
set(handles.editMsgFont,'string','10')
258 0:f233164f4c86 rmeddis
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 29:b51bf546ca3f rmeddis
%Paradigm: read in all relevant parameters
308 0:f233164f4c86 rmeddis
% 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 30:1a502830d462 rmeddis
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 9:ecad0ea62b43 rmeddis
end
332
333 0:f233164f4c86 rmeddis
% 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 30:1a502830d462 rmeddis
% 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 0:f233164f4c86 rmeddis
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 29:b51bf546ca3f rmeddis
global   stimulusParameters betweenRuns variableNames
387 0:f233164f4c86 rmeddis
global targetTypes maskerTypes experiment backgroundTypes
388
389
switch experiment.threshEstMethod
390
    case {'MaxLikelihood','oneIntervalUpDown'}
391
        set(handles.editstopCriteriaBox, 'string', ...
392
            num2str(experiment.singleIntervalMaxTrials))
393 29:b51bf546ca3f rmeddis
394 0:f233164f4c86 rmeddis
    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 29:b51bf546ca3f rmeddis
    end
414 0:f233164f4c86 rmeddis
    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 9:ecad0ea62b43 rmeddis
% % backgroundType popup
437 0:f233164f4c86 rmeddis
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 9:ecad0ea62b43 rmeddis
% called from aShowRelevantObjects
446 0:f233164f4c86 rmeddis
% 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 29:b51bf546ca3f rmeddis
        showModelPushButtons(handles, 0)
457 0:f233164f4c86 rmeddis
        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 29:b51bf546ca3f rmeddis
466 0:f233164f4c86 rmeddis
    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 29:b51bf546ca3f rmeddis
        showModelPushButtons(handles, 1)
472 0:f233164f4c86 rmeddis
        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 29:b51bf546ca3f rmeddis
478 0:f233164f4c86 rmeddis
    otherwise
479 9:ecad0ea62b43 rmeddis
        % i.e. using real subjects (left, right, diotic, dichotic)
480 0:f233164f4c86 rmeddis
        set(handles.editStatsModel, 'visible', 'off')
481
        set(handles.textStatsModel, 'visible', 'off')
482
        set(handles.pushbuttonStop, 'visible', 'off')
483 29:b51bf546ca3f rmeddis
        showModelPushButtons(handles, 0)
484 0:f233164f4c86 rmeddis
        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 29:b51bf546ca3f rmeddis
501 0:f233164f4c86 rmeddis
        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 29:b51bf546ca3f rmeddis
509 0:f233164f4c86 rmeddis
    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 9:ecad0ea62b43 rmeddis
% 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 0:f233164f4c86 rmeddis
531 9:ecad0ea62b43 rmeddis
    % 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 0:f233164f4c86 rmeddis
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 9:ecad0ea62b43 rmeddis
% ------------------------------------------------ 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 0:f233164f4c86 rmeddis
595 9:ecad0ea62b43 rmeddis
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 0:f233164f4c86 rmeddis
610
% ------------------------------------------------ pushbuttonRun_Callback
611
function pushbuttonRun_Callback(hObject, eventdata, handles)
612 29:b51bf546ca3f rmeddis
global checkForPreviousGUI % holds screen positioning across repeated calls
613 28:02aa9826efe0 rmeddis
global experiment betweenRuns paradigmNames errormsg
614 0:f233164f4c86 rmeddis
checkForPreviousGUI.GUIposition=get(handles.figure1,'position');
615
experiment.singleShot=0;
616 30:1a502830d462 rmeddis
experiment.stop=0;
617
618 9:ecad0ea62b43 rmeddis
switch experiment.paradigm
619 28:02aa9826efe0 rmeddis
    case 'profile'
620 9:ecad0ea62b43 rmeddis
        %% special option for two successive and linked measurements
621
        experiment.paradigm='threshold_16ms';
622
        set(handles.edittargetDuration,'string', num2str(0.25))
623 28:02aa9826efe0 rmeddis
        set(handles.editstopCriteriaBox,'string','10') % nTrials
624 9:ecad0ea62b43 rmeddis
        run (handles)
625 29:b51bf546ca3f rmeddis
626 33:161913b595ae rmeddis
        if experiment.stop
627 28:02aa9826efe0 rmeddis
            optionNo=strmatch('profile',paradigmNames);
628
            set(handles.popupmenuParadigm,'value',optionNo);
629
            experiment.paradigm='profile';
630
            aParadigmSelection(handles)
631
            return
632
        end
633 29:b51bf546ca3f rmeddis
634 28:02aa9826efe0 rmeddis
        global resultsTable
635
        longTone=resultsTable(2:end,2:end);
636 29:b51bf546ca3f rmeddis
637 9:ecad0ea62b43 rmeddis
        set(handles.edittargetDuration,'string', num2str(0.016))
638 32:82fb37eb430e rmeddis
        set(handles.editstopCriteriaBox,'string','20') % nTrials
639 9:ecad0ea62b43 rmeddis
        run (handles)
640 33:161913b595ae rmeddis
        if experiment.stop
641 28:02aa9826efe0 rmeddis
            disp(errormsg)
642
            optionNo=strmatch('profile',paradigmNames);
643
            set(handles.popupmenuParadigm,'value',optionNo);
644
            experiment.paradigm='profile';
645
            experiment.stop=-0;
646
            aParadigmSelection(handles)
647
            return
648
        end
649 29:b51bf546ca3f rmeddis
650 28:02aa9826efe0 rmeddis
        shortTone=resultsTable(2:end,2:end);
651 9:ecad0ea62b43 rmeddis
652
        % use these threshold for TMC
653
        thresholds16ms=betweenRuns.thresholds;
654 28:02aa9826efe0 rmeddis
        optionNo=strmatch('TMC',paradigmNames);
655 9:ecad0ea62b43 rmeddis
        set(handles.popupmenuParadigm,'value',optionNo);
656
        aParadigmSelection(handles)
657
        set(handles.edittargetLevel,'string', thresholds16ms+10);
658 33:161913b595ae rmeddis
        set(handles.editstopCriteriaBox,'string','20')  % nTrials
659 29:b51bf546ca3f rmeddis
        pause(.1)
660 9:ecad0ea62b43 rmeddis
        run (handles)
661 29:b51bf546ca3f rmeddis
662 33:161913b595ae rmeddis
        if experiment.stop
663 28:02aa9826efe0 rmeddis
            disp(errormsg)
664
            optionNo=strmatch('profile',paradigmNames);
665
            set(handles.popupmenuParadigm,'value',optionNo);
666
            experiment.paradigm='profile';
667
            experiment.stop=-0;
668
            aParadigmSelection(handles)
669
            return
670
        end
671
672
        TMC=resultsTable(2:end,2:end);
673
        gaps=resultsTable(2:end,1);
674
        BFs=resultsTable(1, 2:end);
675 29:b51bf546ca3f rmeddis
676 28:02aa9826efe0 rmeddis
        % use these threshold for IFMC
677
        optionNo=strmatch('IFMC',paradigmNames);
678
        set(handles.popupmenuParadigm,'value',optionNo);
679
        aParadigmSelection(handles)
680
        set(handles.edittargetLevel,'string', thresholds16ms+10);
681
        set(handles.editstopCriteriaBox,'string','10')  % nTrials
682 29:b51bf546ca3f rmeddis
        pause(.1)
683 28:02aa9826efe0 rmeddis
        run (handles)
684
685 29:b51bf546ca3f rmeddis
686
        IFMCs=resultsTable(2:end,2:end);
687
        offBFs=resultsTable(2:end,1);
688
689
        % reset original paradigm
690
        optionNo=strmatch('profile',paradigmNames);
691
        set(handles.popupmenuParadigm,'value',optionNo);
692
        aParadigmSelection(handles)
693 33:161913b595ae rmeddis
694
%% save data and plot profile
695 29:b51bf546ca3f rmeddis
696 33:161913b595ae rmeddis
%         save profile longTone shortTone gaps BFs TMC offBFs IFMCs
697
profile2mFile(longTone, shortTone, gaps, BFs, TMC, offBFs, IFMCs,...
698
    'MTprofile')
699
plotProfile('MTprofile', 'profile_CMA_L')
700 29:b51bf546ca3f rmeddis
701 33:161913b595ae rmeddis
%% xx
702 29:b51bf546ca3f rmeddis
        if strcmp(errormsg,'manually stopped')
703 28:02aa9826efe0 rmeddis
            disp(errormsg)
704
            optionNo=strmatch('profile',paradigmNames);
705
            set(handles.popupmenuParadigm,'value',optionNo);
706
            experiment.paradigm='profile';
707
            experiment.stop=-0;
708
            aParadigmSelection(handles)
709
            return
710 29:b51bf546ca3f rmeddis
        end
711 9:ecad0ea62b43 rmeddis
    otherwise
712
        run (handles)
713
        experiment.stop=0;
714
end
715 0:f233164f4c86 rmeddis
716
function run (handles)
717
global experiment expGUIhandles stimulusParameters
718
tic
719
expGUIhandles=handles;
720
set(handles.pushbuttonStop, 'backgroundColor', [.941 .941 .941])
721 29:b51bf546ca3f rmeddis
% set(handles.editparamChanges,'visible','off')
722 0:f233164f4c86 rmeddis
723
% message box white (removes any previous error message)
724
set(handles.textMSG,...
725
    'backgroundcolor', 'w', 'ForegroundColor', 'b', 'string', '')
726
727
errorMsg=aReadAndCheckParameterBoxes(handles);
728
if ~isempty(errorMsg)
729
    append=0;
730
    warning=1;
731
    addToMsg(['error message:' errorMsg], append, warning)
732
    return
733
end
734
735
if isnan(stimulusParameters.targetLevel)
736
    addToMsg('Error: targetlevel not set', 1)
737
    error('Error: targetlevel not set')
738
end
739
740
set(handles.textMSG,'backgroundcolor', 'w')
741
set(handles.textMSG,'string', ' ')
742
743
% leave the program and start up multiThreshold
744
subjGUI_MT % leave the program and start up multiThreshold
745
experiment.justInitialized=0;% prevents moving subjectGUI
746
toc
747
748
% --- Executes on button press in pushbuttonSingleShot.
749
function pushbuttonSingleShot_Callback(hObject, eventdata, handles)
750 29:b51bf546ca3f rmeddis
global experiment
751 0:f233164f4c86 rmeddis
experiment.singleShot=1;
752
753
% special test for spontaneous activity
754
x=get(handles.editWRVstartValues, 'string');
755
y=get(handles.edittargetDuration, 'string');
756
set(handles.editWRVstartValues, 'string', '-20')
757
set(handles.edittargetDuration, 'string', '1')
758
759
MAPplot=get(handles.editMAPplot, 'string');
760
set(handles.editMAPplot, 'string', '1')
761
drawnow
762
763
run (handles)
764
765
set(handles.editMAPplot, 'string', MAPplot)
766
set(handles.editWRVstartValues, 'string', x)
767
set(handles.edittargetDuration, 'string', y)
768
769
% ------------------------------------------aReadAndCheckParameterBoxes
770
function errorMsg=aReadAndCheckParameterBoxes(handles)
771
global experiment  stimulusParameters betweenRuns  statsModel
772 29:b51bf546ca3f rmeddis
global variableNames  LevittControl paramChanges
773 0:f233164f4c86 rmeddis
% When the program sets the parameters all should be well
774
% But when the user changes them...
775
776
errorMsg='';
777
778
% name
779
experiment.name=get(handles.editName,'string');
780
781
% ear/models
782
option=get(handles.popupmenuEar,'value');
783
strings=get(handles.popupmenuEar,'string');
784
experiment.ear=strings{option};
785
786
switch experiment.ear
787
    case { 'MAPmodel', 'MAPmodelMultiCh', ...
788 29:b51bf546ca3f rmeddis
            'MAPmodelSingleCh', 'MAPmodelListen'}
789
        % MAPmodel writes forced parameter settings to the screen
790 0:f233164f4c86 rmeddis
        %  so that they can be read from there
791 30:1a502830d462 rmeddis
        % {'randomize within blocks', 'fixed sequence',...
792
        %  'randomize across blocks'}
793 0:f233164f4c86 rmeddis
        set(handles.popupmenuRandomize,'value',2)       % fixed sequence
794
        set(handles.editstimulusDelay,'string','0.01')  % no stimulus delay
795
        stimulusParameters.includeCue=0;                % no cue for MAP
796
end
797
798
% find tone type
799
option=get(handles.popupmenuTargetType,'value');
800
strings=get(handles.popupmenuTargetType,'string');
801
stimulusParameters.targetType=strings{option};
802
803
% find masker type
804
option=get(handles.popupmenuMaskerType,'value');
805
strings=get(handles.popupmenuMaskerType,'string');
806
stimulusParameters.maskerType=strings{option};
807
808
% find background type and level
809
option=get(handles.popupmenuBackgroundType,'value');
810
strings=get(handles.popupmenuBackgroundType,'string');
811
stimulusParameters.backgroundTypeValue=option;
812
stimulusParameters.backgroundLevel=...
813
    str2num(get(handles.editBackgroundLevel,'string'));
814
stimulusParameters.backgroundType=strings{option};
815
816
% Read all stimulus parameter boxes
817
for i=1:length(variableNames)
818
    cmd=['stimulusParameters.' variableNames{i} ...
819
        '= str2num(get(handles.edit' variableNames{i} ',''string'' ));'];
820
    eval(cmd);
821
end
822
% for multiple levels
823
stimulusParameters.targetLevels=stimulusParameters.targetLevel;
824
825
% check that all required values are in the edit boxes
826
for i=1:length(variableNames)-3 % do not include 'level limits'
827
    eval([ 'variableValues=stimulusParameters.' variableNames{i} ';'])
828
    if isempty(variableValues), errorMsg=[ variableNames{i} ...
829
            ' is an empty box']; return, end
830
end
831
832
chosenOption=get(handles.popupmenuVaryParameter1,'value');
833
betweenRuns.variableName1=variableNames{chosenOption};
834
eval(['betweenRuns.variableList1 = stimulusParameters.' ...
835
    betweenRuns.variableName1 ';']);
836
837
chosenOption=get(handles.popupmenuVaryParameter2,'value');
838
betweenRuns.variableName2=variableNames{chosenOption};
839
eval(['betweenRuns.variableList2 = stimulusParameters.' ...
840
    betweenRuns.variableName2 ';']);
841
842
% Check that variable parameters 1 & 2 have different names
843
if strcmp(betweenRuns.variableName1,betweenRuns.variableName2) ...
844
        && ~strcmp(betweenRuns.variableName1,'none')
845
    errorMsg='variable parameters have the same name';
846
    return
847
end
848
849
% calibration
850 29:b51bf546ca3f rmeddis
%  this is used to *reduce* the output signal from what it otherwise
851 0:f233164f4c86 rmeddis
%  would be
852
% signal values are between 1 - 2^23
853
%  these are interpreted as microPascals between -29 dB and 128 dB SPL
854 29:b51bf546ca3f rmeddis
% calibrationdB adjusts these values to compensate for equipment
855 0:f233164f4c86 rmeddis
%  characteristics
856 29:b51bf546ca3f rmeddis
%  this will change the range. e.g. a 7 dB calibration will yield
857 0:f233164f4c86 rmeddis
%   a range of -36 to 121 dB SPL
858
% Calibration is not used when modelling. Values are treated as dB SPL
859
stimulusParameters.calibrationdB=...
860
    str2num(get(handles.editcalibrationdB,'string'));
861
862
% check on cue
863
cueSetUp(handles)
864
865
stimulusParameters.WRVinitialStep=stimulusParameters.WRVsteps(1);
866
stimulusParameters.WRVsmallStep=stimulusParameters.WRVsteps(2);
867
868
% jitter start value set after reading in new parameters
869
switch experiment.paradigm
870
    case 'discomfort'
871
        stimulusParameters.jitterStartdB=0;
872
    otherwise
873
        stimulusParameters.jitterStartdB=abs(stimulusParameters.WRVsteps(1));
874
end
875
876
877
% stats model mean and slope
878
statsModelParameters= str2num(get(handles.editStatsModel,'string'));
879
switch experiment.ear
880
    case {'statsModelLogistic'}
881
        statsModel.logisticMean=statsModelParameters(1) ;
882
        statsModel.logisticSlope=statsModelParameters(2);
883
        statsModel.rareEvenGain=NaN ;
884
        statsModel.rareEventVmin=NaN;
885
    case 'statsModelRareEvent'
886
        statsModel.logisticMean=NaN ;
887
        statsModel.logisticSlope=NaN;
888
        statsModel.rareEvenGain=statsModelParameters(2) ;
889
        statsModel.rareEventVmin=statsModelParameters(1);
890
end
891
892
% MAP plotting
893
experiment.MAPplot=str2num(get(handles.editMAPplot,'string'));
894
% if ~isequal(experiment.MAPplot, 0),
895
%     % any other character will do it
896
%     experiment.MAPplot=1;
897
% end
898
899
% save data
900
experiment.saveData=str2num(get(handles.editSaveData,'string'));
901
if ~isequal(experiment.saveData, 0),
902
    % any other character will do it
903
    experiment.saveData=1;
904
end
905
906
% print tracks
907
experiment.printTracks=str2num(get(handles.editPrintTracks,'string'));
908
if ~isequal(experiment.printTracks, 0),
909
    % any other character will do it
910
    experiment.printTracks=1;
911
end
912
913
% catch trial rate
914
% (1)= start rate,   (2)= base rate,   (3)= time constant (trials)
915
stimulusParameters.catchTrialRates=...
916
    str2num(get(handles.editCatchTrialRate,'string'));
917
if stimulusParameters.catchTrialRates(1) ...
918
        < stimulusParameters.catchTrialRates(2)
919
    errorMsg=...
920
        'catch trial base rates must be less than catch trial start rate';
921
    return,
922
end
923
924
% sample rate
925
% The sample rate is set in the paradigm file.
926
% Normally this is set in the startUp paradigm file and then left
927
% When the model is used, the multiThreshold sample rate
928
% overrules anything in the model
929
stimulusParameters.sampleRate=...
930
    str2num(get(handles.textsampleRate,'string'));
931
932
% music level
933
stimulusParameters.musicLeveldB=...
934
    str2num(get(handles.editMusicLevel,'string'));
935
936
%  set message box font size
937
experiment.msgFontSize=str2num(get(handles.editMsgFont,'string'));
938
experiment.subjGUIfontSize=str2num(get(handles.editSubjectFont,'string'));
939
940
% stop criteria
941
experiment.singleIntervalMaxTrials=...
942
    str2num(get(handles.editstopCriteriaBox,'string'));
943
experiment.maxTrials=experiment.singleIntervalMaxTrials(1);
944
945
% set up 2IFC is required (? better in atrhesholdAssessmentMethod)
946
switch experiment.threshEstMethod
947
    case {'2I2AFC++', '2A2AIFC+++'}
948
        experiment.peaksUsed=experiment.singleIntervalMaxTrials(2);
949
        experiment.PeakTroughCriterionSD=...
950
            experiment.singleIntervalMaxTrials(3);
951
        experiment.trialsToBeUsed= 5;
952
        LevittControl.maxTrials=experiment.singleIntervalMaxTrials(1);
953
        % start value for step until reduced
954
        LevittControl.startLevelStep= stimulusParameters.WRVsteps(1);
955
        % reduced step size
956 29:b51bf546ca3f rmeddis
        LevittControl.steadyLevittStep= stimulusParameters.WRVsteps(2);
957 0:f233164f4c86 rmeddis
        LevittControl.TurnsToSmallSteps= 2;
958
        LevittControl.useLastNturns= 2*experiment.peaksUsed;
959
        LevittControl.minReversals= ...
960
            LevittControl.TurnsToSmallSteps+2*experiment.peaksUsed;
961
        LevittControl.targetsdPT = experiment.PeakTroughCriterionSD;
962
        LevittControl.maxLevittValue= stimulusParameters.WRVlimits(2);
963
        Levitt2;
964
end
965
966
% What kind of randomisation is required?
967
idx=get(handles.popupmenuRandomize,'value');
968
s=get(handles.popupmenuRandomize,'string');
969
betweenRuns.randomizeSequence=s{idx};
970
971
% Make small adjustments to variable values
972
%  to keep values unique against later sorting
973
x=betweenRuns.variableList1;
974
[y idx]= sort(x);
975
for i=1:length(y)-1, if y(i+1)==y(i); y(i+1)=y(i)*1.001; end, end
976
x(idx)=y;
977
betweenRuns.variableList1=x;
978
979
x=betweenRuns.variableList2;
980
[y idx]= sort(x);
981
for i=1:length(y)-1, if y(i+1)==y(i); y(i+1)=y(i)*1.001; end, end
982
x(idx)=y;
983
betweenRuns.variableList2=x;
984
985
% Checks: after reading and setting parameters  ------------------------------------------
986
% check for finger trouble (more checks possible
987
if stimulusParameters.maskerDuration>10
988
    errorMsg='maskerDuration is too long'; return, end
989
if stimulusParameters.gapDuration>10
990
    errorMsg='gapDuration is too long'; return, end
991
if stimulusParameters.targetDuration>10
992
    errorMsg='targetDuration is too long'; return, end
993
994
% rare event slope check
995
if experiment.psyFunSlope<0 ...
996
        && strcmp(experiment.functionEstMethod,'rareEvent')
997
    errorMsg='cannot use rareEvent option for negative psychometr slopes';
998
    return
999
end
1000
1001
% check ramps
1002
if stimulusParameters.rampDuration*2> stimulusParameters.targetDuration
1003
    errorMsg=' ramp duration is too long for the target';
1004
    return
1005
end
1006
1007
if max(stimulusParameters.maskerDuration)>0 ...
1008
        && max(stimulusParameters.rampDuration...
1009
        *2> stimulusParameters.maskerDuration)
1010
    errorMsg=' ramp duration is too long for the masker';
1011
    return
1012
end
1013
1014
% Check WRVstartValues for length and compatibility with randomization
1015
% only one start value supplied so all start values are the same
1016 29:b51bf546ca3f rmeddis
if length(stimulusParameters.WRVstartValues)==1
1017 0:f233164f4c86 rmeddis
    stimulusParameters.WRVstartValues= ...
1018
        repmat(stimulusParameters.WRVstartValues, 1, ...
1019
        length(betweenRuns.variableList1)...
1020
        *length(betweenRuns.variableList2));
1021
elseif ~isequal(length(stimulusParameters.WRVstartValues), ...
1022
        length(betweenRuns.variableList1)...
1023
        *length(betweenRuns.variableList2))
1024
    % otherwise we need one value for each combination of var1/ var2
1025
    errorMsg='WRVstartValues not the same length as number of runs';
1026
    return
1027
elseif strcmp(betweenRuns.randomizeSequence, 'randomize within blocks')...
1028
        && length(stimulusParameters.WRVstartValues)>1
1029
    errorMsg='multiple WRVstartValues inappropriate';
1030
    return
1031
end
1032
1033 9:ecad0ea62b43 rmeddis
% set the target level in advance for every wnticipated run
1034 0:f233164f4c86 rmeddis
switch experiment.paradigm
1035 9:ecad0ea62b43 rmeddis
    case {'trainingIFMC', 'TMC','TMC_16ms', 'TMC - ELP', ...
1036
            'IFMC', 'IFMC_16ms'}
1037 0:f233164f4c86 rmeddis
        % For TMC and IFMC multiple target levels can be set
1038
        if length(stimulusParameters.targetLevel)==1
1039
            betweenRuns.targetLevels=...
1040
                repmat(stimulusParameters.targetLevel, 1, ...
1041
                length(betweenRuns.variableList1)...
1042
                *length(betweenRuns.variableList2));
1043
        elseif length(stimulusParameters.targetLevel)==...
1044
                length(betweenRuns.variableList2)
1045 9:ecad0ea62b43 rmeddis
            % only one level specified, so use this throughout
1046 0:f233164f4c86 rmeddis
            x=stimulusParameters.targetLevel;
1047
            x=repmat(x,length(betweenRuns.variableList1),1);
1048
            x=reshape(x,1,length(betweenRuns.variableList1)*length(betweenRuns.variableList2));
1049
            betweenRuns.targetLevels=x;
1050
        else
1051
            errorMsg='targetLevels not the same length as number of targetFrequencies';
1052
        end
1053
end
1054
1055
switch experiment.paradigm
1056
    case  {'gapDetection', 'frequencyDiscrimination'}
1057
        if ~isequal(stimulusParameters.targetDuration, ...
1058
                stimulusParameters.maskerDuration)
1059
            addToMsg(...
1060
                'Warning: masker and target duration not the same.',1,1)
1061 29:b51bf546ca3f rmeddis
        end
1062 0:f233164f4c86 rmeddis
        if ~isequal(stimulusParameters.maskerLevel, ...
1063
                stimulusParameters.targetLevel)
1064
            addToMsg(['Warning: masker and target level different.'...
1065
                'They will be changed to be equal',1,1]);
1066
        end
1067
end
1068
1069 29:b51bf546ca3f rmeddis
% identify model parameter changes if any
1070
paramChanges=get(handles.editparamChanges,'string');
1071
eval(paramChanges);
1072
1073 0:f233164f4c86 rmeddis
% -------------------------------------------- aSetSampleRate
1074
function aSetSampleRate(sampleRate, handles)
1075
global  stimulusParameters
1076
stimulusParameters.sampleRate=sampleRate;
1077
set(handles.textsampleRate,'string',num2str(stimulusParameters.sampleRate))
1078
1079
% -------------------------------------------- popupmenuEar_Callback
1080
function popupmenuEar_Callback(hObject, eventdata, handles)
1081
global experiment
1082
option=get(handles.popupmenuEar,'value');
1083
options=get(handles.popupmenuEar,'string');			% left/right/model
1084
experiment.ear=options{option};
1085 28:02aa9826efe0 rmeddis
set(handles.editparamChanges,'visible','off')
1086 0:f233164f4c86 rmeddis
switch experiment.ear
1087
    case 'statsModelLogistic'
1088
        set(handles.editStatsModel,'string', '15, 0.5')
1089
    case 'statsModelRareEvent'
1090
        set(handles.editStatsModel,'string', '20 1')
1091 28:02aa9826efe0 rmeddis
    case {'MAPmodelListen',  'MAPmodelMultiCh', 'MAPmodelSingleCh'}
1092
        set(handles.editparamChanges,'visible','on')
1093 0:f233164f4c86 rmeddis
end
1094
earSetUp(handles)
1095
1096
% -------------------------------------------- earSetUp
1097
function	earSetUp(handles)
1098
global experiment stimulusParameters
1099
% option=get(handles.popupmenuEar,'value');
1100
% options=get(handles.popupmenuEar,'string');			% left/right/model
1101
% experiment.ear=options{option};
1102
1103
switch experiment.ear
1104
    case {'statsModelLogistic'}
1105
        statsModel.logisticSlope=0.5;
1106
        statsModel.logisticMean=15;
1107
        set(handles.editStatsModel,'string', ...
1108
            num2str([statsModel.logisticMean statsModel.logisticSlope]))
1109
        set(handles.textStatsModel,...
1110
            'string', {'statsModel',' logistic threshold\ slope'})
1111
    case 'statsModelRareEvent'
1112
        set(handles.textStatsModel,'string', ...
1113
            {'statsModel',' rareEvent Vmin\ gain'})
1114
end
1115
1116
switch experiment.ear
1117
    case {'statsModelLogistic', 'statsModelRareEvent'}
1118
        set(handles.editStatsModel, 'visible', 'off')
1119
        set(handles.textStatsModel, 'visible', 'off')
1120 29:b51bf546ca3f rmeddis
1121 0:f233164f4c86 rmeddis
        % default psychometric bin size and logistic slopes
1122
        set(handles.popupmenuRandomize,'value',2)   % fixed sequence
1123
        set(handles.editName,'string', 'statsModel')
1124
        %         experiment.headphonesUsed=0;
1125 29:b51bf546ca3f rmeddis
1126 0:f233164f4c86 rmeddis
    case {'MAPmodelListen', 'MAPmodelMultiCh', 'MAPmodelSingleCh'}
1127
        stimulusParameters.includeCue=0;						 % no cue
1128
        set(handles.popupmenuCueNoCue,'value', 2)
1129 29:b51bf546ca3f rmeddis
1130 0:f233164f4c86 rmeddis
        set(handles.editCatchTrialRate,'string','0 0  2 ');%no catch trials
1131
        set(handles.editName,'string', 'Normal')			% force name
1132
        experiment.name=get(handles.editName,'string');	% read name back
1133 29:b51bf546ca3f rmeddis
        set(handles.editcalibrationdB,'string','0')
1134
1135 0:f233164f4c86 rmeddis
        set(handles.popupmenuRandomize,'value',2)       % fixed sequence
1136
        set(handles.editstimulusDelay,'string','0')
1137 29:b51bf546ca3f rmeddis
1138 0:f233164f4c86 rmeddis
        set(handles.editSaveData,'string', '0')
1139
        set(handles.editSubjectFont,'string', '10');
1140
        experiment.MacGThreshold=0; % num MacG spikes to exceed threshold
1141
end
1142
aResetPopupMenus(handles)
1143
1144
% --------------------------------------------- popupmenuCueNoCue_Callback
1145
function popupmenuCueNoCue_Callback(hObject, eventdata, handles)
1146
cueSetUp(handles)
1147
1148
% ------------------------------------------------------------- cueSetUp
1149
function cueSetUp(handles)
1150
global stimulusParameters
1151
1152
chosenOption=get(handles.popupmenuCueNoCue,'value');
1153
if chosenOption==1
1154
    stimulusParameters.includeCue=1;
1155
    set(handles.editcueTestDifference,'visible', 'on')
1156
    set(handles.textcueTestDifference,'visible', 'on')
1157
    stimulusParameters.subjectText=stimulusParameters.instructions{2};
1158
else
1159
    stimulusParameters.includeCue=0;
1160
    set(handles.editcueTestDifference,'visible', 'off')
1161
    set(handles.textcueTestDifference,'visible', 'off')
1162
    stimulusParameters.subjectText= stimulusParameters.instructions{1};
1163
end
1164
1165
% -------------------------------------------- popupmenuThreshEst_Callback
1166
function popupmenuThreshEst_Callback(hObject, eventdata, handles)
1167
aThresholdAssessmentMethod(handles);
1168
1169
%  --------------------------------------------- aThresholdAssessmentMethod
1170
function aThresholdAssessmentMethod(handles)
1171
% identify the threshold assessment method
1172
%  and set various parameters on the GUI appropriately
1173
global stimulusParameters experiment  threshEstNames LevittControl
1174
1175
chosenOption=get(handles.popupmenuThreshEst,'value');
1176
experiment.threshEstMethod=threshEstNames{chosenOption};
1177
set(handles.editCatchTrialRate, 'visible', 'on')
1178
set(handles.textCatchTrials, 'visible', 'on')
1179
1180
% establish appropriate stop criterion and post on GUI
1181
switch experiment.threshEstMethod
1182
    case 'MaxLikelihood'
1183
        experiment.functionEstMethod='logisticML';
1184
        stimulusParameters.WRVsteps=10*experiment.psyFunSlope;  % ???
1185
        set(handles.textstopCriteria,'string', 'stop criteria \ maxTrials')
1186
        experiment.singleIntervalMaxTrials=experiment.stopCriteriaSI;
1187
        experiment.allowCatchTrials= 1;
1188
        switch experiment.paradigm
1189
            case 'training'
1190
                experiment.possLogSlopes=0.5;
1191
        end
1192 29:b51bf546ca3f rmeddis
1193 0:f233164f4c86 rmeddis
    case 'oneIntervalUpDown'
1194
        experiment.functionEstMethod='logisticLS';
1195
        set(handles.textstopCriteria,'string', 'stop criteria \ maxTrials')
1196
        experiment.singleIntervalMaxTrials=experiment.stopCriteriaSI;
1197
        switch experiment.paradigm
1198
            case 'discomfort'
1199
                experiment.allowCatchTrials= 0;
1200
            otherwise
1201
                experiment.allowCatchTrials= 1;
1202
        end
1203 29:b51bf546ca3f rmeddis
1204 0:f233164f4c86 rmeddis
    case {'2I2AFC++',  '2I2AFC+++'}
1205
        LevittControl.rule='++'; %  e.g. '++' or '+++'
1206
        experiment.singleIntervalMaxTrials=experiment.stopCriteria2IFC;
1207
        experiment.functionEstMethod='peaksAndTroughs';
1208
        LevittControl.maxTrials=experiment.singleIntervalMaxTrials(1);
1209
        set(handles.editWRVsteps,'string', ...
1210
            num2str(stimulusParameters.WRVsteps))
1211
        set(handles.textstopCriteria,'string', {'trials peaks sdCrit'})
1212
        experiment.allowCatchTrials= 0;
1213
end
1214
1215
set(handles.textstopCriteria,'fontSize',8)
1216
set(handles.editstopCriteriaBox,'string',...
1217
    num2str(experiment.singleIntervalMaxTrials))
1218
1219
% establish the appropriate instructions to the subject
1220
% NB responsibility for this is now transferred to the paradigm file
1221
switch experiment.threshEstMethod
1222
    % only one value required for level change
1223 29:b51bf546ca3f rmeddis
    case {'2I2AFC++', '2A2AIFC+++'}
1224 0:f233164f4c86 rmeddis
        stimulusParameters.subjectText=...
1225
            'did the tone occur in window 1 or 2?';
1226
    case {'MaxLikelihood',  'oneIntervalUpDown'};
1227
        switch stimulusParameters.includeCue
1228
            case 0
1229
                stimulusParameters.subjectText=...
1230
                    stimulusParameters.instructions{1};
1231
            case 1
1232
                stimulusParameters.subjectText= ...
1233
                    stimulusParameters.instructions{2};
1234
        end
1235
end
1236
stimulusParameters.messageString={'training'};
1237
1238
aResetPopupMenus(handles)
1239
% -------------------------------------------------- function orderGlobals
1240
function orderGlobals
1241
global  stimulusParameters experiment betweenRuns withinRuns
1242
1243
stimulusParameters=[];
1244
stimulusParameters.sampleRate=		[];
1245
stimulusParameters.targetType=	'';
1246
stimulusParameters.targetFrequency=	[];
1247
stimulusParameters.targetDuration=	[];
1248
stimulusParameters.targetLevel=	[];
1249
stimulusParameters.gapDuration=	[];
1250
stimulusParameters.maskerType=	'';
1251
stimulusParameters.maskerRelativeFrequency=	[];
1252
stimulusParameters.maskerDuration=	[];
1253
stimulusParameters.maskerLevel=	[];
1254
stimulusParameters.backgroundType=	'';
1255
stimulusParameters.backgroundTypeValue=	[];
1256
stimulusParameters.backgroundLevel=	[];
1257
stimulusParameters.includeCue=	[];
1258
experiment.clickToStimulusPause=[];
1259
stimulusParameters.stimulusDelay=	[];
1260
stimulusParameters.rampDuration=	[];
1261
stimulusParameters.absThresholds=	[];
1262
stimulusParameters.numOHIOtones=	[];
1263
1264
stimulusParameters.WRVname=	'';
1265
stimulusParameters.WRVstartValues=		[];
1266
stimulusParameters.WRVsteps=	[];
1267
stimulusParameters.WRVlimits=	[];
1268
stimulusParameters.WRVinitialStep=		[];
1269
stimulusParameters.WRVsmallStep=	[];
1270
experiment.singleIntervalMaxTrials=	[];
1271
stimulusParameters.calibrationdB=	[];
1272
1273
stimulusParameters.catchTrialRates=	[];
1274
stimulusParameters.catchTrialBaseRate=	[];
1275
stimulusParameters.catchTrialRate=	[];
1276
stimulusParameters.catchTrialTimeConstant=	[];
1277
1278
stimulusParameters.dt=		[];
1279
1280
stimulusParameters.jitterStartdB=	[];
1281
stimulusParameters.restoreCalibration=	[];
1282
stimulusParameters.messageString=		[];
1283
stimulusParameters.cueTestDifference=	[];
1284
stimulusParameters.subjectText=	 '';
1285
stimulusParameters.testTargetBegins=	[];
1286
stimulusParameters.testTargetEnds=	[];
1287
stimulusParameters.musicLeveldB=	[];
1288
1289
stimulusParameters.subjectSampleRate=[];
1290
stimulusParameters.MAPSampleRate=[];
1291
1292
experiment=[];
1293
experiment.name=	'';
1294
experiment.date=	'';
1295
experiment.paradigm=	'';
1296
experiment.ear=	'';
1297
experiment.headphonesUsed=[];
1298
experiment.singleShot=	[];
1299
experiment.randomize=	'';
1300
experiment.maxTrials=	[];
1301
experiment.MacGThreshold=	[];
1302
experiment.resetCriterion=	[];
1303
experiment.runResetCriterion=	[];
1304
1305
experiment.comparisonData=	[];
1306
experiment.absThresholds=	[];
1307
experiment.threshEstMethod=	'';
1308
experiment.functionEstMethod=	'';
1309
experiment.psyBinWidth=	[];
1310 30:1a502830d462 rmeddis
experiment.maxLogisticK=[];
1311
experiment.numPossLogisticK=[];
1312 0:f233164f4c86 rmeddis
experiment.possLogSlopes=	[];
1313
experiment.meanSearchStep=	[];
1314
experiment.psyFunSlope=	[];
1315
experiment.predictionLevels=[];
1316
1317
experiment.buttonBoxType=	'';
1318
experiment.buttonBoxStatus=	'';
1319
experiment.status=	'';
1320 30:1a502830d462 rmeddis
experiment.stop=	[];
1321 0:f233164f4c86 rmeddis
experiment.pleaseRepeat=	[];
1322
experiment.justInitialized=[];
1323
1324
experiment.MAPplot=	    [];
1325
experiment.saveData=	[];
1326
experiment.printTracks=	[];
1327
experiment.msgFontSize=	[];
1328
experiment.subjGUIfontSize=	[];
1329
1330
experiment.timeAtStart=	'';
1331
experiment.minElapsed=	[];
1332
1333
betweenRuns=[];
1334
betweenRuns.variableName1=	'';
1335
betweenRuns.variableList1=	[];
1336
betweenRuns.variableName2=	'';
1337
betweenRuns.variableList2=	[];
1338
betweenRuns.var1Sequence=	[];
1339
betweenRuns.var2Sequence=	[];
1340
betweenRuns.randomizeSequence=[];
1341
betweenRuns.timeNow=	[];
1342
betweenRuns.runNumber=	[];
1343
betweenRuns.thresholds=	[];
1344
betweenRuns.forceThresholds=	[];
1345
betweenRuns.observationCount=	[];
1346
betweenRuns.timesOfFirstReversals=	[];
1347
betweenRuns.bestThresholdTracks='';
1348
betweenRuns.levelTracks='';
1349
betweenRuns.responseTracks='';
1350
betweenRuns.slopeKTracks=	[];
1351
betweenRuns.gainTracks=	[];
1352
betweenRuns.VminTracks=	[];
1353
betweenRuns.bestGain=	[];
1354
betweenRuns.bestVMin=	[];
1355
betweenRuns.bestPaMin=	[];
1356
betweenRuns.bestLogisticM=	[];
1357
betweenRuns.bestLogisticK=	[];
1358
betweenRuns.psychometicFunction='';
1359
betweenRuns.catchTrials=	[];
1360
betweenRuns.caughtOut=	[];
1361
1362
withinRuns=[];
1363
withinRuns.trialNumber=[];
1364 30:1a502830d462 rmeddis
withinRuns.nowInPhase2=[];
1365
withinRuns.beginningOfPhase2=[];
1366 0:f233164f4c86 rmeddis
withinRuns.variableValue=[];
1367
withinRuns.direction='';
1368
withinRuns.peaks=[];
1369
withinRuns.troughs=	[];
1370
withinRuns.levelList=	[];
1371
withinRuns.responseList=	 [];
1372
withinRuns.meanEstTrack=	[];
1373
withinRuns.meanLogisticEstTrack=[];
1374
withinRuns.bestSlopeK=	[];
1375
withinRuns.bestGain=	[];
1376
withinRuns.bestVMin=	[];
1377
withinRuns.forceThreshold=[];
1378
withinRuns.catchTrial=	[];
1379
withinRuns.caughtOut=[];
1380
withinRuns.catchTrialCount=[];
1381
withinRuns.wrongButton=	[];
1382 30:1a502830d462 rmeddis
withinRuns.babblePlaying=[];
1383 0:f233164f4c86 rmeddis
1384
% --- Executes on selection change in popupmenuBackgroundType.
1385
function popupmenuBackgroundType_Callback(hObject, eventdata, handles)
1386
global backgroundTypes
1387
option=get(handles.popupmenuBackgroundType,'value');
1388
selectedBackground=backgroundTypes{option};
1389
stimulusParameters.backgroundType=selectedBackground;
1390
1391
switch selectedBackground
1392
    case 'none'
1393
        set(handles.editBackgroundLevel,'visible','off')
1394
        set(handles.textBGlevel,'visible','off')
1395
    otherwise
1396
        set(handles.editBackgroundLevel,'visible','on')
1397
        set(handles.textBGlevel,'visible','on')
1398
end
1399
1400
1401
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1402
function pushbuttonStop_Callback(hObject, eventdata, handles)
1403
global experiment
1404
experiment.stop=1;
1405
disp('stop!')
1406
set(handles.pushbuttonStop, 'backgroundColor','r')
1407
pause(.1)
1408
drawnow
1409
1410
function pushbuttonOME_Callback(hObject, eventdata, handles)
1411 29:b51bf546ca3f rmeddis
global experiment paramChanges
1412 0:f233164f4c86 rmeddis
aReadAndCheckParameterBoxes(handles);
1413 29:b51bf546ca3f rmeddis
testOME(experiment.name, paramChanges);
1414 0:f233164f4c86 rmeddis
1415
function pushbuttonBM_Callback(hObject, eventdata, handles)
1416 29:b51bf546ca3f rmeddis
global  stimulusParameters experiment paramChanges
1417 0:f233164f4c86 rmeddis
aReadAndCheckParameterBoxes(handles);
1418 28:02aa9826efe0 rmeddis
relativeFrequencies=[0.25    .5   .75  1  1.25 1.5    2];
1419 33:161913b595ae rmeddis
relativeFrequencies=[ 1 ];
1420 29:b51bf546ca3f rmeddis
AN_spikesOrProbability='probability';
1421 28:02aa9826efe0 rmeddis
testBM(stimulusParameters.targetFrequency, ...
1422 29:b51bf546ca3f rmeddis
    experiment.name,relativeFrequencies, AN_spikesOrProbability, ...
1423
    paramChanges);
1424 0:f233164f4c86 rmeddis
1425
function pushbuttonAN_Callback(hObject, eventdata, handles)
1426 29:b51bf546ca3f rmeddis
global stimulusParameters experiment paramChanges
1427 0:f233164f4c86 rmeddis
aReadAndCheckParameterBoxes(handles);
1428
% now carry out tests
1429
showPSTHs=0;
1430 9:ecad0ea62b43 rmeddis
targetFrequency=stimulusParameters.targetFrequency(1);
1431
BFlist=targetFrequency;
1432 0:f233164f4c86 rmeddis
1433 29:b51bf546ca3f rmeddis
testAN(targetFrequency,BFlist,-10:10:90,experiment.name, paramChanges);
1434 9:ecad0ea62b43 rmeddis
1435
function pushbuttonPhLk_Callback(hObject, eventdata, handles)
1436 29:b51bf546ca3f rmeddis
global experiment
1437 0:f233164f4c86 rmeddis
aReadAndCheckParameterBoxes(handles);
1438 29:b51bf546ca3f rmeddis
testPhaseLocking(experiment.name)
1439 0:f233164f4c86 rmeddis
1440
function pushbuttonSYN_Callback(hObject, eventdata, handles)
1441 29:b51bf546ca3f rmeddis
global stimulusParameters experiment paramChanges
1442 0:f233164f4c86 rmeddis
aReadAndCheckParameterBoxes(handles);
1443 29:b51bf546ca3f rmeddis
% now carry out tests
1444
showPSTHs=0;
1445
targetFrequency=stimulusParameters.targetFrequency(1);
1446
BFlist=targetFrequency;
1447
testSynapse(BFlist,experiment.name, paramChanges)
1448 0:f233164f4c86 rmeddis
1449
function pushbuttonFM_Callback(hObject, eventdata, handles)
1450 29:b51bf546ca3f rmeddis
global stimulusParameters experiment paramChanges
1451 0:f233164f4c86 rmeddis
aReadAndCheckParameterBoxes(handles);
1452 28:02aa9826efe0 rmeddis
showPSTHs=1;
1453 29:b51bf546ca3f rmeddis
testFM(stimulusParameters.targetFrequency(1),experiment.name, ...
1454 32:82fb37eb430e rmeddis
    'probability', paramChanges)
1455 0:f233164f4c86 rmeddis
1456
function popupmenuPhase_Callback(hObject, eventdata, handles)
1457
global stimulusParameters
1458
1459
optionNo=get(handles.popupmenuPhase,'value');
1460
options=get(handles.popupmenuPhase,'string');
1461
phase=options{optionNo};
1462
stimulusParameters.maskerPhase=phase;
1463
stimulusParameters.targetPhase=phase;
1464
1465
function pushbuttonParams_Callback(hObject, eventdata, handles)
1466
global experiment stimulusParameters
1467
aReadAndCheckParameterBoxes(handles);
1468
showParams=1; BFlist=-1;
1469 28:02aa9826efe0 rmeddis
paramChanges=get(handles.editparamChanges,'string');
1470 29:b51bf546ca3f rmeddis
eval(paramChanges);
1471 28:02aa9826efe0 rmeddis
1472 0:f233164f4c86 rmeddis
paramFunctionName=['method=MAPparams' experiment.name ...
1473 28:02aa9826efe0 rmeddis
    '(BFlist, stimulusParameters.sampleRate, showParams,paramChanges);'];
1474 0:f233164f4c86 rmeddis
eval(paramFunctionName) % go and fetch the parameters requesting parameter printout
1475
1476
1477
% --- Executes on button press in pushbuttonRP.
1478
function pushbuttonRP_Callback(hObject, eventdata, handles)
1479 29:b51bf546ca3f rmeddis
global experiment stimulusParameters paramChanges
1480 0:f233164f4c86 rmeddis
aReadAndCheckParameterBoxes(handles);
1481
% now carry out test
1482 29:b51bf546ca3f rmeddis
testRP(stimulusParameters.targetFrequency,experiment.name, paramChanges)
1483 0:f233164f4c86 rmeddis
1484
% function handles % ??
1485
1486
1487
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1488
1489
function editmaskerDuration_Callback(hObject, eventdata, handles)
1490
1491
function editmaskerDuration_CreateFcn(hObject, eventdata, handles)
1492
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1493
    set(hObject,'BackgroundColor','white');
1494
end
1495
1496
function editmaskerLevel_Callback(hObject, eventdata, handles)
1497
1498
function editmaskerLevel_CreateFcn(hObject, eventdata, handles)
1499
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1500
    set(hObject,'BackgroundColor','white');
1501
end
1502
1503
function editmaskerRelativeFrequency_Callback(hObject, eventdata, handles)
1504
1505
function editmaskerRelativeFrequency_CreateFcn(hObject, eventdata, handles)
1506
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1507
    set(hObject,'BackgroundColor','white');
1508
end
1509
1510
function editWRVstartValues_Callback(hObject, eventdata, handles)
1511
1512
function editWRVstartValues_CreateFcn(hObject, eventdata, handles)
1513
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1514
    set(hObject,'BackgroundColor','white');
1515
end
1516
1517
function editgapDuration_Callback(hObject, eventdata, handles)
1518
1519
function editgapDuration_CreateFcn(hObject, eventdata, handles)
1520
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1521
    set(hObject,'BackgroundColor','white');
1522
end
1523
1524
function edittargetDuration_Callback(hObject, eventdata, handles)
1525
1526
function edittargetDuration_CreateFcn(hObject, eventdata, handles)
1527
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1528
    set(hObject,'BackgroundColor','white');
1529
end
1530
1531
function edittargetLevel_Callback(hObject, eventdata, handles)
1532
1533
function edittargetLevel_CreateFcn(hObject, eventdata, handles)
1534
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1535
    set(hObject,'BackgroundColor','white');
1536
end
1537
1538
function editrampDuration_Callback(hObject, eventdata, handles)
1539
1540
function editrampDuration_CreateFcn(hObject, eventdata, handles)
1541
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1542
    set(hObject,'BackgroundColor','white');
1543
end
1544
1545
function editcueTestDifference_Callback(hObject, eventdata, handles)
1546
1547
function editcueTestDifference_CreateFcn(hObject, eventdata, handles)
1548
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1549
    set(hObject,'BackgroundColor','white');
1550
end
1551
1552
1553
function editWRVsteps_Callback(hObject, eventdata, handles)
1554
1555
function editWRVsteps_CreateFcn(hObject, eventdata, handles)
1556
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1557
    set(hObject,'BackgroundColor','white');
1558
end
1559
1560
function editWRVlimits_Callback(hObject, eventdata, handles)
1561
1562
function editWRVlimits_CreateFcn(hObject, eventdata, handles)
1563
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1564
    set(hObject,'BackgroundColor','white');
1565
end
1566
1567
function edittargetFrequency_Callback(hObject, eventdata, handles)
1568
1569
function edittargetFrequency_CreateFcn(hObject, eventdata, handles)
1570
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1571
    set(hObject,'BackgroundColor','white');
1572
end
1573
1574
function editName_Callback(hObject, eventdata, handles)
1575
1576
function editName_CreateFcn(hObject, eventdata, handles)
1577
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1578
    set(hObject,'BackgroundColor','white');
1579
end
1580
1581
function editcalibrationdB_Callback(hObject, eventdata, handles)
1582
1583
function editcalibrationdB_CreateFcn(hObject, eventdata, handles)
1584
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1585
    set(hObject,'BackgroundColor','white');
1586
end
1587
1588
function editMAPplot_Callback(hObject, eventdata, handles)
1589
1590
function editMAPplot_CreateFcn(hObject, eventdata, handles)
1591
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1592
    set(hObject,'BackgroundColor','white');
1593
end
1594
1595
function editMsgFont_Callback(hObject, eventdata, handles)
1596
1597
function editMsgFont_CreateFcn(hObject, eventdata, handles)
1598
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1599
    set(hObject,'BackgroundColor','white');
1600
end
1601
1602
function editCatchTrialRate_Callback(hObject, eventdata, handles)
1603
1604
function editCatchTrialRate_CreateFcn(hObject, eventdata, handles)
1605
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1606
    set(hObject,'BackgroundColor','white');
1607
end
1608
1609
1610
function editSaveData_Callback(hObject, eventdata, handles)
1611
1612
function editSaveData_CreateFcn(hObject, eventdata, handles)
1613
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1614
    set(hObject,'BackgroundColor','white');
1615
end
1616
1617
function editStatsModel_Callback(hObject, eventdata, handles)
1618
1619
function editStatsModel_CreateFcn(hObject, eventdata, handles)
1620
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1621
    set(hObject,'BackgroundColor','white');
1622
end
1623
1624
function editBackgroundLevel_Callback(hObject, eventdata, handles)
1625
1626
function editBackgroundLevel_CreateFcn(hObject, eventdata, handles)
1627
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1628
    set(hObject,'BackgroundColor','white');
1629
end
1630
1631
function editPrintTracks_Callback(hObject, eventdata, handles)
1632
1633
function editPrintTracks_CreateFcn(hObject, eventdata, handles)
1634
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1635
    set(hObject,'BackgroundColor','white');
1636
end
1637
1638
function editstopCriteriaBox_Callback(hObject, eventdata, handles)
1639
1640
function editstopCriteriaBox_CreateFcn(hObject, eventdata, handles)
1641
1642
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1643
    set(hObject,'BackgroundColor','white');
1644
end
1645
1646
function editstimulusDelay_Callback(hObject, eventdata, handles)
1647
1648
function editstimulusDelay_CreateFcn(hObject, eventdata, handles)
1649
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1650
    set(hObject,'BackgroundColor','white');
1651
end
1652
1653
1654
function popupmenuCueNoCue_CreateFcn(hObject, eventdata, handles)
1655
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1656
    set(hObject,'BackgroundColor','white');
1657
end
1658
1659
function popupmenuEar_CreateFcn(hObject, eventdata, handles)
1660
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1661
    set(hObject,'BackgroundColor','red');
1662
end
1663
1664
function popupmenuVaryParameter1_Callback(hObject, eventdata, handles)
1665
1666
function popupmenuVaryParameter1_CreateFcn(hObject, eventdata, handles)
1667
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1668
    set(hObject,'BackgroundColor','white');
1669
end
1670
1671
function popupmenuVaryParameter2_Callback(hObject, eventdata, handles)
1672
1673
function popupmenuVaryParameter2_CreateFcn(hObject, eventdata, handles)
1674
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1675
    set(hObject,'BackgroundColor','white');
1676
end
1677
1678
function popupmenuRandomize_Callback(hObject, eventdata, handles)
1679
1680
function popupmenuRandomize_CreateFcn(hObject, eventdata, handles)
1681
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1682
    set(hObject,'BackgroundColor','white');
1683
end
1684
1685
function popupmenuParadigm_CreateFcn(hObject, eventdata, handles)
1686
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1687
    set(hObject,'BackgroundColor','white');
1688
end
1689
1690
1691
function popupmenuMaskerType_CreateFcn(hObject, eventdata, handles)
1692
1693
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1694
    set(hObject,'BackgroundColor','white');
1695
end
1696
1697
1698
function popupmenuThreshEst_CreateFcn(hObject, eventdata, handles)
1699
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1700
    set(hObject,'BackgroundColor','white');
1701
end
1702
1703
function popupmenuBackgroundType_CreateFcn(hObject, eventdata, handles)
1704
1705
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1706
    set(hObject,'BackgroundColor','white');
1707
end
1708
1709
1710
function popupmenuTargetType_CreateFcn(hObject, eventdata, handles)
1711
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1712
    set(hObject,'BackgroundColor','white');
1713
end
1714
1715
function editSubjectFont_Callback(hObject, eventdata, handles)
1716
1717
function editSubjectFont_CreateFcn(hObject, eventdata, handles)
1718
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1719
    set(hObject,'BackgroundColor','white');
1720
end
1721
1722
function editMusicLevel_Callback(hObject, eventdata, handles)
1723
1724
function editMusicLevel_CreateFcn(hObject, eventdata, handles)
1725
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1726
    set(hObject,'BackgroundColor','white');
1727
end
1728
1729
function figure1_ButtonDownFcn(hObject, eventdata, handles)
1730
1731
1732
function edit33_Callback(hObject, eventdata, handles)
1733
1734
function edit33_CreateFcn(hObject, eventdata, handles)
1735
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1736
    set(hObject,'BackgroundColor','white');
1737
end
1738
1739
1740
function popupmenuPhase_CreateFcn(hObject, eventdata, handles)
1741
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1742
    set(hObject,'BackgroundColor','white');
1743
end
1744
1745
function editsegSize_Callback(hObject, eventdata, handles)
1746
1747
function editsegSize_CreateFcn(hObject, eventdata, handles)
1748
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1749
    set(hObject,'BackgroundColor','white');
1750
end
1751
1752
1753
function editnumOHIOtones_Callback(hObject, eventdata, handles)
1754
% hObject    handle to editnumOHIOtones (see GCBO)
1755
% eventdata  reserved - to be defined in a future version of MATLAB
1756
% handles    structure with handles and user data (see GUIDATA)
1757
1758
% Hints: get(hObject,'String') returns contents of editnumOHIOtones as text
1759
%        str2double(get(hObject,'String')) returns contents of editnumOHIOtones as a double
1760
1761
1762
% --- Executes during object creation, after setting all properties.
1763
function editnumOHIOtones_CreateFcn(hObject, eventdata, handles)
1764
% hObject    handle to editnumOHIOtones (see GCBO)
1765
% eventdata  reserved - to be defined in a future version of MATLAB
1766
% handles    empty - handles not created until after all CreateFcns called
1767
1768
% Hint: edit controls usually have a white background on Windows.
1769
%       See ISPC and COMPUTER.
1770
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1771
    set(hObject,'BackgroundColor','white');
1772
end
1773
1774
1775 29:b51bf546ca3f rmeddis
1776 28:02aa9826efe0 rmeddis
1777
1778
function editparamChanges_Callback(hObject, eventdata, handles)
1779
1780
1781
function editparamChanges_CreateFcn(hObject, eventdata, handles)
1782
1783
% Hint: edit controls usually have a white background on Windows.
1784
%       See ISPC and COMPUTER.
1785
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1786
    set(hObject,'BackgroundColor','white');
1787
end
1788