Example #1
0
 def set_pixel_register_value(self, name, value):
     try:  # value is decimal string or number or array
         self.pixel_registers[name]['value'][:, :] = value
     except ValueError:  # value is path to pixel config
         if self.pixel_registers[name]['bitlength'] == 1:  # pixel mask
             if value[0] == "~" or value[0] == "!":
                 reg_value = register_utils.parse_pixel_mask_config(
                     os.path.join(
                         os.path.dirname(self.configuration_file),
                         os.path.normpath(value[1:].replace('\\', '/'))))
                 inverted_mask = np.ones(shape=(80, 336),
                                         dtype=np.dtype('>u1'))
                 inverted_mask[reg_value >= 1] = 0
                 self.pixel_registers[name]['value'][:, :] = inverted_mask
             else:
                 self.pixel_registers[name][
                     'value'][:, :] = register_utils.parse_pixel_mask_config(
                         os.path.join(
                             os.path.dirname(self.configuration_file),
                             os.path.normpath(value).replace('\\', '/')))
         else:  # pixel dac
             self.pixel_registers[name][
                 'value'][:, :] = register_utils.parse_pixel_dac_config(
                     os.path.join(
                         os.path.dirname(self.configuration_file),
                         os.path.normpath(value).replace('\\', '/')))
     if (self.pixel_registers[name]['value'] >= 2**
             self.pixel_registers[name]['bitlength']).any() or (
                 self.pixel_registers[name]['value'] < 0).any():
         raise ValueError("Pixel register %s: value exceeds limits" % name)
Example #2
0
def check_tuning_result(filename):
    ok = True
    error_string = 'FAIL tuning '
    fdac_file = find('*_tuning.dat', _data_folder + '/fdacs')[0]
    tdac_file = find('*_tuning.dat', _data_folder + '/tdacs')[0]
    tdacs, fdacs = parse_pixel_dac_config(tdac_file)[1:77, :], parse_pixel_dac_config(fdac_file)[1:77, :]
    tdac_median, tdac_std = np.median(tdacs), np.std(tdacs)
    fdac_median, fdac_std = np.median(fdacs), np.std(fdacs)

    if tdac_median < _lower_tdac_median_cut or tdac_median > _upper_tdac_median_cut:
        error_string += ' TDAC median = %2.1f' % tdac_median
        ok = False
    if tdac_std < _lower_tdac_std_cut or tdac_std > _upper_tdac_std_cut:
        error_string += ' TDAC std = %2.1f' % tdac_std
        ok = False
    if fdac_median < _lower_fdac_median_cut or fdac_median > _upper_fdac_median_cut:
        error_string += ' FDAC median = %2.1f' % fdac_median
        ok = False
    if fdac_std < _lower_fdac_std_cut or fdac_std > _upper_fdac_std_cut:
        error_string += ' FDAC std = %2.1f' % fdac_std
        ok = False

    return ok, error_string
Example #3
0
def check_tuning_result(filename):
    ok = True
    error_string = 'FAIL tuning '
    fdac_file = find('*_tuning.dat', _data_folder + '/fdacs')[0]
    tdac_file = find('*_tuning.dat', _data_folder + '/tdacs')[0]
    tdacs, fdacs = parse_pixel_dac_config(tdac_file)[1:77, :], parse_pixel_dac_config(fdac_file)[1:77, :]
    tdac_median, tdac_std = np.median(tdacs), np.std(tdacs)
    fdac_median, fdac_std = np.median(fdacs), np.std(fdacs)

    if tdac_median < _lower_tdac_median_cut or tdac_median > _upper_tdac_median_cut:
        error_string += ' TDAC median = %2.1f' % tdac_median
        ok = False
    if tdac_std < _lower_tdac_std_cut or tdac_std > _upper_tdac_std_cut:
        error_string += ' TDAC std = %2.1f' % tdac_std
        ok = False
    if fdac_median < _lower_fdac_median_cut or fdac_median > _upper_fdac_median_cut:
        error_string += ' FDAC median = %2.1f' % fdac_median
        ok = False
    if fdac_std < _lower_fdac_std_cut or fdac_std > _upper_fdac_std_cut:
        error_string += ' FDAC std = %2.1f' % fdac_std
        ok = False

    return ok, error_string
Example #4
0
 def set_pixel_register_value(self, name, value):
     try:  # value is decimal string or number or array
         self.pixel_registers[name]['value'][:, :] = value
     except ValueError:  # value is path to pixel config
         if self.pixel_registers[name]['bitlength'] == 1:  # pixel mask
             if value[0] == "~" or value[0] == "!":
                 reg_value = register_utils.parse_pixel_mask_config(os.path.join(os.path.dirname(self.configuration_file), os.path.normpath(value[1:].replace('\\', '/'))))
                 inverted_mask = np.ones(shape=(80, 336), dtype=np.dtype('>u1'))
                 inverted_mask[reg_value >= 1] = 0
                 self.pixel_registers[name]['value'][:, :] = inverted_mask
             else:
                 self.pixel_registers[name]['value'][:, :] = register_utils.parse_pixel_mask_config(os.path.join(os.path.dirname(self.configuration_file), os.path.normpath(value).replace('\\', '/')))
         else:  # pixel dac
             self.pixel_registers[name]['value'][:, :] = register_utils.parse_pixel_dac_config(os.path.join(os.path.dirname(self.configuration_file), os.path.normpath(value).replace('\\', '/')))
     if (self.pixel_registers[name]['value'] >= 2 ** self.pixel_registers[name]['bitlength']).any() or (self.pixel_registers[name]['value'] < 0).any():
         raise ValueError("Pixel register %s: value exceeds limits" % name)