11# functions description
22
3- <!-- vscode-markdown-toc -->
4-
5- - 1 . [ General functions] ( #Generalfunctions )
6- - 1.1. [ initPTB] ( #initPTB )
7- - 1.2. [ cleanUp] ( #cleanUp )
8- - 1.3. [ getExperimentStart] ( #getExperimentStart )
9- - 1.4. [ getExperimentEnd] ( #getExperimentEnd )
10- - 1.5. [ degToPix] ( #degToPix )
11- - 1.6. [ computeFOV] ( #computeFOV )
12- - 1.7. [ eyeTracker] ( #eyeTracker )
13- - 1.8. [ standByScreen] ( #standByScreen )
14- - 1.9. [ waitForTrigger] ( #waitForTrigger )
15- - 1.10. [ waitFor] ( #waitFor )
16- - 1.11. [ readAndFilterLogfile] ( #readAndFilterLogfile )
17- - 2 . [ Keyboard functions: response collection and aborting experiment] ( #Keyboardfunctions:responsecollectionandabortingexperiment )
18- - 2.1. [ testKeyboards] ( #testKeyboards )
19- - 2.2. [ getResponse] ( #getResponse )
20- - 2.3. [ pressSpaceForme] ( #pressSpaceForme )
21- - 3 . [ Fixations] ( #Fixations )
22- - 3.1. [ drawFixationCross] ( #drawFixationCross )
23- - 4 . [ Drawing dots] ( #Drawingdots )
24- - 5 . [ Drawing apertures] ( #Drawingapertures )
25- - 6 . [ Randomization] ( #Randomization )
26- - 6.1. [ shuffle] ( #shuffle )
27- - 6.2. [ setTargetPositionInSequence] ( #setTargetPositionInSequence )
28- - 6.3. [ repeatShuffleConditions] ( #repeatShuffleConditions )
29- - 6.4. [ setUpRand] ( #setUprand )
30-
31- <!-- vscode-markdown-toc-config
32- numbering=true
33- autoSave=true
34- /vscode-markdown-toc-config -->
35- <!-- /vscode-markdown-toc -->
36-
37- ## 1. <a name =' Generalfunctions ' ></a > General functions
38-
39- ### 1.1. <a name =' initPTB ' ></a >initPTB
3+ <!-- TOC -->
4+
5+ - [ functions description] ( #functions-description )
6+ - [ General functions] ( #general-functions )
7+ - [ initPTB] ( #initptb )
8+ - [ cleanUp] ( #cleanup )
9+ - [ getExperimentStart] ( #getexperimentstart )
10+ - [ getExperimentEnd] ( #getexperimentend )
11+ - [ degToPix] ( #degtopix )
12+ - [ computeFOV] ( #computefov )
13+ - [ eyeTracker] ( #eyetracker )
14+ - [ standByScreen] ( #standbyscreen )
15+ - [ waitForTrigger] ( #waitfortrigger )
16+ - [ waitFor] ( #waitfor )
17+ - [ readAndFilterLogfile] ( #readandfilterlogfile )
18+ - [ Keyboard functions: response collection and aborting experiment] ( #keyboard-functions-response-collection-and-aborting-experiment )
19+ - [ testKeyboards] ( #testkeyboards )
20+ - [ getResponse] ( #getresponse )
21+ - [ pressSpaceForme] ( #pressspaceforme )
22+ - [ checkAbort] ( #checkabort )
23+ - [ Fixations] ( #fixations )
24+ - [ drawFixationCross] ( #drawfixationcross )
25+ - [ Drawing dots] ( #drawing-dots )
26+ - [ Drawing apertures] ( #drawing-apertures )
27+ - [ Randomization] ( #randomization )
28+ - [ shuffle] ( #shuffle )
29+ - [ setTargetPositionInSequence] ( #settargetpositioninsequence )
30+ - [ repeatShuffleConditions] ( #repeatshuffleconditions )
31+
32+ <!-- /TOC -->
33+
34+ ## General functions
35+
36+ ### initPTB
4037
4138This will initialize PsychToolBox.
4239
@@ -57,34 +54,34 @@ any other functions of CPP_PTB.
5754- hides cursor
5855- sound
5956
60- ### 1.2. < a name = ' cleanUp ' ></ a > cleanUp
57+ ### cleanUp
6158
6259A wrapper function to close all windows, ports, show mouse cursor, close
6360keyboard queues and give you back access to the keyboards.
6461
65- ### 1.3. < a name = ' getExperimentStart ' ></ a > getExperimentStart
62+ ### getExperimentStart
6663
6764Wrapper function that will show a fixation cross and collect a start timestamp
6865in ` cfg.experimentStart `
6966
70- ### 1.4. < a name = ' getExperimentEnd ' ></ a > getExperimentEnd
67+ ### getExperimentEnd
7168
7269Wrapper function that will show a fixation cross and display in the console the
7370whole experiment's duration in minutes and seconds
7471
75- ### 1.5. < a name = ' degToPix ' ></ a > degToPix
72+ ### degToPix
7673
7774For a given field value in degrees of visual angle in the input ` structure ` ,
7875this computes its value in pixel using the pixel per degree value of the ` cfg `
7976structure and returns a structure with an additional field with Pix suffix
8077holding that new value.
8178
82- ### 1.6. < a name = ' computeFOV ' ></ a > computeFOV
79+ ### computeFOV
8380
8481Gives you the width of the field on view in degress of visual angle based on the
8582screen width and distance to the screen in cm (taken from the ` cfg ` )
8683
87- ### 1.7. < a name = ' eyeTracker ' ></ a > eyeTracker
84+ ### eyeTracker
8885
8986This will handle the Eye Tracker (EyeLink set up) and can be called to
9087initialize the connection and start the calibration, start/stop eye(s) movement
@@ -106,40 +103,40 @@ There are several actions to perform:
106103 cpp-lln-lab/CPP_BIDS, in the output folder and shut the connection between
107104 the stimulation computer and the EyeLink computer
108105
109- ### 1.8. < a name = ' standByScreen ' ></ a > standByScreen
106+ ### standByScreen
110107
111108It shows a basic one-page instruction stored in ` cfg.task.instruction ` and wait
112109for ` space ` stroke.
113110
114- ### 1.9. < a name = ' waitForTrigger ' ></ a > waitForTrigger
111+ ### waitForTrigger
115112
116113Counts a certain number of triggers coming from the mri/scanner before
117114returning. Requires number of triggers to wait for.
118115
119116This can also be used if you want to let the scanner pace the experiment and you
120117want to synch stimulus presentation to the scanner trigger.
121118
122- ### 1.10. < a name = ' waitFor ' ></ a > waitFor
119+ ### waitFor
123120
124121A generic function that you can use to for a certain amount of time or a number
125122of triggers
126123
127- ### 1.11. < a name = ' readAndFilterLogfile ' ></ a > readAndFilterLogfile
124+ ### readAndFilterLogfile
128125
129126Displays in the command window part of the ` *events.tsv ` file filtered by an
130127element (e.g. 'trigger'). It can take the last output produced (through ` cfg ` )
131128or any output BIDS compatible (through file path).
132129
133- ## 2. < a name = ' Keyboardfunctions:responsecollectionandabortingexperiment ' ></ a > Keyboard functions: response collection and aborting experiment
130+ ## Keyboard functions: response collection and aborting experiment
134131
135- ### 2.1. < a name = ' testKeyboards ' ></ a > testKeyboards
132+ ### testKeyboards
136133
137134Checks that the keyboards asked for are properly connected.
138135
139136If no key is pressed on the correct keyboard after the timeOut time this exits
140137with an error.
141138
142- ### 2.2. < a name = ' getResponse ' ></ a > getResponse
139+ ### getResponse
143140
144141It is wrapper function to use ` KbQueue ` which is definitely what you should use
145142to collect responses.
@@ -172,7 +169,7 @@ In brief, there are several actions you can execute with this function.
172169 again.
173170- release: closes the buffer for good.
174171
175- ### 2.3. < a name = ' pressSpaceForme ' ></ a > pressSpaceForme
172+ ### pressSpaceForme
176173
177174Use that to stop your script and only restart when the space bar is pressed.
178175
@@ -184,39 +181,39 @@ some set up before giving the green light.
184181A simple function that will quit your experiment if you press the key you have
185182defined in ` cfg.keyboard.escapeKey ` .
186183
187- ## 3. < a name = ' Fixations ' ></ a > Fixations
184+ ## Fixations
188185
189- ### 3.1. < a name = ' drawFixationCross ' ></ a > drawFixationCross
186+ ### drawFixationCross
190187
191188Define the parameters of the fixation cross in ` cfg ` and ` expParameters ` and
192189this does the rest.
193190
194- ## 4. < a name = ' Drawingdots ' ></ a > Drawing dots
191+ ## Drawing dots
195192
196- ## 5. < a name = ' Drawingapertures ' ></ a > Drawing apertures
193+ ## Drawing apertures
197194
198- ## 6. < a name = ' Randomization ' ></ a > Randomization
195+ ## Randomization
199196
200197Functions that can be used to create random stimuli sequences.
201198
202- ### 6.1. < a name = ' shuffle ' ></ a > shuffle
199+ ### shuffle
203200
204201Is just there to replace the Shuffle function from PTB in case it is not in the
205202path. Can be useful for testing or for continuous integration.
206203
207- ### 6.2. < a name = ' setTargetPositionInSequence ' ></ a > setTargetPositionInSequence
204+ ### setTargetPositionInSequence
208205
209206For a sequence of length ` seqLength ` where we want to insert ` nbTarget ` targets,
210207this will return ` nbTarget ` random position in that sequence and make sure that
211208they are not in consecutive positions.
212209
213- ### 6.3. < a name = ' repeatShuffleConditions ' ></ a > repeatShuffleConditions
210+ ### repeatShuffleConditions
214211
215212Given ` baseConditionVector ` , a vector of conditions (coded as numbers), this
216213will create a longer vector made of ` nbRepeats ` of this base vector and make
217214sure that a given condition is not repeated one after the other.
218215
219- ### 6.4. < a name = ' setUpRand ' ></ a > setUpRand
216+ ### 6.4. setUpRand
220217
221- Resets the seed of the random number generator. Will "adapt" depending on the matlab/octave version.
222- It is of great importance to do this before anything else!
218+ Set up the randomizers for uniform and normal distributions. It is of great
219+ importance to do this before anything else!
0 commit comments