示例#1
0
    def __init__(self,
                 start_time=None,
                 script_logfile=None,
                 data_logfile=None):
        if start_time is None:
            self.start_time = time.time()
        else:
            self.start_time = start_time
        if script_logfile is None:
            self.script_logdir = pathnames.default_script_logdir(
                self.start_time)
            self.script_logfile = pathnames.default_script_logfile(
                self.start_time)
        else:
            self.script_logdir = os.path.split(script_logfile)[0]
            self.script_logfile = script_logfile
        if data_logfile is None:
            self.data_logdir = pathnames.default_data_logdir(self.start_time)
            self.data_logfile = pathnames.default_data_logfile(self.start_time)
        else:
            self.data_logdir = os.path.split(data_logfile)[0]
            self.data_logfile = data_logfile

        self.init_script_logging()
        self.script_log.info('initalized script logger')
        self.script_log.info('logging to %s' % self.script_logfile)

        self.init_data_logging()
        self.script_log.info('initialized data logger')
        self.script_log.info('storing data to %s' % self.data_logfile)
outdir = args.outdir
verbose = args.verbose
global_threshold = args.global_threshold
run_time = args.run_time
config_file = args.configuration_file
if config_file is None:
    config_file = pathnames.default_config_dir(start_time)
    default_config = pathnames.make_default_config(start_time, default_config)
chips_to_scan = args.chips

return_code = 0

script_logfile = outdir + '/' + \
    os.path.basename(pathnames.default_script_logfile(start_time))
data_logfile = outdir + '/' + os.path.basename(
    pathnames.default_data_logfile(start_time))
sl = ScriptLogger(start_time,
                  script_logfile=script_logfile,
                  data_logfile=data_logfile)
log = sl.script_log
log.info('arguments: %s' % str(args))

try:
    controller = larpix.Controller(timeout=0.01)
    # Initial configuration of chips
    board_info = larpix_scripting.load_board(controller, infile)
    log.info('begin initial configuration of chips for board %s' % board_info)
    config_ok, different_registers = larpix_scripting.load_chip_configurations(
        controller,
        board_info,
        config_file,