[visionegg] Re: trigger
- From: alessandra.stella@xxxxxx
- To: visionegg@xxxxxxxxxxxxx
- Date: Tue, 16 Nov 2004 15:17:51 +0100
Dear Andrew,
the daq/simple_lpt_out.py demo works and I get a trigger on the computer
that record the EEG. I run also the trigger_out.py demo and it works too.
What I would need now is to understand how to get two kind of trigger: one
for the gabor on the left and the other for the gabor on the right.
The trigger's frequency should match the temporal frequency of the two gabors
(5 and 8 Hz). I tried to add the trigger out controller to the list of
controllers
of presentation (I already have a controller for the contrast (to controll
the pattern reversal function)) but it doesn't work. I attached the script
below.
Thanks a lot!
Alessandra
From: Andrew Straw <astraw@xxxxxxxxxxx>
To: visionegg@xxxxxxxxxxxxx
Date: Thu, 04 Nov 2004 09:51:20 -0800
Dear Alessandra,
What happens when you run the daq/simple_lpt_out.py demo? Does this work
for you? If so, what further information do you need?
random.randint(0,1) will return a random integer of value either 0 or 1.
Cheers!
Andrew
import os
import VisionEgg
import VisionEgg.Daq
import random
VisionEgg.start_default_logging(); VisionEgg.watch_exceptions()
from VisionEgg.Core import *
from VisionEgg.FlowControl import Presentation
from VisionEgg.Gratings import *
from VisionEgg.Textures import *
from VisionEgg.MoreStimuli import *
from math import *
from VisionEgg.DaqLPT import *
from VisionEgg.Textures import*
screen = get_default_screen()
screen.parameters.bgcolor = (0.5,0.5,0.5,1.0)
"""gabor standard"""
mask = Mask2D(function='gaussian',
radius_parameter=25,
num_samples=(256,256))
g_standard_ds = SinGrating2D(mask = mask,
bit_depth = 8,
position=((screen.size[0]/2)+300,(screen.size[1]/2)+300
),
size = ( 400 , 400 ),
spatial_freq = 0.05,
temporal_freq_hz = 0.0,
orientation = 90.0 )
g_standard_sx = SinGrating2D(mask = mask,
bit_depth = 8,
position=((screen.size[0]/2)-300,(screen.size[1]/2)+300
),
size = ( 400, 400 ),
spatial_freq = 0.05,
temporal_freq_hz = 0.0,
orientation = 90.0 )
""" gabor """
"""gabors target"""
g_target_ds = SinGrating2D(mask = mask,
bit_depth = 8,
position=((screen.size[0]/2)+300,(screen.size[1]/2)+300
),
size = ( 400 , 400 ),
spatial_freq = 0.05,
temporal_freq_hz = 0.0,
orientation = 45.0 )
g_target_sx = SinGrating2D(mask = mask,
bit_depth = 8,
position=((screen.size[0]/2)-300,(screen.size[1]/2)+300
),
size = ( 400, 400 ),
spatial_freq = 0.05,
temporal_freq_hz = 0.0,
orientation = 45.0 )
"""fine gabor target"""
"""fixation point"""
fixation_p = FixationSpot(position=(screen.size[0]/2,screen.size[1]/2),
anchor='center',
color=(0,0,0,1.0),
size=(8,8))
inner_fixation_p = FixationSpot(position=(screen.size[0]/2,screen.size[1]/2),
anchor='center',
color=(255,255,255,1.0),
size=(4,4))
""" fixation point"""
"""cue right left"""
filename_cue_sx =
os.path.join(VisionEgg.config.VISIONEGG_SYSTEM_DIR,"data","cue.png")
texture_cue_sx = Texture(filename_cue_sx)
cue_sx = TextureStimulus(texture=texture_cue_sx,
position = ((screen.size[0]/2)-14,screen.size[1]/2),
anchor = 'center',
size = (12.0,12.0),
shrink_texture_ok = 1)
filename_cue_ds =
os.path.join(VisionEgg.config.VISIONEGG_SYSTEM_DIR,"data","cue.png")
texture_cue_ds = Texture(filename_cue_ds)
cue_ds = TextureStimulus(texture=texture_cue_ds,
position = ((screen.size[0]/2)+14,screen.size[1]/2),
anchor = 'center',
size = (12.0,12.0),
shrink_texture_ok = 1)
""" cue """
""" standard gabors and cues"""
viewport_gs_stand_cue_sx = Viewport( screen=screen,
stimuli=[fixation_p, inner_fixation_p, g_standard_ds,
g_standard_sx, cue_sx] )
viewport_gs_stand_cue_ds= Viewport( screen=screen,
stimuli=[fixation_p, inner_fixation_p, g_standard_ds,
g_standard_sx, cue_ds] )
"""standard gabors and cues"""
""" target gabors and cues"""
viewport_gs_tgt_cue_sx = Viewport( screen=screen,
stimuli=[fixation_p, inner_fixation_p, g_target_ds,
g_target_sx, cue_sx] )
viewport_gs_tgt_cue_ds= Viewport( screen=screen,
stimuli=[fixation_p, inner_fixation_p, g_target_ds,
g_target_sx, cue_ds] )
"""target gabors and cues"""
"""defining contrast function: pattern reversal 5 and 8 Hz"""
def contrast_controllerds( t ):
return sin(8.0*2.0*pi*t)
def contrast_controllersx( t ):
return sin(5.0*2.0*pi*t)
"""defining contrast function: pattern reversal 5 and 8 Hz"""
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
p = Presentation(go_duration=(random.randint(5,10),'seconds'),
viewports=[viewport_gs_stand_cue_sx])
p.add_controller(g_standard_ds,'contrast',FunctionController(during_go_func=contrast_controllerds))
p.add_controller(g_standard_sx,'contrast',FunctionController(during_go_func=contrast_controllersx))
p.go()
R = Presentation(go_duration=(0.2,'seconds'),
viewports=[viewport_gs_tgt_cue_sx])
R.add_controller(g_target_ds,'contrast',FunctionController(during_go_func=contrast_controllerds))
R.add_controller(g_target_sx,'contrast',FunctionController(during_go_func=contrast_controllersx))
R.go()
S = Presentation(go_duration=(random.randint(5,10),'seconds'),
viewports=[viewport_gs_stand_cue_sx])
S.add_controller(g_standard_ds,'contrast',FunctionController(during_go_func=contrast_controllerds))
S.add_controller(g_standard_sx,'contrast',FunctionController(during_go_func=contrast_controllersx))
S.go()
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
q = Presentation(go_duration=(random.randint(5,10),'seconds'),
viewports=[viewport_gs_stand_cue_ds])
q.add_controller(g_standard_ds,'contrast',FunctionController(during_go_func=contrast_controllerds))
q.add_controller(g_standard_sx,'contrast',FunctionController(during_go_func=contrast_controllersx))
q.go()
U = Presentation(go_duration=(0.2,'seconds'),
viewports=[viewport_gs_tgt_cue_ds])
U.add_controller(g_target_ds,'contrast',FunctionController(during_go_func=contrast_controllerds))
U.add_controller(g_target_sx,'contrast',FunctionController(during_go_func=contrast_controllersx))
U.go()
V = Presentation(go_duration=(random.randint(5,10),'seconds'),
viewports=[viewport_gs_stand_cue_ds])
V.add_controller(g_standard_ds,'contrast',FunctionController(during_go_func=contrast_controllerds))
V.add_controller(g_standard_sx,'contrast',FunctionController(during_go_func=contrast_controllersx))
V.go()
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
- Follow-Ups:
- [visionegg] Re: trigger
- From: Andrew Straw
Other related posts:
- » [visionegg] trigger
- » [visionegg] Re: trigger
- » [visionegg] Re: trigger
- » [visionegg] Re: trigger
- [visionegg] Re: trigger
- From: Andrew Straw