| Reference | Downloads | Github

GratingStim.opacity same as Michelson contrast?


Hi all,

I’m using


for the creation of Gabor patches. To manipulate the visibility I use the opacity attribute. I’m interested in the equation behind this. Is opacity the same as Michelson contrast, which is defined as (I_max - I_min)/(I_max + I_min), where l_max and l_min refers to the maximum and minimum luminance (according to the Wikipedia link below)?

Thanks - rbr



Using the contrast parameter for the grating instead of its opacity parameter would make that a lot easier.

Why are you trying to set Michelson contrast using the opacity parameter?

If there is some reason that you need to use the opacity parameter, then you could find the Michelson contrast buy substituting the result of the opacity calculation into the Michelson equation.

- Allen

1 Like


Dear Allen,

Thank you for the quick reply.

I had no particular reason to use the “opacity” instead of “contrast” parameter. According to the Psychopy website “contrast” and “opacity” can both be used to control contrast and “opacity” seemed easier to control for me:

Set the contrast of the stimulus, i.e. scales how far the stimulus deviates from the middle grey. You can also use the stimulus opacity to control contrast, but that cannot be negative.

I guess I should clarify why I’m asking my question. I’m not particularly interested in Michelson contrast as such. I’m currently writing a paper about my experiment and would like to indicate what we did exactly to manipulate our Gabor patches. I thought that Michelson contrast and opacity may be the same.

Do you think there is a more straightforward way of expressing (using an equation) what opacity does exactly? I’d be happy to substitute opacity into the Michelson equation. Which parameters of the GratingStim would be required for that?

Thanks - rbr




Were you able to solve your question ? I too would like to know.