Table Of Contents

Previous topic

BitsSharp

Next topic

egi (pynetstation)

This Page

Quick links

ColorCAL

Attributes

ColorCAL([port, maxAttempts]) A class to handle the CRS Ltd ColorCAL device

Details

class psychopy.hardware.crs.colorcal.ColorCAL(port=None, maxAttempts=2)

A class to handle the CRS Ltd ColorCAL device

Open serial port connection with Colorcal II device

Usage:cc = ColorCAL(port, maxAttempts)
If no port is provided then the following defaults will be tried:
  • /dev/cu.usbmodem0001 (OSX)
  • /dev/ttyACM0
  • COM3 (windows)
calibrateZero()

Perform a calibration to zero light.

For early versions of the ColorCAL this had to be called after connecting to the device. For later versions the dark calibration was performed at the factory and stored in non-volatile memory.

You can check if you need to run a calibration with:

ColorCAL.getNeedsCalibrateZero()
driverFor = ['colorcal']
getCalibMatrix()

Get the calibration matrix from the device, needed for transforming measurements into real-world values.

This is normally retrieved during __init__ and stored as ColorCal.calibMatrix so most users don’t need to call this function.

getInfo()

Queries the device for information

usage::
(ok, serialNumber,
firmwareVersion, firmwareBuild) = colorCal.getInfo()

ok will be True/False Other values will be a string or None.

getLum()

Conducts a measurement and returns the measured luminance

Note

The luminance is always also stored as .lastLum

getNeedsCalibrateZero()

Check whether the device needs a dark calibration

In initial versions of CRS ColorCAL mkII the device stored its zero calibration in volatile memory and needed to be calibrated in darkness each time you connected it to the USB

This function will check whether your device requires that (based on firmware build number and whether you’ve already done it since python connected to the device).

Returns:True or False
longName = 'CRS ColorCAL'
measure()

Conduct a measurement and return the X,Y,Z values

Usage:

ok, X, Y, Z = colorCal.measure()
Where:
ok is True/False X, Y, Z are the CIE coordinates (Y is luminance in cd/m**2)

Following a call to measure, the values ColorCAL.lastLum will also be populated with, for compatibility with other devices used by PsychoPy (notably the PR650/PR655)

next()
readline(size=None, eol='\n\r')

This should be used in place of the standard serial.Serial.readline() because that doesn’t allow us to set the eol character

sendMessage(message, timeout=0.1)

Send a command to the photometer and wait an alloted timeout for a response.