Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add modulating plaid stimuli #308

Open
k1o0 opened this issue Nov 11, 2020 · 1 comment
Open

Add modulating plaid stimuli #308

k1o0 opened this issue Nov 11, 2020 · 1 comment

Comments

@k1o0
Copy link
Contributor

k1o0 commented Nov 11, 2020

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
@k1o0
Copy link
Contributor Author

k1o0 commented Dec 14, 2020

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.

plaid.txt

@k1o0 k1o0 changed the title Add modulating plaid to docs Add modulating plaid stimuli Dec 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant