Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

# CPP_PTB

<!-- lint disable -->

<!-- TOC -->

- [CPP_PTB](#cpp_ptb)
Expand All @@ -31,6 +33,8 @@

<!-- /TOC -->

<!-- lint enable -->

This is the Crossmodal Perception and Plasticity lab (CPP) PsychToolBox (PTB)
toolbox.

Expand All @@ -44,12 +48,16 @@ octave path.

For instructions see the following links:

<!-- lint disable -->

| Requirements | Used version |
| -------------------------------------------------------- | ------------ |
| [PsychToolBox](http://psychtoolbox.org/) | >=3.0.14 |
| [Matlab](https://www.mathworks.com/products/matlab.html) | >=2015b |
| or [Octave](https://www.gnu.org/software/octave/) | 4.? |

<!-- lint enable -->

Tested:

- matlab 2015b or octave 4.2.2 and PTB 3.0.14.
Expand Down Expand Up @@ -154,9 +162,12 @@ git submodule foreach --recursive 'git submodule update'

Download the code. Unzip. And add to the matlab path.

Pick a specific version from [here](https://github.com/cpp-lln-lab/CPP_PTB/releases).
Pick a specific version from
[here](https://github.com/cpp-lln-lab/CPP_PTB/releases).

Or take [the latest commit](https://github.com/cpp-lln-lab/CPP_PTB/archive/master.zip) - NOT RECOMMENDED.
Or take
[the latest commit](https://github.com/cpp-lln-lab/CPP_PTB/archive/master.zip) -
NOT RECOMMENDED.

### Add CPP_PTB globally to the matlab path

Expand All @@ -182,6 +193,7 @@ In practice, we use the following regular expression for function names:
> Regular expressions look scary but are SUPER useful to sort through filenames:
>
> - A quick [intro to regular expression](https://www.rexegg.com/)
>
> - And many websites allow you to "design and test" your regular expression:
> - [regexper](https://regexper.com/#%5Ba-z%5D%2B%28%28%5BA-Z%5D%7C%5B0-9%5D%29%7B1%7D%5Ba-z%5D%2B%29)
> - ...
Expand Down Expand Up @@ -210,8 +222,11 @@ Thanks goes to these wonderful people
([emoji key](https://allcontributors.org/docs/en/emoji-key)):

<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->

<!-- prettier-ignore-start -->

<!-- markdownlint-disable -->

<table>
<tr>
<td align="center"><a href="https://remi-gau.github.io/"><img src="https://avatars3.githubusercontent.com/u/6961185?v=4" width="100px;" alt=""/><br /><sub><b>Remi Gau</b></sub></a><br /><a href="https://github.com/cpp-lln-lab/CPP_PTB/commits?author=Remi-Gau" title="Code">💻</a> <a href="#design-Remi-Gau" title="Design">🎨</a> <a href="https://github.com/cpp-lln-lab/CPP_PTB/commits?author=Remi-Gau" title="Documentation">📖</a> <a href="https://github.com/cpp-lln-lab/CPP_PTB/issues?q=author%3ARemi-Gau" title="Bug reports">🐛</a> <a href="#userTesting-Remi-Gau" title="User Testing">📓</a> <a href="#ideas-Remi-Gau" title="Ideas, Planning, & Feedback">🤔</a> <a href="#infra-Remi-Gau" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a> <a href="#maintenance-Remi-Gau" title="Maintenance">🚧</a> <a href="https://github.com/cpp-lln-lab/CPP_PTB/commits?author=Remi-Gau" title="Tests">⚠️</a> <a href="#question-Remi-Gau" title="Answering Questions">💬</a></td>
Expand All @@ -221,6 +236,7 @@ Thanks goes to these wonderful people
</table>

<!-- markdownlint-enable -->

<!-- prettier-ignore-end -->

<!-- ALL-CONTRIBUTORS-LIST:END -->
Expand Down
44 changes: 24 additions & 20 deletions docs/00-index.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
# CPP_PTB documentation

<!-- vscode-markdown-toc -->
<!-- lint disable -->

- 1. [the CFG structure](#theCFGstructure)
- 2. [Setting up keyboards](#Settingupkeyboards)
- 3. [functions descriptions](#functionsdescriptions)
- 4. [Annexes](#Annexes)
- 4.1. [Experiment template [ WIP ]](#ExperimenttemplateWIP)
- 4.2. [devSandbox (stand-alone)](#devSandboxstand-alone)
<!-- TOC -->

<!-- vscode-markdown-toc-config
numbering=true
autoSave=true
/vscode-markdown-toc-config -->
<!-- /vscode-markdown-toc -->
- [CPP_PTB documentation](#cpp_ptb-documentation)
- [the CFG structure](#the-cfg-structure)
- [Setting up keyboards](#setting-up-keyboards)
- [functions descriptions](#functions-descriptions)
- [Annexes](#annexes)
- [Experiment template [ WIP ]](#experiment-template--wip-)
- [devSandbox (stand-alone)](#devsandbox-stand-alone)

## 1. <a name='theCFGstructure'></a>the CFG structure
<!-- /TOC -->

<!-- lint enable -->

## the CFG structure

The `cfg` structure is where most of the information about your experiment will
be defined.
Expand All @@ -29,6 +30,7 @@ filled after running `setDefaultsPTB.m` and `initPTB.m`.
that that do not "depend" on your system or that PTB cannot "know". For
example the width of the screen in cm or the dimensions of the fixation
cross you want to use...

- `initPTB.m` will fill in the fields that ARE system dependent like the
screen refresh rate, the reference of the window that PTB opened and where
to flip stimulus to.
Expand Down Expand Up @@ -160,7 +162,7 @@ cfg.software.version % psychtoolbox version
cfg.software.runsOn % matlab or octave and version number
```

## 2. <a name='Settingupkeyboards'></a>Setting up keyboards
## Setting up keyboards

To select a specific keyboard to be used by the experimenter or the participant,
you need to know the value assigned by PTB to each keyboard device.
Expand All @@ -180,6 +182,7 @@ response box in the `cfg` structure
- `cfg.keyboard.responseBox` would be the device number of the device used by
the participant to give his/her response: like the button box in the scanner
or a separate keyboard for a behavioral experiment

- `cfg.keyboard.keyboard` would be the device number of the keyboard on which
the experimenter will type or press the keys necessary to start or abort the
experiment.
Expand All @@ -190,32 +193,33 @@ same.
Using empty vectors (ie `[]`) or a negative value for those means that you will
let PTB find and use the default device.

## 3. <a name='functionsdescriptions'></a>functions descriptions
## functions descriptions

The main functions of the toolbox are described
[here](./10-functions-description.md).

## 4. <a name='Annexes'></a>Annexes
## Annexes

### 4.1. <a name='ExperimenttemplateWIP'></a>Experiment template [ WIP ]
### Experiment template {WIP}

Will be moved to a different repository

### 4.2. <a name='devSandboxstand-alone'></a>devSandbox (stand-alone)
### devSandbox (stand-alone)

Will be moved to a different repository
Will be moved to a different repository.

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.

Here, a tutorial from https://peterscarfe.com/contrastgratingdemo.html is
Here, [a tutorial](https://peterscarfe.com/contrastgratingdemo.html) is
provided for illustrative purpose (notice that some variable names are updated
to our code style). For your use, you will delete that part.

It is composed of two parts:

- a fixed structure that will initialize and close PTB in 'debug mode'
(`PsychDebugWindowConfiguration`, `SkipSyncTests`)

- the actual sandbox where to set your dynamic variables (the stimulation
parameters) and the 'playground' where to develop the stimulation code

Expand Down
22 changes: 22 additions & 0 deletions docs/10-functions-description.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# functions description

<!-- lint disable -->

<!-- TOC -->

- [functions description](#functions-description)
Expand Down Expand Up @@ -31,6 +33,8 @@

<!-- /TOC -->

<!-- lint enable -->

## General functions

### initPTB
Expand All @@ -41,17 +45,24 @@ It is pretty much necessary to use this function to set up the stage for using
any other functions of CPP_PTB.

- checks OS and PTB version

- set some defaults

- set the screen details
- the window opened takes the whole screen by default
- set in debug mode with window transparency if necessary
- can skip synch test if you ask for it (nicely)
- gets the flip interval
- computes the pixel per degree of visual angle

- set fixation cross details

- set font details

- keyboard

- hides cursor

- sound

### cleanUp
Expand Down Expand Up @@ -91,14 +102,20 @@ cpp-lln-lab/CPP_BIDS).
There are several actions to perform:

- Calibration: to initialize EyeLink and run calibration

- 'default calibration' (default) will run a calibration with 6 points

- 'custom calibration' (cfg.eyeTracker.defaultCalibration = 'false') will
run a calibration with 6 points but the experimenter can choose their
position on the screen

- StartRecording: to start eye movements recording

- Message: will add a tag (e.g. 'Block_n1') in the ET output file, the tag is
a string and it is input from `varargin`

- StopRecordings: to stop eye movements recornding

- Shutdown: to save the `.edf` file with BIDS compliant name, from
cpp-lln-lab/CPP_BIDS, in the output folder and shut the connection between
the stimulation computer and the EyeLink computer
Expand Down Expand Up @@ -157,16 +174,21 @@ In brief, there are several actions you can execute with this function.

- init: initialize the buffer for key presses on a given device (you can also
specify the keys of interest that should be listened to).

- start: start listening to the key presses (carefully insert into your
script - where do you want to start buffering the responses).

- check: till that point, it will check the buffer for all key presses. - It
only reports presses on the keys of interest mentioned at initialization. -
It **can** also check for presses on the escape key and abort if the escape
key is part of the keys of interest.

- flush: empties the buffer of key presses in case you want to discard any
previous key presses.

- stop: stops buffering key presses. You can still restart by calling "start"
again.

- release: closes the buffer for good.

### pressSpaceForme
Expand Down