5. Jobin-Yvon CCD client — wanglib.ccd

Client routines for use with the CCD-2000 camera (generally attached to the Spex 750M spectrometer). These utilities talk to the CCD server LabView program running on the old computer over TCP/IP.

To configure the CCD server, refer to README file on the desktop of the CCD controller computer.

5.1. Command-line invocation

For a simple live display from the CCD, invoke this module as a script:

$ python -m wanglib.ccd --ip 128.223.xxx.xxx 800

where 800 is the center wavelength of the grating (as read from the window). You will need to specify the real IP address of the CCD server using the --ip flag.

A more sophisticated GUI for the CCD is available. This program can save data, zoom in and out, and move the grating on the Spex 750M.

5.2. Client library

To integrate the CCD client into your own script, use labview_client.

class wanglib.ccd.labview_client(center_wl, host=None, port=3663)

TCP client for Tim’s labview ccd server.

Instantiate like so:

>>> ccd = labview_client(700, '128.223.xxx.xxx')

where 121.223.xxx.xxx is the IP address of the computer running the Labview server, and 700 is the current wavelength of the spectrometer in nanometers (read from the window).

This info is needed because the labview program calculates wavelength values (from dispersion calibration info) on the server-side. Tye Hetherington wrote that sub-routine.

This client implements no control whatsoever of the SPEX 750m spectrometer to which the CCD is attached. For proper wavelength and dispersion info, you’ll need to keep the client informed.

Whenever you move the spectrometer, set center_wl attribute to match:

>>> ccd.center_wl = 750

To get a spectrum, use get_spectrum().


Establish a connection with the labview server.

If the labview program is ever stopped and restarted (as it should be when not taking data, to avoid wearing out the shutter), this should be called to reestablish the connection.


Takes a shot on the CCD.

Returns a 2-tuple (wl, ccd).

wl: a 1-D array of the horizontal (wavelength) axis. ccd: a 2-D array of CCD counts.

To collapse ccd into a 1D array matching wl, sum over axis 0:

>>> wl,ccd = clnt.get_spectrum()
>>> line, = pylab.plot(wl,ccd.sum(axis=0))