예제 #1
0
 def query_allowed_components(self):
     """Prints a list of components connected to electronic board"""
     raw_allowed = self.query('DC?')
     device_list1 = ['Seed current', 'Pump 1 current', 'Pump 2 current',
                     'Pump 3 current', 'Seed temperature',
                     'Pump 1 temperature', 'Pump 2 temperature',
                     'Pump 3 temperature']
     device_list2 = ['Digital temperature sensor 1',
                     'Digital temperature sensor 2',
                     'Analog temperature sensor 1',
                     'Analog temperature sensor 1',
                     'Voltage test 28V', 'Voltage test 1.8V',
                     'Voltage test 5V', 'Pump 1 photodiode']
     device_list3 = ['Pump 2 photodiode', 'Monitor photodiode 1',
                     'Monitor photodiode 2', 'Trigger', 'Pulse width',
                     'Pulse rate', '', '']
     device_list4 = ['', '', '', 'Seed bias voltage', '', '', '', '']
     device_array = [device_list1, device_list2,
                     device_list3, device_list4]
     allowed = ['allowed!', 'NOT ALLOWED!']
     i = 0
     while i < len(device_array):
         ascii = raw_allowed[2+i]
         bits = _string_to_bits(ascii)
         j = 0
         while j < len(bits):
             if device_array[i][j]:
                 log.log_warn(__name__, 'query_allowed_components',
                              device_array[i][j] + ' is '
                              + allowed[int(bits[j])])
             j += 1
         i += 1
예제 #2
0
 def query_pump_status(self, pump_num):
     """Returns True if pump is on and False if pump is off."""
     pump_status = self.query('P%d?' % pump_num)
     if pump_status[2] == '0':
         log.log_warn(__name__, 'query_pump_status',
                      'Pump %d is off!' % pump_num)
         return False
     return True
예제 #3
0
def _form_temp_command(temp):
    """Makes set temperature into machine-readable format."""
    temp_val = int(np.floor(1638.*((temp-25.)/40.+1.25)))
    if temp_val > 4095 or temp_val < 0:
        log.log_warn(__name__, '_form_temp_command',
                     'Temperature to be set is out of bounds!')
        return
    temp_str = str(temp_val).zfill(4)
    return temp_str
예제 #4
0
 def query_tec_status(self, tec_num):
     """tec_num=0 for seed, ={1,2,3} for pumps, returns True if tec on."""
     if tec_num == 0:
         tec_num = 'S'
     tec_status = self.query('TEC%s?' % tec_num)
     if tec_status[4] == '0':
         log.log_warn(__name__, 'query_tec_status',
                      '%s TEC is off!' % tec_num)
         return False
     return True
예제 #5
0
    def set_pump_write_constant(self, pump_num, val):
        """Sets the write constant of pump_num={1,2,3}

        val must be an integer between 0 and 4095(?)
        probably safest to leave these alone
        unless desired current cant be reached"""
        if pump_num == 2:
            log.log_warn(__name__, 'set_pump_write_constants',
                         'Cannot change pump 2 current!')
            return
        val_str = str(val).zfill(4)
        self.write('PCCW%d%s' % (pump_num, val_str))
예제 #6
0
    def  query_trigger_n_laser_status(self):
        """Returns True's if trigger is correct and laser is emitting."""
        tl_status = self.query('TS?')
# This model does not have an external trigger
#       trigger_match = True 
        laser_on = True
#        if tl_status[2] == '0':
#            log.log_warn(__name__, 'query_trigger_n_laser_status',
#                         'External trigger does not match requirement!')
#            trigger_match = False
        if tl_status[3] == '0':
            log.log_warn(__name__, 'query_trigger_n_laser_status',
                         'Laser not emitting!')
            laser_on = False
        return laser_on
예제 #7
0
    def set_pump_current(self, pump_num, current):
        """
        ! Manual gives units of seed current in volts?!

        pump_num=0 for seed, ={1,2,3} for corresponding pumps,
        sets current in amps"""
        if current > self.pcl_list[pump_num] or current < 0:
            log.log_warn(__name__, 'set_pump_current',
                         'Pump current to be set is out of bounds!')
            return
        if pump_num == 2 and current != 2:
            log.log_warn(__name__, 'set_pump_current',
                         'Pump 2 must stay at 2 amps!')
            return
        item_str = '0%d' % (pump_num + 3)
        current_str = _form_current_command(pump_num, current, self.pccw_list)
        self.__set_analog_output_values(item_str, current_str)
예제 #8
0
    def query_temp_error(self):
        """Returns True for each TEC within error, False if not."""
        temp_error = self.query('FB?')
# This model does not have seed or pump 1 lasers installed
#        seed_temp = pump1_temp = True
        pump2_temp = pump3_temp = True
#        if temp_error[2] == '0':
#            log.log_warn(__name__, 'query_temp_error',
#                         'Seed temperature outsde error limit!')
#            seed_temp = False
#        if temp_error[3] == '0':
#            log.log_warn(__name__, 'query_temp_error',
#                         'Pump 1 temperature outsde error limit!')
#            pump1_temp = False
        if temp_error[4] == '0':
            log.log_warn(__name__, 'query_temp_error',
                         'Pump 2 temperature outsde error limit!')
            pump2_temp = False
        if temp_error[5] == '0':
            log.log_warn(__name__, 'query_temp_error',
                         'Pump 3 temperature outsde error limit!')
            pump3_temp = False
        return pump2_temp, pump3_temp