Several flickering tasks run simultaneously

300 views
Skip to first unread message

pati-confidence

unread,
Jul 6, 2011, 1:17:10 AM7/6/11
to E-Prime
I want to build a BCI system, which presents four targets on LCD
screen, with flickering frequencies of 12Hz, 10Hz, 8.6Hz and 7.5Hz.
respectively.

And the four targets are flickering simultaneously.

Can E-prime achieve the goal?

Any tips will be appreciate. Thank you.

Michiel Spape

unread,
Jul 6, 2011, 4:43:42 AM7/6/11
to e-p...@googlegroups.com
Hi,
Well, yes, it can (given the right monitor), though you would obviously be looking at ways to code your frequencies in duration of stimulus + duration between stimuli (e.g. 10 Hz = one stimulus every 100 ms, therefore, an image taking 17 ms, and an ISI of 83, would give the effect). If, however, it is a psychophysical (or vision science) experiment, I'd suggest something like Psychopy, or Matlab, instead of E-Prime however, the latter being much more catered towards intricate psychological designs than vision science as such.
Best,
Mich

Michiel Spapé
Research Fellow
Perception & Action group
University of Nottingham
School of Psychology
www.cognitology.eu

--
You received this message because you are subscribed to the Google Groups "E-Prime" group.
To post to this group, send email to e-p...@googlegroups.com.
To unsubscribe from this group, send email to e-prime+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/e-prime?hl=en.

This message and any attachment are intended solely for the addressee and may contain confidential information. If you have received this message in error, please send it back to me, and immediately delete it. Please do not use, copy or disclose the information contained in this message or in any attachment. Any views or opinions expressed by the author of this email do not necessarily reflect the views of the University of Nottingham.

This message has been checked for viruses but the contents of an attachment
may still contain software viruses which could damage your computer system:
you are advised to perform your own checks. Email communications with the
University of Nottingham may be monitored as permitted by UK legislation.

Michiel Spape

unread,
Jul 6, 2011, 5:12:17 AM7/6/11
to e-p...@googlegroups.com
Oh, wait, simultaneous tasks, you say?
I think there are a few ways of handling this...
How about you make one slide with your four targets. These are four text "sub objects". Each target has a colour: white (as in, off, since the background is white), or black. See first how you can make them black or white (it's the background colour thing). Then, set each to [Target1Colour], [Target2Colour], [Target3Colour] and [Target4Colour] instead. The slide has a duration of slightly below your maximum refresh rate (i.e. 15 ms if your monitor runs at 60 Hz), and onset sync is on.
Make a list, sequential selection, 1 procedure, and set Exit after to 1 sec (i.e., it repeats for one second). Drag the slide you just made to the one procedure.
Add 4 procedures to the list: Target1Colour, Target2Colour, Target3Colour, Target4Colour. Think of the list as one second, and add levels accordingly: if your monitor runs at 60 Hz, there should be at least 60 levels. Find out, at each level, which of the targets is black. For instance, your second target, flickering at 10 Hz, should be black at the first level (time = 0 ms), 7th level (time = 100 ms), 13th level (time = 200 ms) and so on, but white at level 2-6, and so on.

Well, voila, there you go, it should now flicker. Of course, nothing is randomised, but it should work, and I think you might be able to take it from there. Also, no code yet.
Best,
Michiel

Michiel Spapé
Research Fellow
Perception & Action group
University of Nottingham
School of Psychology
www.cognitology.eu


-----Original Message-----
From: e-p...@googlegroups.com [mailto:e-p...@googlegroups.com] On Behalf Of pati-confidence
Sent: 06 July 2011 06:17
To: E-Prime
Subject: Several flickering tasks run simultaneously

--

David McFarlane

unread,
Jul 7, 2011, 3:03:55 PM7/7/11
to e-p...@googlegroups.com
Mich beat me to the punch, and with the answer
that I would have given at first. And Mich adds
a crucial concern that I would have overlooked,
namely that your chosen flicker times only work
if they are each commensurate with your display
refresh rate, which they probably are not (your
chosen flicker frequencies translate to periods
of 83.3, 100, 116.3, and 113.3 ms, respectively,
and you would have to find a common divisor to
all of those in the range of roughly 8.3 to 16,
good luck!). But I can't resist weighing in further...

Setting aside your incommensurate flicker rates,
can E-Prime do this? Well (as Mich already
said), yes, in principle; but in practice, for
this particular task you might be far better off
using something like Presentation, or MATLAB with
the Psychophysics Toolkit (my own first choice
for your task). You would like a toolset that
includes pre-made objects that can flicker
themselves at specified rates, and then set those
running. AFAIK, EP has no such facility, but
maybe Presentation or MATLAB or Psychopy do, and then Bob's your uncle!

Next, you could try Mich's fine suggestion, but
once again I fear that incommensurability will
raise its ugly head. Now you not only need a
common divisor, but you need a List that contains
the pattern of on-off images for each time point
until the entire temporal pattern repeats, and
that will not happen until you reach the
least-common-multiple of the individual period
times, and in your case that will be greater
than, say, 83.3 * 113.3 = 9.5 s, and perhaps as
great as 83.3 * 100 * 116.3 * 113.3 = 30.7
h. Yikes! Of course, if you are not wedded to
these period times, then you might adust them to
more workable values (there's a nice academic exercise for you).

But I said E-Prime could do this, and here's
how. It would require some intricate code, the
same way that you could do it in any
full-featured programming language, such as C or
C++ or even JavaScript, and I have done things
like this myself in C. You would need to
contruct your own "event loop" (do a search of
the Group or the Forum on that phrase to see
where I have discussed this before). In short,
you create an array that holds the upcoming
transition time for each object (in this case,
your four flickering targets). Each time through
the loop it just checks each of these times
against the current clock time, and when any one
reaches its next transition time then the loop
updates that target and adjuts its transition
time for the next one. Your loop just does that
for the duration of the display. Here is some
pseudo-code for that (using my own odd mixture of C-like and other notation):

while( presentation_ongoing )
for( i = 1 to nTargets )
if( Clock.Read >= target[i].tNext )
target[i].toggle
target[i].tNext = target[i].tNext + target[i].tPeriod

Of course, you also have to initialize .tPeriod
and .tNext for each target, and I left out the
mechanics of how to implement anything like a
.toggle method to redraw a target between its two
states, but I leave those as exercises.

-- David McFarlane, Professional Faultfinder


(P.s. For those who know more C-like notation,
the pseudo-code above could be more nicely written as

while( presentation_ongoing )
for( i = 1 to nTargets )
if( Clock.Read >= target[i].tNext )
target[i].toggle
target[i].tNext += target[i].tPeriod

Isnt' that nice?)

David McFarlane

unread,
Jul 7, 2011, 3:08:39 PM7/7/11
to e-p...@googlegroups.com
Ah, checked my own E-Prime FAQ, and here is the
link of where I have addressed this kind of
question
before:
http://groups.google.com/group/e-prime/browse_thread/thread/fda0b9bbe3a149c3

-- David McFarlane, Professional Faultfinder

(Now next time someone asks this, I will try to
direct them to the thread from today :))

pati-confidence

unread,
Jul 7, 2011, 8:11:27 PM7/7/11
to e-p...@googlegroups.com
Thank you for your so detailed and valuable relies.
I have implemented the required task by the use of the Slide, with four targets flickering in 10Hz, 11Hz, 12Hz and 15Hz respectively, which is much easier than flickering in 7.5Hz, 8.6Hz, 10Hz, 12Hz.
And I will attempt your method later.
Thank you very much!

guobing Wu

To unsubscribe from this group, send email to e-prime+unsubscribe@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/e-prime?hl=en.
--
You received this message because you are subscribed to the Google Groups "E-Prime" group.
To post to this group, send email to e-p...@googlegroups.com.
To unsubscribe from this group, send email to e-prime+unsubscribe@googlegroups.com.

dkmcf

unread,
Jul 7, 2011, 11:43:31 PM7/7/11
to E-Prime
Glad you got it to work so easily! And your report of success made me
realize the error of my excessive computations -- of course you did
not need to continue the List out to the least-common-multiple of your
period times, you only needed to cover the few seconds of the
stimulus, which, after adjusting the period times a bit, is quite
manageable. Kudos to you & Mich together.

-- David McFarlane, Professional Faultfinder


On Jul 7, 8:11 pm, pati-confidence <pati.confide...@gmail.com> wrote:
> Thank you for your so detailed and valuable relies.
> I have implemented the required task by the use of the Slide, with four
> targets flickering in 10Hz, 11Hz, 12Hz and 15Hz respectively, which is much
> easier than flickering in 7.5Hz, 8.6Hz, 10Hz, 12Hz.
> And I will attempt your method later.
> Thank you very much!
>
> guobing Wu
>
>
>
>
>
>
>
> On Fri, Jul 8, 2011 at 3:08 AM, David McFarlane <mcfar...@msu.edu> wrote:
> > Ah, checked my own E-Prime FAQ, and here is the link of where I have
> > addressed this kind of question before:http://groups.google.com/**
> > group/e-prime/browse_thread/**thread/fda0b9bbe3a149c3<http://groups.google.com/group/e-prime/browse_thread/thread/fda0b9bbe...>

Peter Quain

unread,
Jul 11, 2011, 1:55:32 PM7/11/11
to e-p...@googlegroups.com

The issue of LCD monitors has been raised periodically on this list. Because CRTs have gone way of the dinosaur many labs use LCDs now for experiment presentation, and my guess is that some aren't aware of some possible pitfalls of doing so. My understanding is, basically, LCDs work differently to CRT monitors, and the key issue for display timing accuracy is that LCD monitors have onboard image processing engines that do their own thing with the frames sent to them by graphics card, prior to displaying them, and this processing can take (varied) time, with range that can be perhaps 0 to 70 ms across frames, and average lag which can be in the 30-40 ms range. The variation compounds the problem LCD screens may pose for some types of experimental psychology.

This means 1) that you don't have a clue what is going on with display timing unless you test your LCD monitors for input lag (and then it likely will fluctuate across trials anyway) ; and 2) Just because it shows a picture, you can't just treat an LCD monitor as though it is a CRT monitor for purposes of time critical paradigms.

Additionally, any concurrent audio would be out of sync because the audio is not routed through the display, and so would experience no delay.

Also, without testing the monitor, it may not be possible to trust the "refresh rate" setting at anything other than the native refresh (mostly 60Hz) even though Windows may provide an option for the monitor to run at a higher "refresh" (say 75Hz), which some researchers may choose in their experiment. I have seen results showing that when refresh is set to 75Hz on a 60Hz native refresh LCD, frames are redrawn every ~13ms (instead of ~17ms), however 1 in every 6 frames was skipped (no display). So, in 167ms only 10 frames were displayed, not 12. Looked like the engine was correcting back to native refresh. You test this with high speed camera (same as to test input lag).

As far as e-prime goes, this means that you could write a tidy paradigm where timing was tested as perfect on a good PC, and e-prime would log all durations as being so. However, at the display level the timing could be all over the place. Nobody would know, and effectively all the time taken to use e-prime for millisecond precision would be wasted. On monitors that have a big range of input lag, some paradigms would really be impossible to implement accurately.?

I'm no expert in this, have just been fishing round on the net. For anyone who might be interested, below are some useful links providing a little digestible background on how LCDs work, how they differ from CRTs, and how to go about testing for input lag. Note that to do this properly you need a CRT monitor as baseline. Don't be tempted to use another LCD, which would include using a laptop screen, and my advice would be to definitely use a PC (with dual head graphics card in clone mode) not a laptop.

----------------------------------------------------------------------
Good old Wikipedia defining input lag:

http://en.wikipedia.org/wiki/Input_lag

A basic primer on how LCDs / CRTs function, and differences:

http://www.bit-tech.net/hardware/2006/03/20/how_crt_and_lcd_monitors_work/

Here is an interesting site describing CRTs and LCDs (from gamer perspective). Navigate through the next few pages forward / backward using buttons down the bottom:

http://www.tweakguides.com/Graphics_7.html

How to test your monitors for input lag?

Here is a brief description, and a little counter program you can download:

http://www.flatpanelshd.com/focus.php?subaction=showfull&id=1229335064

Here is another description with some useful info about type of camera that is suitable:

http://www.avsforum.com/avs-vb/showthread.php?t=1131464

A neat site who say they have done a lot of testing re: input lag, and provide comparison output for many LCD monitors. Note, lags might be different on your monitor even though it is same model tested. You need to test each individual monitor:

http://www.digitalversus.com/duels.php?ty=6&ma1=35&mo1=121&p1=1303&ma2=284&mo2=326&p2=3097&ph=12

-----------------------------------------------------------------------------
Peter

Reply all
Reply to author
Forward
0 new messages