[visionegg] DropinGUI problems with variable recognition

  • From: Bart Geurten <bart.geurten@xxxxxxxxxxxxxxxx>
  • To: visionegg@xxxxxxxxxxxxx
  • Date: Wed, 15 Nov 2006 17:52:04 +0100

Hi everyone,

I wrote a little script which should be able to move gabor patches and change their contrast etc. The script is based on the gabor demo script. The script works well but the flagged variables (or magic comments if you like) are not recognized by the dropinGui.

The script loads up and can be run without problems, but where you should be able to alter the variable value, it just says 'not found'. I also tried the script you mailed Joe Voss in Oct. 2004 and its variables are also 'not found'.

Does anyone know how to solve that problem or where the variable list (calles vars_list) I think is parsed? I used python 2.4 and visionegg 1.0

thanks

Bart


CODE

#!/usr/bin/env python
"""Sinusoidal grating in a gaussian mask for characterisation of HS neurons"""

############################
#  Import various modules  #
############################

# Status: in progress
# Last update: 15.11.06
# Author: Bart Geurten (based on gabor.py demo script)



import VisionEgg
VisionEgg.start_default_logging(); VisionEgg.watch_exceptions()

from VisionEgg.Core import *
from VisionEgg.FlowControl import Presentation
from VisionEgg.Gratings import SinGrating2D
from VisionEgg.Textures import Mask2D
from VisionEgg.MoreStimuli import *

#####################################
#  Initialize OpenGL window/screen  #
#####################################

screen = get_default_screen()

#########################
#Configuration Variables#
#########################

patch_size = 10 # units of pixel

#Position settings & prevention of an 'out of bounds' stimulus#
patch_position_X = 512 # units of pixel
if  patch_position_X > screen.size[0] - patch_size/2.0:
    patch_position_X = screen.size[0] - patch_size/2.0
if  patch_position_X < 0 + patch_size/2.0:
    patch_position_X = 0 + patch_size/2.0

patch_position_Y = 512 # units of pixel
if  patch_position_Y > screen.size[1] - patch_size/2.0:
    patch_position_Y = screen.size[1] - patch_size/2.0
if  patch_position_Y < 0 + patch_size/2.0:
    patch_position_Y = 0 + patch_size/2.0

spatial_freq = 10.0 # units of cycles/pixel
temporal_freq = 1.0 # Hz
orientation = 0 # down = 270 | left = 180 |up = 90 | right = 0
duration = 5.0 # units of seconds
contrast = 1.2 # If Contrast is higher than 1.0 a contrast ramp will be presented

# dirty little hack variables
set_once = 1
start_time = 0

#######################
# Controler functions #
#######################

def grating_contrast(t):
    global set_once, start_time, contrast

    # If Contrast is higher than 1.0 a contrast ramp will be presented
    if contrast > 1.0:

        if set_once == 1:
            set_once = 0
            start_time = t

        contrast_out = (t - start_time)/ duration
    else:
        contrast_out = contrast

    return contrast_out


def onset_target_color(t):
    TColor = (0.0,0.0,0.0,1.0)
    return TColor

##########################################################
#  Create sinusoidal grating object and gaussian window  #
##########################################################

onsetTarget = Target2D(     position=(screen.size[0]-20.0,20.0),
                            anchor='center',
                            size=(40.0,40.0))

mask = Mask2D(function='gaussian',   # also supports 'circle'
radius_parameter=patch_size, # sigma for gaussian, radius for circle (units: num_samples) num_samples=(512,512)) # this many texture elements in mask (covers whole size specified below)

stimulus = SinGrating2D(mask             = mask,
position = ( patch_position_X,patch_position_Y), size = ( screen.size[0]* 5, screen.size[1]*5), spatial_freq = spatial_freq / screen.size[0], # units of cycles/pixel
                        temporal_freq_hz = temporal_freq,
                        orientation      = orientation )

###############################################################
#  Create viewport - intermediary between stimuli and screen  #
###############################################################

viewport = Viewport( screen=screen, stimuli=[stimulus, onsetTarget] )

#############################################################
#  Create presentation object, function controllers and go!  #
#############################################################

p = Presentation(go_duration=(duration,'seconds'),viewports=[viewport])

# Create instances of the Controller class
onset_target_controller = FunctionController(during_go_func=onset_target_color) grating_contrast_controller = FunctionController(during_go_func=grating_contrast)

p.add_controller(onsetTarget,'color', onset_target_controller)
p.add_controller(stimulus,'contrast',grating_contrast_controller)

p.go()

#################################
#  Flag controllable variables  #
#################################


#%f patch_position_X
#%f patch_position_Y
#%f spatial_freq
#%f temporal_freq
#%f orientation
#%f duration
#%f contrast
--
Bart Geurten
Diplom Biologe
Lehrstuhl fuer Neurobiologie
Fakultaet fuer Biologie
Universitaet Bielefeld
Postbox 10 01 31
33501 Bielefeld
Germany

tel: + 49 (0)521 106 - 5737
fax: + 49 (0)521 106 - 89034
Email: bart.geurten@xxxxxxxxxxxxxxxx
http://www.uni-bielefeld.de/biologie/Neurobiologie/index.html
-------------------------------------------------------------
This email message is intended only for the addressee(s)
and contains information that may be confidential and/or
copyright.  If you are not the intended recipient please
notify the sender by reply email and immediately delete
this email. Use, disclosure or reproduction of this email
by anyone other than the intended recipient(s) is strictly
prohibited. No representation is made that this email or
any attachments are free of viruses. Virus scanning is
recommended and is the responsibility of the recipient.
======================================
The Vision Egg mailing list
Archives: //www.freelists.org/archives/visionegg
Website: http://www.visionegg.org/mailinglist.html

Other related posts:

  • » [visionegg] DropinGUI problems with variable recognition