How to code parallel tasks?

735 views
Skip to first unread message

ccpin

unread,
Nov 16, 2009, 7:36:25 PM11/16/09
to E-Prime
Hello,

I'm Eric, and I would like some tips for coding parallel tasks.

I have 2 tasks that I want run in parallel: a) a pursuit task (mouse
tracking a target), B) a visual/audio go/no go task.

Using Eprime examples, I cobbled together a piece of code that runs
both sequentially (code posted in Files as TryPursuit.zip).

How should I modify the code for them to run in parallel? I figured
one way would be to code everything from scratch using inline, but I'm
pretty sure there's a more efficient way.

Advice would be much appreciated, and many thanks in advance!

cheers,

eric

ccpin

unread,
Nov 16, 2009, 7:43:21 PM11/16/09
to E-Prime
Apologies, I wasn't aware I can't upload files. I'm most happy to send
them to you if you like to help.

cheers,
eric

David McFarlane

unread,
Nov 17, 2009, 3:53:25 PM11/17/09
to e-p...@googlegroups.com
Eric,

Depends on what you mean by "parallel tasks". Some folks apply that
term when subjects perform trials of two different tasks in random
succession, especially when one of the tasks requires some
memorization or vigilance (e.g., n-back trials interrupted with
addition trials, where one must keep in mind the prior n n-back
stimuli while still performing the addition trials). This usage
contrasts with concurrent asynchronous performance of two tasks
(e.g., typing a short essay while images flash on the border of the
screen, and the subject must press a foot pedal whenever a particular
image appears).

For the first kind of dual task in E-Prime you would want a TrialList
that uses levels (rows) with two different Procedures. The trick
then is getting the randomization to work as you like. If you are
not too fussy then you can just have the E-Prime List randomize all
the A-Procedure & B-Procedure trials for you, but if you need to add
constraints to the randomization then things get considerably tricky
(see, e.g. http://www.pstnet.com/forum/Topic2186-5-1.aspx or
http://support.pstnet.com/forum/Topic3166-5-1.aspx ).

For the second kind of dual task, I once did the example above all in
C under DOS. I did that by contructing a randomized "time schedule"
of all timed events before the start of the session, and programming
an event loop which handled every key & foot press and looked at the
time schedule to update the screen images as specified. In principle
you could do much the same thing in E-Prime, perhaps in part by
building a custom TrialList in inline script much as shown in PST's
downloadable NoRepeat.es example. Although, just thinking of my own
example, it turns out that that one would be very easy to do in
E-Prime with proper application of Extended Input (see Appedix C of
the User's Guide) and the EchoClient (see the online E-Basic Help).

Don't know that any of this helps you, but there you go.

-- David McFarlane, Professional Faultfinder

ccpin

unread,
Nov 17, 2009, 6:47:30 PM11/17/09
to E-Prime
Hello David,

Thanks very much for your note.

I am looking at the second kind of dual task. In fact, it's
conceptually the same as what you did. We are implementing a divided
attention task, where subjects perform a visual smooth pursuit
concurrently with an auditory go/no go.

Thanks very much for your tips; I'll keep you posted on how I get on.

Best wishes,

eric

dkmcf

unread,
Nov 18, 2009, 10:46:53 PM11/18/09
to E-Prime
Eric,

Hmm, FWIW on my way to looking up other things I just noticed that PST
does have a Dual Task example in the Samples section of their Web
Support site. We could all (including me) learn to take more
advantage of the resources that PST already supplies. Oh, there is
also the STEP site, which I have mentioned before.

-- David McFarlane, Professional Faultfinder


ccpin

unread,
Nov 24, 2009, 7:17:21 PM11/24/09
to E-Prime
Hello everyone,

To quickly recap, I am trying to implement a divided attention task
where users perform a visual smooth pursuit (mouse tracking a target)
and an auditory no/no go (respond to even digits) simultaneously.

What I have now is a slide within a list. Each time the slide is
shown, it plays a digit (sound file) and displays the updated target
(jpg).

The main problem I now have is with timing. I've had to keep the slide
on long enough (1 s) to a) let the sound file finish playing, and b)
capture a response. However, the image therefore appears jittery, as
it only refreshes every 1 s.

Ideally, I like to refresh the image every 25 ms. Does anyone know how
I can use inline while the slide is running to refresh the image? Or
is there another way to make the image transition smooth?

Thanks a lot,

eric

Michiel Spape

unread,
Nov 26, 2009, 9:52:59 AM11/26/09
to e-p...@googlegroups.com
Hi,
Basically, I see two solutions:
- Just don't let the sound end as the slide ends (for example by using an inline script to make the audio play; or set its StopAfter property to No). Slide duration doesn't need anything to do with the sound duration.
- Do some looping with two little inlines:
1. Just before the slide (the slide being 25 ms)
BeforeSlide: 'note that : indicates it being a lable
Dim TimeStarted as long
TimeStarted = clock.read

2. One after the slide
If (clock.read - TimeStarted) < 1000 then 'only do it if less than 1s has passed
'change some properties of the slide here, or update the location of your mouse
Goto BeforeSlide
End if

Or, for more fun, do it all in canvas - I have a little programme demonstrating a tracking experiment almost entirely written in canvas procedures, let me know if you're interested.

Best,
Mich







Michiel Spapé
Research Fellow
Perception & Action group
University of Nottingham
School of Psychology
--

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 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.

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.

ccpin

unread,
Dec 2, 2009, 8:16:38 PM12/2/09
to E-Prime
Hello Michiel,

We did it, thanks to your great tips. I would be very happy to share
the program with you if you're interested.

eric

On Nov 26, 10:52 pm, Michiel Spape <Michiel.Sp...@nottingham.ac.uk>
wrote:
> For more options, visit this group athttp://groups.google.com/group/e-prime?hl=en.

Kate Cox

unread,
Feb 24, 2014, 2:30:00 AM2/24/14
to e-p...@googlegroups.com, cher...@gmail.com
Hi Eric
I am very new to creating tasks using script in eprime and have been struggling to make a dual attention task which I think is very similar to the one you you described.
I need participants to use their mouse to track a moving target on screen while simultaneously listening to a audio file (or a series of individual audio files) that gives them a list of things they'll need to remember in a later memory task.

I was wondering if you could give me any advice on how you created your task. I've tried adapting with the Track Mouse Coordinates sample on the PST website to at least get the tracking/pursuit task working but being so new to scripts I'm having real trouble as I've only ever used e-objects to create tasks and never used the canvas feature before.

Any help you can offer would be hugely appreciated.

Thanks
Kate 
Reply all
Reply to author
Forward
0 new messages