Package psychopy :: Package hardware :: Module pr :: Class PR650
[frames] | no frames]

Class PR650

source code

An interface to the PR650 via the serial port.

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

N.B. :func:`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()
    
:troubleshooting:
    
    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 log
        log.console.setLevel(log.ERROR)#error messages only
        log.console.setLevel(log.INFO)#will give a little more info
        log.console.setLevel(log.DEBUG)#will export a log of all communications
        
    If you're using a keyspan adapter (at least on OS X) be aware that it needs 
    a driver installed. Otherwise no ports wil be found.
    
    Also note that the attempt to connect to the PR650 must occur within the first
    few seconds after turning it on.
    
    

Instance Methods
 
__init__(self, port, verbose=None) source code
 
sendMessage(self, message, timeout=0.5, DEBUG=False)
send a command to the photometer and wait an alloted timeout for a response (Timeout should be long for low light measurements)
source code
 
measure(self, timeOut=30.0)
Make a measurement with the device.
source code
 
getLum(self)
Makes a measurement and returns the luminance value
source code
 
getSpectrum(self, parse=True)
Makes a measurement and returns the current power spectrum
source code
 
getLastLum(self)
This retrieves the luminance (in cd/m**2) from the last call to .measure()
source code
 
getLastSpectrum(self, parse=True)
This retrieves the spectrum from the last call to .measure()
source code
 
parseSpectrumOutput(self, rawStr)
Parses the strings from the PR650 as received after sending the command 'd5'.
source code
Method Details

measure(self, timeOut=30.0)

source code 
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

getSpectrum(self, parse=True)

source code 

Makes a measurement and returns the current power spectrum

If parse=True (default):
The format is a num array with 100 rows [nm, power]
If 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.

getLastSpectrum(self, parse=True)

source code 

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.

parseSpectrumOutput(self, rawStr)

source code 
Parses the strings from the PR650 as received after sending the command 'd5'. The input argument "rawStr" can be the output from a single phosphor spectrum measurement or a list of 3 such measurements [rawR, rawG, rawB].