Skip to content

Commit 5d91747

Browse files
committed
update doc
1 parent 16c8a42 commit 5d91747

File tree

7 files changed

+55
-98
lines changed

7 files changed

+55
-98
lines changed

docs/functions-description.md

Lines changed: 0 additions & 68 deletions
This file was deleted.

docs/installation.md

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,22 @@
1414

1515
<!-- lint enable -->
1616

17+
## Use the CPP templates for PsychToolBox experiments
18+
19+
The easiest way to use this repository is to create a new repository by using
20+
the
21+
[template PTB experiment repository](https://github.com/cpp-lln-lab/template_PTB_experiment):
22+
this creates a new repository on your github account with all the basic folders,
23+
files and submodules (including CPP_BIDS) already set up. You only have to then
24+
clone the repository and you are good to go.
25+
1726
## Download with git
1827

1928
```bash
2029
cd fullpath_to_directory_where_to_install
2130

22-
# use git to download the code
23-
git clone https://github.com/cpp-lln-lab/CPP_BIDS.git
24-
25-
# move into the folder you have just created
26-
cd CPP_BIDS
27-
28-
# add the src folder to the matlab path and save the path
29-
matlab -nojvm -nosplash -r "addpath(fullfile(pwd, 'src')); savepath ();"
31+
# use git to download the code and the submodules
32+
git clone --recurse-submodules https://github.com/cpp-lln-lab/CPP_BIDS.git
3033
```
3134

3235
Then get the latest commit:
@@ -53,12 +56,6 @@ cd fullpath_to_directory_where_to_install
5356

5457
# use git to download the code
5558
git submodule add https://github.com/cpp-lln-lab/CPP_BIDS.git
56-
57-
# move into the folder you have just created
58-
cd CPP_BIDS
59-
60-
# add the src folder to the matlab path and save the path
61-
matlab -nojvm -nosplash -r "addpath(fullfile(pwd, 'src'))"
6259
```
6360

6461
To get the latest commit you then need to update the submodule with the
@@ -83,7 +80,7 @@ git clone https://github.com/user_name/myExperiment.git
8380
# go into the directory
8481
cd myExperiment
8582

86-
# initialize and get the content of the first level of submodules (e.g. CPP_PTB and CPP_BIDS)
83+
# initialize and get the content of the first level of submodules
8784
git submodule init
8885
git submodule update
8986

@@ -94,6 +91,8 @@ git submodule foreach --recursive 'git submodule update'
9491

9592
## Direct download
9693

94+
NOT RECOMMENDED.
95+
9796
Download the code. Unzip. And add to the matlab path.
9897

9998
Pick a specific version from

docs/source/function_description.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,21 @@ List of functions in the ``src`` folder.
1212
.. autofunction:: createDatasetDescription
1313
.. autofunction:: createFilename
1414
.. autofunction:: createJson
15+
16+
``createJson`` can be used to save in a
17+
human readable format the extra parameters that you used to run your experiment.
18+
This will most likely make the json file non-bids compliant but it can prove useful,
19+
to keep this information in your source dataset
20+
for when you write your methods sections 2 years later after running the experiment.
21+
This ensures that those are the exact parameters you used and you won't have
22+
to read them from the ``setParameters.m`` file and wonder
23+
if those might have been modified when running the experiment
24+
and you did not commit and tagged that change with git.
25+
26+
And for the love of the flying spaghetti monster do not save all your
27+
parameters in a `.mat` file: think of the case when you won't have Matlab or
28+
Octave installed on a computer (plus not everyone uses those).
29+
1530
.. autofunction:: readAndFilterLogfile
1631
.. autofunction:: saveEventsFile
1732
.. autofunction:: userInputs

docs/source/utilities.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@ List of functions in the ``utils`` folder.
88
.. automodule:: src.utils
99

1010
.. autofunction:: checkCppBidsDependencies
11+
.. autofunction:: checkInput
1112
.. autofunction:: createValidName
1213
.. autofunction:: getFullFilename
1314
.. autofunction:: initializeExtraColumns
1415
.. autofunction:: isPositiveInteger
16+
.. autofunction:: nanPadding
1517
.. autofunction:: printCreditsCppBids
1618
.. autofunction:: removeAllDateSuffix
1719
.. autofunction:: removeDateSuffix

src/createFilename.m

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,12 @@
33
function cfg = createFilename(cfg)
44
%
55
% It creates the BIDS compliant directories and fileNames for the behavioral output
6-
% for this subject / session / run using the information from cfg and expParameters.
7-
% Will also create the right fileName for the eyetracking data file. For the moment the date of
8-
% acquisition is appended to the fileName.
6+
% for this subject / session / run using the information from cfg.
7+
%
8+
% The folder tree will always include a session folder.
9+
%
10+
% Will also create the right fileName for the eyetracking data file.
11+
% For the moment the date of acquisition is appended to the fileName.
912
%
1013
% USAGE::
1114
%
@@ -20,7 +23,9 @@
2023
% participants.
2124
%
2225
% The behavior of this function depends on:
26+
%
2327
% - ``cfg.testingDevice``:
28+
%
2429
% + set to ``pc`` (dummy try) or ``beh`` can work for behavioral experiment.
2530
% + set on ``mri`` for fMRI experiment.
2631
% + set on ``eeg`` or ``ieeg`` can work for electro encephalography or intracranial eeg

src/createJson.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ function createJson(varargin)
44
%
55
% Creates the side car JSON file for a run.
66
%
7-
% For JSON sidecars for bold files, this will only contain the minimum BIDS
7+
% For JSON sidecars for bold files, this will only contain the minimum BIDS
88
% requirement and will likey be less complete than the info you could from
99
% a proper BIDS conversion.
1010
%

src/saveEventsFile.m

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
% [logFile] = saveEventsFile(action, cfg, logFile)
1010
%
1111
% :param action: Defines the operation to do. The different possibilities are
12-
% ``'init'``, ``'open'``, ``'open_stim'``, ``'save'`` or ``'close'``.
12+
% ``'init'``, ``'init_stim'``, ``'open'``, ``'save'`` or ``'close'``.
1313
% For more information on each case see below.
1414
% :type action: string
1515
% :param cfg: Configuration variable. See ``checkCFG()``.
@@ -31,15 +31,15 @@
3131
%
3232
% Actions:
3333
%
34-
% .. todo:
35-
% wait for updates on the API of this function to finish updating
36-
%
3734
% Example::
3835
%
39-
% logFile = saveEventsFile('init', [cfg], logFile)
40-
% logFile = saveEventsFile('open', [cfg], logFile)
41-
% logFile = saveEventsFile('open_stim', [cfg], logFile)
42-
% logFile = saveEventsFile('save', [cfg], logFile)
36+
% logFile = saveEventsFile('init', cfg, logFile)
37+
% logFile = saveEventsFile('init_stim', cfg, logFile)
38+
% logFile = saveEventsFile('open', cfg, logFile)
39+
% logFile = saveEventsFile('save', cfg, logFile)
40+
%
41+
% - ``'init'`` and ``'init_stim'`` are used for events and stimuli tsv files respectively.
42+
% This initializes the extra columns to be save.
4343
%
4444
% - ``'open'`` will create the file ID and return it in ``logFile.fileID`` using
4545
% the information in the ``cfg`` structure.
@@ -52,15 +52,19 @@
5252
% logFile = saveEventsFile('open', cfg, logFile);
5353
%
5454
% - ``'save'`` will save the data contained in logfile by using the file ID
55-
% ``logFile.fileID``; logfile must then contain:
55+
% ``logFile.fileID``.
56+
% If saving a stimulus file then the only the fields of ``logFile.extraColumns``
57+
% will be saved.
58+
% For regular _events.tsv files, then ``logFile`` must then contain:
5659
%
5760
% - logFile.onset
58-
% - logFile.trial_type
5961
% - logFile.duration
62+
%
63+
% Otherwise it will be skipped.
6064
%
6165
% Example::
6266
%
63-
% logFile = saveEventsFile('open', cfg, logFile);
67+
% logFile = saveEventsFile('save', cfg, logFile);
6468
%
6569
% - ``'close'`` closes the file with file ID ``logFile.fileID``.
6670
% If ``cfg.verbose`` is superior to ``1`` then this will tell you

0 commit comments

Comments
 (0)