I was wrong. It is totally possible and not very difficult. See the attached example, which I believe implements what you're after.
Note that this is a distinct construction from the plaid you wanted previously. There's not a way to define a single pair of gratings that can sometimes combine, sometimes not. If you want both types of stimuli in the same experiment, you'll need to define two separate pairs of gratings.
on 15 Sep, 2020 04:23 PM
This seems to work well.
However, I'm having a strange problem where the phase of the two gratings
is not matched.
I set them both to have a starting phase of 0 (and confirmed in the output
that both were 0), but for some reason, they're out of phase. I even tried
setting them to have the same variable controlling the phase (see below for
stimulus definition), but they were still out of phase. This suggests that
there must be some deeper issue. Can you look into it?
The gratings are out of phase because the starting_phase parameter specifies the phase at the "starting" edge of the grating (e.g. the left edge when the direction is 0), rather than at the center of the grating. John Maunsell noted ages ago that this doesn't make much sense, but I didn't feel comfortable changing such a basic behavior after the stimulus had already been in use.
Fortunately, I think you can get the behavior you expect by adding a computed offset to the starting phase. To do this, change the definition of opaque_grating by replacing