Previous topic

psychopy.gui - create dialogue boxes

Next topic

Cedrus

Quick links

psychopy.hardware - hardware interfaces

PsychoPy can access a wide range of external hardware. For some devices the interface has already been created in the following sub-packages of PsychoPy. For others you may need to write the code to access the serial port etc. manually.

Contents:

psychopy.hardware.findPhotometer(ports=None)

Try to find a connected photometer/photospectrometer! PsychoPy will sweep a series of serial ports trying to open them. If a port successfully opens then it will try to issue a command to the device. If it responds with one of the expected values then it is assumed to be the appropriate device.

Parameters:
ports : a list of ports to search

Each port can be a string (e.g. ‘COM1’, ‘’/dev/tty.Keyspan1.1’) or a number (for win32 comports only). If none are provided then PsychoPy will sweep COM0-10 on win32 and search known likely port names on OS X and linux.

Returns:
  • An object representing the first photometer found
  • None if the ports didn’t yield a valid response
  • -1 if there were not even any valid ports (suggesting a driver not being installed)

e.g.:

photom = findPhotometer() #sweeps ports 0 to 10 searching for a device
print photom.getLum()
if hasattr(photom, 'getSpectrum'):#can retrieve spectrum (e.g. a PR650)
    print photom.getSpectrum()