# Starting phase

**URL:** <https://mworks.discourse.group/t/starting-phase/156>\
**Category:** Support\
**Created:** [October 5, 2020, 9:21pm UTC](https://mworks.discourse.group/t/starting-phase/156 "2020-10-05T21:21:40Z")\
**Posts on this page:** 6\
**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:** [October 5, 2020, 9:21pm UTC](https://mworks.discourse.group/t/starting-phase/156/1 "2020-10-05T21:21:40Z")

</div>

Hi Chris,

I’ve come upon another experimental problem with the definition of the starting phase being set at the edge rather than the center of the grating. In this condition, a plaid with components moving at 0 and 90 has a different alignment than a plaid with components moving at 180 and 270 (if you just present a static plaid that swaps directions, the pattern changes). Correcting for this will probably depend on both the spatial frequency and the diameter of the grating, but it’s not obvious to me how to deal with it. Do you know the best way to handle this for arbitrary pairs of gratings at 90 deg separation?

Either way, given that this has come up a couple times, it would be really nice to have an option to choose whether you want to use the edge vs center for determining the starting phase. Is this something that you could integrate in future versions?

Thanks,  
Lindsey.

---

<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:** [October 5, 2020, 9:34pm UTC](https://mworks.discourse.group/t/starting-phase/156/2 "2020-10-05T21:34:51Z")

</div>

Hi Lindsey,

> I’ve come upon another experimental problem with the definition of the starting phase being set at the edge rather than the center of the grating. In this condition, a plaid with components moving at 0 and 90 has a different alignment than a plaid with components moving at 180 and 270 (if you just present a static plaid that swaps directions, the pattern changes). Correcting for this will probably depend on both the spatial frequency and the diameter of the grating, but it’s not obvious to me how to deal with it. Do you know the best way to handle this for arbitrary pairs of gratings at 90 deg separation?

The [starting phase correction](https://mworks.tenderapp.com/discussions/questions/2111#comment_48650139) that I suggested already depends on both the spatial frequency and the diameter. When I add this correction to both gratings in the [plaid example](https://mworks.tenderapp.com/discussions/questions/2111-layering-stimuli/page/1#comment_48118758) I sent you, set the grating speeds to zero, and add code to switch between 0/90 and 180/270, I get a static dot pattern. (See the attached example.)

If I misunderstood the scenario you’re describing, can you send me an example that demonstrates the issue?

> Either way, given that this has come up a couple times, it would be really nice to have an option to choose whether you want to use the edge vs center for determining the starting phase. Is this something that you could integrate in future versions?

Yes, definitely. I will try to get that in the nightly build soon.

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:** [October 5, 2020, 9:34pm UTC](https://mworks.discourse.group/t/starting-phase/156/3 "2020-10-05T21:34:51Z")

</div>

Attachment: [plaid\_stimulus\_shift\_180.mwel.zip](https://mworks.discourse.group/uploads/short-url/uKZ5jTRd1MjVIES6X2Tvswnl7p6.zip) (1.99 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:** [October 5, 2020, 9:40pm UTC](https://mworks.discourse.group/t/starting-phase/156/4 "2020-10-05T21:40:32Z")

</div>

Hi Chris,  
Oops- I didn’t realize that the correction that you had sent me before  
would solve this as well- but of course.  
I had just tested it using the old example code that you had sent before  
and hadn’t added the correction to it (or to any of my other experiments  
using plaids).  
I’ll do that now (and check to make sure it works in my hands)- thanks!  
Lindsey.

---

<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 12, 2020, 2:47pm UTC](https://mworks.discourse.group/t/starting-phase/156/5 "2020-11-12T14:47:17Z")

</div>

Hi Lindsey,

As of the current MWorks [nightly build](https://mworks.github.io/downloads/), the drifting grating stimulus has a new parameter, [central\_starting\_phase](https://mworks.github.io/documentation/latest/components/drifting_grating_stimulus.html#central-starting-phase), which specifies the starting phase at the _center_ of the grating. It’s meant as a replacement for (and is mutually exclusive with) the old [starting\_phase](https://mworks.github.io/documentation/latest/components/drifting_grating_stimulus.html#starting-phase) parameter.

When central\_starting\_phase is provided, the phase at any point in time is computed the same as before, but it’s taken to be relative to the grating’s center. This is true for the values of `current_phase` included in the grating’s announcement data, too.

If your grating definition omits both central\_starting\_phase and starting\_phase, the grating behaves as if starting\_phase were set to zero. (This is to preserve the behavior of existing experiments.) Because of this, I recommend that you always specify central\_starting\_phase when creating gratings.

If you have any questions, please let me know.

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, 7:14pm UTC](https://mworks.discourse.group/t/starting-phase/156/6 "2022-07-19T19:14:39Z")

</div>


