Package psychopy :: Package hardware :: Package crs :: Module bits :: Class BitsBox
[frames] | no frames]

Class BitsBox

source code

The main class to control a bits++ box.

This is usually a class added within the window object and is typically accessed from there. e.g.:

from psychopy import visual
win = visual.Window([800,600], bitsMode='fast')
win.bits.setContrast(0.5)#use bits++ to reduce the whole screen contrast by 50%
Instance Methods
 
__init__(self, win, contrast=1.0, gamma=[1.0, 1.0, 1.0], nEntries=256, bitsType='bits++') source code
 
setLUT(self, newLUT=None, gammaCorrect=True, LUTrange=1.0)
Sets the LUT to a specific range of values.
source code
 
setContrast(self, contrast, LUTrange=1.0)
Optional parameter LUTrange determines which entries of the LUT will be set to this contrast
source code
 
setGamma(self, newGamma)
Set the LUT to have the requested gamma.
source code
 
reset(self) source code
Method Details

setLUT(self, newLUT=None, gammaCorrect=True, LUTrange=1.0)

source code 

Sets the LUT to a specific range of values.

Note that, if you leave gammaCorrect=True then any LUT values you supply will automatically be gamma corrected.

If BitsBox setMethod is 'fast' then the LUT will take effect on the next Window.update() If the setMethod is 'slow' then the update will take place over the next 1-4secs down the USB port.

Examples:
bitsBox.setLUT()
builds a LUT using bitsBox.contrast and bitsBox.gamma
bitsBox.setLUT(newLUT=some256x1array)
(NB array should be float 0.0:1.0) Builds a luminance LUT using newLUT for each gun (actually array can be 256x1 or 1x256)
bitsBox.setLUT(newLUT=some256x3array)
(NB array should be float 0.0:1.0) Allows you to use a different LUT on each gun

(NB by using BitsBox.setContr() and BitsBox.setGamma() users may not need this function!?)

setContrast(self, contrast, LUTrange=1.0)

source code 

Optional parameter LUTrange determines which entries of the LUT will be set to this contrast

Examples:
setContrast(1.0,0.5)
will set the central 50% of the LUT so that a stimulus with contr=0.5 will actually be drawn with contrast 1.0

setContrast(1.0,[0.25,0.5])

setContrast(1.0,[63,127])
will set the lower-middle quarter of the LUT (which might be useful in LUT animation paradigms)
Parameters:
  • contrast (float in the range 0:1) - The contrast for the range being set
  • LUTrange (float or array) - If a float is given then this is the fraction of the LUT to be used. If an array of floats is given, these will specify the start/stop points as fractions of the LUT. If an array of ints (0-255) is given these determine the start stop indices of the LUT

setGamma(self, newGamma)

source code 
Set the LUT to have the requested gamma. Currently also resets the LUT to be a linear contrast ramp spanning its full range. May change this to read the current LUT, undo previous gamm and then apply new one?