Skip to content

Commit 32cd843

Browse files
committed
add introduction
1 parent 4109c3b commit 32cd843

File tree

1 file changed

+32
-9
lines changed

1 file changed

+32
-9
lines changed

devSandbox.m

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,33 @@
11
function devSandbox
22

3+
% This script is a stand-alone function that can be useful as a sandbox to
4+
% develop the PTB audio/visual stimulation of your experiment. No input/output
5+
% recquired.
6+
%
7+
% Here, a tutorial from https://peterscarfe.com/contrastgratingdemo.html is
8+
% provided for illustrative purpose (notice that some vars' name are updated
9+
% to our code style).
10+
%
11+
% It is composed of two parts:
12+
% - a fixed structure that will initialize and close PTB in 'debug mode'
13+
% (`PsychDebugWindowConfiguration`, `SkipSyncTests`)
14+
% - the actual sandbox where to set your dynamic vars (the stimualtion
15+
% parameters) and the 'playground' where to develop the stimulation code
16+
%
17+
% When you are happy with it, ideally you will move the vars in `setParameters.m`
18+
% and the stimulation code in a separate function in `my-experiment-folder/subfun`.
19+
% The code style and vars name is the same used in `cpp-lln-lab/CPP_PTB`
20+
% github repo, therefore it should be easy to move everything in your experiment
21+
% scripts (see the template that is annexed in `cpp-lln-lab/CPP_PTB`)
22+
23+
324
cfg = struct;
425

526
cfg.backgroundColor = [ 127 127 127 ];
627

728
cfg = devSandbox_initPTB(cfg);
829

9-
30+
%%
1031
% -------------------------------------------------------------------------
1132
% -------------------------- SET YOUR VARS HERE ---------------------------
1233
% -------------------------------------------------------------------------
@@ -35,9 +56,11 @@
3556
waitframes = 1;
3657

3758
% -------------------------------------------------------------------------
59+
%%
3860

3961
try
40-
62+
63+
%%
4164
% -------------------------------------------------------------------------
4265
% ------------------------------ PLAYGROUND -------------------------------
4366
% -------------------------------------------------------------------------
@@ -60,7 +83,7 @@
6083

6184
% Make a two layer mask filled with the background colour
6285
mask = ones(1, numel(x), 2) * grey;
63-
86+
6487
% Place the grating in the 'alpha' channel of the mask
6588
mask(:, :, 2)= grating .* contrast;
6689

@@ -123,17 +146,17 @@
123146
end
124147

125148

126-
149+
127150
% -------------------------------------------------------------------------
128-
151+
%%
129152

130153
devSandbox_cleanUp
131-
154+
132155
catch
133-
156+
134157
devSandbox_cleanUp
135158
psychrethrow(psychlasterror);
136-
159+
137160
end
138161

139162

@@ -156,7 +179,7 @@
156179
cfg.screenNumber = max(cfg.screens);
157180

158181
% Open an on screen window
159-
[cfg.window, cfg.windowRect] = PsychImaging('OpenWindow', cfg.screenNumber, cfg.backgroundColor);
182+
[cfg.window, cfg.windowRect] = Screen('OpenWindow', cfg.screenNumber, cfg.backgroundColor);
160183

161184
% Get the size of the on screen window
162185
[cfg.screenXpixels, cfg.screenYpixels] = Screen('WindowSize', cfg.window);

0 commit comments

Comments
 (0)