# proprietary package :/ import pyBen from os import path import logging log = logging.getLogger(__name__) from ..base import Monochromator class TMC300(Monochromator): """ Controls the Bentham TMC300 monochromator. This is the source of the probe light beam """ def __init__(self): self.path_cfg = path.abspath('system.cfg') self.path_atr = path.abspath('systemAll-1nm.atr') self.parked = -1 self.wavelength_nm = -1 def return_parameters(self): """ Returns parameters relevant for this device. New parameters to be saved can be added here """ parameters = {'bentham cfg_path': self.path_cfg, 'bentham atr_path': self.path_atr, 'bentham wavelength': self.wavelength} return parameters def reset(self): """ Parks the TMC300. Important to do at least once after new lamp was started """ pyBen.build_system_model(self.path_cfg) pyBen.load_setup(self.path_atr) pyBen.initialise() pyBen.park() log.info('TMC300 initialized and parked') self.parked = 1 self.wavelength_nm = -1 def set_wavelength_nm(self, wavelength_nm): """ Changes the probe wavelength """ pyBen.build_system_model(self.path_cfg) pyBen.load_setup(self.path_atr) pyBen.initialise() pyBen.select_wavelength(wavelength_nm, 0) log.info('TMC300 wavelength set to: %0.1f' % wavelength_nm + 'nm') self.wavelength = wavelength_nm self.parked = 0 def get_wavelength_nm(self): return self.wavelength def __repr__(self): return 'TMC300'