Color Selection and Scaling
The program cds has been developed for detection and scaling
experiments related to color vision. The subject is shown color patches and
has to select one of them or has to detect a color patch in a background and
a distractor set. Adjustment and adaptive procedures also are possible. This
may be used to find unique hues or to run threshold experiments.
Color Stimulus Definition
There are 5 color stimuli available. They are called a, b, c, d, and
t. The string positions controls which of these five stimuli are
visible and where the stimulus' position is. The color coordinates of a,
b, c and d have to be specified in the parameter file. The coordinates
of t usually are computed as a convex mixture of a and b. The equation
t = w * a + (1.0 - w) * b,
where 0 <=w <=1 has to hold.
The coordinates of a are given by the parameters ax, ay, and
aL, those of b by bx, by, and bL. The factor
w is defined by the parameter aweight.
Special values for aweight may be used to make t identical to
a or b. The parameter aweight may also be used as an adaptive
variable in adaptive procedures.
The stimuli a and b must be defined, but they need not be visible.
Even t need not be visible, although it is always computed and stored into
the data file. Its coordinates are tx,
ty, and tL.
The coordinates of c and d are cx, cy, cL, dx,
dy, and dL respectively.
The stimulus patches are numbered clockwise and their centers are positioned
equally distant on a circle around the center of the screen. The circle's
radius is patchdist. The position of the first patch on the circle is
given by firstangle. This parameter gives the angle between the
horizontal and a line from the screen center to the patch. The patches are
circular, square or rectangular with their size defined by
diameter. The form is defined by patchtype. If the flag L is
set then the patches are positioned on a horizontal line, not on a circle and
patchdist is the distance between two patch centers.
The number and sequence of stimulus patches is defined by the string
positions. The string contains one of the letters
"a", "b", "c", "d", or "t" for each position. The
number of letters gives the number of patches and the letter gives the name
of the stimulus which is mapped to the respective position. Patches are
ordered from left to right according to their names in positions if the
flag L is set.
If the flag T is set then the position of t is selected randomly.
The string positions need not contain the letter "t" in this case.
The actual position of the test stimulus t is stored in the parameter
The adaptation field has width fieldwidth and height
fieldheight. Its color is defined by fieldcolx, fieldcoly, and
fieldlum. If the flag R is set then the adaptation field is
rectangular, otherwise it is elliptical.
A fixation mark of size
fixmark and luminance fixmarklum may be shown at the center of the
adaptation field. If fixmark is 0 then there is no fixation mark. If
the flag S is set then the adaptation background for the patch areas is
controlled separately from the rest of the adaptation field. Its color is
then defined by patchx, patchy, and patchL,
Responses and Response Keys
The subject's response usually is to select one of the color patches. The
mapping of response keys to stimulus patches is done via the array
keys. It contains the response key numbers which are associated with
the color patches as they are ordered in the string positions.
Thus keys must have the same number of entries as
positions. To make patches unselectable one can set the corresponding
key number to numbers which cannot be generated by response keys, like
-1. The following example defines four stimulus patches, the target
stimulus t is positioned randomly and may be selected by one of the keys
labeled "4", "5", "2", and "1" in the separate numeric
section of the keyboard. Remember that the ASCII code of those numeric keys
is 48 plus the respective number.
positions = "bbbb" /* 4 patches filled with color b */
firstangle = 1350 /* top left patch is 1st */
flags = "TRl" /* random target position,
rectangular background field */
switchtype = 0 /* keyboard response */
keys = [48+4, 48+5, 48+2, 48+1] /* keys are: 4, 5, 2, 1 */
evaluation = 2 /* evaluate whether target detection */
Every stimulus patch not containing the target t contains
stimulus b. The arrangement is such that the first stimulus is the top
left patch at 135deg. The stimulus field has two lines and two columns.
The parameter evaluation determines how responses are evaluated.
The result of the evaluation is stored in response and the response
time is stored in rtime. The following types of evaluation are possible:
evaluation = 0. No special evaluation is done and
response is set to the position which corresponds to the response key.
evaluation = 1. The response is coded as a yes/no response.
"yes" corresponds to the selection of a or d and
"no" to the selection of b or c. This is useful for adaptive designs
where "yes" leads to an increase of the adaptive variable and
"no" to a decrease. If aweight is the adaptive variable then a
decrease of aweight reduces the similarity of the target stimulus t
evaluation = 2. This also leads to yes/no coding of the response.
The response is "yes" if the target t is selected and "no" if any
other position is selected. This is useful for detection tasks where the
subject has to find the target stimulus among several distractors.
Random Intensity Variation
Some experiments require a random fluctuation of distractor stimuli. An
example is a detection experiment where the distractors vary in brightness
and the task is to detect one deviant color among the distractors.
Such a random variation of stimulus intensity is done when the flag
C is set. If this is the case then
fluctuation is half of the luminance range for the distractor stimuli.
Thus if C is set then the effective luminance of the distractor stimuli
(this are all displayed stimuli not equal to a, b, and t)
is in the interval (1.0 +- fluctuation) * L, where L is the
luminance given in the parameter file.
For detection experiments it may be necessary to present a sound cue while
the target stimulus is shown in order to indicate the presentation interval.
This is done if soundcue is positive. It gives the cue's duration.
cuepitch gives its frequency and aftercue is the delay between the
cue off and stimulus on event.
There are two different adjustment procedures available to set the
target color t. If the flag A is set then the color of t may be
adjusted by mouse movements. With no buttons pressed the mouse moves in the
CIE xy-chromaticity diagram and the color coordinates of t are set
accordingly. When a
single button is pressed, then mouse motion controls the luminance of t
while chromaticity is kept constant.
If the flag M is set then t also is adjusted by mouse movements,
however, motion in color space is restricted to the line connecting colors
a and b.
In this case the parameter actually adjusted is the weight w
in the mixture \eqrefcdsmix.
Pressing the stopkey signals the program that adjustment is
- aftercue (int)
- Pause between end of sound cue and beginning of the patch
- aweight (float)
- Weight of the stimulus a for computing the target
stimulus t = aweight*a + (1-aweight)*b.
- ax , ay , aL , bx , by , bL , cx , cy , cL , dx , dy , dL (float)
coordinates of the stimuli a, b, c, and d respectively.
- colortable (float)
- This is a table of xyL-colors. The colors may be
referenced by character entries in the string positions. Character 0
corresponds to the first color in colortable, charcater 1 to the second
... Thus the character ASCII codes are index values for entries in the
color table. This feature may be used to assig arbitray colors to multiple
- cuepitch (int)
- Frequency [Hz] of the sound cue.
- diameter (int)
- Defines color patch size. It is the diameter of the circular
patches and the length of one side for square patches. Nonsquare rectangular
patches have one side equal to diameter and the other equal to
- dsptime (int)
- Stimulus patch display duration. Adjustment methods are run
without time limit.
- evaluation (int)
- Selects the type of response evaluation:
- No special evaluation. Set response to the position
of the response key given in the array keys.
- Recode the response to yes/no, where "yes" corresponds to the
selection of a or d and "no" to the selection of b or c.
- Set response to "yes" if the target t is selected and
to "no" otherwise.
- fieldheight , fieldwidth (int)
- Height and width of the adaptation field.
- firstangle (int)
- The angle between the horizontal and the connection
between the screen center and the center of the first patch.
- fixmark (int)
- Size of the fixation mark. A 0 size means that there is no
- fixmarklum (float)
- Liminance of the fixation mark.
- flags (string)
- These are the possible flags:
- Use a 3-dimensional adjustment method to adjust the target color
t. In this case t is not computed as a mixture from a and b.
- If this flag is ON then the luminance of the distractor
stimuli fluctuates randomly.
- Do not mix target color from a and b but set t directly from
coordinates given in the parameter file or adjusted by the adjustment method.
- Separate stimulus set into two groups and show them next to each
- Use horizontal linear positions for the patches instead of circular
ones. Color patches are ordered from left to right according to their names
- Use an oval adaptation field instead of a rectangular field.
- Repaint the display for each trial.
- Allow definition of a special adaptation color for the color patch
- Randomly position the target stimulus t at any of the positions
in positions. The actual position is stored in target.
- fluctuation (float)
- Gives the random fluctuation range of the distractor
luminance values if the flag C is
set. If C is set then distractor luminances are in the interval
(1.0 +- fluctuation) * L, where L is the luminance given in
the parameter file.
- keys (int)
- Gives the numbers of the possible response keys in a sequence
which simultanously defines how the keys are associated with positions.
For keyboard keys the numbers correspond to the ASCII codes. For switches
the numbers correspond to the standard PXL switch numbers.
- patchdist (int)
- For circular patch positions this is the radius of the
circle where the patches are positioned on. The center of the circle always
is the center of the screen. The patch centers lie on the circle. If the
flag L is set then the patches are positioned on a horizontal line. In
this case patchdist is the distance between centers of adjacent patches.
- patchtype (int)
- Form of patches: 0 = circular disks, 1 = horizontal bars, 2 =
vertical bars, 3 = square bars.
- patchx , patchy , patchL (float)
- Color patch area adaptation color. Used only if
flag S is set. If the flag is clear then the color patch area color is
identical to the adaptation field color.
- positions (string)
- Defines the number of stimulus patches and which stimuli
are shown at the possible positions. Each character in positions is one of
"a", "b", "c", "d", and "t" which corresponds to the
five possible color stimuli a, b, c, d, and the target t.
If the flag T is set then t is positioned randomly. The serial
position of each patch in this array also establishes the correspondence
between the patches and the response keys.
- soundcue (int)
- Duration of sound cue. No sound cue is given if soundcue
- target (int)
- The position number of the target stimulus t. Numbers start
with 1 corresponding to the position at firstangle and run clockwise.
- tx , ty , tL (float)
- Color coordinates of the target stimulus t. Note that
t always is a convex mixture of a and b.
There are 4 color patches where three of them always contain the same color
(b) and one of them contains the target t. The subject't task is to
detect t among the 3 distractors.
The distractor color is white/gray and the target is slightly colored. It
actually is a mixture of white (b) and some highly saturated color which
in color space lies on one of the confusion lines for color blind persons.
Thus the experiment is used to detect color vision anomalies by determining
the discrimination ability along confusion lines in color space. The
distractors' luminance values are randomly fluctuated such the the subject
has to discriminate between luminance and hue variation.
Parameter file cblind.x from directory \pxl\app\cds
This experiment determines unique hues by an adaptive procedure.
There are three linear positioned patches in each display. The outer two
colors are similar to opposite uniqe hues like yellow on the left side and
blue on the right side and the
center is some target color. The subject's task is to chose either a
"left" or a "right" key according to whether the center color either contains
more of the left or more of the right color.
The adaptive procedure will converge to a color which neither contains the
left nor the right color.
The center color is a convex mixture of stimuli a and
b which are not displayed. The stimuli c and d only tell the subject
which colors to look at.
Parameter file uniq.x from directory \pxl\app\cds
This example creates an adjustment procedure where there is a single color
patch on the screen whose color can be adjusted by mouse movements.
Parameter file adjcol.x from directory \pxl\app\cds
Show color patches and get a choice or rating response
Stimuli are 6 color patches or 2 groups of 3 patches on a bright background
field. The task is a rating response or a binary choice task.
The keyboard is used for rating and the mouse buttons are used for choice.
Parameter file pref2.x from directory \pxl\app\cds
Back to table of contents