Drifting Grating stimulus: not odd-symmetric

The drifiting grating stimulus, when set to a sinusoidal grating, produces an even-symmetric stimulus. This means that its mean is in general not zero (or 127 for the usual case of a gray background).
Thus the onset of the stimulus produces a step in luminance.
The sinusoid should be generated so that the center of the stimulus is a zero-crossing (i.e. using cos()) rather than a peak (sin()).

Test case showing the effect attached.

Best
Mark

Attachment: test_show_evensymmetry.xml (1.83 KB)

Hi Mark,

I see what you’re saying. However, I’m uncomfortable with changing the default behavior of the stimulus, since other folks may expect/prefer the way it works now.

As an alternative, I propose adding a “phase_shift” parameter to the drifting grating, which shifts the phase of the grating by a specified number of degrees. It would default to zero, but you could set it to 90 to get the effect you want. Would that be acceptable?

Chris

From John M:

It is certainly better to have the phase controlled by a variable rather than fixed at a particular value (e.g., odd symmetric). However, a “phase_shift” parameter is only going to be confusing unless users can guess what the default phase is and where the phase applies, which they can’t.

The phase should refer to the center of the grating. That makes it easy to do odd or even symmetry, and avoids confusion over which corner the phase refers to (video, top-left or Cartesian, bottom-left). Because this is a drifting grating the phase can only refer to a static grating or the starting phase of a drifting grating. It should probably be called “initial_phase” or “starting_phase”.

John

I would add on to say -
I think 90 is a sensible default. I understand you’re reluctant to change default behavior on people. But I can’t think of any science advantage for having an even-symmetric grating, so I doubt you will be hurting anyone’s experiments.
Chris, you might want to poll Jim and Dave to see if they agree.
The disadvantage of a 0 default is that you might burn people in the future who don’t know about the parameter and end up leaving a luminance change from background in their grating.

end up leaving a luminance change from background in their grating.

nb: for certain science questions this is a very bad thing.
Most people who ask those questions should know this. But the cost-benefit comes out far in favor of 90, if I was making the decision.

The phase should refer to the center of the grating. That makes it easy to do odd or even symmetry, and avoids confusion over which corner the phase refers to (video, top-left or Cartesian, bottom-left). Because this is a drifting grating the phase can only refer to a static grating or the starting phase of a drifting grating. It should probably be called “initial_phase” or “starting_phase”.

That all makes sense. I’m happy with “initial_phase”.

I think 90 is a sensible default. I understand you’re reluctant to change default behavior on people. But I can’t think of any science advantage for having an even-symmetric grating, so I doubt you will be hurting anyone’s experiments.
Chris, you might want to poll Jim and Dave to see if they agree.

Fair enough. I’ll see what Jim and Dave have to say.

Chris

Well, now I feel stupid: I just noticed that the drifting grating already supports a parameter called “starting_phase” that does exactly what I’ve proposed. The default is zero, which we may want to change, but setting it to 90 seems to give the odd-symmetric grating that you want.

That’ll teach me to read the code more carefully!

Chris