You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
| or [octave](https://www.gnu.org/software/octave/)| 4.? |
23
49
24
50
The exact version required for this to work but it is known to work with:
25
-
- matlab 2017a or octave 4.2.2 and PTB 3.0.16.
51
+
- matlab 2015b or octave 4.2.2 and PTB 3.0.14.
26
52
27
-
## Code guidestyle
53
+
## 2. <aname='Codeguidestyle'></a>Code guidestyle
28
54
29
55
We use the `camelCase` to more easily differentiates our functions from the ones from PTB that use a `PascalCase`.
30
56
We use the following regular expression for function names: `[a-z]+(([A-Z]|[0-9]){1}[a-z]+)*`.
31
57
32
58
We keep the McCabe complexity as reported by the [check_my_code function](https://github.com/Remi-Gau/check_my_code) below 15.
33
59
34
-
We use the [MISS_HIT linter](https://florianschanda.github.io/miss_hit/style_checker.html) to automatically fix some linting issues.
60
+
We use the [MISS_HIT linter](https://florianschanda.github.io/miss_hit/style_checker.html) to automatically fix some linting issues. The code style and quality is also checked during the continuous integration.
35
61
36
-
## How to install
62
+
## 3. <aname='Howtoinstall'></a>How to install
37
63
38
-
### Download with git
64
+
### 3.1. <aname='Downloadwithgit'></a>Download with git
39
65
40
66
```bash
41
67
cd fullpath_to_directory_where_to_install
@@ -59,7 +85,7 @@ To work with a specific version, create a branch at a specific version tag numbe
59
85
git checkout -b version1 v0.0.1
60
86
```
61
87
62
-
### Add as a submodule
88
+
### 3.2. <aname='Addasasubmodule'></a>Add as a submodule
63
89
64
90
Add it as a submodule in the repo you are working on.
Remember that updates to submodules need to be committed as well.
83
109
84
-
#### Example for submodule usage
110
+
#### 3.2.1. <aname='Exampleforsubmoduleusage'></a>Example for submodule usage
85
111
86
112
So say you want to clone a repo that has some nested submodules, then you would type this to get the content of all the submodules at once (here with my experiment repo):
pros: in principle, downloading the experiment you have the whole package plus the benefit to stay updated and use version control of this dependency. Can probably handle a use case in which one uses different version on different projects (e.g. older and newer projects).
110
-
cons: for pro users and not super clear how to use it at the moment. -->
<!-- Download a specific version and c/p it in a subfun folder
126
-
pros: the easiest solution to share the code and 'installing' it on the stimulation computer (usually not the one used to develop the code).
127
-
cons: extreme solution useful only at the very latest stage (i.e. one minute before acquiring your data); prone to be customized/modified (is it what we want?) -->
128
-
129
-
## Setting up keyboards
146
+
## 4. <aname='Settingupkeyboards'></a>Setting up keyboards
130
147
131
148
To select a specific keyboard to be used by the experimenter or the participant, you need to know
132
149
the value assigned by PTB to each keyboard device.
@@ -151,7 +168,11 @@ press the keys necessary to start or abort the experiment.
151
168
152
169
Using empty vectors (ie `[]`) or a negative value for those means that you will let PTB find and use the default device.
153
170
154
-
## Structure
171
+
## 5. <aname='Structure'></a>Structure
172
+
173
+
The `cfg` structure is where most of the information about your experiment will be defined.
174
+
175
+
Below we try to outline what it contains.
155
176
156
177
```matlab
157
178
@@ -209,101 +230,11 @@ cfg.mri.triggerNb
209
230
cfg.mri.triggerKey
210
231
```
211
232
212
-
## function details
213
-
214
-
215
-
### initPTB
216
-
217
-
This will initialize PsychToolBox
218
-
219
-
- screen
220
-
- the windon opened takes the whole screen by default
221
-
- set in debug mode with window transparency if necessary
222
-
- can skip synch test if you ask for it (nicely)
223
-
- gets the flip interval
224
-
- computes the pixel per degree of visual angle
225
-
- set font details
226
-
- keyboard
227
-
- sound
228
-
229
-
### testKeyboards
230
-
231
-
Checks that the keyboards asked for properly connected.
232
-
233
-
If no key is pressed on the correct keyboard after the timeOut time this exits with an error.
234
-
235
-
### cleanUp
236
-
237
-
A wrapper function to close all windows, ports, show mouse cursor, close keyboard queues
238
-
and give access back to the keyboards.
239
-
240
-
### getExperimentStart
241
-
242
-
Wrapper function that will show a fixation cross and collect a start timestamp in `cfg.experimentStart`
243
-
244
-
### getExperimentEnd
245
-
246
-
Wrapper function that will show a fixation cross and display in the console the whole experiment's duration in minutes and seconds
247
-
248
-
### getResponse
249
-
250
-
It is wrapper function to use `KbQueue` which is definitely what you should use to collect responses.
251
-
252
-
You can easily collect responses while running some other code at the same time.
253
-
254
-
It will only take responses from one device which can simply be the "main keyboard"
255
-
(the default device that PTB will find) or another keyboard connected to the computer
256
-
or the response box that the participant is using.
257
-
258
-
You can use it in a way so that it only takes responses from certain keys and ignore others (like
259
-
the triggers from an MRI scanner).
260
-
261
-
If you want to know more on how to use it check its help section and the `CPP_getResponseDemo.m`.
262
-
263
-
In brief, there are several actions you can execute with this function.
264
-
265
-
- init: initialize the buffer for key presses on a given device (you can also specify the keys of interest that should be listened to).
266
-
- start: start listening to the key presses (carefully insert into your script - where do you want to start buffering the responses).
267
-
- check: till that point, it will check the buffer for all key presses.
268
-
- It only reports presses on the keys of interest mentioned at initialization.
269
-
- It **can** also check for presses on the escape key and abort if the escape key is part of the keys of interest.
270
-
- flush: Empties the buffer of key presses in case you want to discard any previous key presses.
271
-
- stop: Stops buffering key presses. You can still restart by calling "start" again.
272
-
- release: Closes the buffer for good.
273
-
274
-
### deg2Pix
275
-
276
-
For a given field value in degrees of visual angle in the input `structure`,
277
-
this computes its value in pixel using the pixel per degree value of the `cfg` structure
278
-
and returns a structure with an additional field with Pix suffix holding that new value.
279
-
280
-
### drawFixationCross
281
-
282
-
Define the parameters of the fixation cross in `cfg` and `expParameters` and this does the rest.
283
-
284
-
### eyeTracker
285
-
286
-
This will handle the Eye Tracker (EyeLink set up) and can be called to initialize the connection and start the calibration, start/stop eye(s) movement recordings and save the `*.edf` file (named with BIDS specification from cpp-lln-lab/CPP_BIDS).
287
-
288
-
### pressSpace4me
289
-
290
-
Use that to stop your script and only restart when the space bar is pressed.
291
-
292
-
### standByScreen
293
-
294
-
It shows a basic one-page instruction stored in `cfg.task.instruction` and wait for `space` stroke.
295
-
296
-
### waitForTrigger
297
-
298
-
Counts a certain number of triggers coming from the mri/scanner before returning.
This script is a stand-alone function that can be useful as a sandbox to develop the PTB audio/visual stimulation of your experiment. No input/output required.
309
240
@@ -317,7 +248,7 @@ It is composed of two parts:
317
248
318
249
When you are happy with it, ideally you will move the vars in `setParameters.m` and the stimulation code in a separate function in `my-experiment-folder/subfun`. The code style and variable names are the same used in `cpp-lln-lab/CPP_PTB` github repo, therefore it should be easy to move everything in your experiment scripts (see the template that is annexed in `cpp-lln-lab/CPP_PTB`).
319
250
320
-
## Contributors ✨
251
+
## 7. <aname='Contributors'></a>Contributors ✨
321
252
322
253
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
0 commit comments