Package VisionEgg :: Module FlowControl :: Class Presentation |
[frames] | no frames]

# Class Presentation

source code

             object --+
                      |
    ClassWithParameters --+
                          |
                         Presentation

    Handles the timing and coordination of stimulus presentation.

    This class is the key to the real-time operation of the Vision
    Egg. It contains the main 'go' loop, and maintains the association
    between 'controllers', instances of the Controller class, and the
    parameters they control.

    During the main 'go' loop and at other specific times, the
    parameters are updated via function calls to the controllers.

    Between entries into the 'go' loop, a Vision Egg application
    should call the method between_presentations as often as possible
    to ensure parameter values are kept up to date and any
    housekeeping done by controllers is done.

    No OpenGL environment I know of can guarantee that a new frame is
    drawn and the double buffers swapped before the monitor's next
    vertical retrace sync pulse.  Still, although one can worry
    endlessly about this problem, it works.  In other words, on a fast
    computer with a fast graphics card running even a pre-emptive
    multi-tasking operating system (see below for specific
    information), a new frame is drawn before every monitor update. If
    this did become a problem, the go() method could be re-implemented
    in C, along with the functions it calls.  This would probably
    result in speed gains, but without skipping frames at 200 Hz, why
    bother?

    Parameters
    ==========
    check_events                 -- allow input event checking during 'go' loop? (Boolean)
                                    Default: True
    collect_timing_info          -- log timing statistics during go loop? (Boolean)
                                    Default: True
    enter_go_loop                -- test used by run_forever() to enter go loop (Boolean)
                                    Default: False
    go_duration                  -- Tuple to specify 'go' loop duration. Either (value,units) or ('forever',) (Sequence of AnyOf(Real or String))
                                    Default: (5.0, 'seconds')
    handle_event_callbacks       -- List of tuples to handle events. (event_type,event_callback_func) (Sequence of Sequence2 of AnyOf(Integer or Callable))
                                    Default: (determined at runtime)
    override_t_abs_sec           -- Override t_abs. Set only when reconstructing experiments. (units: seconds) (Real)
                                    Default: (determined at runtime)
    quit                         -- quit the run_forever loop? (Boolean)
                                    Default: False
    trigger_armed                -- test trigger on go loop? (Boolean)
                                    Default: True
    trigger_go_if_armed          -- trigger go loop? (Boolean)
                                    Default: True
    viewports                    -- list of Viewport instances to draw. Order is important. (Sequence of Instance of <class 'VisionEgg.ClassWithParameters'>)
                                    Default: (determined at runtime)
    warn_longest_frame_threshold -- threshold to print frame skipped warning (units: factor of inter-frame-interval) (Real)
                                    Default: 2.0
    warn_mean_fps_threshold      -- threshold to print observered vs. expected frame rate warning (fraction units) (Real)
                                    Default: 0.01

Instance Methods
__init__(self, **kw) Create self.parameters and set values. | source code
add_controller(self, class_with_parameters, parameter_name, controller) Add a controller | source code
remove_controller(self, class_with_parameters, parameter_name, controller=None) Remove one (or more--see below) controller(s). | source code
is_in_go_loop(self) Queries if the presentation is in a go loop. | source code
were_frames_dropped_in_last_go_loop(self) | source code
get_last_go_loop_start_time_absolute_sec(self) | source code
go(self) Main control loop during stimulus presentation. | source code
export_movie_go(self, frames_per_sec=12.0, filename_suffix=".tif", filename_base="visionegg_movie", path=".") Emulates method 'go' but saves a movie. | source code
run_forever(self) Main control loop between go loops. | source code
between_presentations(self) Maintain display while between stimulus presentations. | source code
Inherited from `ClassWithParameters`: `__getstate__`, `__setstate__`, `get_specified_type`, `is_constant_parameter`, `set`, `verify_parameters` Inherited from `object`: `__delattr__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__repr__`, `__setattr__`, `__str__`

Class Variables
| parameters_and_defaults = `{'viewports':(None, ve_types.Sequenc`...``
Inherited from `ClassWithParameters`: `__safe_for_unpickling__`, `constant_parameters_and_defaults`

Properties
Inherited from `object`: `__class__`

Method Details

### __init__(self, **kw) (Constructor) | source code
    Create self.parameters and set values.
Overrides: ClassWithParameters.__init__ (inherited documentation)

### remove_controller(self, class_with_parameters, parameter_name, controller=None) | source code
    Remove one (or more--see below) controller(s).

    If controller is None, all controllers affecting the
    specified parameter are removed.

    If class_with_parameters and paramter_name are None, the
    controller is removed completely

    If class_with_parameters, paramter_name, and controller are
    all None, all controllers are removed.

### is_in_go_loop(self) | source code
    Queries if the presentation is in a go loop.

    This is useful to check the state of the Vision Egg
    application from a remote client over Pyro.

### go(self) | source code
    Main control loop during stimulus presentation.

    This is the heart of realtime control in the Vision Egg, and
    contains the main loop during a stimulus presentation. This
    coordinates the timing of calling the controllers.

    In the main loop, the current time (in absolute seconds,
    go-loop-start-relative seconds, and go-loop-start-relative
    frames) is computed, the appropriate controllers are called
    with this information, the screen is cleared, each viewport is
    drawn to the back buffer (while the video card continues
    painting the front buffer on the display), and the buffers are
    swapped.

### between_presentations(self) | source code
    Maintain display while between stimulus presentations.

    This function gets called as often as possible when in the
    'run_forever' loop except when execution has shifted to the
    'go' loop.

    Other than the difference in the time variable passed to the
    controllers, this routine is very similar to the inside of the
    main loop in the go method.

Class Variable Details

  ### parameters_and_defaults Value:
      {'viewports':(None, ve_types.Sequence(ve_types.Instance(VisionEgg.Clas
      sWithParameters)), 'list of Viewport instances to draw. Order is impor
      tant.'), 'collect_timing_info':(True, ve_types.Boolean, 'log timing st
      atistics during go loop?'), 'go_duration':((5.0, 'seconds'), ve_types.
      Sequence(ve_types.AnyOf(ve_types.Real, ve_types.String)), "Tuple to sp
      ecify 'go' loop duration. Either (value,units) or ('forever',)"), 'che
      ck_events':(True, ve_types.Boolean, "allow input event checking during
       'go' loop?"), 'handle_event_callbacks':(None, ve_types.Sequence(ve_ty
      ...