# Module Documentation

## Contents

- Overview
- Core Modules

- HUD Text
- Fixation Cross
- HUD Image
- Billboard Image
- Bllboard Image List
- Billboard Video
- Billboard Camera
- Sound
- Keyboard
- Joystick
- Python Script
- OpenGL Viewer
- Trigger
- GL Grid

- Additional Modules

- Stroke Stick
- Avatar
- Avatar Animation
- Motion Capture IK
- VisuoTactile
- Center Reachout Task
- Trajectory Following
- Optic Flow
- Fusion Core Tracker
- OS5000 Tracker
- Freespace Tracker
- Stereo IR Tracker
- StrokeRobot
- BCI Interface
- CUI Tracker
- Poly Bot
- Mono Bot
- Arduino BVP
- Arduino

## Overview

ExpyVR is composed of a set of Python-programmed, independent modules which, though they cover a wide range of functions, can be easily embedded and combined into an experiment by adding them to the timeline of an experimental flow. Here we explain some of the specific modules which have been programmed, their parameters, and their potential use. New modules can be easily added -- more details can be found in the Programmer's Guide.
There are some common properties for several modules, described here and referenced in the modules descriptions bellow:

- DISP : the module can display something on screen.
- INPUT :the module can react to user input.
- HUD : it is a Head Up Display, a rendering mode for 2D which has no depth information. It is rendered in the order of execution of the time line (from top to bottom) and displayed in front of elements rendered before (and behind those rendered after).
- 3D : it is displayed in 3D, taking a depth parameter into account. The order of execution does not matter (as opposed to HUD). Often a 3D module offers the 'keyboard movable' option which allows to move the object in 3D in order to place it (using left, right, up, down, page-up,and page-down keys).
- STEREO: means there is the possibility to choose to which eye it is displayed when using a stereoscopic display mode.
- PAUSE : the module can suspend the execution of the experiment when starting (a DISP module) or un-suspend on user action (INPUT). Warning: pausing the experiment timer (as seen in log files) could create disparities between relative times if synchronizing across programs.
- END: the module can end the execution of the routine (for INPUT modules) to continue to the next routine.
- LOG: the events occurring to the module are saved to a separate CSV file (for analysis).

Note that we use the terms module and component interchangeably in this guide. Also, as many individual modules are still in development and being added on a regular basis, this documentation might therefore not always be up-to-date.

Back to contents

### Core Modules

These modules make the core set of modules in ExpyVR, and are likely to be used across many types of experiments.

| HUD Text: Display text in 2D
DISP HUD PAUSE | text: text to display (multiple lines is possible). font, size, color, italic, bold ; Various font properties withFrame: display text within a semi-transparent grey frame or not (for better readability) posx / posy : where to display text. Values must be a percentage of the window size as measured from the bottom left corner (ie: 50/50 is in the middle). pause_on_start: Pauses experiment, suspending the timer, until another component "unpauses".
| HUD Text File: Display lines of text of a .csv file in 2D
DISP HUD PAUSE |
| Fixation Cross : Display a fixation cross in 2D
DISP HUD PAUSE | shape: shape of the fixation cross size : size of fixation cross (in terms of % of screen) pensize : width of the stroke of the font (in pixels) color : color of fixation cross. In RGB + alpha (opacity), i.e. (R,G,B,alpha) : (0-255, 0-255, 0-255, 0-255). posX / posY : where to display the cross. Values must be a percentage of the window size as measured from the bottom left corner (ie: 50/50 is in the middle).
| HUD Image: Display an image in 2D
DISP HUD PAUSE | filename : name of the image file to open (PNG, BMP, GIF, JPG). scale : scale of the image, in % of window width. posX / posY : where to display the image. Values must be a percentage of the window size as measured from the bottom left corner (ie: 50/50 is in the middle). angle; rotation of the image (value in degrees) alpha: opacity of the image (0.0 is transparent, 1.0 is opaque)
| Billboard Image: Display an image on a billboard in the 3D scene.
DISP 3D STEREO PAUSE | keyboard_movable: for debug, allows to use keyboard (arrows left, right, up down and page up, page down) to move the billboard in the scene (X, Y and Z axis). filename : name of the image file to open (PNG, BMP, GIF, JPG). mask: name of the image file to use as opacity mask; colors of the mask (RGB & alpha) multiply the colors of pixels of the image (opaque white image does not do anything). scale : scale the image by this factor (1.0 for original size) aspect ratio: deforms the image by changing its aspect ratio (width / height) x: position in the X axis y: position in the Y axis depth: position in the Z axis angle; rotation of the billboard in the Z axis (value in degrees) alpha: opacity of the billboard (1.0 is 100% visible) flip: horizontal flip to get a mirror image
| Billboard Image List: Display an image from a sequence on a billboard in the 3D scene.
DISP 3D STEREO PAUSE LOG | files : template name of the image files to open (PNG, BMP, GIF, JPG). The template name must contain a '*' character as a wildcard placeholder for the index of the image (e.g. img*.jpg means all images named img0.jpg, img1.jpg, img2.jpg, etc.). preload : loads every images to memory (RAM) before starting the experiment; the display is then instantaneous, but preloading can be very long for many files. keys : keys (pyglet keyboard symbol) to be used to browse into the list of images. index: index of the image to display (e.g. index 1 loads img1.jpg)) scale : scale the image by this factor (1.0 for original size) aspect ratio: deforms the image by changing its aspect ratio (width / height) x: position in the X axis y: position in the Y axis depth: position in the Z axis angle; rotation of the billboard in the Z axis (value in degrees) alpha: opacity of the billboard (1.0 is 100% visible) flip: horizontal flip to get a mirror image
| Video: Display a video on a billboard in the 3D scene.
DISP 3D STEREO PAUSE | filename : name of the video file to open ( AVI, DivX, H.263, H.264, MPEG, MPEG-2, OGG/Theora, Xvid, WMV). mask: name of the image file to use as opacity mask; colors of the mask (RGB & alpha) multiply the colors of pixels of the image (opaque white image does not do anything). loop : restart the video when at end volume : volume of audio output (in %) scale : scale the image by this factor (1.0 for original size) aspect ratio: deforms the image by changing its aspect ratio (width / height) x: position in the X axis y: position in the Y axis depth: position in the Z axis angle; rotation of the billboard in the Z axis (value in degrees) alpha: opacity of the billboard (1.0 is 100% visible) flip: horizontal flip to get a mirror image Comments: Pausing the execution (e.g. with the pause_on_start option) also pauses the playing of the video The activation time-line determines when the movie is playing
| Webcam: Display the image of a webcam on a billboard in the 3D scene.
DISP 3D STEREO | opencvid: identifier of the webcam (0, 1, and 2 should work, more is unknown) opencvmaxwidth : maximum width of the opencv frames, this allows to limit the frame sizes for webcams which allows to select different resolutions (e.g. 320, 640, 1024, 1280). Lower resolution means higher frequency. update_time: update interval in second (e.g. 0.33 is 30Hz). If you don't know the update interval for your webcam, leave it to zero; the module will determine it automatically at init (the value determined automatically is shown in the logs; you can use it afterwards) bg_subtract_key: list of keyboard codes (pyglet keyboard symbol) to define the keys initiating the background subtraction (capture a frame of the background) bg_subtract_thresh: luminance difference threshold used to subtract the background from the rest of the captured frames [0 256] delay: delay between captured frames and displayed frames, in seconds (e.g. 0.4s). mask: name of the image file to use as opacity mask; colors of the mask (RGB & alpha) multiply the colors of pixels of the image (opaque white image does not do anything). scale : scale the image by this factor (1.0 for original size) aspect ratio: deforms the image by changing its aspect ratio (width / height) x: position in the X axis y: position in the Y axis depth: position in the Z axis angle: rotation of the billboard in the Z axis (value in degrees) alpha: opacity of the billboard (1.0 is 100% visible) flip: horizontal flip to get a mirror image greyscale: convert frames to greyscale
| Sound: Play an audio file (*.wav, *.mp3, etc.)
| filename : name of the audio file to open ( .WAV ) loop:
| Whitenoise: Play an audio white noise
| Keyboard: Listen to keyboard events, log their timing, and possibly unpause the script.
| Joystick: Listen to joystick events, log their timing, and possibly unpause the script.
| Serial: Listen to a serial port and expose data for scripting.
| Trigger: Send triggers on the parallel port.
| How to setup Parrallel port with inPout interface: 1 - Uncompress the InpOutBinaries_1500.zip (in ExpyVR\expyvr\resources\deployment) 2 - copy the win32 folder locally in your computer (e.g. desktop) 3 - run the InstallDriver.exe : agree to the dialog box (enter credentials if required) (4) - For x64 systems, copy the corresponding inpout32.dll into the 'expyvr/lib/' directory (replace the file)
| Script: Generic placeholder for Python code.
| OpenGL: Generic placeholder for OpenGL code to render 3D objects
| GL Grid:Simple 3D grid to help visualize the space and location of objects in 3D
| AltTab:Simulate the [Alt][Tab] to switch between application windows.

Back to contents

### Additional Modules

These modules extend ExpyVR, often in an experiment-specific manner. As such, only a quick explanation
of the module will be given so that you can get an idea for what it could be used. If you want further information,
contact the author of the module.

| Micophone: This module was developed in order to record auditory (microphone-based) reaction times. Default sampling rate is 22 000Hz, and default frames per buffer is 200. Changing these values will have close to zero impact, as this only changing the sampling rate of the underlying module on which the microphone module is built upon. Checking "EndRoutine" will end the visualization of on-line intensities being recorded as soon as a supra-threshold intensity is recorded. "Record" is in a sense it's counterpart, as it will record all data, even after the first supra-threshold value has been recorded. Threshold has to be determined for the specific environment in which the experiment will be run. The Microphone module updates every 17 milliseconds.
| Avatar :
| Avatar Animation:
| Motion Capture IK:
| Visuo-tactile:
| Avatar:

Last update: 22.10.2011 | Author: Nathan Evans