1.2.2. Jobin-Yvon spectrometers: wanglib.instruments.spex750m
¶
This module contains utilities for controlling Jobin-Yvon “SPEX” series monochromators over RS232 serial.
- Classes defined:
1.2.2.1. Tutorial¶
both spex750m
and triax320
behave roughly the same
way. In this tutorial we use the 750M for example. Instantiate like:
>>> beast = spex750m()
This opens a connection with the larger of the two spectrometers (the SPEX 750M.)
Classes are configured to look for the spectrometer at the serial port where they are normally plugged in. To specify a different serial port, just pass it as an optional parameter when instantiating. For example, the following should be equivalent:
>>> beast = spex750m(addr=1)
>>> beast = spex750m(addr="COM2") # on windows
>>> beast = spex750m(addr="/dev/ttyS1") # on linux
It’s a good idea to check that the spectrometer has been
calibrated. This is unneccessary for the Triax, but on the 750M, we
should check it. Having instantiated it as beast
, run
>>> beast.wl
790.
This queries the current wavelength in nm, which ought to match the value displayed in the window. If it doesn’t, run
>>> beast.calibrate(800)
This will re-set the calibration to 800nm:
>>> beast.wl
800.
You can control the spectrometer using the methods documented below. For example, this performs a wavelength scan:
>>> beast = spex750m('/dev/ttyUSB0')
>>> beast.calibrate(800)
>>> beast.set_wavelength(750)
>>> for i in range(200):
... beast.rel_move(0.5)
... while beast.is_busy():
... sleep(0.1)
... result = measure_something()
... print beast.get_wavelength(), result
1.2.2.2. API documentation¶
-
class
wanglib.instruments.spex750m.
spex750m
(addr=None)¶ A class implementing standard Jobin-Yvon serial commands for simple spectrometers like the SPEX 750M.
By default, this class is configured to look for the 750M plugged into
/dev/ttyUSB0
(the first port on the USB-serial adapter, when run under linux).-
boot_status_check
()¶ Check the boot status of the controller.
- * : Just Autobauded
- B : Boot Acknowledged
- F : Just Flashed
-
calibrate
(wl_value)¶ Read the current wavelength from the window and pass it to this method (units of nm) to recalibrate the 750M.
-
get_wavelength
()¶ Query the current wavelength
-
get_wl
()¶ Query the current wavelength
-
init_hardware
()¶ Initialize 750M hardware. I don’t know why this works, I just copied Yan’s LabView routine.
-
is_busy
()¶ Check if the motors are busy.
-
reboot
()¶ Reboot the controller if it’s not responding
-
rel_move
(distance_to_move)¶ Move the grating by the given number of nanometers.
-
set_wavelength
(wl)¶ Move to the wavelength value specified. contingent on proper calibration, of course.
-
set_wl
(wl)¶ Move to the wavelength value specified. contingent on proper calibration, of course.
-
wait_for_ok
(expected_bytes=1)¶ Wait indefinitely for the ‘o’ status byte.
This function waits until a certain number of bytes (usually just one) are present on the bus. When that data arrives, the first bye is read and checked to make sure it’s the “okay” status.
-
wavelength
¶ Query the current wavelength
-
wl
¶ Query the current wavelength
-
-
class
wanglib.instruments.spex750m.
triax320
(addr=None)¶ A class implementing Jobin-Yvon serial commands for more advanced spectrometers like the TRIAX 320.
Instantiate as you would a spex750m. If you don’t specify a serial port, this class will assume the spectrometer is attached to
/dev/ttyUSB1
, the second port on the USB-serial converter.- Unlike the 750M, the Triax
- has motorized entrance and exit slits
- zeroes its grating on power-up.
To perform a motor init on the triax, call
motor_init()
.-
calibrate
(wl)¶ Set wavelength of Triax without moving motor
-
entr_slit
¶
-
exit_slit
¶
-
get_wavelength
()¶ Query the current wavelength
-
get_wl
()¶ Query the current wavelength
-
motor_init
()¶ Move all motors to their power-up (autocal) positions.
This zeroes the wavelength grating and both entrance and exit slits. Don’t forget to reopen the slits after calling this.
-
set_wavelength
(wl)¶ Move to a new wavelength
-
set_wl
(wl)¶ Move to a new wavelength
-
slits
¶ Return the entrance and exit slit settings together.
>>> beast.slits (30., 30.)
Indicates that both slits are at 30. They can also be set together:
>>> beast.slits = (20,30) >>> beast.slits (20., 30.)
sets the entrance slit to 20. There is a shortcut for setting the slits to equal values:
>>> beast.slits = 20 >>> beast.slits (20., 20.)
-
wavelength
¶ Query the current wavelength
-
wl
¶ Query the current wavelength