Skip to content

Commit 7dfa413

Browse files
committed
mh autofix
1 parent 62e3bcf commit 7dfa413

File tree

7 files changed

+348
-369
lines changed

7 files changed

+348
-369
lines changed

audioLocTranslational.m

Lines changed: 44 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -23,32 +23,31 @@
2323
cfg = userInputs(cfg);
2424
cfg = createFilename(cfg);
2525

26-
2726
%% Experiment
2827

2928
% Safety loop: close the screen if code crashes
3029
try
31-
30+
3231
% % % REFACTOR THIS FUNCTION
3332
[cfg] = loadAudioFiles(cfg);
3433

3534
%% Init the experiment
3635
[cfg] = initPTB(cfg);
37-
36+
3837
% % Convert some values from degrees to pixels
3938
% cfg = deg2Pix('diameterAperture', cfg, cfg);
4039
% expParameters = deg2Pix('dotSize', expParameters, cfg);
41-
40+
4241
[el] = eyeTracker('Calibration', cfg);
43-
42+
4443
% % % REFACTOR THIS FUNCTION
4544
[cfg] = expDesign(cfg);
46-
45+
4746
% Prepare for the output logfiles with all
4847
logFile = saveEventsFile('open', cfg, [], ...
4948
'direction', 'speed', 'target', 'event', 'block');
5049

51-
% disp(cfg);
50+
% disp(cfg);
5251

5352
standByScreen(cfg);
5453

@@ -64,90 +63,89 @@
6463
getResponse('start', cfg.keyboard.responseBox);
6564

6665
WaitSecs(cfg.onsetDelay);
67-
66+
6867
%% For Each Block
69-
68+
7069
for iBlock = 1:cfg.numBlocks
71-
72-
fprintf('\n - Running Block %.0f \n',iBlock)
73-
70+
71+
fprintf('\n - Running Block %.0f \n', iBlock);
72+
7473
eyeTracker('StartRecording', cfg);
75-
74+
7675
% For each event in the block
7776
for iEvent = 1:cfg.numEventsPerBlock
78-
77+
7978
% Check for experiment abortion from operator
8079
checkAbort(cfg, cfg.keyboard.keyboard);
81-
80+
8281
% set direction, speed of that event and if it is a target
8382
thisEvent.trial_type = 'dummy';
84-
thisEvent.direction = cfg.designDirections(iBlock,iEvent);
85-
thisEvent.speed = cfg.designSpeeds(iBlock,iEvent);
86-
thisEvent.target = cfg.designFixationTargets(iBlock,iEvent);
87-
83+
thisEvent.direction = cfg.designDirections(iBlock, iEvent);
84+
thisEvent.speed = cfg.designSpeeds(iBlock, iEvent);
85+
thisEvent.target = cfg.designFixationTargets(iBlock, iEvent);
86+
8887
% play the sounds and collect onset and duration of the event
8988
[onset, duration] = doAudMot(cfg, thisEvent, cfg.audio.pahandle);
90-
89+
9190
thisEvent.event = iEvent;
9291
thisEvent.block = iBlock;
9392
thisEvent.duration = duration;
9493
thisEvent.onset = onset - cfg.experimentStart;
95-
94+
9695
% Save the events txt logfile
9796
% we save event by event so we clear this variable every loop
9897
thisEvent.fileID = logFile.fileID;
99-
98+
10099
saveEventsFile('save', cfg, thisEvent, ...
101100
'direction', 'speed', 'target', 'event', 'block');
102-
103-
clear thisEvent
104-
105-
101+
102+
clear thisEvent;
103+
106104
% collect the responses and appends to the event structure for
107105
% saving in the tsv file
108106
responseEvents = getResponse('check', cfg.keyboard.responseBox, cfg, ...
109107
getOnlyPress);
110-
108+
111109
triggerString = ['trigger'];
112110
saveResponsesAndTriggers(responseEvents, cfg, logFile, triggerString);
113-
111+
114112
% wait for the inter-stimulus interval
115113
WaitSecs(cfg.ISI);
116-
114+
117115
end
118-
116+
119117
eyeTracker('StopRecordings', cfg);
120-
118+
121119
WaitSecs(cfg.IBI);
122-
120+
123121
end
124-
122+
125123
% End of the run for the BOLD to go down
126124
WaitSecs(cfg.endDelay);
127-
125+
128126
% Close the logfiles
129127
saveEventsFile('close', cfg, logFile);
130-
128+
131129
getResponse('stop', cfg.keyboard.responseBox);
132130
getResponse('release', cfg.keyboard.responseBox);
133-
134-
totalExperimentTime = GetSecs-cfg.experimentStart;
135-
131+
132+
totalExperimentTime = GetSecs - cfg.experimentStart;
133+
136134
eyeTracker('Shutdown', cfg);
137-
135+
138136
% save the whole workspace
139-
matFile = fullfile(cfg.dir.output, strrep(cfg.fileName.events,'tsv', 'mat'));
137+
matFile = fullfile(cfg.dir.output, strrep(cfg.fileName.events, 'tsv', 'mat'));
140138
if IsOctave
141139
save(matFile, '-mat7-binary');
142140
else
143141
save(matFile, '-v7.3');
144142
end
145-
146-
cleanUp()
147-
143+
144+
cleanUp();
145+
148146
catch
149-
150-
cleanUp()
147+
148+
cleanUp();
151149
psychrethrow(psychlasterror);
152-
150+
153151
end

getDependencies.m

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
function getDependencies(action)
22

3-
if nargin<1
4-
action = '';
5-
end
3+
if nargin < 1
4+
action = '';
5+
end
66

7-
switch action
8-
case 'update'
9-
% install dependencies
10-
mpm install -i mpm-requirements.txt -f -c audio_motion_localizer
11-
end
7+
switch action
8+
case 'update'
9+
% install dependencies
10+
mpm install -i mpm-requirements.txt -f -c audio_motion_localizer;
11+
end
1212

13-
% adds them to the path
14-
mpm_folder = fileparts(which('mpm'));
15-
addpath(genpath(fullfile(mpm_folder, 'mpm-packages', 'mpm-collections', 'audio_motion_localizer')));
13+
% adds them to the path
14+
mpm_folder = fileparts(which('mpm'));
15+
addpath(genpath(fullfile(mpm_folder, 'mpm-packages', 'mpm-collections', 'audio_motion_localizer')));
1616

1717
end

miss_hit.cfg

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
line_length: 100
22
regex_function_name: "[a-z]+(([A-Z]){1}[A-Za-z]+)*"
33
suppress_rule: "copyright_notice"
4-
exclude_dir: "lib"
5-
exclude_dir: "Visual-loc_radial"
4+
exclude_dir: "lib"

setParameters.m

Lines changed: 21 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
function cfg = setParameters
2-
2+
33
% Initialize the parameters and general configuration variables
44
cfg = struct();
5-
5+
66
% by default the data will be stored in an output folder created where the
77
% setParamters.m file is
88
% change that if you want the data to be saved somewhere else
99
cfg.dir.output = fullfile( ...
1010
fileparts(mfilename('fullpath')), '..', ...
1111
'output');
12-
12+
1313
%% Debug mode settings
14-
14+
1515
cfg.debug.do = true; % To test the script out of the scanner, skip PTB sync
1616
cfg.debug.smallWin = false; % To test on a part of the screen, change to 1
1717
cfg.debug.transpWin = true; % To test with trasparent full size screen
18-
18+
1919
cfg.verbose = false;
20-
20+
2121
%% Engine parameters
2222

2323
cfg.testingDevice = 'pc';
@@ -31,26 +31,23 @@
3131

3232
% MRI settings
3333
cfg = setMRI(cfg);
34-
34+
3535
cfg.audio.channels = 2;
3636

37-
3837
%% Experiment Design
39-
cfg.names = {'static','motion'};
38+
cfg.names = {'static', 'motion'};
4039
cfg.possibleDirections = [-1 1]; % 1 motion , -1 static
41-
cfg.numBlocks = size(cfg.possibleDirections,2);
42-
cfg.numRepetitions = 1; %AT THE MOMENT IT IS NOT SET IN THE MAIN SCRIPT
43-
40+
cfg.numBlocks = size(cfg.possibleDirections, 2);
41+
cfg.numRepetitions = 1; % AT THE MOMENT IT IS NOT SET IN THE MAIN SCRIPT
4442

4543
%% Timing
46-
cfg.IBI = 0; %8;
44+
cfg.IBI = 0; % 8;
4745
cfg.ISI = 0.1; % Time between events in secs
4846
cfg.onsetDelay = 1; % Number of seconds before the motion stimuli are presented
4947
cfg.endDelay = 1; % Number of seconds after the end all the stimuli before ending the run
50-
51-
48+
5249
%% Auditory Stimulation
53-
50+
5451
% expParameters.experimentType = 'Gratings'; %Dots/Gratings % Visual modality is in RDKs %NOT USED IN THE MAIN SCIPT
5552
cfg.speedEvent = 8; % speed in visual angles
5653
cfg.numEventsPerBlock = 12; % Number of events per block (should not be changed)
@@ -76,18 +73,15 @@
7673
cfg.target.duration = 0.05; % In secs
7774

7875
cfg.extraColumns = {'direction', 'speed', 'target', 'event', 'block', 'keyName'};
79-
80-
81-
82-
76+
8377
end
8478

8579
function cfg = setKeyboards(cfg)
8680
cfg.keyboard.escapeKey = 'ESCAPE';
8781
cfg.keyboard.responseKey = {'space', 't'};
8882
cfg.keyboard.keyboard = [];
8983
cfg.keyboard.responseBox = [];
90-
84+
9185
if strcmpi(cfg.testingDevice, 'mri')
9286
cfg.keyboard.keyboard = [];
9387
cfg.keyboard.responseBox = [];
@@ -98,29 +92,28 @@
9892
% letter sent by the trigger to sync stimulation and volume acquisition
9993
cfg.mri.triggerKey = 't';
10094
cfg.mri.triggerNb = 4;
101-
95+
10296
cfg.mri.repetitionTime = 1.8;
103-
97+
10498
cfg.bids.MRI.Instructions = 'Detect the RED fixation cross';
10599
cfg.bids.MRI.TaskDescription = [];
106-
107-
end
108100

101+
end
109102

110103
function cfg = setMonitor(cfg)
111-
104+
112105
% Monitor parameters for PTB
113106
cfg.color.white = [255 255 255];
114107
cfg.color.black = [0 0 0];
115108
cfg.color.red = [255 0 0];
116109
cfg.color.grey = mean([cfg.color.black; cfg.color.white]);
117110
cfg.color.background = cfg.color.black;
118111
cfg.text.color = cfg.color.white;
119-
112+
120113
% Monitor parameters
121114
cfg.screen.monitorWidth = 50; % in cm
122115
cfg.screen.monitorDistance = 40; % distance from the screen in cm
123-
116+
124117
if strcmpi(cfg.testingDevice, 'mri')
125118
cfg.screen.monitorWidth = 50;
126119
cfg.screen.monitorDistance = 40;

0 commit comments

Comments
 (0)