Welcome Guest, you are in: Login

ScrewTurn Wiki



Search the wiki


Old Roulette Element

Modified on 2018/07/11 14:25 by Administrator Categorized as Base Elements, Elements, Randomization

Element Icon LPT Port
Category: Communication AddIn: Base Layer
Creator: OkazoLab Scope: Parent event
Owns Snippets:   Triggered Usage: Snippets
== Synchronized actions


Generic Properties

NameProperty description                                     ConstraintsTypeOn change
Is Enabled        If set to false the element is completely omitted when the experiment is run                 Boolean         
Title        Title of the element                 String         
Port Settings
Base Address        Defines the base address the LPT port, for example 0x0378 (888)                 Int32         
Working Mode        Defines a working mode for the element.Select the 'AutoOutput on event onset' mode for sending signals synchronously with an onset of the parent event,or 'Triggering on input' mode for catching the particular pattern in port input. For custom reading/writing scenarios use the 'Manual IO' mode, in which port communication can be controlled by your code.                 stParallelPortMode         
Test Input        Open a input monitor window showing real-time port input with the current settings. Use for testing at designtime.                 Boolean         
Input Value        Returns the current state of the port input lines. The property is updated automatically only in the Triggering Input mode. The value can be read either to the integer or binary formats, e.g. 'string S=Input;' may return '01010101'                 clBinaryInteger         
Triggering Value        When the element is in the 'Triggering input' working mode, a value of this property defines the 'catching' input pattern in the binary format. If the pattern is detected in port input at any time, the element registers the detection time and becomes triggered. The Triggering Input has to be defined for each of the port line, e.g. '1111****' can be used for detection of the ON state in the first 4 lines of a 8-bit port. Use either '0' or '1' chars for the relevant lines and and the '*' char for irrelevant. Set all lines to *, if you want to detect any change in the port input.                 String         
Trigger Once        Defines whether the element can be triggered multiple times, while the parent event is active. If the property value is 'true' only the first triggering is registered                 Boolean         
Signal Profile        Defines the time-amplitude profile of the output signal.'Level Change', 'Pulse' and 'TTL' profiles are available                 stParallelPortSignalShape         
Preface Duration        Defines the duration (ms) of the guarantied zero preface interval for the TTL or Pulse signals. Increase the preface duration marginally, if your recording hardware does not detect port signals. Note that a non-zero preface delays the onset of the actual signal.                 Double         
Pulse Duration        Duration of a single output pulse in ms. The value is applied only if the Pulse signal profile is selected                 UInt64         
Interpulse Duration        Defines a duration of the inter-pulse interval in ms. The value is applied only if the Pulse  signal profile is selected                 clTime         
Pulse Number        Defines a number of pulses in the pulse train. The value is applied only if the Pulse signal profile is selected                 Int32         
Output Value        Value to be sent through the port. Can be defined in integer or binary format, e.g. Output='01010000'; or Output=255;                 clBinaryInteger         
Send Output Now        Runtime action initiating an instant output communication through the port. Call this action in snippets by 'SendNow=true;', but only if the element works in the 'Manual I/O' mode.                 Boolean         
Runtime Status
Is Triggered        Indicates whether the element has been triggered at least once since activation of the parent event.Triggering occurs only in the 'Input Detection' working mode                 Boolean         
Triggering Time        Indicates the local event time of the last element triggering. Triggering occurs only in the 'Input Detection' working mode.                 clTime         

Roulette is an element that is designed to produce flexible randomization scenarios in your experiment. In the simplest case it works as a random number generator.


In the simplest case it works as a random number generator. For more complicated scenarios it can generate the balanced random blocks of integer numbers and provides a runtime control over them. A simple roulette random number generator can be created by choosing an appropriate event and selecting EventAdd Element command and selecting Roulette under the Design section.


Snapshot 1

Snapshot 1

Snapshot 2

Snapshot 2

Practical Use

A Simple Random Number Generator

Many experiments require the use of simple random number generators for independent, non-blocked features of the design. In a visual task for example it may be necessary to randomly rotate the stimuli on each trial. This factor is unrelated to the experimental factors that will be manipulated in the design (see next section). Once the new Roulette element has been added, it is necessary to amend certain properties in order to get it to behave as appropriately. If the random number generator is simply that, then it is necessary to set the range of the random numbers that are desired in the Factors box by specifying the highest number in the range and placing the letter x behind it. If a stimulus is going to be rotated by a random number of degrees upon each trial for example, then we would set the factors box to read “360x”.

It is of course necessary to specify via code, the parameter that will be controlled by the random number that has been generated.

Experimental Factors and Blocking

Most experiments will have a roulette counter to ensure that the main experimental factors are randomly presented, a specific number of times, within each block. If, under the Roulette properties, the property for Blocking is set to ‘True’, then the main levels of the experimental variables can be defined. Under Factors the levels of each experimental variable should be written as ‘2x3x3’ or ‘2x2’ etc. The Block Length will then be calculated, and if a certain variable should be more frequent then others, then this can be manipulated via the Value Frequencies option.

It is of course necessary to assign the output of the Factored Random Value as a multiparameter array (see Parameters and then in the code snippets, assign the individual parameters of this array to variable names. It is then necessary to specify what the properties of these parameters should be, in the differing levels of each variable. See the bottom of this page for a more detailed example.

In the example below, Blocking is set to "true", and the experimental design in outlined in the Factors box as 2x2x2x3x4. A multi parameter array named ‘fRandomValue’ (visible in orange) has been assigned to the property Factored Random Value. The individual parameters of this array have been assigned specific names in the snippets box. The last factor (x4) has not been defined. This means that each of the conditions that have been defined, will be repeated 4 times – thus lengthening the duration of each block. Given that the first parameter in the array ‘TContrast’ can be only one of two values (as defined in the Factors box), only four simple lines of code are required to specify what EventIDE should do for each of the 2 levels of this factor. In this example, the shared ‘Colormask’ property of three different elements has been assigned as a multi-parameter array, and the RGB values of this color mask manipulated as required. See the section parameters for more information on manipulating the properties of individual elements.

Distance=fRandomValue [3];


ScrewTurn Wiki version Some of the icons created by FamFamFam.