| Reference | Downloads | Github

Sf, tf, and speed of grating stim


I wanted to verify that I understood the parameters of drifting grating stim correctly.
If I have monitor refresh rate 60 Hz, then:
temporal_frequency (Hz) = phase_advance * 30, because 0.5 phase corresponds to 1 cycle (psychopy docs)
*speed = temporal_frequency / spatial_frequency (degrees/sec) or linear_speed = tf*d(monitor distance)cot(sf) (cm/s)

Is that correct or I am missing smth?


Code to present 0.2s drifting:
tf = 2 # Hz
spatial_freq=0.05 # cyc/deg
phase_advance= tf/30.0 # monitor refresh rate 60 Hz, 0.5 phase = 1 cycle
orientation_latency=12 # units are in frames? 1/60 = duration of 1 frame. (1/60)12 = 0.2s = 200ms.
speed = tf/sf # degrees/s, cycle - constant; linear_speed = tf*d(monitor distance)*cot(sf) = cm/s

    for frameN in range(orientation_latency):
        grating2.setPhase(phase_advance, '+')#advance phase by 0.05 of a cycle

No phase of 0.5 is not 1 cycle. PsychoPy’s phase setting has units of cycles 1=1. The beauty is that you can set
phase = t*tf
phase_advance = tf/frame_rate
(but make sure that you do the from __future__ import division line and/or make sure that your tf of frame_rate is a float.

(You might benefit from one of our programming workshops - check them out)

I don’t know what your orientation latnecy thing is about so can’t comment on that

Thanks for your reply. Now it makes sense.