Control a CRS Bits# device. See typical usage in the class summary (and in the menu demos>hardware>BitsBox of PsychoPy’s Coder view).
||A class to support functions of the Bits#|
||Get/set the mode of the BitsSharp to one of:|
||Test whether we have an active connection on the virtual serial|
||Returns a python dictionary of info about the Bits Sharp box|
||Checks whether there is a configuration for this device and|
||Get / set the gamma correction file to be used|
||Temporal dithering can be set to True or False|
||Get / set the EDID file for the monitor.|
||Make a beep of a given frequency and duration|
||Return the r,g,b values for a number of pixels on a particular|
||[Not currently implemented] Used to begin event collection by|
||[Not currently implemented] Used to stop event collection by|
Direct communications with the serial port:
||Send a command to the device (does not wait for a reply or sleep())|
||Read the latest response from the serial port|
Control the CLUT (Bits++ mode only):
||Set the contrast of the LUT for ‘bits++’ mode only|
||Set the LUT to have the requested gamma value Currently also resets the LUT to be a linear contrast ramp spanning its full range.|
||SetLUT is only really needed for bits++ mode of bits# to set the look-up table (256 values with 14bits each).|
BitsSharp(win=None, portName=None, mode='', checkConfigLevel=1, gammaCorrect='hardware', gamma=None, noComms=False)¶
A class to support functions of the Bits#
This device uses the CDC (serial port) connection to the Bits box. To use it you must have followed the instructions from CRS Ltd. to get your box into the CDC communication mode.
Typical usage (also see demo in Coder view demos>hardware>BitsBox ):
from psychopy import visual from psychopy.hardware import crs # we need to be rendering to framebuffer win = visual.Window([1024,768], useFBO=True) bits = crs.BitsSharp(win, mode = 'mono++') # You can continue using your window as normal and OpenGL shaders # will convert the output as needed print(bits.info) if not bits.OK: print('failed to connect to Bits box') core.quit() core.wait(0.1) # now, you can change modes using bits.mode = 'mono++' # 'color++', 'mono++', 'bits++', 'status'
win : a PsychoPy
mode : ‘bits++’, ‘color++’, ‘mono++’, ‘status’
Make a beep of a given frequency and duration
checkConfig(level=1, demoMode=False, logFile='')¶
Checks whether there is a configuration for this device and whether it’s correct
Get / set the gamma correction file to be used (as stored on the device)
Returns a python dictionary of info about the Bits Sharp box
Read the latest response from the serial port
1: a single-line reply (use readline()) 2: a multiline reply (use readlines() which requires timeout) -1: may not be any EOL character; just read whatever chars are
getVideoLine(lineN, nPixels, timeout=1.0, nAttempts=10)¶
Return the r,g,b values for a number of pixels on a particular video line
an Nx3 numpy array of uint8 values
Test whether we have an active connection on the virtual serial port
Get/set the mode of the BitsSharp to one of: “bits++” “mono++” (not currently working?) “color++” (not currently working?) “status” “storage” “auto”
Get / set the EDID file for the monitor. The edid files will be located in the EDID subdirectory of the flash disk. The file “automatic.edid” will be the file read from the connected monitor.
name= 'CRS Bits#'¶
Pause for a default period for this device
Get the current waiting characters from the serial port if there are any
Deprecated: This was used on the old Bits++ to power-cycle the box It required the compiled dll, which only worked on windows and doesn’t work with Bits#
Send a command to the device (does not wait for a reply or sleep())
setContrast(contrast, LUTrange=1.0, gammaCorrect=None)¶
Set the contrast of the LUT for ‘bits++’ mode only
Set the LUT to have the requested gamma value 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?
setLUT(newLUT=None, gammaCorrect=False, LUTrange=1.0, contrast=None)¶
SetLUT is only really needed for bits++ mode of bits# to set the look-up table (256 values with 14bits each).
For the BitsPlusPlus device the deafult is to perform gamma correction here but on the BitsSharp it seems better to have the device perform that itself as the last step so gamma correction is off here by default.
If no contrast has yet been set (it isn’t needed for other modes) then it will be set to 1 here.
[Not currently implemented] Used to begin event collection by the device
[Not currently implemented] Used to stop event collection by the device
Temporal dithering can be set to True or False
The window that this box is attached to