Now Shipping! – The EyeLink 3; combined head and eye tracking at up to 1000 Hz.

FAQ: How can I use Python Custom Class in Experiment Builder?
#1
Experiment Builder Custom Class is an advanced Python 2.7 component that enables code-based solutions for tasks that are difficult or impractical to implement via the GUI.

To enable this feature, navigate to Edit > Preferences and check Enable Custom Class. Once enabled, you can create or import a script into Library > Custom Class. The default 'New' script includes commented example code demonstrating class definitions, as well as getter and setter methods.

For practical applications, refer to the Webinars and Template Examples linked below, which showcase different use cases and implementation guidance. Documentation for this feature is still in development and will be added to this page in the future.

Webinars
Template Examples
Documentation / Guides
This section will be expanded as documentation is created.


Header Information
This section of commented code is automatically added to the top of custom class scripts that are created. It provides the basic rules for custom class construction.
Code:
# -*- coding: UTF-8 -*-
##############################################################################
# CustomClass Rules                                                          #
# =================                                                          #
#                                                                            #
#1. All custom classes must inherit sreb.EBObject and the constructor        #
#   must call sreb.EBObject's constructor. If a class starts with _ then it  #
#   is considered internal and will not be treated as a custom class.        #
#                                                                            #
#2. The custom class will only use the default constructor.                  #  
#   ie. a constructor with no parameters.                                    #
#                                                                            #
#3. To add a property provide getter and have an attribute that does not     #
#   starts with an underscore(_) or an upper case letter, and have the       #
#   attribute of a know type. Known types are int,float,str,EBPoint,EBColor, #
#   tuple, and list.                                                         #
#   If an attribute's default value is of type tuple and only has two        #
#   items, the property will be treated as an EBPoint. Similarly, if an      #
#   attribute's default value is a tuple of 3 items the property will be     #
#   treated as an EBColor.  The input type of the setter and the output type #
#   of the getter is expected to be the same as the type of the attribute.   #
#                                                                            #
#4. If only getter is provided, the property will be a readonly property.    #
#                                                                            #
#6. The custom class may be instanciated during development to obtain        #
#   class info. Avoid such things as display mode change, remote connections #
#   in the constructor.                                                      #
#                                                                            #
#7. Any method in the custom class can be called using the Execute action    #
#   By default, the return type of the method is string unless a doc string  #
#   with the following constraint is available                               #
#    a. The doc string starts with "RETURN:" (case matters)               #
#       b. Following the text "RETURN:" provide a default value of the type  #
#          or the __repr__ value of the class. eg. str for string            #
#8. If a property's setter metthod has default values for it's parameters,   #
#    the property will not accept references or equation.                    #
##############################################################################