# Use of virtual tangent screen in mworks 0.5.1

Dear developers,

I'm from Zoccolan Lab in SISSA.

I'm starting to use mworks for a simple electrophysiological
experiments with rats, where I need to show some gratings on the
screen.

I'm actually facing a problem with the implementation of the
virtual tangent screen: despite having set it on in the setup
variables, I actually see no change on the screen.

Moreover, I would like to know if there is some documentation
regarding the calculation mworks makes to set screen degrees from
the display size, it would be really helpful.

Thanks for your support!

Alessandro

Comments are currently closed for this discussion. You can start a new one.

# Keyboard shortcuts

### Generic

? | Show this help |
---|---|

ESC | Blurs the current field |

### Comment Form

r | Focus the comment reply box |
---|---|

^ + ↩ | Submit the comment |

You can use `Command ⌘`

instead of `Control ^`

on Mac

Support Staff 1 Posted by

Christopher Sta...on 27 Jun, 2014 03:47 PMHi Alessandro,

For assistance with the virtual tangent screen, you'll need to contact Dave Cox. I'm not familiar with Dave's plans for the feature, but at present it has not been merged in to the main MWorks code base (hence its absence from the 0.5.1 release).

Here's the calculation that MWorks performs:

Cheers,

Chris Stawarz

2 Posted by

Alessandro Di F...on 28 Jun, 2014 01:32 PMHi Cristopher,

Thanks for your answers!

Regarding the use of virtual tangent screen, I will contact Dave Cox.

Regarding the calculation of display angles, in my case (a 103x58cm monitor at a distance of 30 cm) I expect a value in degrees of 120x88, but instead mworks is giving me 120x67.

Can you please explain why the half_height_deg is calculated in this way, and not simply by repeating the formula used for half_width_deg?

I assume it has something to do with the aspect ratio of the screen, but I'm not sure.

Thanks for your willingness.

Alessandro

Support Staff 3 Posted by

Christopher Sta...on 02 Jul, 2014 04:02 PMHi Alessandro,

The code that does that calculation predates my involvement with MWorks, so I had to think about it for a while. Here's how this works:

If the stimulus observer's eye is at distance

dfrom the center of the display, then the visual angleVsubtended by a circle of radiusrwhose center coincides with that of the display is given (in radians) bywhich is basically the equation for

`half_width_deg`

given above.Now, the point of these calculations is to define a mapping from degrees of visual angle to display pixels. In order for this mapping to preserve the shapes of stimuli (e.g. so that the aspect ratio of a rectangle does not change when the coordinates of its vertices are converted from degrees to pixels), we need it to be both linear and identical in every direction. Put another way, if a given visual angle is increased by

ΔV, then the corresponding change in radiusΔrshould be independent of bothrand the direction of the radius vector. More formally, we need the derivative ofrwith respect toVto be constant.Rearranging the previous equation to express

ras a function ofV, we getThe derivative of this equation is

notconstant with respect toV. However, ifV/2is small, then we can apply the small-angle approximation, and the above equation simplifies towhich

doeshave a constant derivative.Getting back to your question, the above equation yields the following formulas for

`half_width_deg`

and`half_height_deg`

:Dividing the second equation by the first and multiplying by

`half_width_deg`

giveswhich is exactly the equation MWorks uses to compute

`half_height_deg`

.Now, since we used the small-angle approximation to get to this point, the validity of these results depends on the angle

V/2 being suitably small. In order to keep the relative error within 2%,V/2 must be no larger than about 14 degrees. This implies that the distance from the observer's eye to the center of the display should be at least twice the display's largest dimension, i.e.In the case of your setup, this relation does

nothold, which is why the display dimensions calculated by MWorks differ from what you expect.The upshot here is that, for your setup, describing positions and sizes in terms of visual angle just isn't going to be very useful, because those coordinates can't be mapped on to pixels in a linear fashion. Instead, you'll need to pick a different coordinate system that

doesvary linearly with pixels, and then choose values for the width, height, and distance to the display that yield the bounds you want.In the future, MWorks probably should provide built-in support for alternative coordinate systems. PsychoPy seems to offer a nice set of unit options, so we may want to follow their lead.

I hope you find this helpful. If you have additional questions, please let me know.

Chris

4 Posted by

Alessandro Di F...on 03 Jul, 2014 08:50 AMHi Christopher,

Thanks for your time and your explanation, now everything is clear.

I will try to find some other way to solve this issue.

Thanks again for your willingness.

Ale

Christopher Stawarz

closedthis discussion on 03 Jul, 2014 01:56 PM.