Skip to content

Commit 97ef11e

Browse files
committed
fix part of sphynx warning in some functions
1 parent 2504eae commit 97ef11e

File tree

7 files changed

+91
-99
lines changed

7 files changed

+91
-99
lines changed

docs/source/function_description.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,13 @@ List of functions in the ``src`` folder.
2323

2424
List of functions in the ``src/aperture`` folder.
2525

26+
(to add saveAperture)
27+
2628
.. module:: src.aperture
2729

2830
.. autofunction:: apertureTexture
2931
.. autofunction:: eccenLogSpeed
3032
.. autofunction:: getApertureName
31-
.. autofunction:: saveAperture
3233
.. autofunction:: saveApertures
3334
.. autofunction:: smoothOval
3435
.. autofunction:: smoothRect

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/keyboard/checkAbort.m

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
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
%
9+
% USAGE:
10+
%
11+
% function checkAbort(cfg, deviceNumber)
12+
%
1113
% Maint script
1214
% try
1315
% % Your awesome experiment

src/keyboard/getResponse.m

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

5950
if nargin < 2 || isempty(deviceNumber)
6051
deviceNumber = -1;

src/readAndFilterLogfile.m

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,26 @@
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
%
65
% It will display in the command window the content of the `output.tsv' filtered by one element
7-
% of a target column.
6+
% 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
2021
%
21-
% OUTPUT:
22-
%
23-
% - outputFiltered: dataset with only the specified content, to see it in the command window
24-
% use display(outputFiltered)
22+
% :returns: - outputFiltered: dataset with only the specified content, to see it in the command
23+
% window use display(outputFiltered)
2524

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

src/utils/degToPix.m

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,21 @@
11
% (C) Copyright 2020 CPP_PTB developers
22

33
function structure = degToPix(fieldName, structure, cfg)
4-
% structure = degToPix(fieldName, structure, cfg)
4+
% For a given field value in degrees of visual angle in the structure, this computes its value
5+
% in pixel using the pixel per degree value of the cfg structure and returns a structure with
6+
% an additional field with Pix suffix holding that new value.
57
%
6-
% For a given field value in degrees of visual angle in the structure,
7-
% this computes its value in pixel using the pixel per degree value of the cfg structure
8-
% and returns a structure with an additional field with Pix suffix holding that new value.
8+
% USAGE:
99
%
10+
% structure = degToPix(fieldName, structure, cfg)
1011
%
11-
% USAGE:
12-
% ------
1312
% fixation.width = 2;
1413
% cfg.screen.ppd = 10;
1514
%
1615
% fixation = degToPix('width', fixation, cfg);
1716
%
18-
% Returns:
19-
% -------
17+
% - Returns:
2018
% fixation.widthPix = 20;
21-
%
2219

2320
deg = getfield(structure, fieldName); %#ok<GFLD>
2421

src/waitForTrigger.m

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

3-
function lastTriggerTimeStamp = waitForTrigger(varargin)
4-
% waitForTrigger(cfg, deviceNumber, quietMode, nbTriggersToWait)
5-
%
3+
function [lastTriggerTimeStamp] = waitForTrigger(varargin)
64
% Counts a certain number of triggers coming from the scanner before returning.
75
%
6+
% USAGE:
7+
%
8+
% [lastTriggerTimeStamp] = waitForTrigger([cfg,] [deviceNumber,] [quietMode,] [nbTriggersToWait])
9+
%
10+
% :param cfg:
11+
% :type cfg: struct
12+
% :param deviceNumber: device number of the keyboard or trigger box in MRI
13+
% :type deviceNumber: integer
14+
% :param quietMode: a boolean to make sure nothing is printed on the screen or the prompt
15+
% :type quietMode: boolean
16+
% :param nbTriggersToWait: number of triggers to wait
17+
% :type nbTriggersToWait: integer
18+
%
19+
% :returns: - :lastTriggerTimeStamp: (optional) it can be used as experimentStart timestamp (``cfg.experimentStart``)
20+
%
821
% If you are not using the quietMode, it flips and waits for half a TR before starting to
922
% check for the next trigger (unless this was the last trigger to wait for and in
1023
% this case it returns immediately).
1124
%
1225
% Will print the count down in the command line and on the PTB window if one is
1326
% opened.
1427
%
15-
% If the fMRI sequence RT is provided (cgf.MRI.repetitionTime) then it will wait
28+
% If the fMRI sequence RT is provided (``cgf.MRI.repetitionTime``) then it will wait
1629
% for half a RT before starting to check for next trigger, otherwise it will
1730
% wait 500 ms.
1831
%
1932
% When no deviceNumber is set then it will check the default device: this is
2033
% probably only useful in debug as you will want to make sure you get the
2134
% triggers coming from the scanner in a real case scenario.
22-
%
23-
% INPUTS
24-
% - varargin{1} = cfg
25-
%
26-
% - varargin{2} = deviceNumber
27-
%
28-
% - varargin{3} = quietMode: a boolean to make sure nothing is printed on the screen or
29-
% the prompt
30-
%
31-
% - nvarargin{4} = nbTriggersToWait
3235

3336
[cfg, nbTriggersToWait, deviceNumber, quietMode] = checkInputs(varargin);
3437

0 commit comments

Comments
 (0)