From bd34b950f5dbc2cbdf6c01bccb348f038d55a43d Mon Sep 17 00:00:00 2001 From: marcobarilari Date: Wed, 23 Sep 2020 18:16:56 +0200 Subject: [PATCH 1/3] fix style according to miss_hit 0.9.12 release --- demos/CPP_getResponseDemo.m | 6 +-- dev/devSandbox.m | 10 ++-- manualTests/test_getResponse.m | 2 +- src/aperture/apertureTexture.m | 60 ++++++++++----------- src/aperture/eccenLogSpeed.m | 2 +- src/dot/computeCartCoord.m | 2 +- src/dot/dotTexture.m | 12 ++--- src/dot/reseedDots.m | 12 ++--- src/drawFieldOfVIew.m | 12 ++--- src/errors/errorDistanceToScreen.m | 6 +-- src/eyeTracker.m | 30 +++++------ src/fixation/drawFixation.m | 66 +++++++++++------------ src/fixation/initFixation.m | 16 +++--- src/getExperimentEnd.m | 4 +- src/initPTB.m | 26 ++++----- src/keyboard/checkAbortGetResponse.m | 4 +- src/keyboard/getResponse.m | 4 +- src/readAndFilterLogfile.m | 4 +- src/screen/standByScreen.m | 4 +- src/utils/checkPtbVersion.m | 18 +++---- src/utils/degToPix.m | 2 +- src/utils/printCreditsCppPtb.m | 8 +-- src/utils/setDefaults.m | 12 ++--- src/waitFor.m | 8 +-- src/waitForTrigger.m | 4 +- tests/test_checkAbortGetResponse.m | 2 +- tests/test_computeFOV.m | 2 +- tests/test_computeRadialMotionDirection.m | 24 ++++----- tests/test_reseedDots.m | 32 +++++------ tests/test_setDefaultsPTB.m | 26 ++++----- 30 files changed, 210 insertions(+), 210 deletions(-) diff --git a/demos/CPP_getResponseDemo.m b/demos/CPP_getResponseDemo.m index 6c4dc66..c0744c2 100644 --- a/demos/CPP_getResponseDemo.m +++ b/demos/CPP_getResponseDemo.m @@ -103,9 +103,9 @@ end fprintf('\n %s was %s at time %.3f seconds\n', ... - responseEvents(iEvent).keyName, ... - eventType, ... - responseEvents(iEvent).onset - startSecs); + responseEvents(iEvent).keyName, ... + eventType, ... + responseEvents(iEvent).onset - startSecs); end diff --git a/dev/devSandbox.m b/dev/devSandbox.m index 637830a..48dd61e 100644 --- a/dev/devSandbox.m +++ b/dev/devSandbox.m @@ -256,11 +256,11 @@ InitializePsychSound(1); cfg.audio.pahandle = PsychPortAudio('Open', ... - [], ... - [], ... - [], ... - cfg.audio.fs, ... - cfg.audio.channels); + [], ... + [], ... + [], ... + cfg.audio.fs, ... + cfg.audio.channels); end end diff --git a/manualTests/test_getResponse.m b/manualTests/test_getResponse.m index 78a3bad..cea8d4a 100644 --- a/manualTests/test_getResponse.m +++ b/manualTests/test_getResponse.m @@ -54,7 +54,7 @@ for iEvent = 1:size(responseEvents, 1) fprintf(' %s was pressed\n ', ... - responseEvents(iEvent).keyName); + responseEvents(iEvent).keyName); if ~any(strcmp({responseEvents(iEvent).keyName}, cfg.keyboard.responseKey)) errorRestrictedKeysGetReponse(); diff --git a/src/aperture/apertureTexture.m b/src/aperture/apertureTexture.m index 49086ee..319fc84 100644 --- a/src/aperture/apertureTexture.m +++ b/src/aperture/apertureTexture.m @@ -10,7 +10,7 @@ cfg = apertureInit(cfg); cfg.aperture.texture = Screen('MakeTexture', cfg.screen.win, ... - cfg.color.background(1) * ones(cfg.screen.winRect([3 3]))); + cfg.color.background(1) * ones(cfg.screen.winRect([3 3]))); case 'make' @@ -29,9 +29,9 @@ end Screen('DrawTexture', cfg.screen.win, cfg.aperture.texture, ... - cfg.screen.winRect, ... - CenterRect(cfg.screen.winRect * scalingFactor, cfg.screen.winRect), ... - rotationAngle); + cfg.screen.winRect, ... + CenterRect(cfg.screen.winRect * scalingFactor, cfg.screen.winRect), ... + rotationAngle); end @@ -64,8 +64,8 @@ cfg.ring.csFuncFact = ... 1 / ... ((cfg.ring.maxEcc + exp(1)) * ... - log(cfg.ring.maxEcc + exp(1)) - ... - (cfg.ring.maxEcc + exp(1))); + log(cfg.ring.maxEcc + exp(1)) - ... + (cfg.ring.maxEcc + exp(1))); end case 'bar' @@ -115,8 +115,8 @@ end Screen('FillOval', cfg.aperture.texture, TRANSPARENT, ... - CenterRectOnPoint([0, 0, repmat(diameter, 1, 2)], ... - xCenter, yCenter)); + CenterRectOnPoint([0, 0, repmat(diameter, 1, 2)], ... + xCenter, yCenter)); case 'ring' @@ -126,14 +126,14 @@ Screen('Fillrect', cfg.aperture.texture, cfg.color.background); Screen('FillOval', cfg.aperture.texture, TRANSPARENT, ... - CenterRectOnPoint( ... - [0, 0, repmat(cfg.ring.outerRimPix, 1, 2)], ... - xCenter, yCenter)); + CenterRectOnPoint( ... + [0, 0, repmat(cfg.ring.outerRimPix, 1, 2)], ... + xCenter, yCenter)); Screen('FillOval', cfg.aperture.texture, [cfg.color.background 255], ... - CenterRectOnPoint( ... - [0, 0, repmat(cfg.ring.innerRimPix, 1, 2)], ... - xCenter, yCenter)); + CenterRectOnPoint( ... + [0, 0, repmat(cfg.ring.innerRimPix, 1, 2)], ... + xCenter, yCenter)); case 'wedge' @@ -156,11 +156,11 @@ Screen('Fillrect', cfg.aperture.texture, cfg.color.background); Screen('FillArc', cfg.aperture.texture, TRANSPARENT, ... - CenterRect( ... - cfg.destinationRect, ... - cfg.screen.winRect), ... - thisEvent.angle, ... % start angle - cfg.aperture.width); % arc angle + CenterRect( ... + cfg.destinationRect, ... + cfg.screen.winRect), ... + thisEvent.angle, ... % start angle + cfg.aperture.width); % arc angle case 'bar' @@ -169,25 +169,25 @@ % We let the stimulus through Screen('FillOval', cfg.aperture.texture, TRANSPARENT, ... - CenterRect( ... - [0, 0, repmat(cfg.screen.winRect(4), 1, 2)], ... - cfg.screen.winRect)); + CenterRect( ... + [0, 0, repmat(cfg.screen.winRect(4), 1, 2)], ... + cfg.screen.winRect)); % Then we add the position of the bar aperture % which one is the right and which one is the left?? Screen('FillRect', cfg.aperture.texture, cfg.color.background, ... - [0, ... - 0, ... - thisEvent.barPosPix - cfg.aperture.barWidthPix / 2, ... - cfg.screen.winRect(4)]); + [0, ... + 0, ... + thisEvent.barPosPix - cfg.aperture.barWidthPix / 2, ... + cfg.screen.winRect(4)]); Screen('FillRect', cfg.aperture.texture, cfg.color.background, ... - [thisEvent.barPosPix + cfg.aperture.barWidthPix / 2, ... - 0, ... - cfg.screen.winRect(3), ... - cfg.screen.winRect(4)]); + [thisEvent.barPosPix + cfg.aperture.barWidthPix / 2, ... + 0, ... + cfg.screen.winRect(3), ... + cfg.screen.winRect(4)]); otherwise diff --git a/src/aperture/eccenLogSpeed.m b/src/aperture/eccenLogSpeed.m index df00b83..fb4c86e 100644 --- a/src/aperture/eccenLogSpeed.m +++ b/src/aperture/eccenLogSpeed.m @@ -30,7 +30,7 @@ % near-exp visual angle newOuterRimVA = ((outerRimVA + exp(1)) * log(outerRimVA + exp(1)) - ... - (outerRimVA + exp(1))) * maxEcc * csFuncFact; + (outerRimVA + exp(1))) * maxEcc * csFuncFact; outerRimPix = newOuterRimVA * cfg.screen.ppd; % in pixel % width of apperture changes logarithmically with eccentricity of inner ring diff --git a/src/dot/computeCartCoord.m b/src/dot/computeCartCoord.m index 8aacd65..cedf865 100644 --- a/src/dot/computeCartCoord.m +++ b/src/dot/computeCartCoord.m @@ -1,7 +1,7 @@ function cartesianCoordinates = computeCartCoord(positions, cfg) cartesianCoordinates = ... [positions(:, 1) + cfg.dot.matrixWidth, ... % x coordinate - positions(:, 2) + cfg.dot.matrixWidth]; % y coordinate + positions(:, 2) + cfg.dot.matrixWidth]; % y coordinate % cartesianCoordinates = positions; end diff --git a/src/dot/dotTexture.m b/src/dot/dotTexture.m index 1d5ff2c..c775a03 100644 --- a/src/dot/dotTexture.m +++ b/src/dot/dotTexture.m @@ -4,7 +4,7 @@ case 'init' cfg.dot.texture = Screen('MakeTexture', cfg.screen.win, ... - cfg.color.background(1) * ones(cfg.screen.winRect([4 3]))); + cfg.color.background(1) * ones(cfg.screen.winRect([4 3]))); case 'make' @@ -12,11 +12,11 @@ Screen('FillRect', cfg.dot.texture, cfg.color.background); Screen('DrawDots', cfg.dot.texture, ... - thisEvent.dot.positions, ... - cfg.dot.sizePix, ... - cfg.dot.color, ... - cfg.screen.center, ... - dotType); + thisEvent.dot.positions, ... + cfg.dot.sizePix, ... + cfg.dot.color, ... + cfg.screen.center, ... + dotType); case 'draw' diff --git a/src/dot/reseedDots.m b/src/dot/reseedDots.m index b6bd6e7..7c2c750 100644 --- a/src/dot/reseedDots.m +++ b/src/dot/reseedDots.m @@ -16,12 +16,12 @@ % - has been been picked to be killed N = any([ ... - dots.positions > cfg.dot.matrixWidth, ... - dots.positions < 0, ... - dots.time > dots.lifeTime, ... - radius - cfg.dot.sizePix < fixationWidthPix / 2, ... - rand(cfg.dot.number, 1) < cfg.dot.proportionKilledPerFrame ... - ], 2); + dots.positions > cfg.dot.matrixWidth, ... + dots.positions < 0, ... + dots.time > dots.lifeTime, ... + radius - cfg.dot.sizePix < fixationWidthPix / 2, ... + rand(cfg.dot.number, 1) < cfg.dot.proportionKilledPerFrame ... + ], 2); % If there is any such dot we relocate it to a new random position % and change its lifetime to 1 diff --git a/src/drawFieldOfVIew.m b/src/drawFieldOfVIew.m index 7a15385..4eae9be 100644 --- a/src/drawFieldOfVIew.m +++ b/src/drawFieldOfVIew.m @@ -15,14 +15,14 @@ function drawFieldOfVIew(cfg) fov = cfg.screen.effectiveFieldOfView; fov = CenterRect( ... - [0, 0, fov(1), fov(2)], ... - cfg.screen.winRect); + [0, 0, fov(1), fov(2)], ... + cfg.screen.winRect); Screen('FrameRect', ... - cfg.screen.win, ... - RED, ... - fov, ... - penWidth); + cfg.screen.win, ... + RED, ... + fov, ... + penWidth); end end diff --git a/src/errors/errorDistanceToScreen.m b/src/errors/errorDistanceToScreen.m index 1e17135..486ebe4 100644 --- a/src/errors/errorDistanceToScreen.m +++ b/src/errors/errorDistanceToScreen.m @@ -1,9 +1,9 @@ function errorDistanceToScreen(cfg) errorStruct.message = sprintf([ - 'Distance to monitor seems too small.\n' ... - 'It should be in centimeters.\n' ... - 'cfg.screen.monitorDistance = %f'], cfg.screen.monitorDistance); + 'Distance to monitor seems too small.\n' ... + 'It should be in centimeters.\n' ... + 'cfg.screen.monitorDistance = %f'], cfg.screen.monitorDistance); errorStruct.identifier = 'computeFOV:wrongDistanceToScreen'; diff --git a/src/eyeTracker.m b/src/eyeTracker.m index f8e3a9c..284097c 100755 --- a/src/eyeTracker.m +++ b/src/eyeTracker.m @@ -102,21 +102,21 @@ Eyelink('Command', 'calibration_samples = 6'); Eyelink('Command', 'calibration_sequence = 0,1,2,3,4,5'); Eyelink('Command', 'calibration_targets = %d,%d %d,%d %d,%d %d,%d %d,%d', ... - 640, 512, ... % width/2,height/2 - 640, 102, ... % width/2,height*0.1 - 640, 614, ... % width/2,height*0.6 - 128, 341, ... % width*0.1,height*1/3 - 1152, 341); % width-width*0.1,height*1/3 + 640, 512, ... % width/2,height/2 + 640, 102, ... % width/2,height*0.1 + 640, 614, ... % width/2,height*0.6 + 128, 341, ... % width*0.1,height*1/3 + 1152, 341); % width-width*0.1,height*1/3 % Validation target locations Eyelink('Command', 'validation_samples = 5'); Eyelink('Command', 'validation_sequence = 0,1,2,3,4,5'); Eyelink('Command', 'validation_targets = %d,%d %d,%d %d,%d %d,%d %d,%d', ... - 640, 512, ... % width/2,height/2 - 640, 102, ... % width/2,height*0.1 - 640, 614, ... % width/2,height*0.6 - 128, 341, ... % width*0.1,height*1/3 - 1152, 341); % width-width*0.1,height*1/3 + 640, 512, ... % width/2,height/2 + 640, 102, ... % width/2,height*0.1 + 640, 614, ... % width/2,height*0.6 + 128, 341, ... % width*0.1,height*1/3 + 1152, 341); % width-width*0.1,height*1/3 end @@ -177,9 +177,9 @@ % Set the edf file path + name. edfFileName = fullfile( ... - cfg.dir.outputSubject, ... - cfg.fileName.modality, ... - cfg.fileName.eyetracker); + cfg.dir.outputSubject, ... + cfg.fileName.modality, ... + cfg.fileName.eyetracker); Eyelink('Command', 'set_idle_mode'); @@ -203,8 +203,8 @@ if exist(edfFileName, 'file') == 2 fprintf('Data file ''%s'' can be found in ''%s''\n', ... - cfg.fileName.eyetracker, ... - fullfile(cfg.dir.outputSubject, 'eyetracker')); + cfg.fileName.eyetracker, ... + fullfile(cfg.dir.outputSubject, 'eyetracker')); end diff --git a/src/fixation/drawFixation.m b/src/fixation/drawFixation.m index e9897ae..04b987b 100644 --- a/src/fixation/drawFixation.m +++ b/src/fixation/drawFixation.m @@ -7,29 +7,29 @@ function drawFixation(cfg) smooth = 1; Screen('DrawLines', ... - cfg.screen.win, ... - cfg.fixation.allCoords, ... - cfg.fixation.lineWidthPix, ... - cfg.fixation.color, ... - [cfg.screen.center(1) cfg.screen.center(2)], smooth); + cfg.screen.win, ... + cfg.fixation.allCoords, ... + cfg.fixation.lineWidthPix, ... + cfg.fixation.color, ... + [cfg.screen.center(1) cfg.screen.center(2)], smooth); case 'dot' % Draw gap around fixation of 20% the size Screen('FillOval', ... - cfg.screen.win, ... - cfg.color.background, ... - CenterRect( ... - [0 0 repmat(1.2 * cfg.fixation.widthPix, 1, 2)], ... - cfg.screen.winRect)); + cfg.screen.win, ... + cfg.color.background, ... + CenterRect( ... + [0 0 repmat(1.2 * cfg.fixation.widthPix, 1, 2)], ... + cfg.screen.winRect)); % Draw fixation Screen('FillOval', ... - cfg.screen.win, ... - cfg.color.foreground, ... - CenterRect( ... - [0 0 repmat(cfg.fixation.widthPix, 1, 2)], ... - cfg.screen.winRect)); + cfg.screen.win, ... + cfg.color.foreground, ... + CenterRect( ... + [0 0 repmat(cfg.fixation.widthPix, 1, 2)], ... + cfg.screen.winRect)); case 'bestFixation' @@ -39,30 +39,30 @@ function drawFixation(cfg) % Draw gap around fixation of 20% the size Screen('FillOval', ... - cfg.screen.win, ... - cfg.color.background, ... - CenterRect( ... - [0 0 repmat(1.5 * cfg.fixation.widthPix, 1, 2)], ... - cfg.screen.winRect)); + cfg.screen.win, ... + cfg.color.background, ... + CenterRect( ... + [0 0 repmat(1.5 * cfg.fixation.widthPix, 1, 2)], ... + cfg.screen.winRect)); Screen('FillOval', ... - cfg.screen.win, ... - cfg.color.black, ... - cfg.fixation.outerOval, ... - cfg.fixation.widthPix); + cfg.screen.win, ... + cfg.color.black, ... + cfg.fixation.outerOval, ... + cfg.fixation.widthPix); Screen('DrawLines', ... - cfg.screen.win, ... - cfg.fixation.allCoords, ... - cfg.fixation.widthPix / 3, ... - cfg.color.white, ... - [cfg.screen.center(1) cfg.screen.center(2)]); + cfg.screen.win, ... + cfg.fixation.allCoords, ... + cfg.fixation.widthPix / 3, ... + cfg.color.white, ... + [cfg.screen.center(1) cfg.screen.center(2)]); Screen('FillOval', ... - cfg.screen.win, ... - cfg.color.black, ... - cfg.fixation.innerOval, ... - cfg.fixation.widthPix / 3); + cfg.screen.win, ... + cfg.color.black, ... + cfg.fixation.innerOval, ... + cfg.fixation.widthPix / 3); end diff --git a/src/fixation/initFixation.m b/src/fixation/initFixation.m index f5ed33e..876a997 100644 --- a/src/fixation/initFixation.m +++ b/src/fixation/initFixation.m @@ -42,16 +42,16 @@ % DOI 10.1016/j.visres.2012.10.012 cfg.fixation.outerOval = [ ... - cfg.screen.center(1) - cfg.fixation.widthPix / 2, ... - cfg.screen.center(2) - cfg.fixation.widthPix / 2, ... - cfg.screen.center(1) + cfg.fixation.widthPix / 2, ... - cfg.screen.center(2) + cfg.fixation.widthPix / 2]; + cfg.screen.center(1) - cfg.fixation.widthPix / 2, ... + cfg.screen.center(2) - cfg.fixation.widthPix / 2, ... + cfg.screen.center(1) + cfg.fixation.widthPix / 2, ... + cfg.screen.center(2) + cfg.fixation.widthPix / 2]; cfg.fixation.innerOval = [ ... - cfg.screen.center(1) - cfg.fixation.widthPix / 6, ... - cfg.screen.center(2) - cfg.fixation.widthPix / 6, ... - cfg.screen.center(1) + cfg.fixation.widthPix / 6, ... - cfg.screen.center(2) + cfg.fixation.widthPix / 6]; + cfg.screen.center(1) - cfg.fixation.widthPix / 6, ... + cfg.screen.center(2) - cfg.fixation.widthPix / 6, ... + cfg.screen.center(1) + cfg.fixation.widthPix / 6, ... + cfg.screen.center(2) + cfg.fixation.widthPix / 6]; end diff --git a/src/getExperimentEnd.m b/src/getExperimentEnd.m index 19d0ea7..a2389f4 100644 --- a/src/getExperimentEnd.m +++ b/src/getExperimentEnd.m @@ -8,8 +8,8 @@ ExpmtDurMin = floor(ExpmtDur / 60); ExpmtDurSec = mod(ExpmtDur, 60); disp(['Experiment lasted ', ... - num2str(ExpmtDurMin), ' minutes ', ... - num2str(ExpmtDurSec), ' seconds']); + num2str(ExpmtDurMin), ' minutes ', ... + num2str(ExpmtDurSec), ' seconds']); disp(' '); end diff --git a/src/initPTB.m b/src/initPTB.m index fc38635..919e6d1 100644 --- a/src/initPTB.m +++ b/src/initPTB.m @@ -57,7 +57,7 @@ if isfield(cfg.screen, 'resolution') [newWidth, newHeight, newHz] = deal(cfg.screen.resolution{:}); cfg.screen.oldResolution = Screen('Resolution', cfg.screen.idx, ... - newWidth, newHeight, newHz); + newWidth, newHeight, newHz); end cfg = openWindow(cfg); @@ -107,9 +107,9 @@ [~, versionStruc] = PsychtoolboxVersion; cfg.software.version = sprintf('%i.%i.%i', ... - versionStruc.major, ... - versionStruc.minor, ... - versionStruc.point); + versionStruc.major, ... + versionStruc.minor, ... + versionStruc.point); runsOn = 'Matlab - '; if IsOctave @@ -173,9 +173,9 @@ function initDebug(cfg) % find output device to use idx = find( ... - audioDev.NrInputChannels == cfg.audio.inputChannels && ... - audioDev.NrOutputChannels == cfg.audio.channels && ... - ~cellfun(@isempty, regexp({audioDev.HostAudioAPIName}, cfg.audio.deviceName))); + audioDev.NrInputChannels == cfg.audio.inputChannels && ... + audioDev.NrOutputChannels == cfg.audio.channels && ... + ~cellfun(@isempty, regexp({audioDev.HostAudioAPIName}, cfg.audio.deviceName))); % save device ID cfg.audio.devIdx = audioDev(idx).DeviceIndex; @@ -186,11 +186,11 @@ function initDebug(cfg) end cfg.audio.pahandle = PsychPortAudio('Open', ... - cfg.audio.devIdx, ... - cfg.audio.playbackMode, ... - cfg.audio.requestedLatency, ... - cfg.audio.fs, ... - cfg.audio.channels); + cfg.audio.devIdx, ... + cfg.audio.playbackMode, ... + cfg.audio.requestedLatency, ... + cfg.audio.fs, ... + cfg.audio.channels); % set initial PTB volume for safety (participants can adjust this manually % at the begining of the experiment) @@ -209,7 +209,7 @@ function initDebug(cfg) if cfg.debug.smallWin [cfg.screen.win, cfg.screen.winRect] = ... Screen('OpenWindow', cfg.screen.idx, cfg.color.background, ... - [0, 0, 480, 270]); + [0, 0, 480, 270]); else [cfg.screen.win, cfg.screen.winRect] = ... Screen('OpenWindow', cfg.screen.idx, cfg.color.background); diff --git a/src/keyboard/checkAbortGetResponse.m b/src/keyboard/checkAbortGetResponse.m index e19cfea..8bbf513 100644 --- a/src/keyboard/checkAbortGetResponse.m +++ b/src/keyboard/checkAbortGetResponse.m @@ -2,8 +2,8 @@ function checkAbortGetResponse(responseEvents, cfg) if isfield(responseEvents, 'keyName') > 0 && ... any( ... - strcmpi({responseEvents(:).keyName}, cfg.keyboard.escapeKey) ... - ) + strcmpi({responseEvents(:).keyName}, cfg.keyboard.escapeKey) ... + ) errorAbortGetReponse; end end diff --git a/src/keyboard/getResponse.m b/src/keyboard/getResponse.m index 0f103dd..8070949 100644 --- a/src/keyboard/getResponse.m +++ b/src/keyboard/getResponse.m @@ -60,8 +60,8 @@ if nargin < 3 cfg = struct( ... - 'keyboard', struct('responseKey', {}) ... - ); + 'keyboard', struct('responseKey', {}) ... + ); end if nargin < 4 diff --git a/src/readAndFilterLogfile.m b/src/readAndFilterLogfile.m index 4592f30..e9df981 100644 --- a/src/readAndFilterLogfile.m +++ b/src/readAndFilterLogfile.m @@ -26,8 +26,8 @@ tsvFile = varargin{1}; elseif isstruct(varargin{1}) tsvFile = fullfile(varargin{1}.dir.outputSubject, ... - varargin{1}.fileName.modality, ... - varargin{1}.fileName.events); + varargin{1}.fileName.modality, ... + varargin{1}.fileName.events); end % Check if the file exists diff --git a/src/screen/standByScreen.m b/src/screen/standByScreen.m index 8df6d23..3293dba 100644 --- a/src/screen/standByScreen.m +++ b/src/screen/standByScreen.m @@ -3,8 +3,8 @@ function standByScreen(cfg) Screen('FillRect', cfg.screen.win, cfg.color.background, cfg.screen.winRect); DrawFormattedText(cfg.screen.win, ... - cfg.task.instruction, ... - 'center', 'center', cfg.text.color); + cfg.task.instruction, ... + 'center', 'center', cfg.text.color); Screen('Flip', cfg.screen.win); diff --git a/src/utils/checkPtbVersion.m b/src/utils/checkPtbVersion.m index 7a42ab7..c1de8fe 100644 --- a/src/utils/checkPtbVersion.m +++ b/src/utils/checkPtbVersion.m @@ -15,22 +15,22 @@ function checkPtbVersion() [~, versionStruc] = PsychtoolboxVersion; fprintf(' Using PTB %i.%i.%i\n', ... - versionStruc.major, ... - versionStruc.minor, ... - versionStruc.point); + versionStruc.major, ... + versionStruc.minor, ... + versionStruc.point); if any([ ... versionStruc.major < PTB.major, ... versionStruc.minor < PTB.minor, ... versionStruc.point < PTB.point ... - ]) + ]) str = sprintf('%s %i.%i.%i %s.\n%s', ... - 'The current version PTB version is not', ... - PTB.major, ... - PTB.minor, ... - PTB.point, ... - 'In case of problems (e.g json file related) consider updating.'); + 'The current version PTB version is not', ... + PTB.major, ... + PTB.minor, ... + PTB.point, ... + 'In case of problems (e.g json file related) consider updating.'); warning(str); %#ok<*SPWRN> end catch diff --git a/src/utils/degToPix.m b/src/utils/degToPix.m index 90d6072..9780d02 100644 --- a/src/utils/degToPix.m +++ b/src/utils/degToPix.m @@ -8,6 +8,6 @@ deg = getfield(structure, fieldName); %#ok structure = setfield(structure, [fieldName 'Pix'], ... - floor(deg * cfg.screen.ppd)); %#ok + floor(deg * cfg.screen.ppd)); %#ok end diff --git a/src/utils/printCreditsCppPtb.m b/src/utils/printCreditsCppPtb.m index e39e0ac..77035ba 100644 --- a/src/utils/printCreditsCppPtb.m +++ b/src/utils/printCreditsCppPtb.m @@ -2,15 +2,15 @@ function printCreditsCppPtb() try version = fileread(fullfile(fileparts(mfilename('fullpath')), ... - '..', '..', 'version.txt')); + '..', '..', 'version.txt')); catch version = 'v1.0.0'; end contributors = { ... - 'Rémi Gau', ... - 'Marco Barilari', ... - 'Ceren Battal'}; + 'Rémi Gau', ... + 'Marco Barilari', ... + 'Ceren Battal'}; % DOI_URL = 'https://doi.org/10.5281/zenodo.3554331.'; diff --git a/src/utils/setDefaults.m b/src/utils/setDefaults.m index 8f34929..b7ad426 100644 --- a/src/utils/setDefaults.m +++ b/src/utils/setDefaults.m @@ -16,16 +16,16 @@ structure.(names{i}) = ... setDefaults( ... - structure.(names{i}), ... - fieldsToSet.(names{i}) ... - ); + structure.(names{i}), ... + fieldsToSet.(names{i}) ... + ); else structure = setFieldToIfNotPresent( ... - structure, ... - names{i}, ... - thisField); + structure, ... + names{i}, ... + thisField); end end diff --git a/src/waitFor.m b/src/waitFor.m index 0657f53..29d8e99 100644 --- a/src/waitFor.m +++ b/src/waitFor.m @@ -5,10 +5,10 @@ function waitFor(cfg, timeToWait) if cfg.pacedByTriggers.do waitForTrigger( ... - cfg, ... - cfg.keyboard.responseBox, ... - cfg.pacedByTriggers.quietMode, ... - timeToWait); + cfg, ... + cfg.keyboard.responseBox, ... + cfg.pacedByTriggers.quietMode, ... + timeToWait); else WaitSecs(timeToWait); end diff --git a/src/waitForTrigger.m b/src/waitForTrigger.m index 0a936ff..a93b4c4 100644 --- a/src/waitForTrigger.m +++ b/src/waitForTrigger.m @@ -35,7 +35,7 @@ function waitForTrigger(varargin) if strcmpi(cfg.testingDevice, 'mri') msg = ['Experiment starting in ', ... - num2str(nbTriggersToWait - triggerCounter), '...']; + num2str(nbTriggersToWait - triggerCounter), '...']; talkToMe(cfg, msg, quietMode); @@ -105,7 +105,7 @@ function talkToMe(cfg, msg, quietMode) if isfield(cfg, 'screen') && isfield(cfg.screen, 'win') DrawFormattedText(cfg.screen.win, msg, ... - 'center', 'center', cfg.text.color); + 'center', 'center', cfg.text.color); Screen('Flip', cfg.screen.win); diff --git a/tests/test_checkAbortGetResponse.m b/tests/test_checkAbortGetResponse.m index b50c0ab..bbce61c 100644 --- a/tests/test_checkAbortGetResponse.m +++ b/tests/test_checkAbortGetResponse.m @@ -15,6 +15,6 @@ function test_checkAbortGetResponseBasic() cfg.keyboard.escapeKey = 'ESCAPE'; assertExceptionThrown(@()checkAbortGetResponse(responseEvents, cfg), ... - 'getResponse:abortRequested'); + 'getResponse:abortRequested'); end diff --git a/tests/test_computeFOV.m b/tests/test_computeFOV.m index cc54b09..a151e42 100644 --- a/tests/test_computeFOV.m +++ b/tests/test_computeFOV.m @@ -24,6 +24,6 @@ function test_computeFOVError() cfg.screen.monitorDistance = 1.2; % error as distance is most likely in meter assertExceptionThrown(@()computeFOV(cfg), ... - 'computeFOV:wrongDistanceToScreen'); + 'computeFOV:wrongDistanceToScreen'); end diff --git a/tests/test_computeRadialMotionDirection.m b/tests/test_computeRadialMotionDirection.m index f568037..38083d6 100644 --- a/tests/test_computeRadialMotionDirection.m +++ b/tests/test_computeRadialMotionDirection.m @@ -17,22 +17,22 @@ function test_computeRadialMotionDirectionBasic() dots.direction = 666; dots.positions = [ - 100, 100 / 2; ... % middle of right side - 100, 100; ... % top right corner - 100 / 2, 100; ... - 0, 100 / 2; ... - 0, 0; ... - 100 / 2, 0]; + 100, 100 / 2; ... % middle of right side + 100, 100; ... % top right corner + 100 / 2, 100; ... + 0, 100 / 2; ... + 0, 0; ... + 100 / 2, 0]; % direction = computeRadialMotionDirection(cfg, positions, direction); expectedDirection = [ - 0; ... right - 45; ... up-right - 90; ... up - 180; ... left - -135; ... down left - -90]; % down + 0; ... right + 45; ... up-right + 90; ... up + 180; ... left + -135; ... down left + -90]; % down %% test diff --git a/tests/test_reseedDots.m b/tests/test_reseedDots.m index 189e0bd..6f3da93 100644 --- a/tests/test_reseedDots.m +++ b/tests/test_reseedDots.m @@ -25,28 +25,28 @@ function test_reseedDotsBasic() dots.isSignal = true(5, 1); dots.positions = [ ... - 49, 1; % OK - 490, 2043; % out of frame - -104, 392; % out of frame - 492, 402; % OK - 1000, 1000; % on the fixation cross - ]; + 49, 1 % OK + 490, 2043 % out of frame + -104, 392 % out of frame + 492, 402 % OK + 1000, 1000 % on the fixation cross + ]; dots.time = [ ... - 6; ... OK - 4; ... OK - 56; ... OK - 300; ... % exceeded its life time - 50]; % OK + 6; ... OK + 4; ... OK + 56; ... OK + 300; ... % exceeded its life time + 50]; % OK dots = reseedDots(dots, cfg); reseeded = [ ... - 6; - 1; - 1; - 1; - 1]; + 6 + 1 + 1 + 1 + 1]; assertEqual(reseeded, dots.time); diff --git a/tests/test_setDefaultsPTB.m b/tests/test_setDefaultsPTB.m index ae61b66..1256f30 100644 --- a/tests/test_setDefaultsPTB.m +++ b/tests/test_setDefaultsPTB.m @@ -43,14 +43,14 @@ function test_setDefaultsPtbAudio() % test data expectedCfg = returnExpectedCFG(); expectedCfg.audio = struct( ... - 'do', true, ... - 'fs', 44800, ... - 'channels', 2, ... - 'initVolume', 1, ... - 'requestedLatency', 3, ... - 'repeat', 1, ... - 'startCue', 0, ... - 'waitForDevice', 1); + 'do', true, ... + 'fs', 44800, ... + 'channels', 2, ... + 'initVolume', 1, ... + 'requestedLatency', 3, ... + 'repeat', 1, ... + 'startCue', 0, ... + 'waitForDevice', 1); % test assertEqual(expectedCfg, cfg); @@ -60,11 +60,11 @@ function test_setDefaultsPtbAudio() function expectedCFG = returnExpectedCFG() expectedCFG = struct( ... - 'testingDevice', 'pc', ... - 'debug', struct('do', true, 'transpWin', true, 'smallWin', true), ... - 'color', struct( ... - 'background', [0 0 0]), ... - 'text', struct('font', 'Courier New', 'size', 18, 'style', 1)); + 'testingDevice', 'pc', ... + 'debug', struct('do', true, 'transpWin', true, 'smallWin', true), ... + 'color', struct( ... + 'background', [0 0 0]), ... + 'text', struct('font', 'Courier New', 'size', 18, 'style', 1)); expectedCFG.screen.monitorWidth = 42; expectedCFG.screen.monitorDistance = 134; From ca89652f063182d35d41e386f2ad3ee3bd1f3cdd Mon Sep 17 00:00:00 2001 From: marcobarilari Date: Wed, 23 Sep 2020 18:28:06 +0200 Subject: [PATCH 2/3] mh fix pt 2 --- src/aperture/apertureTexture.m | 18 +++++++++--------- src/fixation/drawFixation.m | 12 ++++++------ tests/test_setDefaultsPTB.m | 2 +- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/aperture/apertureTexture.m b/src/aperture/apertureTexture.m index 319fc84..ab75c50 100644 --- a/src/aperture/apertureTexture.m +++ b/src/aperture/apertureTexture.m @@ -116,7 +116,7 @@ Screen('FillOval', cfg.aperture.texture, TRANSPARENT, ... CenterRectOnPoint([0, 0, repmat(diameter, 1, 2)], ... - xCenter, yCenter)); + xCenter, yCenter)); case 'ring' @@ -127,13 +127,13 @@ Screen('FillOval', cfg.aperture.texture, TRANSPARENT, ... CenterRectOnPoint( ... - [0, 0, repmat(cfg.ring.outerRimPix, 1, 2)], ... - xCenter, yCenter)); + [0, 0, repmat(cfg.ring.outerRimPix, 1, 2)], ... + xCenter, yCenter)); Screen('FillOval', cfg.aperture.texture, [cfg.color.background 255], ... CenterRectOnPoint( ... - [0, 0, repmat(cfg.ring.innerRimPix, 1, 2)], ... - xCenter, yCenter)); + [0, 0, repmat(cfg.ring.innerRimPix, 1, 2)], ... + xCenter, yCenter)); case 'wedge' @@ -157,8 +157,8 @@ Screen('FillArc', cfg.aperture.texture, TRANSPARENT, ... CenterRect( ... - cfg.destinationRect, ... - cfg.screen.winRect), ... + cfg.destinationRect, ... + cfg.screen.winRect), ... thisEvent.angle, ... % start angle cfg.aperture.width); % arc angle @@ -170,8 +170,8 @@ % We let the stimulus through Screen('FillOval', cfg.aperture.texture, TRANSPARENT, ... CenterRect( ... - [0, 0, repmat(cfg.screen.winRect(4), 1, 2)], ... - cfg.screen.winRect)); + [0, 0, repmat(cfg.screen.winRect(4), 1, 2)], ... + cfg.screen.winRect)); % Then we add the position of the bar aperture diff --git a/src/fixation/drawFixation.m b/src/fixation/drawFixation.m index 04b987b..da0a928 100644 --- a/src/fixation/drawFixation.m +++ b/src/fixation/drawFixation.m @@ -20,16 +20,16 @@ function drawFixation(cfg) cfg.screen.win, ... cfg.color.background, ... CenterRect( ... - [0 0 repmat(1.2 * cfg.fixation.widthPix, 1, 2)], ... - cfg.screen.winRect)); + [0 0 repmat(1.2 * cfg.fixation.widthPix, 1, 2)], ... + cfg.screen.winRect)); % Draw fixation Screen('FillOval', ... cfg.screen.win, ... cfg.color.foreground, ... CenterRect( ... - [0 0 repmat(cfg.fixation.widthPix, 1, 2)], ... - cfg.screen.winRect)); + [0 0 repmat(cfg.fixation.widthPix, 1, 2)], ... + cfg.screen.winRect)); case 'bestFixation' @@ -42,8 +42,8 @@ function drawFixation(cfg) cfg.screen.win, ... cfg.color.background, ... CenterRect( ... - [0 0 repmat(1.5 * cfg.fixation.widthPix, 1, 2)], ... - cfg.screen.winRect)); + [0 0 repmat(1.5 * cfg.fixation.widthPix, 1, 2)], ... + cfg.screen.winRect)); Screen('FillOval', ... cfg.screen.win, ... diff --git a/tests/test_setDefaultsPTB.m b/tests/test_setDefaultsPTB.m index 1256f30..d42e292 100644 --- a/tests/test_setDefaultsPTB.m +++ b/tests/test_setDefaultsPTB.m @@ -63,7 +63,7 @@ function test_setDefaultsPtbAudio() 'testingDevice', 'pc', ... 'debug', struct('do', true, 'transpWin', true, 'smallWin', true), ... 'color', struct( ... - 'background', [0 0 0]), ... + 'background', [0 0 0]), ... 'text', struct('font', 'Courier New', 'size', 18, 'style', 1)); expectedCFG.screen.monitorWidth = 42; From a924e15da3ef4f39057f5a643ba35c58f0762a09 Mon Sep 17 00:00:00 2001 From: Remi Gau Date: Wed, 23 Sep 2020 19:06:45 +0200 Subject: [PATCH 3/3] finish making the miss_hit god happy --- src/aperture/apertureTexture.m | 3 ++- src/initPTB.m | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/aperture/apertureTexture.m b/src/aperture/apertureTexture.m index ab75c50..87a4f03 100644 --- a/src/aperture/apertureTexture.m +++ b/src/aperture/apertureTexture.m @@ -10,7 +10,8 @@ cfg = apertureInit(cfg); cfg.aperture.texture = Screen('MakeTexture', cfg.screen.win, ... - cfg.color.background(1) * ones(cfg.screen.winRect([3 3]))); + cfg.color.background(1) * ... + ones(cfg.screen.winRect([3 3]))); case 'make' diff --git a/src/initPTB.m b/src/initPTB.m index 919e6d1..a104d31 100644 --- a/src/initPTB.m +++ b/src/initPTB.m @@ -175,7 +175,8 @@ function initDebug(cfg) idx = find( ... audioDev.NrInputChannels == cfg.audio.inputChannels && ... audioDev.NrOutputChannels == cfg.audio.channels && ... - ~cellfun(@isempty, regexp({audioDev.HostAudioAPIName}, cfg.audio.deviceName))); + ~cellfun(@isempty, regexp({audioDev.HostAudioAPIName}, ... + cfg.audio.deviceName))); % save device ID cfg.audio.devIdx = audioDev(idx).DeviceIndex;