comparison multithreshold 1.46/expGUI_MT.m @ 30:1a502830d462

MT update
author Ray Meddis <rmeddis@essex.ac.uk>
date Mon, 11 Jul 2011 14:31:29 +0100
parents b51bf546ca3f
children 82fb37eb430e
comparison
equal deleted inserted replaced
29:b51bf546ca3f 30:1a502830d462
83 83
84 function varargout = expGUI_MT_OutputFcn(hObject, eventdata, handles) 84 function varargout = expGUI_MT_OutputFcn(hObject, eventdata, handles)
85 % Get default command line output from handles structure 85 % Get default command line output from handles structure
86 initializeGUI(handles) 86 initializeGUI(handles)
87 varargout{1} = handles.output; 87 varargout{1} = handles.output;
88 setLocationOfGUIs(handles) 88
89 89 % function setLocationOfGUIs(handles)
90 function setLocationOfGUIs(handles) 90 % global checkForPreviousGUI % holds screen positioning across repeated calls
91 global checkForPreviousGUI % holds screen positioning across repeated calls 91 % scrnsize=get(0,'screensize');
92 scrnsize=get(0,'screensize'); 92 % checkForPreviousGUI=[];
93 checkForPreviousGUI=[]; 93 % % if isstruct(checkForPreviousGUI)...
94 % if isstruct(checkForPreviousGUI)... 94 % % && checkForPreviousGUI.GUIalreadyStarted==1 ...
95 % && checkForPreviousGUI.GUIalreadyStarted==1 ... 95 % % && isfield(checkForPreviousGUI,'GUIposition')
96 % && isfield(checkForPreviousGUI,'GUIposition') 96 % % set(handles.figure1,'position',checkForPreviousGUI.GUIposition)
97 % set(handles.figure1,'position',checkForPreviousGUI.GUIposition) 97 % % else
98 % else 98 % % % relocate the GUI only if this is the first time of use
99 % % relocate the GUI only if this is the first time of use 99 % % set(0, 'units','pixels')
100 % set(0, 'units','pixels') 100 % % % occupies top to bottom of screen but only 60% width
101 % % occupies top to bottom of screen but only 60% width 101 % % % [left bottom width height]
102 % % [left bottom width height] 102 % % firstPos=[0.01*scrnsize(4) 0.03*scrnsize(3) 0.6*scrnsize(3) 0.92*scrnsize(4)];
103 % 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 % firstPos=[4 0.045*scrnsize(4) 0.6*scrnsize(3) 0.93*scrnsize(4)]; 104 % % set(handles.figure1, 'units','pixels')
105 % set(handles.figure1, 'units','pixels') 105 % % set(handles.figure1,'position',firstPos)
106 % set(handles.figure1,'position',firstPos) 106 % % checkForPreviousGUI.GUIalreadyStarted=1;
107 % checkForPreviousGUI.GUIalreadyStarted=1; 107 % % checkForPreviousGUI.GUIposition=firstPos;
108 % checkForPreviousGUI.GUIposition=firstPos; 108 % % end
109 % end 109 % set(handles.figure1,'color',[.871 .961 .996])
110 set(handles.figure1,'color',[.871 .961 .996]) 110 % set(handles.figure1,'name', pwd)
111 set(handles.figure1,'name', pwd) 111 %
112 112 % % MAP model figure; sits alongside GUI if requested
113 % MAP model figure; sits alongside GUI if requested 113 % figure(99)
114 figure(99) 114 % % [left bottom width height]
115 % [left bottom width height] 115 % MAPpos=[0.615*scrnsize(3) 0.05*scrnsize(4) 0.15*scrnsize(3) 0.85*scrnsize(4)];
116 MAPpos=[0.615*scrnsize(3) 0.05*scrnsize(4) 0.15*scrnsize(3) 0.85*scrnsize(4)]; 116 % % visible only on request.
117 % visible only on request. 117 % set(gcf,'position',MAPpos , 'visible','off')
118 set(gcf,'position',MAPpos , 'visible','off') 118 %
119
120 119
121 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 120 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
122 121
123 % -----------------------------------------------------initializeGUI 122 % -----------------------------------------------------initializeGUI
124 function initializeGUI(handles) 123 function initializeGUI(handles)
126 % Then wait for user action 125 % Then wait for user action
127 global stimulusParameters experiment betweenRuns 126 global stimulusParameters experiment betweenRuns
128 global targetTypes maskerTypes backgroundTypes 127 global targetTypes maskerTypes backgroundTypes
129 global variableNames paradigmNames threshEstNames cueNames 128 global variableNames paradigmNames threshEstNames cueNames
130 129
131 % dbstop if error % allow for debugging and user error reporting 130 % Specify order of fields in main structures
132 % dbstop if warning 131 % identify as empty values or empty strings only
133
134 % specify structure fields for pretty automatic printing
135 % It also initialises some simple variables
136 orderGlobals 132 orderGlobals
137 133
138 addpath ('paradigms') % preset paradigm informations is stored here 134 addpath ('paradigms') %paradigm informations is stored here
139 % filesep is usd to be compatible with other operating systems 135 addpath (['..' filesep 'testPrograms']) % model physiology tests
140 % addpath (['..' filesep 'modules'], ['..' filesep 'utilities'], ...
141 % ['..' filesep 'parameterStore'], ['..' filesep 'wavFileStore'],...
142 % ['..' filesep 'testPrograms'])
143 addpath (['..' filesep 'testPrograms'])
144 136
145 % specify all variables that need to be set on the GUI 137 % specify all variables that need to be set on the GUI
146 variableNames={'stimulusDelay','maskerDuration','maskerLevel',... 138 variableNames={'stimulusDelay','maskerDuration','maskerLevel',...
147 'maskerRelativeFrequency', 'targetFrequency', 'gapDuration',... 139 'maskerRelativeFrequency', 'targetFrequency', 'gapDuration',...
148 'targetDuration','targetLevel','rampDuration',... 140 'targetDuration','targetLevel','rampDuration',...
149 'cueTestDifference', 'WRVstartValues', 'WRVsteps', 'WRVlimits'}; 141 'cueTestDifference', 'WRVstartValues', 'WRVsteps', 'WRVlimits'};
150 142
151 % Variable variables 143 % Variable variables
152 % (specifies paradigm paramaters that can changed on a 'between runs' basis) 144 % (names of variable that can changed between runs)
153 % make them options in the two between runs variable menus
154 % NB 'numOHIOtones' is used only to solve a problem; it should not be
155 % selected manually
156 betweenRunsVariables={'stimulusDelay','maskerDuration','maskerLevel',... 145 betweenRunsVariables={'stimulusDelay','maskerDuration','maskerLevel',...
157 'maskerRelativeFrequency','targetFrequency', 'gapDuration',... 146 'maskerRelativeFrequency','targetFrequency', 'gapDuration',...
158 'targetDuration','targetLevel','numOHIOtones'}; 147 'targetDuration','targetLevel','numOHIOtones'};
148 % populate the 'between runs variable' menus
159 set(handles.popupmenuVaryParameter1,'string',betweenRunsVariables) 149 set(handles.popupmenuVaryParameter1,'string',betweenRunsVariables)
160 set(handles.popupmenuVaryParameter2,'string',betweenRunsVariables) 150 set(handles.popupmenuVaryParameter2,'string',betweenRunsVariables)
161
162 % NB 'Warning: popupmenu control requires a scalar Value'
163 % indicates that an inappropriate 'value' is being set.
164 % when testing for this, always clear the GUI before running
165 151
166 % Trial presentation order - randomize at startup 152 % Trial presentation order - randomize at startup
167 presentationOrderNames={'randomize within blocks', 'fixed sequence', ... 153 presentationOrderNames={'randomize within blocks', 'fixed sequence', ...
168 'randomize across blocks'}; 154 'randomize across blocks'};
169 set(handles.popupmenuRandomize,'string', presentationOrderNames) 155 set(handles.popupmenuRandomize,'string', presentationOrderNames)
182 backgroundTypes={'none','noise', 'pinkNoise', 'TEN','noiseDich',... 168 backgroundTypes={'none','noise', 'pinkNoise', 'TEN','noiseDich',...
183 'pinkNoiseDich','whiteNoise','24TalkerBabble',... 169 'pinkNoiseDich','whiteNoise','24TalkerBabble',...
184 '16TalkerBabble','8TalkerBabble','4TalkerBabble',... 170 '16TalkerBabble','8TalkerBabble','4TalkerBabble',...
185 '4TalkerReversedBabble','2TalkerBabble','1TalkerBabble'}; 171 '4TalkerReversedBabble','2TalkerBabble','1TalkerBabble'};
186 set(handles.popupmenuBackgroundType, 'string', backgroundTypes); 172 set(handles.popupmenuBackgroundType, 'string', backgroundTypes);
187 set(handles.editBackgroundLevel,'string',... 173 set(handles.editBackgroundLevel,'string', '0')
188 num2str(stimulusParameters.backgroundLevel))
189 174
190 % Establish available paradigms by scanning paradigms folder 175 % Establish available paradigms by scanning paradigms folder
191 paradigmNames= what('paradigms'); 176 paradigmNames= what('paradigms');
192 paradigmNames=paradigmNames.m; % m files only 177 paradigmNames= paradigmNames.m; % select m files only
193 for i=1:length(paradigmNames), paradigmNames{i}=paradigmNames{i}(10:end-2); end 178 for i=1:length(paradigmNames) % strip off file extension
179 paradigmNames{i}=paradigmNames{i}(10:end-2);
180 end
194 set(handles.popupmenuParadigm,'string', paradigmNames) 181 set(handles.popupmenuParadigm,'string', paradigmNames)
195 182
196 % startup paradigm, 'training' (could be anywhere on the list) 183 % startup paradigm, 'training' (could be anywhere on the list)
197 startupParadigm='training'; 184 startupParadigm='training';
198 idx= find(strcmp(paradigmNames,startupParadigm)); 185 idx= find(strcmp(paradigmNames,startupParadigm));
199 if ~isempty(idx) 186 if ~isempty(idx)
200 set(handles.popupmenuParadigm,'value', idx) 187 set(handles.popupmenuParadigm,'value', idx)
201 else 188 else
202 % training paradigm is always the startup paradigm 189 % training paradigm must exist
203 error(['expGUI_MT\initializeGUI: No ' startupParadigm... 190 error(['expGUI_MT\initializeGUI: No ' startupParadigm...
204 ' paradigm found in paradigms folder']) 191 ' paradigm found in paradigms folder'])
205 end 192 end
206 193
207 earOptions={'left', 'right', 'diotic', 'dichoticLeft', 'dichoticRight',... 194 earOptions={'left', 'right', 'diotic', 'dichoticLeft', 'dichoticRight',...
211 defaultOption=1; 198 defaultOption=1;
212 experiment.ear=earOptions{defaultOption}; 199 experiment.ear=earOptions{defaultOption};
213 set(handles.popupmenuEar,'value', defaultOption) % 'left' is deafult 200 set(handles.popupmenuEar,'value', defaultOption) % 'left' is deafult
214 set(handles.pushbuttonSingleShot, 'visible', 'off') % use only for MAP 201 set(handles.pushbuttonSingleShot, 'visible', 'off') % use only for MAP
215 202
216 % masker phase box- value must be set in paradigm 203 % phase
217 phaseOptions={'sin','cos','alt','rand'}; 204 phaseOptions={'sin','cos','alt','rand'};
218 set(handles.popupmenuPhase,'string', phaseOptions) 205 set(handles.popupmenuPhase,'string', phaseOptions)
206 set(handles.popupmenuPhase,'value', 1)
219 207
220 % Cue 208 % Cue
221 cueNames={'cued', 'noCue'}; 209 cueNames={'cued', 'noCue'};
222 set(handles.popupmenuCueNoCue, 'string', cueNames); 210 set(handles.popupmenuCueNoCue, 'string', cueNames);
211 set(handles.popupmenuCueNoCue, 'value', 1);
223 212
224 % threshold assessment method - value must be set in paradigm 213 % threshold assessment method - value must be set in paradigm
225 threshEstNames={'oneIntervalUpDown', 'MaxLikelihood', ... 214 threshEstNames={'oneIntervalUpDown', 'MaxLikelihood', ...
226 '2I2AFC++', '2I2AFC+++'}; 215 '2I2AFC++', '2I2AFC+++'};
227 set(handles.popupmenuThreshEst, 'string', threshEstNames); 216 set(handles.popupmenuThreshEst, 'string', threshEstNames);
263 % {'logisticLS', 'logisticML', 'rareEvent'} 252 % {'logisticLS', 'logisticML', 'rareEvent'}
264 experiment.functionEstMethod='logisticLS'; 253 experiment.functionEstMethod='logisticLS';
265 254
266 % message box 255 % message box
267 set(handles.textMSG,'backgroundcolor', 'w', 'ForegroundColor', 'b', 'string', '') 256 set(handles.textMSG,'backgroundcolor', 'w', 'ForegroundColor', 'b', 'string', '')
268 set(handles.editMsgFont,'string','7') 257 set(handles.editMsgFont,'string','10')
269 set(handles.editSubjectFont,'string','14') 258 set(handles.editSubjectFont,'string','14')
270 259
271 % default psychometric bin size and logistic slopes 260 % default psychometric bin size and logistic slopes
272 experiment.psyBinWidth=1; % dB 261 experiment.psyBinWidth=1; % dB
273 maxLogisticK=2; % steepest slope contemplated 262 maxLogisticK=2; % steepest slope contemplated
326 error(['ExpGUI\aParadigmSelection:'... 315 error(['ExpGUI\aParadigmSelection:'...
327 'paradigm file not found or error in file']) 316 'paradigm file not found or error in file'])
328 end 317 end
329 rmpath ('paradigms') 318 rmpath ('paradigms')
330 319
331 switch experiment.paradigm 320 if ~isfield(experiment,'maskerInUse')
332 % identify masker free paradigms 321 error('selected paradigm does not specify if masker is used')
333 case {'training', 'discomfort','absThreshold', 'absThreshold_8',... 322 end
334 'absThreshold_16','TENtest', 'threshold_duration','SRT'... 323
335 'paradigm_thr_IFMC'} 324
336 experiment.maskerInUse=0; 325 if ~experiment.maskerInUse
337 otherwise 326 stimulusParameters.maskerType='tone';
338 experiment.maskerInUse=1; 327 stimulusParameters.maskerPhase='sin';
328 stimulusParameters.maskerDuration=0.0;
329 stimulusParameters.maskerLevel= -50;
330 stimulusParameters.maskerRelativeFrequency= 1 ;
339 end 331 end
340 332
341 % if a variable is subject to change, specify list of values here 333 % if a variable is subject to change, specify list of values here
342 % eg. stimulusParameters.targetFrequency=betweenRuns.variableList1; 334 % eg. stimulusParameters.targetFrequency=betweenRuns.variableList1;
343 cmd=['stimulusParameters.' ... 335 cmd=['stimulusParameters.' ...
346 cmd=['stimulusParameters.' ... 338 cmd=['stimulusParameters.' ...
347 betweenRuns.variableName2 '=betweenRuns.variableList2;']; 339 betweenRuns.variableName2 '=betweenRuns.variableList2;'];
348 eval (cmd); 340 eval (cmd);
349 341
350 % establish popup menus on the basis of the paradigm file 342 % establish popup menus on the basis of the paradigm file
351 set(handles.popupmenuRandomize,'value', betweenRuns.randomizeSequence) 343 % set(handles.popupmenuRandomize,'value', betweenRuns.randomizeSequence)
352 set(handles.popupmenuPhase,'string', stimulusParameters.maskerPhase) 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
353 if stimulusParameters.includeCue 352 if stimulusParameters.includeCue
354 set(handles.popupmenuCueNoCue,'value', 1) 353 set(handles.popupmenuCueNoCue,'value', 1)
355 else 354 else
356 set(handles.popupmenuCueNoCue,'value', 2) 355 set(handles.popupmenuCueNoCue,'value', 2)
357 end 356 end
612 function pushbuttonRun_Callback(hObject, eventdata, handles) 611 function pushbuttonRun_Callback(hObject, eventdata, handles)
613 global checkForPreviousGUI % holds screen positioning across repeated calls 612 global checkForPreviousGUI % holds screen positioning across repeated calls
614 global experiment betweenRuns paradigmNames errormsg 613 global experiment betweenRuns paradigmNames errormsg
615 checkForPreviousGUI.GUIposition=get(handles.figure1,'position'); 614 checkForPreviousGUI.GUIposition=get(handles.figure1,'position');
616 experiment.singleShot=0; 615 experiment.singleShot=0;
616 experiment.stop=0;
617
617 switch experiment.paradigm 618 switch experiment.paradigm
618 case 'profile' 619 case 'profile'
619 %% special option for two successive and linked measurements 620 %% special option for two successive and linked measurements
620 clc 621 clc
621 experiment.paradigm='threshold_16ms'; 622 experiment.paradigm='threshold_16ms';
782 switch experiment.ear 783 switch experiment.ear
783 case { 'MAPmodel', 'MAPmodelMultiCh', ... 784 case { 'MAPmodel', 'MAPmodelMultiCh', ...
784 'MAPmodelSingleCh', 'MAPmodelListen'} 785 'MAPmodelSingleCh', 'MAPmodelListen'}
785 % MAPmodel writes forced parameter settings to the screen 786 % MAPmodel writes forced parameter settings to the screen
786 % so that they can be read from there 787 % so that they can be read from there
788 % {'randomize within blocks', 'fixed sequence',...
789 % 'randomize across blocks'}
787 set(handles.popupmenuRandomize,'value',2) % fixed sequence 790 set(handles.popupmenuRandomize,'value',2) % fixed sequence
788 set(handles.editstimulusDelay,'string','0.01') % no stimulus delay 791 set(handles.editstimulusDelay,'string','0.01') % no stimulus delay
789 stimulusParameters.includeCue=0; % no cue for MAP 792 stimulusParameters.includeCue=0; % no cue for MAP
790 end 793 end
791 794
1299 experiment.comparisonData= []; 1302 experiment.comparisonData= [];
1300 experiment.absThresholds= []; 1303 experiment.absThresholds= [];
1301 experiment.threshEstMethod= ''; 1304 experiment.threshEstMethod= '';
1302 experiment.functionEstMethod= ''; 1305 experiment.functionEstMethod= '';
1303 experiment.psyBinWidth= []; 1306 experiment.psyBinWidth= [];
1304 experiment.maxLogisticK=2; 1307 experiment.maxLogisticK=[];
1305 experiment.numPossLogisticK=100; 1308 experiment.numPossLogisticK=[];
1306 experiment.possLogSlopes= []; 1309 experiment.possLogSlopes= [];
1307 experiment.meanSearchStep= []; 1310 experiment.meanSearchStep= [];
1308 experiment.psyFunSlope= []; 1311 experiment.psyFunSlope= [];
1309 experiment.predictionLevels=[]; 1312 experiment.predictionLevels=[];
1310 1313
1311 experiment.buttonBoxType= ''; 1314 experiment.buttonBoxType= '';
1312 experiment.buttonBoxStatus= ''; 1315 experiment.buttonBoxStatus= '';
1313 experiment.status= ''; 1316 experiment.status= '';
1314 experiment.stop= 0; 1317 experiment.stop= [];
1315 experiment.pleaseRepeat= []; 1318 experiment.pleaseRepeat= [];
1316 experiment.justInitialized=[]; 1319 experiment.justInitialized=[];
1317 1320
1318 experiment.MAPplot= []; 1321 experiment.MAPplot= [];
1319 experiment.saveData= []; 1322 experiment.saveData= [];
1332 betweenRuns.var1Sequence= []; 1335 betweenRuns.var1Sequence= [];
1333 betweenRuns.var2Sequence= []; 1336 betweenRuns.var2Sequence= [];
1334 betweenRuns.randomizeSequence=[]; 1337 betweenRuns.randomizeSequence=[];
1335 betweenRuns.timeNow= []; 1338 betweenRuns.timeNow= [];
1336 betweenRuns.runNumber= []; 1339 betweenRuns.runNumber= [];
1337 % betweenRuns.variableCount1= [];
1338 % betweenRuns.variableCount2= [];
1339 betweenRuns.thresholds= []; 1340 betweenRuns.thresholds= [];
1340 betweenRuns.forceThresholds= []; 1341 betweenRuns.forceThresholds= [];
1341 betweenRuns.observationCount= []; 1342 betweenRuns.observationCount= [];
1342 betweenRuns.timesOfFirstReversals= []; 1343 betweenRuns.timesOfFirstReversals= [];
1343 betweenRuns.bestThresholdTracks=''; 1344 betweenRuns.bestThresholdTracks='';
1355 betweenRuns.catchTrials= []; 1356 betweenRuns.catchTrials= [];
1356 betweenRuns.caughtOut= []; 1357 betweenRuns.caughtOut= [];
1357 1358
1358 withinRuns=[]; 1359 withinRuns=[];
1359 withinRuns.trialNumber=[]; 1360 withinRuns.trialNumber=[];
1360 withinRuns.nowInPhase2=0; 1361 withinRuns.nowInPhase2=[];
1361 withinRuns.beginningOfPhase2=0; 1362 withinRuns.beginningOfPhase2=[];
1362 withinRuns.variableValue=[]; 1363 withinRuns.variableValue=[];
1363 withinRuns.direction=''; 1364 withinRuns.direction='';
1364 withinRuns.peaks=[]; 1365 withinRuns.peaks=[];
1365 withinRuns.troughs= []; 1366 withinRuns.troughs= [];
1366 withinRuns.levelList= []; 1367 withinRuns.levelList= [];
1373 withinRuns.forceThreshold=[]; 1374 withinRuns.forceThreshold=[];
1374 withinRuns.catchTrial= []; 1375 withinRuns.catchTrial= [];
1375 withinRuns.caughtOut=[]; 1376 withinRuns.caughtOut=[];
1376 withinRuns.catchTrialCount=[]; 1377 withinRuns.catchTrialCount=[];
1377 withinRuns.wrongButton= []; 1378 withinRuns.wrongButton= [];
1378 withinRuns.babblePlaying=0; 1379 withinRuns.babblePlaying=[];
1379 1380
1380 % --- Executes on selection change in popupmenuBackgroundType. 1381 % --- Executes on selection change in popupmenuBackgroundType.
1381 function popupmenuBackgroundType_Callback(hObject, eventdata, handles) 1382 function popupmenuBackgroundType_Callback(hObject, eventdata, handles)
1382 global backgroundTypes 1383 global backgroundTypes
1383 option=get(handles.popupmenuBackgroundType,'value'); 1384 option=get(handles.popupmenuBackgroundType,'value');