[visionegg] Advice on using Presentation for sequential stimulus.

  • From: Simeon Fitch <metasim@xxxxxxxxx>
  • To: visionegg@xxxxxxxxxxxxx
  • Date: Mon, 22 Aug 2005 09:47:37 -0400

In the experiment I'm composing the subject is shown a sequence of 
"Stimulus" instances, each for a specific duration, followed by a screen 
querying a response.

I have code that seems to work fine, but I have a nagging suspicion that I 
may not be properly using the Vision Egg API, or overlooking a more 
straight-forward way of achieving the same thing. I'd appreciate any 
recommendations or tips anyone might have.

Here's the basic structure:
for t in numberOfTrials:
Display fixation spot for 1 second
Display a mask pattern for 3 frames @ 0.05s/frame
Display a dot lattice for 0.3s
Display response options and wait for subjeect to press a key
 
I've structured my code such that each step is managed by a separate "
Core.Stimulus" subclass, which in turn has its own viewport and 
presentation. The root of my question is whether I can be using the 
FlowControl classes or something else to do the following in a more elegant 
manner:

fixation = FixationSpot(position=center)
fixationView = Viewport(screen=screen, size=screen.size, stimuli=[fixation])
fixationPres = Presentation(go_duration=(1, 'seconds'),
 viewports=[fixationView])

lattice = DotLattice(position=center, dotSize=5)
latticeView = Viewport(screen=screen, size=screen.size, stimuli=[lattice])
latticePres = Presentation(go_duration=(0.5, 'seconds'),
 viewports=[latticeView])

mask = DotLatticeMask(lattice)
maskView = Viewport(screen=screen, size=screen.size, stimuli=[mask])
maskPres = Presentation(go_duration=(3, 'frames'),
 viewports=[maskView])

callbacks = [
(KEYDOWN, lambda event: response.keydown(event, responsePres)),
]

response = ResponseVectors(position=center, lattice=lattice)
responseView = Viewport(screen=screen, size=screen.size, stimuli=[response])
responsePres = Presentation(go_duration=('forever',),
viewports=[responseView],
handle_event_callbacks=callbacks)

# Main experimentation loop
for trial in conditions:
lattice.setTrial(trial)

fixationPres.go()
maskPres.go()
latticePres.go()
responsePres.go()

dataFileWriter.writerow(trial.values())


 Basically, in contrast to the multiStim.py demo file which shows multiple 
stimuli at the same time, I want to know how to properly show multiple 
stimuli sequentially.

Thanks,

Simeon

-- 
Simeon H.K. Fitch, Owner
Mustard Seed Software
http://www.mseedsoft.com/

Other related posts: