To import PR650, you can either use:
from psychopy_photoresearch.pr import PR650
or, any time after psychopy.plugins.activatePlugins has been called:
from psychopy.hardware.pr import PR650
An interface to the PR650 via the serial port.
(Added in version 1.63.02)
example usage:
from psychopy.hardware.pr import PR650
myPR650 = PR650(port)
myPR650.getLum() # make a measurement
nm, power = myPR650.getLastSpectrum() # get a power spectrum for the
last measurement
NB psychopy.hardware.findPhotometer()
will locate and return
any supported device for you so you can also do:
from psychopy import hardware
phot = hardware.findPhotometer()
print(phot.getLum())
Various messages are printed to the log regarding the function of this device, but to see them you need to set the printing of the log to the correct level:
from psychopy import logging
logging.console.setLevel(logging.ERROR) # error messages only
logging.console.setLevel(logging.INFO) # will give more info
logging.console.setLevel(logging.DEBUG) # log all communications
If you’re using a keyspan adapter (at least on macOS) be aware that it needs a driver installed. Otherwise no ports will be found.
Also note that the attempt to connect to the PR650 must occur within the first few seconds after turning it on.
This retrieves the spectrum from the last call to .measure()
If parse=True
(default):
The format is a num array with 100 rows [nm, power]
otherwise:
The output will be the raw string from the PR650 and should then
be passed to .parseSpectrumOutput()
. It’s more efficient to
parse R,G,B strings at once than each individually.
Makes a measurement and returns the current power spectrum
parse=True
(default):The format is a num array with 100 rows [nm, power]
parse=False
(default):The output will be the raw string from the PR650 and should then
be passed to .parseSpectrumOutput()
. It’s slightly more
efficient to parse R,G,B strings at once than each individually.
Make a measurement with the device. For a PR650 the device is instructed to make a measurement and then subsequent commands are issued to retrieve info about that measurement.