Specific device classes

General concepts

Most devices share common methods and approach to make them more predictable and easier to use.

First, the device identifier / address needs to be provided by user during the device object creation, and it is automatically connected. The devices have open and close methods but the device also works as a resource (with Python with statement), so these usually aren’t used explicitly.

The devices usually have get_settings and apply_settings methods which return Python dictionaries with the most common settings or take these dictionaries and apply them. In addition, there are get_full_status and get_full_info functions, which return progressively more information (get_full_status adds variable status information which cannot be changed by user, and get_full_info adds constant device information, such as model name and serial number). get_full_info can be particularly useful to check the device status and see if it is connected and working properly.

Devices of the same kind (e.g., cameras or translation stages) aim to have consistent overlapping interfaces (where it makes sense), so different devices are fairly interchangeable in simple applications.

Examples

Connecting to a Cryomagnetics LM500 level meter and reading out the level at the first channel:

from pylablib.aux_libs.devices import Cryomagnetics  # import the device library
# Next, create the device object and connect to the device;
#   the connection is automatically opened on creation, and closed when the ``with`` block is ended
with Cryomagnetics.LM500("COM1") as lm:
    level = lm.get_level(1)  # read the level

Stepping the M Squared laser wavelength and recording an image from the Andor IXON camera at each step:

from pylablib.aux_libs.devices import M2, Andor  # import the device libraries
with M2.M2ICE("192.168.0.1", 39933) as laser, Andor.AndorCamera() as cam:  # connect to the devices
    # change some camera parameters
    cam.set_shutter("open")
    cam.set_exposure(50E-3)
    cam.set_amp_mode(preamp=2)
    cam.set_EMCCD_gain(128)
    cam.setup_image_mode(vbin=2, hbin=2)
    # setup acquisition mode
    cam.set_acquisition_mode("cont")
    cam.setup_cont_mode()
    # start camera acquisition
    cam.start_acquisition()
    wavelength = 740E-9  # initial wavelength (in meters)
    images = []
    while wavelength < 770E-9:
        laser.tune_wavelength_table(wavelength)  # tune the laser frequency (using coarse tuning)
        time.sleep(0.5)  # wait until the laser stabilizes
        cam.wait_for_frame()  # ensure that there's a frame in the camera queue
        frame = cam.read_newest_image()
        images.append(frame)
        wavelength += 0.5E-9

List of devices

Device Kind Module Comments
M Squared ICE BLOC Laser M2  
Pure Photonics PPCL200 Laser PurePhotonics In CBDX1 chassis
Lighthouse Photonics SproutG Laser LighthousePhotonics  
LaserQuantum Finesse laser Laser LaserQuantum  
Agilent HP8168F Laser AgilentLasers  
Nuphoton NP2000 EDFA NuPhoton  
HighFinesse WS/6 and WS/7 Wavemeter HighFinesse  
Andor Shamrock Spectrometer Andor Tested with Andor SR-303i
Andor SDK2 interface Camera Andor Tested with Andor IXON and Luca
Andor SDK3 interface Camera Andor Tested with Andor Zyla
Hamamatsu DCAM interface Camera DCAM Tested with ORCA-Flash 4.0 (C11440-22CU)
NI IMAQdx interface Camera IMAQdx Tested with Photon Focus HD1-D1312 with GigE connection
NI IMAQ interface Camera IMAQ Tested with NI PCI-1430 frame grabber
Photon Focus PFCam interface Camera PhotonFocus Tested with MV-D1024E and CameraLink connection with NI PCIe-1433 frame grabber (via IMAQ)
PCO SC2 interface Camera PCO_SC2 Tested with PCO.edge 5.5 CL and PCO.edge CLHS
Ophir Vega Optical power meter Ophir  
Thorlabs PM100D Optical power meter Thorlabs  
OZ Optics TF100 Tunable optical filter OZOptics  
OZ Optics DD100 Variable optical attenuator OZOptics  
OZ Optics EPC04 Polarization controller OZOptics  
Agilent AWG33220A Arbitrary waveform generator AgilentElectronics  
Agilent N9310A Microwave generator AgilentElectronics  
Vaunix LMS (Lab Brick) Microwave generator Vaunix  
Thorlabs MDT693/4A High voltage source Thorlabs  
Agilent AMP33502A DC amplifier AgilentElectronics  
Rigol DSA1030A Microwave spectrum analyzer Rigol  
Agilent HP8712B, HP8722D Vector network analyzers AgilentElectronics  
Tektronix DPO2014, TDS2000, MDO3000 Oscilloscopes Tektronix  
NI DAQ interface NI DAQ devices NI Wrapper around the nidaqmx package. Tested with NI USB-6008 and NI PCIe-6323
Zurich Instruments HF2 / UHF Lock-in amplifiers ZurichInstruments  
Arcus PerforMax Translation stage Arcus Tested with PMX-4EX-SA stage.
SmarAct SCU3D Translation stage SmarAct  
Attocube ANC300 Piezo slider controller Attocube Only tested with Ethernet or Serial connection
Attocube ANC350 Piezo slider controller Attocube Only tested with USB connection
Trinamic TMCM1110 Stepper motor controller Trinamic  
Thorlabs KDC101 DC servo motor controller Thorlabs  
Thorlabs K10CR1 Motorized rotation mount Thorlabs  
Thorlabs FW102/202 Motorized filter wheel Thorlabs  
Thorlabs MFF Motorized flip mount Thorlabs  
Cryomagnetics LM500/510 Cryogenic level meter Cryomagnetics  
Lakeshore 218 and 370 Temperature controllers Lakeshore  
MKS 9xx Pressure gauge MKS  
Pfeiffer TPG261 Pressure gauge Pfeiffer  

All the modules are located in pylablib.aux_libs.devices.

Additional requirements

First, any device using PyVISA require NI VISA to be installed. See PyVISA for details.

Second, some devices need dlls supplied by the manufacturer:

  • Andor SDK2 cameras: require atmcd.dll (currently supplied for x64 and x86). Can be obtained with Andor Solis software, or Andor SDK. If Andor Solis is installed in the default location (C:/Program Files/Andor Solis), these dlls are accessed automatically. It might be called atmcd64d_legacy.dll or atmcd32d_legacy.dll (depending on the Solis version and Python bitness), but it needs to be renamed to atmcd.dll when placed into aux_libs/devices/libs/x64 (or x32) folder.
  • Andor SDK3 cameras: require several at*.dll: atcore.dll, atblkbx.dll, atcl_bitflow.dll, atdevapogee.dll, atdevregcam.dll, atusb_libusb.dll, atusb_libusb10.dll (currently supplied only for x64). Has potential incompatibilities between different versions of Windows; tested with Windows 7 x64 and Andor Solis 4.30.30034.0. Can be obtained with Andor Solis software. If Andor Solis is installed in the default location (C:/Program Files/Andor Solis), these dlls are accessed automatically.
  • PCO SC2 cameras: require several SC2_*.dll: SC2_Cam.dll, sc2_cl_me4.dll, sc2_cl_mtx.dll, sc2_cl_nat.dll, sc2_cl_ser.dll, sc2_clhs.dll. These are provided with pco.sdk, which can be obtained on PCO website.
  • Arcus PerforMax translation stages: require PerformaxCom.dll and SiUSBXp.dll. Can be obtained from Arcus website, either at USB 64-bit DLL (for 64-bit systems), or inside Python USB source (for 32-bit systems)
  • HighFinesse WS/6 and WS/7 wavemeters: require wlmData.dll. Each device needs a unique dll supplied by the manufacturer. One can either supply DLL path on creation of the device class, or place it into aux_libs/devices/libs/x64 (or x32) folder; in the latter case, it should be renamed to wlmData6.dll or wlmData7.dll depending on the wavemeter model (WS/6 or WS/7).
  • SmarAct SCU3D translation stage controller: requires SCU3DControl.dll. Should be supplied with the device by the manufacturer.

For the application to have access to them, they need to be placed into the package folder (correspondingly, into aux_libs/devices/libs/ inside the main package folder, which is usually something like Python36/Lib/site-packages/pylablib/).

Third, some devices need additional software installed:

  • IMAQ cameras: National Instruments IMAQ library.
  • IMAQdx cameras: National Instruments IMAQdx library.
  • Photon Focus cameras: Photon Focus PFRemote software.
  • Hamamatsu DCAM cameras: DCAM software (Hamamatsu HOKAWO) and drivers.
  • Andor cameras: Andro Solis software and drivers
  • NI DAQs: National Instruments NI-DAQmx library (with C support; just Runtime is sufficient).
  • HighFinesse: manufacturer-provided drivers and software (specific to the particular wavemeter).
  • Thorlabs Kinesis devices (KFF, KDC101, K10CR1): Kinesis/APT software.
  • Trinamic hardware: Trinamic TMCL-IDE (needed to install device drivers)
  • Arcus PerforMax software: Arcus Drivers and Tools, Arcus USB Series and Arcus Performax Series software (needed to install device drivers).
  • Zurich Instruments: manufacturer provided software and Python libraries.

The list might be incomplete, and it does not include drivers for all USB devices.