Rigbox
Rigbox copied to clipboard
Add modulating plaid stimuli
Users have had issues with the order of textures in Signals. An example that uses inverted contrasts will hopefully make things clearer. Below is an example of a modulating plaid that takes into account the layer order:
%%% Create a modulating plaid
% Creates some sinewave gratings then modulates their contrasts, accounting
% for layer opacity.
%%%
% Setup playground
PsychDebugWindowConfiguration % Make our screen transparant
[t, setgraphic] = sig.test.playgroundPTB;
vs = StructRef; % This mimicks the fourth input arg of your expDef
% Create our stimuli
% This is a vertical sinewave grating
vertical = vis.grating(t, 'sine', 'none');
vertical.orientation = 0;
vertical.contrast = (sin(t) * 0.5) + 0.5;
% This is a horizontal sinewave grating
horizontal = vis.grating(t, 'sine', 'none');
horizontal.orientation = 90;
horizontal.contrast = sin(t);
[horizontal.show, vertical.show] = deal(true); % show both
vs.horizontal = horizontal;
vs.vertical = vertical;
% Render stimulus
setgraphic(vs)
% Programmatically press the play button
startstop = get(findobj(gcf, 'String', 'Play'), 'Callback');
startstop() % Play button callback
Modulating plaids turns out to be more difficult than expected. I've implemented a new stimulus function that generates the plaid as a single array, instead of overlaying two sines: plaid = grating1*newelem.contrast(1) + grating2'*newelem.contrast(2);
. This works better although the text must be re-loaded each time there's a change, which is less efficient.