Drifting grating spatial frequency and mask

Hi Chris,

I have two questions about the drifting gratings in MWorks:

  • The spatial frequency of the gratings changes with the “width” parameter, but not with the “height” parameter. Could you explain why it changes this way?

  • I would like to add a parameter that allows me to change the mask of the grating at runtime. So instead of hardcoding mask=“Gaussian”, I would like something like mask=“gratingMask”, where I can set gratingMask to e.g. “rectangle” during the experiment.
    If I do it like this:

    , it gives an error. Can you tell me how to do this?

Thanks a lot,
Bram

Hi Bram,

The spatial frequency of the gratings changes with the “width” parameter, but not with the “height” parameter. Could you explain why it changes this way?

I must be misunderstanding your question, as it doesn’t appear to me that the width affects the spatial frequency at all (see attachment grating_width.xml). Can you send me an example experiment that demonstrates this behavior?

I would like to add a parameter that allows me to change the mask of the grating at runtime.

Currently, this is not possible, as the mask is fixed at experiment load time. One potential workaround is to use a list replicator to create multiple gratings that differ only in their mask, and then queue/dequeue them as needed. See attachment grating_masks.xml for a demonstration of this approach.

Cheers,
Chris

Attachments:

Hi Chris,

I should have been more precise, the spatial frequency changes when the aspect ratio of the rectangle < 1, so that the height > width. See the attached experiment. Note also that, although I use x_size=9 for dg1 and dg2, the x_size of dg1 is larger in reality.

Thanks for the list replicator suggestion, that’s a useful feature.

Let me know what you think.
Greetings,
Bram

Attachment: grating_width.xml (1.49 KB)

Hi Bram,

I should have been more precise, the spatial frequency changes when the aspect ratio of the rectangle < 1, so that the height > width.

Thanks for the clarification. I see the issue now, and it is definitely a bug. I’ll try to get a fix in to the nightly build soon.

Cheers,
Chris

Hi Bram,

The fix for the spatial frequency issue will be in tonight’s nightly build.

Cheers,
Chris

Thanks!

Hi Chris,

Just did some quick tests. Everything seems to work fine. I will do more tests in the upcoming weeks.

Thanks a lot,
Bram