comparison multithreshold 1.46/expGUI_MT.m @ 0:f233164f4c86

first commit
author Ray Meddis <rmeddis@essex.ac.uk>
date Fri, 27 May 2011 13:19:21 +0100
parents
children eafe11c86f44
comparison
equal deleted inserted replaced
-1:000000000000 0:f233164f4c86
1 % expGUI_MT = 'experimenter GUI for multiThreshold
2 % allows the experimenter to design experiments.
3 % The *running* of experiments is left to subjGUI.m
4 %
5 % There are three kinds of experiments known as 'earOptions':
6 % 1. Measurements using real listeners
7 % 'left', 'right', 'diotic', 'dichoticLeft', 'dichoticRight'
8 % 2. Measurements using the MAP model as the subject
9 % 'MAPmodelListen', 'MAPmodelMultiCh', 'MAPmodelSingleCh'
10 % 3. Monte Carlo simulations
11 % 'statsModelLogistic','statsModelRareEvent'
12 %
13 % There are many stimulus configurations relating to different measurement
14 % requirements. These configurations are defined in paradigm files located
15 % in the 'paradigms' folder with names of the form paradigm_<name>.m. These
16 % files specify values in the stimulusParameter and experiment structures.
17 % Some minor parameters are specified in the intialiseGUI function below.
18 % Each configuration is only a start up arrangement and the user can modify
19 % the parameters on the GUI itself.
20 %
21 % the 'RUN' button initiates the measurements and hands control over to the
22 % subjGUI program. When the measurements are complete control is handed
23 % back and the stack unwinds without any further action
24
25 function varargout = expGUI_MT(varargin)
26 %EXPGUI_MT M-file for expGUI_MT.fig
27 % EXPGUI_MT, by itself, creates a new EXPGUI_MT or raises the existing
28 % singleton*.
29 %
30 % H = EXPGUI_MT returns the handle to a new EXPGUI_MT or the handle to
31 % the existing singleton*.
32 %
33 % EXPGUI_MT('Property','Value',...) creates a new EXPGUI_MT using the
34 % given property value pairs. Unrecognized properties are passed via
35 % varargin to expGUI_MT_OpeningFcn. This calling syntax produces a
36 % warning when there is an existing singleton*.
37 %
38 % EXPGUI_MT('CALLBACK') and EXPGUI_MT('CALLBACK',hObject,...) call the
39 % local function named CALLBACK in EXPGUI_MT.M with the given input
40 % arguments.
41 %
42 % *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
43 % instance to run (singleton)".
44 %
45 % See also: GUIDE, GUIDATA, GUIHANDLES
46
47 % Edit the above text to modify the response to help expGUI_MT
48
49 % Last Modified by GUIDE v2.5 07-Apr-2011 07:20:00
50
51 % Begin initialization code - DO NOT EDIT
52 gui_Singleton = 1;
53 gui_State = struct('gui_Name', mfilename, ...
54 'gui_Singleton', gui_Singleton, ...
55 'gui_OpeningFcn', @expGUI_MT_OpeningFcn, ...
56 'gui_OutputFcn', @expGUI_MT_OutputFcn, ...
57 'gui_LayoutFcn', [], ...
58 'gui_Callback', []);
59 if nargin && ischar(varargin{1})
60 gui_State.gui_Callback = str2func(varargin{1});
61 end
62
63 if nargout
64 [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
65 else
66 gui_mainfcn(gui_State, varargin{:});
67 end
68 % End initialization code - DO NOT EDIT
69
70 % -------------------------------------------------- expGUI_MT_OpeningFcn
71 function expGUI_MT_OpeningFcn(hObject, eventdata, handles, varargin)
72
73 % Choose default command line output for expGUI_MT
74 handles.output = hObject;
75
76 cla(handles.axes1)
77 cla(handles.axes2)
78 cla(handles.axes4)
79 cla(handles.axes5)
80
81 % Update handles structure
82 guidata(hObject, handles);
83
84 function varargout = expGUI_MT_OutputFcn(hObject, eventdata, handles)
85 % Get default command line output from handles structure
86 initializeGUI(handles)
87 varargout{1} = handles.output;
88 setLocationOfGUIs(handles)
89
90 function setLocationOfGUIs(handles)
91 global checkForPreviousGUI % holds screen positioning across repeated calls
92 scrnsize=get(0,'screensize');
93 checkForPreviousGUI=[];
94 % if isstruct(checkForPreviousGUI)...
95 % && checkForPreviousGUI.GUIalreadyStarted==1 ...
96 % && isfield(checkForPreviousGUI,'GUIposition')
97 % set(handles.figure1,'position',checkForPreviousGUI.GUIposition)
98 % else
99 % % relocate the GUI only if this is the first time of use
100 % set(0, 'units','pixels')
101 % % occupies top to bottom of screen but only 60% width
102 % % [left bottom width height]
103 % firstPos=[0.01*scrnsize(4) 0.03*scrnsize(3) 0.6*scrnsize(3) 0.92*scrnsize(4)];
104 % firstPos=[4 0.045*scrnsize(4) 0.6*scrnsize(3) 0.93*scrnsize(4)];
105 % set(handles.figure1, 'units','pixels')
106 % set(handles.figure1,'position',firstPos)
107 % checkForPreviousGUI.GUIalreadyStarted=1;
108 % checkForPreviousGUI.GUIposition=firstPos;
109 % end
110 set(handles.figure1,'color',[.871 .961 .996])
111 set(handles.figure1,'name', pwd)
112
113 % MAP model figure; sits alongside GUI if requested
114 figure(99)
115 % [left bottom width height]
116 MAPpos=[0.615*scrnsize(3) 0.05*scrnsize(4) 0.15*scrnsize(3) 0.85*scrnsize(4)];
117 % visible only on request.
118 set(gcf,'position',MAPpos , 'visible','off')
119
120
121 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
122
123 % -----------------------------------------------------initializeGUI
124 function initializeGUI(handles)
125 % Populate the edit boxes and popup menus on the GUI
126 % Then wait for user action
127 global stimulusParameters experiment betweenRuns
128 global targetTypes maskerTypes backgroundTypes
129 global variableNames paradigmNames threshEstNames cueNames
130
131 % dbstop if error % allow for debugging and user error reporting
132 % dbstop if warning
133
134 % specify structure fields for pretty automatic printing
135 % It also initialises some simple variables
136 orderGlobals
137
138 addpath ('paradigms') % preset paradigm informations is stored here
139 % filesep is usd to be compatible with other operating systems
140 % addpath (['..' filesep 'modules'], ['..' filesep 'utilities'], ...
141 % ['..' filesep 'parameterStore'], ['..' filesep 'wavFileStore'],...
142 % ['..' filesep 'testPrograms'])
143
144 % specify all variables that need to be set on the GUI
145 variableNames={'stimulusDelay','maskerDuration','maskerLevel',...
146 'maskerRelativeFrequency', 'targetFrequency', 'gapDuration',...
147 'targetDuration','targetLevel','rampDuration',...
148 'cueTestDifference', 'WRVstartValues', 'WRVsteps', 'WRVlimits'};
149
150 % Variable variables
151 % (specifies paradigm paramaters that can changed on a 'between runs' basis)
152 % make them options in the two between runs variable menus
153 % NB 'numOHIOtones' is used only to solve a problem; it should not be
154 % selected manually
155 betweenRunsVariables={'stimulusDelay','maskerDuration','maskerLevel',...
156 'maskerRelativeFrequency','targetFrequency', 'gapDuration',...
157 'targetDuration','targetLevel','numOHIOtones'};
158 set(handles.popupmenuVaryParameter1,'string',betweenRunsVariables)
159 set(handles.popupmenuVaryParameter2,'string',betweenRunsVariables)
160
161 % NB 'Warning: popupmenu control requires a scalar Value'
162 % indicates that an inappropriate 'value' is being set.
163 % when testing for this, always clear the GUI before running
164
165 % Trial presentation order - randomize at startup
166 presentationOrderNames={'randomize within blocks', 'fixed sequence', ...
167 'randomize across blocks'};
168 set(handles.popupmenuRandomize,'string', presentationOrderNames)
169
170 % targetType- value must be set in paradigm
171 targetTypes={'tone','noise', 'pinkNoise','whiteNoise','24TalkerBabble',...
172 'speech', 'Twister','digitStrings'};
173 set(handles.popupmenuTargetType, 'string', targetTypes);
174
175 % maskerType - value must be set in paradigm
176 maskerTypes={'tone','noise', 'pinkNoise','TEN','whiteNoise','24TalkerBabble', ...
177 'speech'};
178 set(handles.popupmenuMaskerType, 'string', maskerTypes);
179
180 % background Type- value must be set in paradigm (default = 1, 'none')
181 backgroundTypes={'none','noise', 'pinkNoise', 'TEN','noiseDich',...
182 'pinkNoiseDich','whiteNoise','24TalkerBabble',...
183 '16TalkerBabble','8TalkerBabble','4TalkerBabble',...
184 '4TalkerReversedBabble','2TalkerBabble','1TalkerBabble'};
185 set(handles.popupmenuBackgroundType, 'string', backgroundTypes);
186 set(handles.editBackgroundLevel,'string',...
187 num2str(stimulusParameters.backgroundLevel))
188
189 % Establish available paradigms by scanning paradigms folder
190 paradigmNames= what('paradigms');
191 paradigmNames=paradigmNames.m; % m files only
192 for i=1:length(paradigmNames), paradigmNames{i}=paradigmNames{i}(10:end-2); end
193 set(handles.popupmenuParadigm,'string', paradigmNames)
194
195 % startup paradigm, 'training' (could be anywhere on the list)
196 startupParadigm='training';
197 idx= find(strcmp(paradigmNames,startupParadigm));
198 if ~isempty(idx)
199 set(handles.popupmenuParadigm,'value', idx)
200 else
201 % training paradigm is always the startup paradigm
202 error(['expGUI_MT\initializeGUI: No ' startupParadigm...
203 ' paradigm found in paradigms folder'])
204 end
205
206 earOptions={'left', 'right', 'diotic', 'dichoticLeft', 'dichoticRight',...
207 'MAPmodelListen', 'MAPmodelMultiCh', 'MAPmodelSingleCh'...
208 'statsModelLogistic','statsModelRareEvent'};
209 set(handles.popupmenuEar,'string', earOptions)
210 defaultOption=1;
211 experiment.ear=earOptions{defaultOption};
212 set(handles.popupmenuEar,'value', defaultOption) % 'left' is deafult
213 set(handles.pushbuttonSingleShot, 'visible', 'off') % use only for MAP
214
215 % masker phase box- value must be set in paradigm
216 phaseOptions={'sin','cos','alt','rand'};
217 set(handles.popupmenuPhase,'string', phaseOptions)
218
219 % Cue
220 cueNames={'cued', 'noCue'};
221 set(handles.popupmenuCueNoCue, 'string', cueNames);
222
223 % threshold assessment method - value must be set in paradigm
224 threshEstNames={'oneIntervalUpDown', 'MaxLikelihood', ...
225 '2I2AFC++', '2I2AFC+++'};
226 set(handles.popupmenuThreshEst, 'string', threshEstNames);
227 experiment.stopCriteria2IFC=[75 3 5];
228 experiment.stopCriteriaSI=[20];
229
230 % ** editBoxes that are only set by hand
231 % music (relative) level, 'tada!' (manual setting only)
232 % increase for the hard of hearing
233 set(handles.editMusicLevel,'string','0')
234
235 % Catch Trial Rate
236 set(handles.editCatchTrialRate,'string','0.2 0.1 2 ');
237
238 % calibration
239 stimulusParameters.restoreCalibration=7;
240 set(handles.editcalibrationdB,'string',...
241 stimulusParameters.restoreCalibration)
242
243 % a MAPplot
244 experiment.MAPplot=0; %default
245 set(handles.editMAPplot,'string',num2str(experiment.MAPplot))
246
247 % saveData
248 experiment.saveData=1;
249 set(handles.editSaveData,'string',num2str(experiment.saveData))
250
251 % printTracks
252 experiment.printTracks=0;
253 set(handles.editPrintTracks,'string',num2str(experiment.printTracks))
254
255 % standard delay between button press and initiation of next stimulus
256 experiment.clickToStimulusPause=1;
257
258 % buttonBoxType: NB no problem if mouse is used instead
259 experiment.buttonBoxType='square';
260
261 % estimation of the mean
262 % {'logisticLS', 'logisticML', 'rareEvent'}
263 experiment.functionEstMethod='logisticLS';
264
265 % message box
266 set(handles.textMSG,'backgroundcolor', 'w', 'ForegroundColor', 'b', 'string', '')
267 set(handles.editMsgFont,'string','7')
268 set(handles.editSubjectFont,'string','14')
269
270 % default psychometric bin size and logistic slopes
271 experiment.psyBinWidth=1; % dB
272 maxLogisticK=2; % steepest slope contemplated
273 experiment.maxLogisticK=maxLogisticK;
274 experiment.numPossLogisticK=100;
275 experiment.possLogSlopes= ...
276 0.01: maxLogisticK/experiment.numPossLogisticK: maxLogisticK;
277 experiment.meanSearchStep=0.25; % dB
278
279 % indicate that this is the first run and the GUI should be located in
280 % default location.
281 experiment.justInitialized=1;
282
283 % set up GUI based on training paradigm
284 aParadigmSelection(handles);
285 earSetUp(handles)
286 aThresholdAssessmentMethod(handles)
287 aShowRelevantObjects(handles)
288
289 % Done. Now wait for action
290
291 % -------------------------------------------- popupmenuMaskerType_Callback
292 function popupmenuMaskerType_Callback(hObject, eventdata, handles)
293 % show or remove masker frequency box
294 aShowRelevantObjects(handles)
295
296 % -------------------------------------------- popupmenuTargetType_Callback
297 function popupmenuTargetType_Callback(hObject, eventdata, handles)
298 % show or remove target frequency box
299 aShowRelevantObjects(handles)
300
301 % -------------------------------------------- popupmenuParadigm_Callback
302 function popupmenuParadigm_Callback(hObject, eventdata, handles)
303 % Any change to the paradigm selection causes all boxes to be shown
304 % showParameters(handles)
305 aParadigmSelection(handles);
306
307 % -------------------------------------------- aParadigmSelection
308 function aParadigmSelection(handles)
309 global experiment stimulusParameters betweenRuns paradigmNames
310 global variableNames
311
312 % identify paradigm selected
313 chosenOption=get(handles.popupmenuParadigm,'value');
314 paradigm=paradigmNames{chosenOption};
315 experiment.paradigm=paradigm;
316
317 %Paradigm: read in all relevant parameters
318 % a file must exist with this name 'paradigm_<paradigm>'
319 % 'handles' are only occasionally used
320 addpath ('paradigms')
321 cmd=['paradigm_' paradigm '(handles);'];
322 try
323 eval(cmd)
324 catch
325 error(['ExpGUI\aParadigmSelection:'...
326 'paradigm file not found or error in file'])
327 end
328 rmpath ('paradigms')
329
330 % if a variable is subject to change, specify list of values here
331 % eg. stimulusParameters.targetFrequency=betweenRuns.variableList1;
332 cmd=['stimulusParameters.' ...
333 betweenRuns.variableName1 '=betweenRuns.variableList1;'];
334 eval (cmd);
335 cmd=['stimulusParameters.' ...
336 betweenRuns.variableName2 '=betweenRuns.variableList2;'];
337 eval (cmd);
338
339 % establish popup menus on the basis of the paradigm file
340 set(handles.popupmenuRandomize,'value', betweenRuns.randomizeSequence)
341 set(handles.popupmenuPhase,'string', stimulusParameters.maskerPhase)
342 if stimulusParameters.includeCue
343 set(handles.popupmenuCueNoCue,'value', 1)
344 else
345 set(handles.popupmenuCueNoCue,'value', 2)
346 end
347
348 set(handles.text34, 'string', stimulusParameters.WRVname)
349
350 % Put the new data values into the edit boxes on the GUI
351 for i=1:length(variableNames)
352 cmd=(['set(handles.edit' variableNames{i} ...
353 ',''string'', num2str(stimulusParameters.' ...
354 variableNames{i} '));']);
355 eval(cmd);
356 end
357 % backgroundLevel is not a variableName (?!)
358 set(handles.editBackgroundLevel,'string', num2str...
359 (stimulusParameters.backgroundLevel))
360
361 % on RUN the sample rate will be picked from the text box
362 % However, MAP overrules the sample rate and sets its own
363 aSetSampleRate(stimulusParameters.subjectSampleRate, handles);
364
365
366 % used for plotting functions (NB affected by paradigm settings)
367 experiment.predictionLevels=stimulusParameters.WRVlimits(1):...
368 experiment.meanSearchStep:stimulusParameters.WRVlimits(2);
369 experiment.possLogSlopes=abs(experiment.possLogSlopes)*...
370 sign(experiment.psyFunSlope);
371
372 aResetPopupMenus(handles)
373
374 % ------------------------------------------------------ aResetPopupMenus
375 function aResetPopupMenus(handles)
376 global stimulusParameters betweenRuns variableNames
377 global targetTypes maskerTypes experiment backgroundTypes
378
379 switch experiment.threshEstMethod
380 case {'MaxLikelihood','oneIntervalUpDown'}
381 set(handles.editstopCriteriaBox, 'string', ...
382 num2str(experiment.singleIntervalMaxTrials))
383
384 case {'2I2AFC++','2I2AFC+++'}
385 set(handles.editstopCriteriaBox, 'string', ...
386 num2str(experiment.stopCriteria2IFC))
387 otherwise
388 error([' aResetPopupMenus: threshEstMethod not recognised -> ' ...
389 experiment.threshEstMethod])
390 end
391
392 % forced noCue
393 switch experiment.paradigm
394 case 'discomfort'
395 set(handles.popupmenuCueNoCue,'value', 2)
396 end
397
398 %set variables popupmenus as specified in betweenRuns
399 variableParameter1ID=0; variableParameter2ID=0;
400 for i=1:length(variableNames)
401 if strcmp(variableNames{i},betweenRuns.variableName1)
402 variableParameter1ID=i;
403 end
404 if strcmp(variableNames{i},betweenRuns.variableName2)
405 variableParameter2ID=i;
406 end
407 end
408 if variableParameter1ID==0 || variableParameter2ID==0;
409 Error('a ResetPopMenu: variableParameter not identified')
410 end
411
412 % display popupmenus
413 set(handles.popupmenuVaryParameter1, 'value',round(variableParameter1ID))
414 set(handles.popupmenuVaryParameter2, 'value',round(variableParameter2ID))
415
416 % targetType
417 idx= find(strcmp(stimulusParameters.targetType, targetTypes));
418 set(handles.popupmenuTargetType,'value', idx)
419
420 % paradigm selection may alter the maskerType
421 idx= find(strcmp(stimulusParameters.maskerType, maskerTypes));
422 set(handles.popupmenuMaskerType,'value', idx)
423
424 aShowRelevantObjects(handles)
425
426 % % backgroundType
427 idx= find(strcmp(stimulusParameters.backgroundType, backgroundTypes));
428 set(handles.popupmenuBackgroundType,'value', idx)
429 set(handles.editBackgroundLevel,'string', ...
430 num2str(stimulusParameters.backgroundLevel))
431
432 % ---------------------------------------------- aShowRelevantObjects
433 function aShowRelevantObjects(handles)
434 global experiment stimulusParameters
435 % always on
436 set(handles.edittargetLevel, 'visible', 'on')
437 set(handles.edittargetDuration, 'visible', 'on')
438 set(handles.edittargetFrequency, 'visible', 'on')
439
440 switch experiment.ear
441 case {'statsModelLogistic', 'statsModelRareEvent'}
442 set(handles.editStatsModel, 'visible', 'on')
443 set(handles.textStatsModel, 'visible', 'on')
444 set(handles.pushbuttonStop, 'visible', 'on')
445 set(handles.pushbuttonOME, 'visible', 'off')
446 set(handles.pushbuttonBM, 'visible', 'off')
447 set(handles.pushbuttonRP, 'visible', 'off')
448 set(handles.pushbuttonAN, 'visible', 'off')
449 set(handles.pushbuttonRF, 'visible', 'off')
450 set(handles.pushbuttonSYN, 'visible', 'off')
451 set(handles.pushbuttonFM, 'visible', 'off')
452 set(handles.pushbuttonParams, 'visible', 'off')
453 set(handles.pushbuttonSingleShot, 'visible', 'off')
454 set(handles.editCatchTrialRate, 'visible', 'off')
455 set(handles.textCatchTrials, 'visible', 'off')
456 set(handles.editcalibrationdB, 'visible', 'off')
457 set(handles.textcalibration, 'visible', 'off')
458 set(handles.popupmenuCueNoCue, 'visible', 'off')
459 set(handles.textCue, 'visible', 'off')
460 set(handles.editMusicLevel,'visible', 'off')
461 set(handles.textMusicLevel,'visible', 'off')
462 set(handles.editMAPplot,'visible', 'off')
463 set(handles.textMAPplot,'visible', 'off')
464
465 case {'MAPmodel', 'MAPmodelListen', 'MAPmodelMultiCh', 'MAPmodelSingleCh'}
466 set(handles.popupmenuCueNoCue, 'visible', 'off')
467 set(handles.editStatsModel, 'visible', 'off')
468 set(handles.textStatsModel, 'visible', 'off')
469 set(handles.pushbuttonStop, 'visible', 'on')
470 set(handles.pushbuttonOME, 'visible', 'on')
471 set(handles.pushbuttonBM, 'visible', 'on')
472 set(handles.pushbuttonRP, 'visible', 'on')
473 set(handles.pushbuttonAN, 'visible', 'on')
474 set(handles.pushbuttonRF, 'visible', 'on')
475 set(handles.pushbuttonSYN, 'visible', 'on')
476 set(handles.pushbuttonFM, 'visible', 'on')
477 set(handles.pushbuttonParams, 'visible', 'on')
478 set(handles.pushbuttonSingleShot, 'visible', 'on')
479 set(handles.editcalibrationdB, 'visible', 'off')
480 set(handles.textcalibration, 'visible', 'off')
481 set(handles.textCue, 'visible', 'off')
482 set(handles.editMusicLevel,'visible', 'off')
483 set(handles.textMusicLevel,'visible', 'off')
484 set(handles.editMAPplot,'visible', 'on')
485 set(handles.textMAPplot,'visible', 'on')
486
487 otherwise
488 set(handles.editStatsModel, 'visible', 'off')
489 set(handles.textStatsModel, 'visible', 'off')
490 set(handles.pushbuttonStop, 'visible', 'off')
491 set(handles.pushbuttonOME, 'visible', 'off')
492 set(handles.pushbuttonBM, 'visible', 'off')
493 set(handles.pushbuttonRP, 'visible', 'off')
494 set(handles.pushbuttonAN, 'visible', 'off')
495 set(handles.pushbuttonRF, 'visible', 'off')
496 set(handles.pushbuttonSYN, 'visible', 'off')
497 set(handles.pushbuttonFM, 'visible', 'off')
498 set(handles.pushbuttonParams, 'visible', 'off')
499 set(handles.pushbuttonSingleShot, 'visible', 'off')
500 set(handles.editCatchTrialRate, 'visible', 'on')
501 set(handles.textCatchTrials, 'visible', 'on')
502 set(handles.editcalibrationdB, 'visible', 'on')
503 set(handles.textcalibration, 'visible', 'on')
504 set(handles.popupmenuCueNoCue, 'visible', 'on')
505 set(handles.textCue, 'visible', 'on')
506 set(handles.editMusicLevel,'visible', 'on')
507 set(handles.textMusicLevel,'visible', 'on')
508 set(handles.editMAPplot,'visible', 'off')
509 set(handles.textMAPplot,'visible', 'off')
510 end
511
512 switch experiment.threshEstMethod
513 case {'MaxLikelihood','oneIntervalUpDown'}
514 set(handles.popupmenuCueNoCue,'visible', 'on')
515 set(handles.textCue,'visible', 'on')
516 set(handles.editstopCriteriaBox, 'string', ...
517 num2str(experiment.singleIntervalMaxTrials))
518
519 if stimulusParameters.includeCue==0
520 set(handles.editcueTestDifference,'visible', 'off')
521 set(handles.textcueTestDifference,'visible', 'off')
522 else
523 set(handles.editcueTestDifference,'visible', 'on')
524 set(handles.textcueTestDifference,'visible', 'on')
525 end
526
527 case {'2I2AFC++','2I2AFC+++'}
528 set(handles.editCatchTrialRate, 'visible', 'off')
529 set(handles.textCatchTrials, 'visible', 'off')
530 set(handles.popupmenuCueNoCue,'visible', 'off')
531 set(handles.textCue,'visible', 'off')
532 set(handles.editcueTestDifference,'visible', 'off')
533 set(handles.textcueTestDifference,'visible', 'off')
534 end
535
536
537 % show/ remove masker related boxes
538 switch experiment.paradigm
539 % masker free paradigms
540 case {'training', 'discomfort','absThreshold', 'absThreshold_8',...
541 'TENtest', 'threshold_duration','SRT'}
542 set(handles.editmaskerDuration,'visible', 'off')
543 set(handles.editmaskerLevel,'visible', 'off')
544 set(handles.editmaskerRelativeFrequency,'visible', 'off')
545 set(handles.editgapDuration,'visible', 'off')
546 set(handles.textmaskerDuration,'visible', 'off')
547 set(handles.textmaskerLevel,'visible', 'off')
548 set(handles.textmaskerRelativeFrequency,'visible', 'off')
549 set(handles.textgapDuration,'visible', 'off')
550 set(handles.popupmenuMaskerType,'visible', 'off')
551 set(handles.textMaskerType,'visible', 'off')
552
553 % paradigms with maskers
554 case {'forwardMasking','forwardMaskingD','trainingIFMC', 'TMC','TMC_16ms', ...
555 'TMCmodel','IFMC','IFMC_8ms','GOM','overShoot','overShootB',...
556 'gapDetection', 'psychometric', 'FMreProbe'}
557 set(handles.editmaskerDuration,'visible', 'on')
558 set(handles.editmaskerLevel,'visible', 'on')
559 set(handles.editmaskerRelativeFrequency,'visible', 'on')
560 set(handles.editgapDuration,'visible', 'on')
561 set(handles.popupmenuMaskerType,'visible', 'on')
562 set(handles.textmaskerDuration,'visible', 'on')
563 set(handles.textmaskerLevel,'visible', 'on')
564 set(handles.textmaskerRelativeFrequency,'visible', 'on')
565 set(handles.textgapDuration,'visible', 'on')
566 set(handles.popupmenuMaskerType,'visible', 'on')
567 set(handles.textMaskerType,'visible', 'on')
568 % masker relative frequency /type
569 chosenOption=get(handles.popupmenuMaskerType,'value');
570 maskerTypes=get(handles.popupmenuMaskerType,'string');
571 maskerType=maskerTypes{chosenOption};
572 switch maskerType
573 case 'tone'
574 set(handles.editmaskerRelativeFrequency,'visible', 'on')
575 otherwise
576 set(handles.editmaskerRelativeFrequency,'visible', 'off')
577 end
578 end
579
580 eval(['set(handles.edit' stimulusParameters.WRVname ...
581 ',''visible'',''off'' )'])
582
583 % target type
584 chosenOption=get(handles.popupmenuTargetType,'value');
585 targetTypes=get(handles.popupmenuTargetType,'string');
586 targetType=targetTypes{chosenOption};
587 switch targetType
588 case 'tone'
589 set(handles.edittargetFrequency,'visible', 'on')
590 otherwise
591 set(handles.edittargetFrequency,'visible', 'off')
592 end
593
594 if strcmp(stimulusParameters.backgroundType,'none')
595 set(handles.popupmenuBackgroundType, 'visible', 'on');
596 set(handles.editBackgroundLevel,'visible','off')
597 set(handles.textBGlevel,'visible','off')
598 else
599 set(handles.popupmenuBackgroundType, 'visible', 'on');
600 set(handles.editBackgroundLevel,'visible','on')
601 set(handles.textBGlevel,'visible','on')
602 end
603
604
605
606 % ------------------------------------------------ pushbuttonRun_Callback
607 function pushbuttonRun_Callback(hObject, eventdata, handles)
608 global checkForPreviousGUI % holds screen positioning across repeated calls
609 global experiment
610 checkForPreviousGUI.GUIposition=get(handles.figure1,'position');
611 experiment.singleShot=0;
612 run (handles)
613 experiment.stop=0;
614
615 function run (handles)
616 global experiment expGUIhandles stimulusParameters
617 tic
618 expGUIhandles=handles;
619 set(handles.pushbuttonStop, 'backgroundColor', [.941 .941 .941])
620
621 % message box white (removes any previous error message)
622 set(handles.textMSG,...
623 'backgroundcolor', 'w', 'ForegroundColor', 'b', 'string', '')
624
625 errorMsg=aReadAndCheckParameterBoxes(handles);
626 if ~isempty(errorMsg)
627 append=0;
628 warning=1;
629 addToMsg(['error message:' errorMsg], append, warning)
630 return
631 end
632
633 if isnan(stimulusParameters.targetLevel)
634 addToMsg('Error: targetlevel not set', 1)
635 error('Error: targetlevel not set')
636 end
637
638 set(handles.textMSG,'backgroundcolor', 'w')
639 set(handles.textMSG,'string', ' ')
640
641 % leave the program and start up multiThreshold
642 subjGUI_MT % leave the program and start up multiThreshold
643 experiment.justInitialized=0;% prevents moving subjectGUI
644 toc
645
646 % --- Executes on button press in pushbuttonSingleShot.
647 function pushbuttonSingleShot_Callback(hObject, eventdata, handles)
648 global experiment
649 experiment.singleShot=1;
650
651 % special test for spontaneous activity
652 x=get(handles.editWRVstartValues, 'string');
653 y=get(handles.edittargetDuration, 'string');
654 set(handles.editWRVstartValues, 'string', '-20')
655 set(handles.edittargetDuration, 'string', '1')
656
657 MAPplot=get(handles.editMAPplot, 'string');
658 set(handles.editMAPplot, 'string', '1')
659 drawnow
660
661 run (handles)
662
663 set(handles.editMAPplot, 'string', MAPplot)
664 set(handles.editWRVstartValues, 'string', x)
665 set(handles.edittargetDuration, 'string', y)
666
667 % ------------------------------------------aReadAndCheckParameterBoxes
668 function errorMsg=aReadAndCheckParameterBoxes(handles)
669 global experiment stimulusParameters betweenRuns statsModel
670 global variableNames LevittControl
671 % When the program sets the parameters all should be well
672 % But when the user changes them...
673
674 errorMsg='';
675
676 % name
677 experiment.name=get(handles.editName,'string');
678
679 % ear/models
680 option=get(handles.popupmenuEar,'value');
681 strings=get(handles.popupmenuEar,'string');
682 experiment.ear=strings{option};
683
684 switch experiment.ear
685 case { 'MAPmodel', 'MAPmodelMultiCh', ...
686 'MAPmodelSingleCh', 'MAPmodelListen'}
687 % MAPmodel writes forced parameter settings to the screen
688 % so that they can be read from there
689 set(handles.popupmenuRandomize,'value',2) % fixed sequence
690 set(handles.editstimulusDelay,'string','0.01') % no stimulus delay
691 stimulusParameters.includeCue=0; % no cue for MAP
692 end
693
694 % find tone type
695 option=get(handles.popupmenuTargetType,'value');
696 strings=get(handles.popupmenuTargetType,'string');
697 stimulusParameters.targetType=strings{option};
698
699 % find masker type
700 option=get(handles.popupmenuMaskerType,'value');
701 strings=get(handles.popupmenuMaskerType,'string');
702 stimulusParameters.maskerType=strings{option};
703
704 % find background type and level
705 option=get(handles.popupmenuBackgroundType,'value');
706 strings=get(handles.popupmenuBackgroundType,'string');
707 stimulusParameters.backgroundTypeValue=option;
708 stimulusParameters.backgroundLevel=...
709 str2num(get(handles.editBackgroundLevel,'string'));
710 stimulusParameters.backgroundType=strings{option};
711
712 % Read all stimulus parameter boxes
713 for i=1:length(variableNames)
714 cmd=['stimulusParameters.' variableNames{i} ...
715 '= str2num(get(handles.edit' variableNames{i} ',''string'' ));'];
716 eval(cmd);
717 end
718 % for multiple levels
719 stimulusParameters.targetLevels=stimulusParameters.targetLevel;
720
721 % check that all required values are in the edit boxes
722 for i=1:length(variableNames)-3 % do not include 'level limits'
723 eval([ 'variableValues=stimulusParameters.' variableNames{i} ';'])
724 if isempty(variableValues), errorMsg=[ variableNames{i} ...
725 ' is an empty box']; return, end
726 end
727
728 chosenOption=get(handles.popupmenuVaryParameter1,'value');
729 betweenRuns.variableName1=variableNames{chosenOption};
730 eval(['betweenRuns.variableList1 = stimulusParameters.' ...
731 betweenRuns.variableName1 ';']);
732
733 chosenOption=get(handles.popupmenuVaryParameter2,'value');
734 betweenRuns.variableName2=variableNames{chosenOption};
735 eval(['betweenRuns.variableList2 = stimulusParameters.' ...
736 betweenRuns.variableName2 ';']);
737
738 % Check that variable parameters 1 & 2 have different names
739 if strcmp(betweenRuns.variableName1,betweenRuns.variableName2) ...
740 && ~strcmp(betweenRuns.variableName1,'none')
741 errorMsg='variable parameters have the same name';
742 return
743 end
744
745 % calibration
746 % this is used to *reduce* the output signal from what it otherwise
747 % would be
748 % signal values are between 1 - 2^23
749 % these are interpreted as microPascals between -29 dB and 128 dB SPL
750 % calibrationdB adjusts these values to compensate for equipment
751 % characteristics
752 % this will change the range. e.g. a 7 dB calibration will yield
753 % a range of -36 to 121 dB SPL
754 % Calibration is not used when modelling. Values are treated as dB SPL
755 stimulusParameters.calibrationdB=...
756 str2num(get(handles.editcalibrationdB,'string'));
757
758 % check on cue
759 cueSetUp(handles)
760
761 stimulusParameters.WRVinitialStep=stimulusParameters.WRVsteps(1);
762 stimulusParameters.WRVsmallStep=stimulusParameters.WRVsteps(2);
763
764 % jitter start value set after reading in new parameters
765 switch experiment.paradigm
766 case 'discomfort'
767 stimulusParameters.jitterStartdB=0;
768 otherwise
769 stimulusParameters.jitterStartdB=abs(stimulusParameters.WRVsteps(1));
770 end
771
772
773 % stats model mean and slope
774 statsModelParameters= str2num(get(handles.editStatsModel,'string'));
775 switch experiment.ear
776 case {'statsModelLogistic'}
777 statsModel.logisticMean=statsModelParameters(1) ;
778 statsModel.logisticSlope=statsModelParameters(2);
779 statsModel.rareEvenGain=NaN ;
780 statsModel.rareEventVmin=NaN;
781 case 'statsModelRareEvent'
782 statsModel.logisticMean=NaN ;
783 statsModel.logisticSlope=NaN;
784 statsModel.rareEvenGain=statsModelParameters(2) ;
785 statsModel.rareEventVmin=statsModelParameters(1);
786 end
787
788 % MAP plotting
789 experiment.MAPplot=str2num(get(handles.editMAPplot,'string'));
790 % if ~isequal(experiment.MAPplot, 0),
791 % % any other character will do it
792 % experiment.MAPplot=1;
793 % end
794
795 % save data
796 experiment.saveData=str2num(get(handles.editSaveData,'string'));
797 if ~isequal(experiment.saveData, 0),
798 % any other character will do it
799 experiment.saveData=1;
800 end
801
802 % print tracks
803 experiment.printTracks=str2num(get(handles.editPrintTracks,'string'));
804 if ~isequal(experiment.printTracks, 0),
805 % any other character will do it
806 experiment.printTracks=1;
807 end
808
809 % catch trial rate
810 % (1)= start rate, (2)= base rate, (3)= time constant (trials)
811 stimulusParameters.catchTrialRates=...
812 str2num(get(handles.editCatchTrialRate,'string'));
813 if stimulusParameters.catchTrialRates(1) ...
814 < stimulusParameters.catchTrialRates(2)
815 errorMsg=...
816 'catch trial base rates must be less than catch trial start rate';
817 return,
818 end
819
820 % sample rate
821 % The sample rate is set in the paradigm file.
822 % Normally this is set in the startUp paradigm file and then left
823 % When the model is used, the multiThreshold sample rate
824 % overrules anything in the model
825 stimulusParameters.sampleRate=...
826 str2num(get(handles.textsampleRate,'string'));
827
828 % music level
829 stimulusParameters.musicLeveldB=...
830 str2num(get(handles.editMusicLevel,'string'));
831
832 % set message box font size
833 experiment.msgFontSize=str2num(get(handles.editMsgFont,'string'));
834 experiment.subjGUIfontSize=str2num(get(handles.editSubjectFont,'string'));
835
836 % stop criteria
837 experiment.singleIntervalMaxTrials=...
838 str2num(get(handles.editstopCriteriaBox,'string'));
839 experiment.maxTrials=experiment.singleIntervalMaxTrials(1);
840
841 % set up 2IFC is required (? better in atrhesholdAssessmentMethod)
842 switch experiment.threshEstMethod
843 case {'2I2AFC++', '2A2AIFC+++'}
844 experiment.peaksUsed=experiment.singleIntervalMaxTrials(2);
845 experiment.PeakTroughCriterionSD=...
846 experiment.singleIntervalMaxTrials(3);
847 experiment.trialsToBeUsed= 5;
848 LevittControl.maxTrials=experiment.singleIntervalMaxTrials(1);
849 % start value for step until reduced
850 LevittControl.startLevelStep= stimulusParameters.WRVsteps(1);
851 % reduced step size
852 LevittControl.steadyLevittStep= stimulusParameters.WRVsteps(2);
853 LevittControl.TurnsToSmallSteps= 2;
854 LevittControl.useLastNturns= 2*experiment.peaksUsed;
855 LevittControl.minReversals= ...
856 LevittControl.TurnsToSmallSteps+2*experiment.peaksUsed;
857 LevittControl.targetsdPT = experiment.PeakTroughCriterionSD;
858 LevittControl.maxLevittValue= stimulusParameters.WRVlimits(2);
859 Levitt2;
860 end
861
862 % What kind of randomisation is required?
863 idx=get(handles.popupmenuRandomize,'value');
864 s=get(handles.popupmenuRandomize,'string');
865 betweenRuns.randomizeSequence=s{idx};
866
867 % Make small adjustments to variable values
868 % to keep values unique against later sorting
869 x=betweenRuns.variableList1;
870 [y idx]= sort(x);
871 for i=1:length(y)-1, if y(i+1)==y(i); y(i+1)=y(i)*1.001; end, end
872 x(idx)=y;
873 betweenRuns.variableList1=x;
874
875 x=betweenRuns.variableList2;
876 [y idx]= sort(x);
877 for i=1:length(y)-1, if y(i+1)==y(i); y(i+1)=y(i)*1.001; end, end
878 x(idx)=y;
879 betweenRuns.variableList2=x;
880
881 % Checks: after reading and setting parameters ------------------------------------------
882 % check for finger trouble (more checks possible
883 if stimulusParameters.maskerDuration>10
884 errorMsg='maskerDuration is too long'; return, end
885 if stimulusParameters.gapDuration>10
886 errorMsg='gapDuration is too long'; return, end
887 if stimulusParameters.targetDuration>10
888 errorMsg='targetDuration is too long'; return, end
889
890 % rare event slope check
891 if experiment.psyFunSlope<0 ...
892 && strcmp(experiment.functionEstMethod,'rareEvent')
893 errorMsg='cannot use rareEvent option for negative psychometr slopes';
894 return
895 end
896
897 % check ramps
898 if stimulusParameters.rampDuration*2> stimulusParameters.targetDuration
899 errorMsg=' ramp duration is too long for the target';
900 return
901 end
902
903 if max(stimulusParameters.maskerDuration)>0 ...
904 && max(stimulusParameters.rampDuration...
905 *2> stimulusParameters.maskerDuration)
906 errorMsg=' ramp duration is too long for the masker';
907 return
908 end
909
910 % Check WRVstartValues for length and compatibility with randomization
911 % only one start value supplied so all start values are the same
912 if length(stimulusParameters.WRVstartValues)==1
913 stimulusParameters.WRVstartValues= ...
914 repmat(stimulusParameters.WRVstartValues, 1, ...
915 length(betweenRuns.variableList1)...
916 *length(betweenRuns.variableList2));
917 elseif ~isequal(length(stimulusParameters.WRVstartValues), ...
918 length(betweenRuns.variableList1)...
919 *length(betweenRuns.variableList2))
920 % otherwise we need one value for each combination of var1/ var2
921 errorMsg='WRVstartValues not the same length as number of runs';
922 return
923 elseif strcmp(betweenRuns.randomizeSequence, 'randomize within blocks')...
924 && length(stimulusParameters.WRVstartValues)>1
925 errorMsg='multiple WRVstartValues inappropriate';
926 return
927 end
928
929 switch experiment.paradigm
930 % case { 'TMC', 'TMCmodel','IFMC'}
931 case {'trainingIFMC', 'TMC','TMC_16ms', 'TMC - ELP', 'IFMC'}
932
933 % For TMC and IFMC multiple target levels can be set
934 if length(stimulusParameters.targetLevel)==1
935 betweenRuns.targetLevels=...
936 repmat(stimulusParameters.targetLevel, 1, ...
937 length(betweenRuns.variableList1)...
938 *length(betweenRuns.variableList2));
939 elseif length(stimulusParameters.targetLevel)==...
940 length(betweenRuns.variableList2)
941 x=stimulusParameters.targetLevel;
942 x=repmat(x,length(betweenRuns.variableList1),1);
943 x=reshape(x,1,length(betweenRuns.variableList1)*length(betweenRuns.variableList2));
944 betweenRuns.targetLevels=x;
945 else
946 errorMsg='targetLevels not the same length as number of targetFrequencies';
947 end
948 end
949
950 switch experiment.paradigm
951 case {'gapDetection', 'frequencyDiscrimination'}
952 if ~isequal(stimulusParameters.targetDuration, ...
953 stimulusParameters.maskerDuration)
954 addToMsg(...
955 'Warning: masker and target duration not the same.',1,1)
956 end
957 if ~isequal(stimulusParameters.maskerLevel, ...
958 stimulusParameters.targetLevel)
959 addToMsg(['Warning: masker and target level different.'...
960 'They will be changed to be equal',1,1]);
961 end
962 end
963
964 % -------------------------------------------- aSetSampleRate
965 function aSetSampleRate(sampleRate, handles)
966 global stimulusParameters
967 stimulusParameters.sampleRate=sampleRate;
968 set(handles.textsampleRate,'string',num2str(stimulusParameters.sampleRate))
969
970 % -------------------------------------------- popupmenuEar_Callback
971 function popupmenuEar_Callback(hObject, eventdata, handles)
972 global experiment
973 option=get(handles.popupmenuEar,'value');
974 options=get(handles.popupmenuEar,'string'); % left/right/model
975 experiment.ear=options{option};
976 switch experiment.ear
977 case 'statsModelLogistic'
978 set(handles.editStatsModel,'string', '15, 0.5')
979 case 'statsModelRareEvent'
980 set(handles.editStatsModel,'string', '20 1')
981 end
982 earSetUp(handles)
983
984 % -------------------------------------------- earSetUp
985 function earSetUp(handles)
986 global experiment stimulusParameters
987 % option=get(handles.popupmenuEar,'value');
988 % options=get(handles.popupmenuEar,'string'); % left/right/model
989 % experiment.ear=options{option};
990
991 switch experiment.ear
992 case {'statsModelLogistic'}
993 statsModel.logisticSlope=0.5;
994 statsModel.logisticMean=15;
995 set(handles.editStatsModel,'string', ...
996 num2str([statsModel.logisticMean statsModel.logisticSlope]))
997 set(handles.textStatsModel,...
998 'string', {'statsModel',' logistic threshold\ slope'})
999 case 'statsModelRareEvent'
1000 set(handles.textStatsModel,'string', ...
1001 {'statsModel',' rareEvent Vmin\ gain'})
1002 end
1003
1004 switch experiment.ear
1005 case {'statsModelLogistic', 'statsModelRareEvent'}
1006 set(handles.editStatsModel, 'visible', 'off')
1007 set(handles.textStatsModel, 'visible', 'off')
1008
1009 % default psychometric bin size and logistic slopes
1010 set(handles.popupmenuRandomize,'value',2) % fixed sequence
1011 set(handles.editName,'string', 'statsModel')
1012 % experiment.headphonesUsed=0;
1013
1014 case {'MAPmodelListen', 'MAPmodelMultiCh', 'MAPmodelSingleCh'}
1015 stimulusParameters.includeCue=0; % no cue
1016 set(handles.popupmenuCueNoCue,'value', 2)
1017
1018 set(handles.editCatchTrialRate,'string','0 0 2 ');%no catch trials
1019 set(handles.editName,'string', 'Normal') % force name
1020 experiment.name=get(handles.editName,'string'); % read name back
1021 set(handles.editcalibrationdB,'string','0')
1022
1023 set(handles.popupmenuRandomize,'value',2) % fixed sequence
1024 set(handles.editstimulusDelay,'string','0')
1025
1026 set(handles.editSaveData,'string', '0')
1027 set(handles.editSubjectFont,'string', '10');
1028 experiment.MacGThreshold=0; % num MacG spikes to exceed threshold
1029 end
1030 aResetPopupMenus(handles)
1031
1032 % --------------------------------------------- popupmenuCueNoCue_Callback
1033 function popupmenuCueNoCue_Callback(hObject, eventdata, handles)
1034 cueSetUp(handles)
1035
1036 % ------------------------------------------------------------- cueSetUp
1037 function cueSetUp(handles)
1038 global stimulusParameters
1039
1040 chosenOption=get(handles.popupmenuCueNoCue,'value');
1041 if chosenOption==1
1042 stimulusParameters.includeCue=1;
1043 set(handles.editcueTestDifference,'visible', 'on')
1044 set(handles.textcueTestDifference,'visible', 'on')
1045 stimulusParameters.subjectText=stimulusParameters.instructions{2};
1046 else
1047 stimulusParameters.includeCue=0;
1048 set(handles.editcueTestDifference,'visible', 'off')
1049 set(handles.textcueTestDifference,'visible', 'off')
1050 stimulusParameters.subjectText= stimulusParameters.instructions{1};
1051 end
1052
1053 % -------------------------------------------- popupmenuThreshEst_Callback
1054 function popupmenuThreshEst_Callback(hObject, eventdata, handles)
1055 aThresholdAssessmentMethod(handles);
1056
1057 % --------------------------------------------- aThresholdAssessmentMethod
1058 function aThresholdAssessmentMethod(handles)
1059 % identify the threshold assessment method
1060 % and set various parameters on the GUI appropriately
1061 global stimulusParameters experiment threshEstNames LevittControl
1062
1063 chosenOption=get(handles.popupmenuThreshEst,'value');
1064 experiment.threshEstMethod=threshEstNames{chosenOption};
1065 set(handles.editCatchTrialRate, 'visible', 'on')
1066 set(handles.textCatchTrials, 'visible', 'on')
1067
1068 % establish appropriate stop criterion and post on GUI
1069 switch experiment.threshEstMethod
1070 case 'MaxLikelihood'
1071 experiment.functionEstMethod='logisticML';
1072 stimulusParameters.WRVsteps=10*experiment.psyFunSlope; % ???
1073 set(handles.textstopCriteria,'string', 'stop criteria \ maxTrials')
1074 experiment.singleIntervalMaxTrials=experiment.stopCriteriaSI;
1075 experiment.allowCatchTrials= 1;
1076 switch experiment.paradigm
1077 case 'training'
1078 experiment.possLogSlopes=0.5;
1079 end
1080
1081 case 'oneIntervalUpDown'
1082 experiment.functionEstMethod='logisticLS';
1083 set(handles.textstopCriteria,'string', 'stop criteria \ maxTrials')
1084 experiment.singleIntervalMaxTrials=experiment.stopCriteriaSI;
1085 switch experiment.paradigm
1086 case 'discomfort'
1087 experiment.allowCatchTrials= 0;
1088 otherwise
1089 experiment.allowCatchTrials= 1;
1090 end
1091
1092 case {'2I2AFC++', '2I2AFC+++'}
1093 LevittControl.rule='++'; % e.g. '++' or '+++'
1094 experiment.singleIntervalMaxTrials=experiment.stopCriteria2IFC;
1095 experiment.functionEstMethod='peaksAndTroughs';
1096 LevittControl.maxTrials=experiment.singleIntervalMaxTrials(1);
1097 set(handles.editWRVsteps,'string', ...
1098 num2str(stimulusParameters.WRVsteps))
1099 set(handles.textstopCriteria,'string', {'trials peaks sdCrit'})
1100 experiment.allowCatchTrials= 0;
1101 end
1102
1103 set(handles.textstopCriteria,'fontSize',8)
1104 set(handles.editstopCriteriaBox,'string',...
1105 num2str(experiment.singleIntervalMaxTrials))
1106
1107 % establish the appropriate instructions to the subject
1108 % NB responsibility for this is now transferred to the paradigm file
1109 switch experiment.threshEstMethod
1110 % only one value required for level change
1111 case {'2I2AFC++', '2A2AIFC+++'}
1112 stimulusParameters.subjectText=...
1113 'did the tone occur in window 1 or 2?';
1114 case {'MaxLikelihood', 'oneIntervalUpDown'};
1115 switch stimulusParameters.includeCue
1116 case 0
1117 stimulusParameters.subjectText=...
1118 stimulusParameters.instructions{1};
1119 case 1
1120 stimulusParameters.subjectText= ...
1121 stimulusParameters.instructions{2};
1122 end
1123 end
1124 stimulusParameters.messageString={'training'};
1125
1126 aResetPopupMenus(handles)
1127 % -------------------------------------------------- function orderGlobals
1128 function orderGlobals
1129 global stimulusParameters experiment betweenRuns withinRuns
1130
1131 stimulusParameters=[];
1132 stimulusParameters.sampleRate= [];
1133 stimulusParameters.targetType= '';
1134 stimulusParameters.targetFrequency= [];
1135 stimulusParameters.targetDuration= [];
1136 stimulusParameters.targetLevel= [];
1137 stimulusParameters.gapDuration= [];
1138 stimulusParameters.maskerType= '';
1139 stimulusParameters.maskerRelativeFrequency= [];
1140 stimulusParameters.maskerDuration= [];
1141 stimulusParameters.maskerLevel= [];
1142 stimulusParameters.backgroundType= '';
1143 stimulusParameters.backgroundTypeValue= [];
1144 stimulusParameters.backgroundLevel= [];
1145 stimulusParameters.includeCue= [];
1146 experiment.clickToStimulusPause=[];
1147 stimulusParameters.stimulusDelay= [];
1148 stimulusParameters.rampDuration= [];
1149 stimulusParameters.absThresholds= [];
1150 stimulusParameters.numOHIOtones= [];
1151
1152 stimulusParameters.WRVname= '';
1153 stimulusParameters.WRVstartValues= [];
1154 stimulusParameters.WRVsteps= [];
1155 stimulusParameters.WRVlimits= [];
1156 stimulusParameters.WRVinitialStep= [];
1157 stimulusParameters.WRVsmallStep= [];
1158 experiment.singleIntervalMaxTrials= [];
1159 stimulusParameters.calibrationdB= [];
1160
1161 stimulusParameters.catchTrialRates= [];
1162 stimulusParameters.catchTrialBaseRate= [];
1163 stimulusParameters.catchTrialRate= [];
1164 stimulusParameters.catchTrialTimeConstant= [];
1165
1166 stimulusParameters.dt= [];
1167
1168 stimulusParameters.jitterStartdB= [];
1169 stimulusParameters.restoreCalibration= [];
1170 stimulusParameters.messageString= [];
1171 stimulusParameters.cueTestDifference= [];
1172 stimulusParameters.subjectText= '';
1173 stimulusParameters.testTargetBegins= [];
1174 stimulusParameters.testTargetEnds= [];
1175 stimulusParameters.musicLeveldB= [];
1176
1177 stimulusParameters.subjectSampleRate=[];
1178 stimulusParameters.MAPSampleRate=[];
1179
1180 experiment=[];
1181 experiment.name= '';
1182 experiment.date= '';
1183 experiment.paradigm= '';
1184 experiment.ear= '';
1185 experiment.headphonesUsed=[];
1186 experiment.singleShot= [];
1187 experiment.randomize= '';
1188 experiment.maxTrials= [];
1189 experiment.MacGThreshold= [];
1190 experiment.resetCriterion= [];
1191 experiment.runResetCriterion= [];
1192
1193 experiment.comparisonData= [];
1194 experiment.absThresholds= [];
1195 experiment.threshEstMethod= '';
1196 experiment.functionEstMethod= '';
1197 experiment.psyBinWidth= [];
1198 experiment.maxLogisticK=2;
1199 experiment.numPossLogisticK=100;
1200 experiment.possLogSlopes= [];
1201 experiment.meanSearchStep= [];
1202 experiment.psyFunSlope= [];
1203 experiment.predictionLevels=[];
1204
1205 experiment.buttonBoxType= '';
1206 experiment.buttonBoxStatus= '';
1207 experiment.status= '';
1208 experiment.stop= 0;
1209 experiment.pleaseRepeat= [];
1210 experiment.justInitialized=[];
1211
1212 experiment.MAPplot= [];
1213 experiment.saveData= [];
1214 experiment.printTracks= [];
1215 experiment.msgFontSize= [];
1216 experiment.subjGUIfontSize= [];
1217
1218 experiment.timeAtStart= '';
1219 experiment.minElapsed= [];
1220
1221 betweenRuns=[];
1222 betweenRuns.variableName1= '';
1223 betweenRuns.variableList1= [];
1224 betweenRuns.variableName2= '';
1225 betweenRuns.variableList2= [];
1226 betweenRuns.var1Sequence= [];
1227 betweenRuns.var2Sequence= [];
1228 betweenRuns.randomizeSequence=[];
1229 betweenRuns.timeNow= [];
1230 betweenRuns.runNumber= [];
1231 % betweenRuns.variableCount1= [];
1232 % betweenRuns.variableCount2= [];
1233 betweenRuns.thresholds= [];
1234 betweenRuns.forceThresholds= [];
1235 betweenRuns.observationCount= [];
1236 betweenRuns.timesOfFirstReversals= [];
1237 betweenRuns.bestThresholdTracks='';
1238 betweenRuns.bestThresholdMeanTracks='';
1239 betweenRuns.bestThresholdMedianTracks='';
1240 betweenRuns.levelTracks='';
1241 betweenRuns.responseTracks='';
1242 betweenRuns.slopeKTracks= [];
1243 betweenRuns.gainTracks= [];
1244 betweenRuns.VminTracks= [];
1245 betweenRuns.bestGain= [];
1246 betweenRuns.bestVMin= [];
1247 betweenRuns.bestPaMin= [];
1248 betweenRuns.bestLogisticM= [];
1249 betweenRuns.bestLogisticK= [];
1250 betweenRuns.psychometicFunction='';
1251 betweenRuns.catchTrials= [];
1252 betweenRuns.caughtOut= [];
1253
1254 withinRuns=[];
1255 withinRuns.trialNumber=[];
1256 withinRuns.nowInPhase2=0;
1257 withinRuns.beginningOfPhase2=0;
1258 withinRuns.variableValue=[];
1259 withinRuns.direction='';
1260 withinRuns.peaks=[];
1261 withinRuns.troughs= [];
1262 withinRuns.levelList= [];
1263 withinRuns.responseList= [];
1264 withinRuns.meanEstTrack= [];
1265 withinRuns.meanLogisticEstTrack=[];
1266 withinRuns.bestSlopeK= [];
1267 withinRuns.bestGain= [];
1268 withinRuns.bestVMin= [];
1269 withinRuns.forceThreshold=[];
1270 withinRuns.catchTrial= [];
1271 withinRuns.caughtOut=[];
1272 withinRuns.catchTrialCount=[];
1273 withinRuns.wrongButton= [];
1274 withinRuns.babblePlaying=0;
1275
1276 % --- Executes on selection change in popupmenuBackgroundType.
1277 function popupmenuBackgroundType_Callback(hObject, eventdata, handles)
1278 global backgroundTypes
1279 option=get(handles.popupmenuBackgroundType,'value');
1280 selectedBackground=backgroundTypes{option};
1281 stimulusParameters.backgroundType=selectedBackground;
1282
1283 switch selectedBackground
1284 case 'none'
1285 set(handles.editBackgroundLevel,'visible','off')
1286 set(handles.textBGlevel,'visible','off')
1287 otherwise
1288 set(handles.editBackgroundLevel,'visible','on')
1289 set(handles.textBGlevel,'visible','on')
1290 end
1291
1292
1293 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1294 function pushbuttonStop_Callback(hObject, eventdata, handles)
1295 global experiment
1296 experiment.stop=1;
1297 disp('stop!')
1298 set(handles.pushbuttonStop, 'backgroundColor','r')
1299 pause(.1)
1300 drawnow
1301
1302 function pushbuttonOME_Callback(hObject, eventdata, handles)
1303 aReadAndCheckParameterBoxes(handles);
1304 testOME
1305
1306 function pushbuttonBM_Callback(hObject, eventdata, handles)
1307 global stimulusParameters experiment
1308 aReadAndCheckParameterBoxes(handles);
1309 testBM(stimulusParameters.targetFrequency, experiment.name);
1310
1311 function pushbuttonAN_Callback(hObject, eventdata, handles)
1312 aReadAndCheckParameterBoxes(handles);
1313 % now carry out tests
1314 showPSTHs=0;
1315 testAN
1316
1317 function pushbuttonRF_Callback(hObject, eventdata, handles)
1318 aReadAndCheckParameterBoxes(handles);
1319 showPSTHs=1;
1320 testRF
1321
1322 function pushbuttonSYN_Callback(hObject, eventdata, handles)
1323 aReadAndCheckParameterBoxes(handles);
1324 testSynapse
1325
1326 function pushbuttonFM_Callback(hObject, eventdata, handles)
1327 aReadAndCheckParameterBoxes(handles);
1328 testFM
1329
1330 function popupmenuPhase_Callback(hObject, eventdata, handles)
1331 global stimulusParameters
1332
1333 optionNo=get(handles.popupmenuPhase,'value');
1334 options=get(handles.popupmenuPhase,'string');
1335 phase=options{optionNo};
1336 stimulusParameters.maskerPhase=phase;
1337 stimulusParameters.targetPhase=phase;
1338
1339 function pushbuttonParams_Callback(hObject, eventdata, handles)
1340 global experiment stimulusParameters
1341 aReadAndCheckParameterBoxes(handles);
1342 % print model parameters using the 'name' box (e.g. CTa -> MAPparamsCTa)
1343 showParams=1; BFlist=-1;
1344 paramFunctionName=['method=MAPparams' experiment.name ...
1345 '(BFlist, stimulusParameters.sampleRate, showParams);'];
1346 eval(paramFunctionName) % go and fetch the parameters requesting parameter printout
1347
1348
1349 % --- Executes on button press in pushbuttonRP.
1350 function pushbuttonRP_Callback(hObject, eventdata, handles)
1351 global experiment stimulusParameters
1352 aReadAndCheckParameterBoxes(handles);
1353 % now carry out test
1354 testRP(stimulusParameters.targetFrequency,experiment.name)
1355
1356 % function handles % ??
1357
1358
1359 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1360
1361 function editmaskerDuration_Callback(hObject, eventdata, handles)
1362
1363 function editmaskerDuration_CreateFcn(hObject, eventdata, handles)
1364 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1365 set(hObject,'BackgroundColor','white');
1366 end
1367
1368 function editmaskerLevel_Callback(hObject, eventdata, handles)
1369
1370 function editmaskerLevel_CreateFcn(hObject, eventdata, handles)
1371 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1372 set(hObject,'BackgroundColor','white');
1373 end
1374
1375 function editmaskerRelativeFrequency_Callback(hObject, eventdata, handles)
1376
1377 function editmaskerRelativeFrequency_CreateFcn(hObject, eventdata, handles)
1378 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1379 set(hObject,'BackgroundColor','white');
1380 end
1381
1382 function editWRVstartValues_Callback(hObject, eventdata, handles)
1383
1384 function editWRVstartValues_CreateFcn(hObject, eventdata, handles)
1385 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1386 set(hObject,'BackgroundColor','white');
1387 end
1388
1389 function editgapDuration_Callback(hObject, eventdata, handles)
1390
1391 function editgapDuration_CreateFcn(hObject, eventdata, handles)
1392 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1393 set(hObject,'BackgroundColor','white');
1394 end
1395
1396 function edittargetDuration_Callback(hObject, eventdata, handles)
1397
1398 function edittargetDuration_CreateFcn(hObject, eventdata, handles)
1399 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1400 set(hObject,'BackgroundColor','white');
1401 end
1402
1403 function edittargetLevel_Callback(hObject, eventdata, handles)
1404
1405 function edittargetLevel_CreateFcn(hObject, eventdata, handles)
1406 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1407 set(hObject,'BackgroundColor','white');
1408 end
1409
1410 function editrampDuration_Callback(hObject, eventdata, handles)
1411
1412 function editrampDuration_CreateFcn(hObject, eventdata, handles)
1413 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1414 set(hObject,'BackgroundColor','white');
1415 end
1416
1417 function editcueTestDifference_Callback(hObject, eventdata, handles)
1418
1419 function editcueTestDifference_CreateFcn(hObject, eventdata, handles)
1420 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1421 set(hObject,'BackgroundColor','white');
1422 end
1423
1424
1425 function editWRVsteps_Callback(hObject, eventdata, handles)
1426
1427 function editWRVsteps_CreateFcn(hObject, eventdata, handles)
1428 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1429 set(hObject,'BackgroundColor','white');
1430 end
1431
1432 function editWRVlimits_Callback(hObject, eventdata, handles)
1433
1434 function editWRVlimits_CreateFcn(hObject, eventdata, handles)
1435 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1436 set(hObject,'BackgroundColor','white');
1437 end
1438
1439 function edittargetFrequency_Callback(hObject, eventdata, handles)
1440
1441 function edittargetFrequency_CreateFcn(hObject, eventdata, handles)
1442 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1443 set(hObject,'BackgroundColor','white');
1444 end
1445
1446 function editName_Callback(hObject, eventdata, handles)
1447
1448 function editName_CreateFcn(hObject, eventdata, handles)
1449 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1450 set(hObject,'BackgroundColor','white');
1451 end
1452
1453 function editcalibrationdB_Callback(hObject, eventdata, handles)
1454
1455 function editcalibrationdB_CreateFcn(hObject, eventdata, handles)
1456 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1457 set(hObject,'BackgroundColor','white');
1458 end
1459
1460 function editMAPplot_Callback(hObject, eventdata, handles)
1461
1462 function editMAPplot_CreateFcn(hObject, eventdata, handles)
1463 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1464 set(hObject,'BackgroundColor','white');
1465 end
1466
1467 function editMsgFont_Callback(hObject, eventdata, handles)
1468
1469 function editMsgFont_CreateFcn(hObject, eventdata, handles)
1470 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1471 set(hObject,'BackgroundColor','white');
1472 end
1473
1474 function editCatchTrialRate_Callback(hObject, eventdata, handles)
1475
1476 function editCatchTrialRate_CreateFcn(hObject, eventdata, handles)
1477 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1478 set(hObject,'BackgroundColor','white');
1479 end
1480
1481
1482 function editSaveData_Callback(hObject, eventdata, handles)
1483
1484 function editSaveData_CreateFcn(hObject, eventdata, handles)
1485 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1486 set(hObject,'BackgroundColor','white');
1487 end
1488
1489 function editStatsModel_Callback(hObject, eventdata, handles)
1490
1491 function editStatsModel_CreateFcn(hObject, eventdata, handles)
1492 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1493 set(hObject,'BackgroundColor','white');
1494 end
1495
1496 function editBackgroundLevel_Callback(hObject, eventdata, handles)
1497
1498 function editBackgroundLevel_CreateFcn(hObject, eventdata, handles)
1499 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1500 set(hObject,'BackgroundColor','white');
1501 end
1502
1503 function editPrintTracks_Callback(hObject, eventdata, handles)
1504
1505 function editPrintTracks_CreateFcn(hObject, eventdata, handles)
1506 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1507 set(hObject,'BackgroundColor','white');
1508 end
1509
1510 function editstopCriteriaBox_Callback(hObject, eventdata, handles)
1511
1512 function editstopCriteriaBox_CreateFcn(hObject, eventdata, handles)
1513
1514 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1515 set(hObject,'BackgroundColor','white');
1516 end
1517
1518 function editstimulusDelay_Callback(hObject, eventdata, handles)
1519
1520 function editstimulusDelay_CreateFcn(hObject, eventdata, handles)
1521 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1522 set(hObject,'BackgroundColor','white');
1523 end
1524
1525
1526 function popupmenuCueNoCue_CreateFcn(hObject, eventdata, handles)
1527 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1528 set(hObject,'BackgroundColor','white');
1529 end
1530
1531 function popupmenuEar_CreateFcn(hObject, eventdata, handles)
1532 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1533 set(hObject,'BackgroundColor','red');
1534 end
1535
1536 function popupmenuVaryParameter1_Callback(hObject, eventdata, handles)
1537
1538 function popupmenuVaryParameter1_CreateFcn(hObject, eventdata, handles)
1539 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1540 set(hObject,'BackgroundColor','white');
1541 end
1542
1543 function popupmenuVaryParameter2_Callback(hObject, eventdata, handles)
1544
1545 function popupmenuVaryParameter2_CreateFcn(hObject, eventdata, handles)
1546 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1547 set(hObject,'BackgroundColor','white');
1548 end
1549
1550 function popupmenuRandomize_Callback(hObject, eventdata, handles)
1551
1552 function popupmenuRandomize_CreateFcn(hObject, eventdata, handles)
1553 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1554 set(hObject,'BackgroundColor','white');
1555 end
1556
1557 function popupmenuParadigm_CreateFcn(hObject, eventdata, handles)
1558 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1559 set(hObject,'BackgroundColor','white');
1560 end
1561
1562
1563 function popupmenuMaskerType_CreateFcn(hObject, eventdata, handles)
1564
1565 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1566 set(hObject,'BackgroundColor','white');
1567 end
1568
1569
1570 function popupmenuThreshEst_CreateFcn(hObject, eventdata, handles)
1571 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1572 set(hObject,'BackgroundColor','white');
1573 end
1574
1575 function popupmenuBackgroundType_CreateFcn(hObject, eventdata, handles)
1576
1577 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1578 set(hObject,'BackgroundColor','white');
1579 end
1580
1581
1582 function popupmenuTargetType_CreateFcn(hObject, eventdata, handles)
1583 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1584 set(hObject,'BackgroundColor','white');
1585 end
1586
1587 function editSubjectFont_Callback(hObject, eventdata, handles)
1588
1589 function editSubjectFont_CreateFcn(hObject, eventdata, handles)
1590 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1591 set(hObject,'BackgroundColor','white');
1592 end
1593
1594 function editMusicLevel_Callback(hObject, eventdata, handles)
1595
1596 function editMusicLevel_CreateFcn(hObject, eventdata, handles)
1597 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1598 set(hObject,'BackgroundColor','white');
1599 end
1600
1601 function figure1_ButtonDownFcn(hObject, eventdata, handles)
1602
1603
1604 function edit33_Callback(hObject, eventdata, handles)
1605
1606 function edit33_CreateFcn(hObject, eventdata, handles)
1607 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1608 set(hObject,'BackgroundColor','white');
1609 end
1610
1611
1612 function popupmenuPhase_CreateFcn(hObject, eventdata, handles)
1613 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1614 set(hObject,'BackgroundColor','white');
1615 end
1616
1617 function editsegSize_Callback(hObject, eventdata, handles)
1618
1619 function editsegSize_CreateFcn(hObject, eventdata, handles)
1620 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1621 set(hObject,'BackgroundColor','white');
1622 end
1623
1624
1625 function editnumOHIOtones_Callback(hObject, eventdata, handles)
1626 % hObject handle to editnumOHIOtones (see GCBO)
1627 % eventdata reserved - to be defined in a future version of MATLAB
1628 % handles structure with handles and user data (see GUIDATA)
1629
1630 % Hints: get(hObject,'String') returns contents of editnumOHIOtones as text
1631 % str2double(get(hObject,'String')) returns contents of editnumOHIOtones as a double
1632
1633
1634 % --- Executes during object creation, after setting all properties.
1635 function editnumOHIOtones_CreateFcn(hObject, eventdata, handles)
1636 % hObject handle to editnumOHIOtones (see GCBO)
1637 % eventdata reserved - to be defined in a future version of MATLAB
1638 % handles empty - handles not created until after all CreateFcns called
1639
1640 % Hint: edit controls usually have a white background on Windows.
1641 % See ISPC and COMPUTER.
1642 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
1643 set(hObject,'BackgroundColor','white');
1644 end
1645
1646
1647