Flashing two dots at different frequencies.

125 views
Skip to first unread message

Ben

unread,
Dec 8, 2009, 10:30:02 PM12/8/09
to E-Prime
Hi,

For a SSVEP experiment I need to flash two dots on an image at
different frequencies. My problem is that I haven't been able find a
way to set different timings for each dot to turn on and off
independently.
I am new to E-Prime and would appreciate your help.

Thank you,
Ben.

David McFarlane

unread,
Dec 9, 2009, 9:44:22 AM12/9/09
to e-p...@googlegroups.com
Ben,

Standard reminder: 1) I do not work for PST. 2) PST's trained staff
really does like to take any and all questions at
http://support.pstnet.com/e%2Dprime/support/login.asp , and they strive
to respond to all requests in 24-48 hours. So don't be shy there. 3)
If you do get an answer from PST Web Support, please extend the courtesy
of posting their reply back here for the sake of others.

That said, here is my take ...

Hmm, it would make it rather easier if one frequency were an integral
multiple of the other. In that case the slower dot appears only in
conjunction with the faster one, and you could simply use two different
Slides with a List that cycles through them at the right frequency. But
I assume that your situation is not so simple.

Back when I did this sort of thing in C, at the start of the session I
would create an array with all the scheduled times and events, and then
just roll that out through an event loop. E.g., if each dot persisted
for 200 ms, and one dot flashed every 500 ms while the other every 750
ms, then my array might look like

t_ms event
---- -----
0 dot500on
200 dot500off
500 dot500on
700 dot500off
750 dot750on
950 dot750off
1000 dot500on
1200 dot500off
1500 dot500on
1500 dot750on
1700 dot500off
1700 dot750off
2000 dot500on
2200 dot500off

(Actually, I would add the start time of the session to all those
times.) In principle you could do this with E-Prime, but I am not about
to demonstrate that myself.

I call this general approach an "in advace" technique. If you prefer an
"on the fly" technique, then you might consider using inline script to
select which dot(s) appear next, and to manipulate
SetNextTargetOnsetTime for that dot to appear (or use .CustomOnsetTime &
.CustomOffsetTime if you prefer) -- see the online E-Basic Help.
Because one dot might need to turn on or off during the duration of
another dot, you might still need to set the Duration of the dots to 0
and use script to turn them off at the appropriate time.

I sure hope someone else chimes in with a better idea!

-- David McFarlane, Professional Faultfinder
"For a successful technology, reality must take precedence over public
relations, for nature cannot be fooled." (Richard Feynman, Nobel
prize-winning physicist)

David McFarlane

unread,
Dec 9, 2009, 10:21:47 PM12/9/09
to e-p...@googlegroups.com
Ben,

Here is another "on the fly" approach (based on my experience with
NetLogo at the start of this year). Think of each flashing dot as an
object or "agent" with properties for on duration, off duration, current
state (on or off), and clock time for its next change of state (you
might do this with a User Defined Type, or with some clever use of the
properties already built in to E-Prime display objects). Your event
loop would then check the "next change" time of each active object
against the current clock time. For each object whose "next change"
time has been reached, it would toggle the object's state and update its
"next change" time accordingly.

You would still have to write your own event loop for E-Prime (in
NetLogo this is built in).

Ben

unread,
Dec 10, 2009, 4:13:19 PM12/10/09
to E-Prime

Hello David,

Thank you for your responses.
I actually implemented the exact same approach in VB yesterday and it
is working nicely.

Best,
B.
Reply all
Reply to author
Forward
0 new messages