# Drifting Grating Mask Question

**URL:** <https://mworks.discourse.group/t/drifting-grating-mask-question/371>\
**Category:** Support\
**Created:** [November 7, 2017, 1:10pm UTC](https://mworks.discourse.group/t/drifting-grating-mask-question/371 "2017-11-07T13:10:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![cstawarz](https://yyz1.discourse-cdn.com/flex031/user_avatar/mworks.discourse.group/cstawarz/32/3_2.png) [@cstawarz](https://mworks.discourse.group/u/cstawarz)\
**Post date:** [November 7, 2017, 1:10pm UTC](https://mworks.discourse.group/t/drifting-grating-mask-question/371/1 "2017-11-07T13:10:53Z")

</div>

Hi Chris,

I’m new to MWorks and I hope you can help me with generating a particular stimulus.

I want to make circular gabor stimuli (sinusoid enveloped by a gaussian). I tried using the drifting grating stimuli with a gaussian mask but it doesn’t look like a gaussian, it is a rectangle. Using a circular mask resulted in a shape that I want, but with a sharp edge between the stimuli and the background. I also tried to use a smaller SD but then it is difficult to know what the true size of the stimulus is and the stimulus looks elongated instead of circular. Is there a way to make a circular grating stimulus with a gaussian mask and no sharp edge between the grating and the background? From my understanding, this is what people in vision science regularly use.

Sorry if my question is not clear enough.

Thank you  
Tenri

---

<div class="post-metadata">

**Author:** ![cstawarz](https://yyz1.discourse-cdn.com/flex031/user_avatar/mworks.discourse.group/cstawarz/32/3_2.png) [@cstawarz](https://mworks.discourse.group/u/cstawarz)\
**Post date:** [November 7, 2017, 1:10pm UTC](https://mworks.discourse.group/t/drifting-grating-mask-question/371/2 "2017-11-07T13:10:53Z")

</div>

Attachment: [gabor\_patch.jpg](https://mworks.discourse.group/uploads/short-url/w9dzB42ev3UFXfnODwDvU2APs15.jpeg) (26.6 KB)

---

<div class="post-metadata">

**Author:** ![cstawarz](https://yyz1.discourse-cdn.com/flex031/user_avatar/mworks.discourse.group/cstawarz/32/3_2.png) [@cstawarz](https://mworks.discourse.group/u/cstawarz)\
**Post date:** [November 8, 2017, 3:21pm UTC](https://mworks.discourse.group/t/drifting-grating-mask-question/371/3 "2017-11-08T15:21:37Z")

</div>

Hi Tenri,

Until very recently, MWorks’ drifting grating always included a normalization term that made the maximum amplitude of the Gaussian mask dependent on its standard deviation ([more info](https://mworks.discourse.group/discussions/problems/271#comment_43120119)). In recent [nightly builds](https://mworks.github.io/downloads/), the drifting grating has a new parameter, [normalized](https://mworks.github.io/documentation/0.8/components/drifting_grating_stimulus.html#normalized). If you set this parameter to `NO`, then the normalization term is omitted, and the maximum amplitude is always 1.

If you add `normalized="NO"` to your grating definition and run your experiment on a nightly build, I think you’ll find that the stimulus behaves as you expect.

Cheers,  
Chris

---

<div class="post-metadata">

**Author:** ![cstawarz](https://yyz1.discourse-cdn.com/flex031/user_avatar/mworks.discourse.group/cstawarz/32/3_2.png) [@cstawarz](https://mworks.discourse.group/u/cstawarz)\
**Post date:** [July 19, 2022, 9:51pm UTC](https://mworks.discourse.group/t/drifting-grating-mask-question/371/4 "2022-07-19T21:51:27Z")

</div>


