Skip to content

Commit ad6a44e

Browse files
Merge pull request #141 from marcobarilari/marco_sphinx-docs
Sphynx doc pt.2 (fix warnings)
2 parents 92d9136 + 7dd40a0 commit ad6a44e

File tree

12 files changed

+267
-113
lines changed

12 files changed

+267
-113
lines changed

docs/source/function_description.rst

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Function description
2-
====================
2+
********************
33

44
The functions of our pipeline
55

@@ -21,20 +21,27 @@ List of functions in the ``src`` folder.
2121

2222
----
2323

24+
Aperture
25+
========
26+
2427
List of functions in the ``src/aperture`` folder.
2528

29+
(to add saveAperture)
30+
2631
.. module:: src.aperture
2732

2833
.. autofunction:: apertureTexture
2934
.. autofunction:: eccenLogSpeed
3035
.. autofunction:: getApertureName
31-
.. autofunction:: saveAperture
3236
.. autofunction:: saveApertures
3337
.. autofunction:: smoothOval
3438
.. autofunction:: smoothRect
3539

3640
----
3741

42+
Dot
43+
===
44+
3845
List of functions in the ``src/dot`` folder.
3946

4047
.. module:: src.dot
@@ -53,6 +60,9 @@ List of functions in the ``src/dot`` folder.
5360

5461
----
5562

63+
Errors
64+
======
65+
5666
List of functions in the ``src/errors`` folder.
5767

5868
.. module:: src.errors
@@ -64,6 +74,9 @@ List of functions in the ``src/errors`` folder.
6474

6575
----
6676

77+
Fixation
78+
========
79+
6780
List of functions in the ``src/fixation`` folder.
6881

6982
.. module:: src.fixation
@@ -73,6 +86,9 @@ List of functions in the ``src/fixation`` folder.
7386

7487
----
7588

89+
Keyboard
90+
========
91+
7692
List of functions in the ``src/keyboard`` folder.
7793

7894
.. module:: src.keyboard
@@ -86,6 +102,9 @@ List of functions in the ``src/keyboard`` folder.
86102

87103
----
88104

105+
Randomization
106+
=============
107+
89108
List of functions in the ``src/randomization`` folder.
90109

91110
.. module:: src.randomization
@@ -96,6 +115,9 @@ List of functions in the ``src/randomization`` folder.
96115

97116
----
98117

118+
Screen
119+
======
120+
99121
List of functions in the ``src/screen`` folder.
100122

101123
.. module:: src.screen
@@ -105,6 +127,9 @@ List of functions in the ``src/screen`` folder.
105127

106128
----
107129

130+
Utilities
131+
=========
132+
108133
List of functions in the ``src/utils`` folder.
109134

110135
(to add makeGif)

src/dot/initDots.m

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@
2020
% dots.isSignal : signal dots (1) and those are noise dots (0)
2121
% dots.directionAllDots
2222
% dots.lifeTime : in frames
23-
% dots.speeds : [ndots, 2] ; horizontal and vertical speed ; in pixels per
24-
% frame
23+
% dots.speeds : [ndots, 2] ; horizontal and vertical speed ; in pixels per frame
2524
% dots.speedPixPerFrame
2625

2726
dots.direction = thisEvent.direction(1);

src/eyeTracker.m

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,37 @@
11
% (C) Copyright 2020 CPP_PTB developers
22

33
function [el, cfg] = eyeTracker(input, cfg, varargin)
4-
% [el] = eyeTracker(input, cfg, varargin)
54
%
65
% Wrapper function that deals with all the necessery actions to implement
7-
% Eye Tracker recording with eyelink.
6+
% Eye Tracker recording with eyelink.
87
%
9-
% INPUT
8+
% USAGE:
109
%
11-
% - action: Defines what we want the function to do
12-
% - Calibration: to initialize EyeLink and run calibration
13-
% -- 'default calibration' (default) will run a calibration with 6 points
14-
% -- 'custom calibration' (cfg.eyeTracker.defaultCalibration = 'false') will run a
15-
% calibration with 6 points but the experimenter can choose their position on the screen
16-
% - StartRecording: to start eye movements recording
17-
% - Message: will add a tag (e.g. 'Block_n1') in the ET output file, the tag is a string and it
18-
% is input from `varargin`
19-
% - StopRecordings: to stop eye movements recornding
20-
% - Shutdown: to save the `.edf` file with BIDS compliant name, from cpp-lln-lab/CPP_BIDS, in
21-
% the output folder and shut the connection between the stimulation computer and the EyeLink
22-
% computer
10+
% function [el, cfg] = eyeTracker(input, cfg, [message])
2311
%
24-
% OUTPUT
12+
% :param input: Defines what we want the function to do
13+
% :type input: string
14+
% :param cfg: structure that stores any info regarding the experiment
15+
% :type cfg: struct
16+
% :param message: optional argument to pass in when you want to tag the output in a specific
17+
% moment of the experiment (for example ``Experiment-start``)
18+
% :type message: string
2519
%
26-
% `el` is a structure where are stored EyeLink setup variables
20+
% :returns: - :el: (struct) stores info related to the Eye Tracker
21+
% - :cfg: (struct)
22+
%
23+
% - ``Calibration`` to initialize EyeLink and run calibration
24+
% - ``default calibration`` (default) will run a calibration with 6 points
25+
% - ``custom calibration`` (``cfg.eyeTracker.defaultCalibration = 'false'``) will run
26+
% a calibration with 6 points but the experimenter can choose their position
27+
% on the screen
28+
% - ``StartRecording``: to start eye movements recording
29+
% - ``Message``: will add a tag (e.g. ``Block_n1``) in the ET output file, the tag is a
30+
% string and it is input from `varargin`
31+
% - ``StopRecordings``: to stop eye movements recording
32+
% - ``Shutdown``: to save the ``.edf`` file with BIDS compliant name, from
33+
% cpp-lln-lab/CPP_BIDS, in the output folder and shut the connection between the
34+
% stimulation computer and the EyeLink computer
2735

2836
if ~cfg.eyeTracker.do
2937

src/keyboard/checkAbort.m

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,37 @@
11
% (C) Copyright 2020 CPP_PTB developers
22

33
function checkAbort(cfg, deviceNumber)
4-
% checkAbort(cfg, deviceNumber)
54
%
6-
% Check for experiment abortion from operator
7-
% When no deviceNumber is set then it will check the default device
8-
% When an abort key s detected this will set a global variable and throw a
5+
% Check for experiment abortion from operator. When no deviceNumber is set then it will check
6+
% the default device. When an abort key is detected this will set a global variable and throw a
97
% specific error that can then be catched.
108
%
11-
% Maint script
12-
% try
13-
% % Your awesome experiment
14-
% catch ME % when something goes wrong
15-
% switch ME.identifier
9+
% USAGE::
10+
%
11+
% checkAbort(cfg, deviceNumber)
12+
%
13+
% Examples::
14+
%
15+
% try
16+
%
17+
% % Your awesome experiment
18+
%
19+
% catch ME % when something goes wrong
20+
%
21+
% switch ME.identifier
22+
%
1623
% case 'checkAbort:abortRequested'
17-
% % stuff to do when an abort is requested (save data...)
24+
%
25+
% % stuff to do when an abort is requested (save data...)
26+
%
1827
% otherwise
19-
% % stuff to do otherwise
20-
% rethrow(ME) % display the error
21-
% end
22-
% end
28+
%
29+
% % stuff to do otherwise
30+
% rethrow(ME) % display the error
31+
%
32+
% end
33+
% end
34+
%
2335

2436
if nargin < 1 || isempty(cfg)
2537
error('I need at least one input.');

src/keyboard/getResponse.m

Lines changed: 45 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,68 @@
11
% (C) Copyright 2020 CPP_PTB developers
22

33
function responseEvents = getResponse(action, deviceNumber, cfg, getOnlyPress)
4-
% responseEvents = getResponse(action, deviceNumber, cfg, getOnlyPress)
54
%
6-
% Wrapper function to use KbQueue
5+
% Wrapper function to use KbQueue. The queue will be listening to key presses
6+
% on a keyboard device:
7+
% ``cfg.keyboard.responseBox`` or ``cfg.keyboard.keyboard`` are 2 main examples.
8+
% When no ``deviceNumber`` is set then it will listen to the default device.
9+
% Check the ``CPP_getResponseDemo`` for a quick script on how to use it.
710
%
8-
% The queue will be listening to key presses on a keyboard device:
9-
% cfg.keyboard.responseBox or cfg.keyboard.keyboard are 2 main examples.
11+
% USAGE::
1012
%
11-
% When no deviceNumber is set then it will listen to the default device.
13+
% responseEvents = getResponse(action, deviceNumber, cfg, getOnlyPress)
1214
%
13-
% Check the CPP_getResponseDemo for a quick script on how to use it.
15+
% :param action: Defines what we want the function to do
16+
% :param deviceNumber: device number of the keyboard or trigger box in MRI
17+
% :type deviceNumber: integer
18+
% :param cfg:
19+
% :param getOnlyPress: if set to true the function will only return the key presses and will not
20+
% return when the keys were released (default=true). See the section on
21+
% `Returns` below for more info
1422
%
23+
% :returns:
1524
%
16-
% INPUT
25+
% - :responseEvents: returns all the keypresses and return them
26+
% as a structure with field names that make it easier
27+
% to save the output of in a BIDS format
1728
%
18-
% - action: Defines what we want the function to do
19-
% - init: to initialise the queue
20-
% - start: to start listening to keypresses
21-
% - check: checks all the key presses events since 'start', or since last
22-
% 'check' or 'flush' (whichever was the most recent)
23-
% -- can check for demand to abort if the escapeKey is listed in the
24-
% Keys of interest.
25-
% -- can only check for demands to abort when getResponse('check') is called:
26-
% so there will be a delay between the key press and the experiment stopping
27-
% -- abort errors send specific signals that allow the catch to get
28-
% them and allows us to "close" nicely
29-
% - flush: empties the queue of events in case you want to restart from a clean
30-
% queue
31-
% - stop: stops listening to key presses
29+
% - ``responseEvents.onset`` this is an absolute value and you should substract
30+
% the "experiment start time" to get a value relative to when the experiment was started.
3231
%
33-
% - getOnlyPress: if set to true the function will only return the key presses and
34-
% will not return when the keys were released (default=true)
35-
% See the section on OUTPUT below for more info
32+
% - ``responseEvents.trial_type = response``
3633
%
34+
% - ``responseEvents.duration = 0``
3735
%
36+
% - ``responseEvents.keyName`` the name of the key pressed
3837
%
39-
% OUTPUT
38+
% - ``responseEvents(iEvent,1).pressed`` if
4039
%
41-
% responseEvents: returns all the keypresses and return them as a structure
42-
% with field names that make it easier to save the output of in a BIDS
43-
% format
40+
% - ``pressed == 1`` --> the key was pressed
41+
% - ``pressed == 0`` --> the key was released
4442
%
45-
% responseEvents.onset : this is an absolute value and you should
46-
% substract the "experiment start time" to get a value relative to when the
47-
% experiment was started.
43+
% ---
4844
%
49-
% responseEvents.trial_type = 'response';
45+
% ``action`` options:
5046
%
51-
% responseEvents.duration = 0;
47+
% - ``init`` to initialise the queue
5248
%
53-
% responseEvents.keyName : the name of the key pressed
49+
% - ``start`` to start listening to keypresses
50+
%
51+
% - ``check`` checks all the key presses events since 'start', or since last 'check'
52+
% or 'flush' (whichever was the most recent)
53+
%
54+
% - can check for demand to abort if the ``escapeKey`` is listed in the Keys of interest
55+
%
56+
% - can only check for demands to abort when ``getResponse('check')`` is called
57+
% so there will be a delay between the key press and the experiment stopping
58+
%
59+
% - abort errors send specific signals that allow the catch to get them and allows us
60+
% to "close" nicely
61+
%
62+
% - ``flush`` empties the queue of events in case you want to restart from a clean queue
63+
%
64+
% - ``stop`` stops listening to key presses
5465
%
55-
% responseEvents(iEvent,1).pressed : if
56-
% pressed == 1 --> the key was pressed
57-
% pressed == 0 --> the key was released
5866

5967
if nargin < 2 || isempty(deviceNumber)
6068
deviceNumber = -1;

src/readAndFilterLogfile.m

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,30 @@
11
% (C) Copyright 2020 CPP_PTB developers
22

3-
function outputFiltered = readAndFilterLogfile(columnName, filterBy, varargin)
4-
% outputFiltered = readOutputFilter(filterHeader, filterContent, varargin)
3+
function [outputFiltered] = readAndFilterLogfile(columnName, filterBy, varargin)
54
%
6-
% It will display in the command window the content of the `output.tsv' filtered by one element
7-
% of a target column.
5+
% It will display in the command window the content of the `output.tsv` filtered
6+
% by one element of a target column. Dependecies: bids_matlab (from CPP_BIDS)
87
%
9-
% DEPENDENCIES:
10-
% - bids_matlab (from CPP_BIDS)
8+
% USAGE:
119
%
12-
% INPUT:
10+
% [outputFiltered] = readOutputFilter(filterHeader, filterContent, varargin)
1311
%
14-
% - columnName: string, the header of the column where the content of insterest is stored
15-
% (e.g., for 'trigger' will be 'trial type')
16-
% - filterBy: string, the content of the column you want to filter out. It can take just
17-
% part of the content name (e.g., you want to display the triggers and you have
18-
% 'trigger_motion' and 'trigger_static', 'trigger' as input will do)
19-
% - varargin: either cfg (to display the last run output) or the file path as string
12+
% :param columnName: the header of the column where the content of insterest is stored
13+
% (e.g., for 'trigger' will be 'trial type')
14+
% :type columnName: string
15+
% :param filterBy: the content of the column you want to filter out. It can take just
16+
% part of the content name (for example, you want to display the triggers and
17+
% you have ``trigger_motion`` and ``trigger_static``, ``trigger`` as input
18+
% will do)
19+
% :type filterBy: string
20+
% :param varargin: either ``cfg`` (to display the last run output) or the file path as string
21+
%
22+
% :returns:
23+
%
24+
% - :outputFiltered: dataset with only the specified content to see it in the
25+
% command window use display(outputFiltered)
2026
%
21-
% OUTPUT:
2227
%
23-
% - outputFiltered: dataset with only the specified content, to see it in the command window
24-
% use display(outputFiltered)
2528

2629
% Checke if input is cfg or the file path
2730
if ischar(varargin{1})

src/templates/templateFunction.m

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
% (C) Copyright 2020 CPP_PTB developers
2+
3+
function [argout1, argout2] = templateFunction(argin1, argin2, argin3)
4+
%
5+
% Short description of what the function does goes here.
6+
%
7+
% USAGE::
8+
%
9+
% [argout1, argout2] = templateFunction(argin1, [argin2 == default,] [argin3])
10+
%
11+
% :param argin1: (dimension) obligatory argument. Lorem ipsum dolor sit amet,
12+
% consectetur adipiscing elit. Ut congue nec est ac lacinia.
13+
% :type argin1: type
14+
% :param argin2: optional argument and its default value. And some of the
15+
% options can be shown in litteral like ``this`` or ``that``.
16+
% :type argin2: string
17+
% :param argin3: (dimension) optional argument
18+
%
19+
% :returns: - :argout1: (type) (dimension)
20+
% - :argout2: (type) (dimension)
21+
%
22+
% .. todo:
23+
%
24+
% - item 1
25+
% - item 2
26+
27+
% The code goes below
28+
29+
end

0 commit comments

Comments
 (0)