Table Of Contents

Previous topic


Next topic

egi (pynetstation)

This Page

Quick links



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


class, 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)

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:

driverFor = ['colorcal']

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.


Queries the device for information

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

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


Conducts a measurement and returns the measured luminance


The luminance is always also stored as .lastLum


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'

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


ok, X, Y, Z = colorCal.measure()
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)

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.