EPrime - motion stim issues

776 views
Skip to first unread message

Lisa Levinson

unread,
Aug 16, 2011, 11:24:29 PM8/16/11
to e-p...@googlegroups.com
I am looking to replicate an experiment originally created in Presentation for use with EPrime, part of an EEG experiment. The original experiment used that software’s programming language to create a color and motion stimulus that allowed the researchers to compare the parvocellular and magnocellular visual pathways. I do not know EBasic and so I have created the color stim in Photoshop and imported the image as a slide. While I am not able to control luminance it appears very close to the original. The motion stim is proving much more complicated. I created a vertically oriented sinusoidal spatial frequency grating as an animation file in Final Cut (editing software) and have been struggling ever since to make it work as intended.
 
The experiment calls for a low frequency grating to traverse from left to right for 100ms with inter-stimulus intervals anywhere from 500 ms to 1000ms. Because the stimulus presentation is so short I don’t seem to be able to use the video start/stop feature; additionally, randomizing the ISI is not possible using this feature. I determined that one cycle of the animation sequence is 31 frames and with a 60 frame per second animation that means that I have 10 six frame sets per second (each set 100ms). I then created 6 frame .avi files and loaded them sequentially. Because the experiment calls for 320 trials I had the choice to load 320 files or create a loop with 5 six frame sets, I opted for the loop. To allow for the randomized ISI intervals I created jpeg files containing the final frame of each set and then finished the sequence with my one remaining frame (5 six frame sets plus one final still, making 31 frames).
 
After loading the movie/still files (sequentially) it seems that even though the stills(jpegs) were captured from the animation frames they are not similar in size, so I have an inconsistency there – issue one. The other issue is that the two images (movie/still) overlap rather than following in sequence. One appears inside the other and the error message I get once I abort is “unable to update frame.” I did eliminate the 500ms ISI but that has not helped. I also tried to eliminated the jpeg files but then I can only randomize the duration of the motion which should be consistent at 100ms intervals. It is the time between presentations that should randomly fall within 500 to 100ms.
 
I am at a complete loss as to what to try next. HELP!

David McFarlane

unread,
Aug 18, 2011, 1:26:53 PM8/18/11
to e-p...@googlegroups.com
Lisa,

OK, I will ask the obvious dumb question. If you
already have a program that works in
Presentation, why would you want to recreate it
in E-Prime? Although in principle E-Prime should
be able to handle this, it may require jumping
through a lot of complicated hoops, and it seems
to me that Presentation makes a better platform for this type of task.

-- David McFarlane, Professional Faultfinder

Lisa Levinson

unread,
Aug 18, 2011, 2:48:42 PM8/18/11
to e-p...@googlegroups.com
Yes, Presentation is better for this type of experiment, however, the Presentation script was generated in a different lab and the lab I am working in is not set up to use Presentation (requires a serial port connection for which we have had issues with timing). So, you are 100% correct, I have been jumping through complicated hoops for more time than I will admit and while I have made progress the motion stim for this experiment is just crazy difficult to figure out. Today I was going to attempt to increase the duration of stimulus presentation to see if it is a loading issue. Will let you know but any thoughts would be greatly appreciated.


 
--
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.
For more options, visit this group at http://groups.google.com/group/e-prime?hl=en.


Paul Groot

unread,
Aug 18, 2011, 7:04:38 PM8/18/11
to e-p...@googlegroups.com
Hi Lisa,

It looks like this 'hybrid' movie/still solution is causing more
problems than it solves. Like Presentation, you probably would like to
use some script to create/present the graphics. Unfortunately, E-Basic
only has limited support for creating graphics on the fly (text,
lines, rectangles and ellipses), and I'm not sure if your stimuli
could be drawn by those primitives. However, pre-created static
bitmaps (as movies) can be a workaround for painting more complex
graphics objects. Programming moving objects is not extremely
difficult, and if I remember correctly, there is an example available
on the pst support site
(http://www.pstnet.com/support/samples.asp?Mode=View&SampleID=8) When
the graphics objects themself change, you might run into difficulties
when the computer hardware cannot keep up with the number of required
bitmaps and desired frame rate. Using movies will probably the only
working solution in that case. I think I would include the ISI's in
the movie so it becomes a single file that can be played without
interruption. ISI durations cannot be set at runtime this way, unless
you use the technique described below.

In some cases is also possible to use an external (DLL) library to
create complex stimuli at run time (gabor patches, gradient fills,
...). Such an external library could be used to create bitmaps or
movies on the fly, which then can be loaded by eprime. However, this
requires in-depth knowledge of a programming language such as C++
because such a specific library probably doesn't exist yet. I used
this technique before to create audio files and complex bitmap
sequences. (If you have EPrime version 1, you might have a look at the
attached example. This will display a changing ellipse with a gradient
fill that can be defined at runtime in EPrime)

Best,
Paul

2011/8/18 Lisa Levinson <lml...@gmail.com>:

>> e-prime+u...@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+u...@googlegroups.com.

StimMaker.dll
StimMakerTest.ebs

Lisa Levinson

unread,
Aug 19, 2011, 9:15:06 AM8/19/11
to e-p...@googlegroups.com
Paul - Thanks so much for your input. One thought I had yesterday (which you seem to have come up with too) was to generate a video that basically included the movie, still images and my targets (behavioral task to maintain attention). I would edit six frames to run and then maintain the non-moving images for a set but externally randomized intervals (take the ISI times, randomize in excel and then use that sequence in the editing of the still images). I would do the same for the targets. I would add a white box at the bottom of the screen when these various elements begin/end. Running the video off of a monitor and use a photo cell (under a tent) to record when these elements appear and then go back and sync the EGI recording to  the photo cell indicators. This borrows from the eye tracking technique and bypasses EPrime.

I will take a look on the pst site. Yesterday I didn't get to test my duration theory to see if this is strictly a loading issue, instead I tried a few other approaches - unsuccessfully. Monday I will change durations to confirm a loading issue, which my gut tells me it is. If that is the case this will call for radical problem solving (like what I am thinking above) rather than figuring out how and where to customize the script.

Thank you for the StimMaker ellipse script. Will review in WORD and see on Monday if I can get it to run. 

Thanks so much for your help. We may be wired to learn by trial and error but this process has been ridiculous, I have spent a very long time learning all the ways this can't be done.
Best,
Lisa

Lisa Levinson

unread,
Aug 23, 2011, 7:06:57 PM8/23/11
to e-p...@googlegroups.com
Paul-

I have worked out a script that seems to run properly. Rather than use a still/jpeg file between motion files I added a "wait" slide. So, my gradient runs for 100ms and the wait slide follows allowing me to present a non-moving image of the gradient for a specified duration. Note: in order for the animation to run as a loop I have five motion files, loaded in sequence. Here is my next challenge...I need five wait slides between my motion files but I would like to randomly assign a duration to those wait slides. At the moment I have them set up so that wait1 runs for 1000ms, wait2 for 600ms, wait3 for 700ms, wait4 for 800ms and wait5 for 900ms. This list is set for random but I am not exactly sure what I am getting. Do you think wait1 will always run at 1000ms, wait 2 for 600ms, etc?

Lisa

On Thu, Aug 18, 2011 at 7:04 PM, Paul Groot <pfc....@gmail.com> wrote:

Paul Groot

unread,
Aug 24, 2011, 3:20:57 PM8/24/11
to e-p...@googlegroups.com
Hi Lisa,

If you enter a numeric (hard coded) value into the duration properties
of the wait1 to wait5 objects, you will indeed get fixed
(non-randomized) intervals. Setting the ordering property of the list
to random has no effect on this. There are several ways to get random
duration values. The easiest way (=without any inline script) is to
create a separate list and add an attribute with the interval values
you would like to use. Set the ordering of this list to random (with
or w/o replacement) and use this list as nested list in your real
trial list. The name of the attribute (i.e. 'FootageInterval') can
then be used to set the duration property in the wait objects. To make
sure EPrime picks a new value from the nested list for each wait
object you will have to use the following syntax for the durations:

[FootageInterval:0] (for duration Wait1)
[FootageInterval:1] (for duration Wait2)
etc.

Alternatively you could use a simple inline script at the start of the
trial and use the E-Basic random() function to set durations. (That
would be uniform random w/o replacement.)

Hope this helps
Paul


2011/8/24 Lisa Levinson <lml...@gmail.com>:

Lisa Levinson

unread,
Aug 24, 2011, 5:17:53 PM8/24/11
to e-p...@googlegroups.com
Thanks Paul - very helpful.

David McFarlane

unread,
Aug 25, 2011, 11:43:57 AM8/25/11
to e-p...@googlegroups.com
At 8/24/2011 03:20 PM Wednesday, Paul Groot wrote:
>Alternatively you could use a simple inline script at the start of
>the trial and use the E-Basic random() function to set durations.
>(That would be uniform random w/o replacement.)

Um, wouldn't the E-Basic random() function result in uniform random
samples *with* replacement?

Paul Groot

unread,
Aug 25, 2011, 3:25:12 PM8/25/11
to e-p...@googlegroups.com
Absolutely; the cyclic chain of numbers will definitely pop-up the
same numbers after a while... So they must have been but back ;-)

my mistake!

2011/8/25 David McFarlane <mcfa...@msu.edu>:

David McFarlane

unread,
Aug 25, 2011, 4:59:16 PM8/25/11
to e-p...@googlegroups.com
Ah, I was not thinking about the underlying architecture of the
Random() function, so you got me there! Now the discussion must get
more technical...

Of course, if Random() is based on, say, a 32-bit cyclic PRNG, then
it will repeat its sequence after no more than 2^32 = 4,294,967,296
samples (or perhaps more like 2^31 = 2,147,483,648 samples, because
E-Basic/VBA does not use unsigned integers). But that is not what I
had in mind, because we rarely use Random() to pick numbers from that
entire range.

Rather, I had in mind more common & prosaic uses such as
Random(0,99). The underlying architecture now parses the full 32-bit
range into 100 segments, with no guarantee that it will not draw
samples from the same segment until a sample has been drawn from each
segment. To the contrary, it is extremely likely in this case that
it will draw duplicate numbers within the first 100 samples. You can
see this readily if you try a scaled-down example, say, Random(0,9)
or even Random(0,2) -- I know, I just did this.

More to the point, I was thinking in terms of my understanding of the
*intent* or *specification* of the Random() function, apart from its
actual implementation. As I understand it, Random() is *meant* to
act as a die roll, not as a shuffled deck of cards. IOW, Random(1,6)
should return a random number from 1 to 6 each time, without regard
to what came before (just like a six-sided die), rather than return a
number and then remember that number and not return it again until
all other numbers have been returned (like a shuffled six-card deck).

Did I get this right now?

Best,


-- David McFarlane, Professional Faultfinder

Lisa Levinson

unread,
Aug 25, 2011, 7:08:13 PM8/25/11
to e-p...@googlegroups.com
Thank you - will try this tomorrow. Lisa

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

Paul Groot

unread,
Aug 25, 2011, 7:17:30 PM8/25/11
to e-p...@googlegroups.com
Hi David,

That is indeed what happens when using the random function. (I was
just trying to talk myself out of a silly typo ;-)

A deeper understanding of the problem often raises new questions...
Purely academic off course!
I just realized that the EPrime (1.2) documentation mentions two types
of random generators: The standard visual basic functions (random,
randomize) and the E-Basic specific PRNG object. This might be
important if you use the seed value to setup your experiment to a
known state (for reproducibility and testing). The edat output file
logs a single seed value retrieved with PRNG.GetSeed(), so it would be
interesting to know if there is only one active PRNG under the hood. A
simple test shows that this is indeed the case:

PRNG.SetSeed 987654321
debug.print PRNG.GetSeed()
Randomize 123456789
debug.print PRNG.GetSeed()

will print:
987654321
123456789

cheers
Paul

2011/8/25 David McFarlane <mcfa...@msu.edu>:

David McFarlane

unread,
Aug 26, 2011, 10:41:59 AM8/26/11
to e-p...@googlegroups.com
Paul,

Thanks for checking on the equivalence between PRNG and Randomize,
etc., and posting a very nice test. I had wondered about that
myself, and some time ago ran extensive tests to convince myself that
they all use the same underlying generator. Perhaps it is time that
I posted that as part of my "Mastering E-Prime" series. In short, I
concluded that PRNG just gathers into one E-Object all of the
functions of the standard VBA randomization functions, and that PRNG
includes a GetSeed method lacking from standard VBA. Beyond that,
which you use comes down to matter of personal programming taste or
style. I like keeping all those functions neatly organized under one
object, but I always comment that in my source code.

But of course no one should take my word for anything, so it is good
to have someone else verify this.

Best,
-- David McFarlane, Professional Faultfinder

David McFarlane

unread,
Aug 26, 2011, 11:40:35 AM8/26/11
to e-p...@googlegroups.com
OK, I posted the article at
http://groups.google.com/group/e-prime/browse_thread/thread/5b7862e01f738dfc
. (Also, I should have mentioned in my earlier post here that,
besides PRNG including a GetSeed method lacking from standard VBA,
PRNG lacks a simple equivalent to the standard set's "Randomize" with
no argument.)

-- David McFarlane, Professional Faultfinder

Reply all
Reply to author
Forward
0 new messages