Exemplo n.º 1
0
def configure_pulser_run(wib,
                         pulser_dac,
                         femb_mask=[False, False, False, False],
                         cold=False):
    req = wib.defaults()
    req.cold = cold
    req.pulser = True
    for i in range(4):
        femb_conf = req.fembs[i]
        femb_conf.enabled = femb_mask[i]
        if not femb_conf.enabled:
            continue
        #see wib.proto for meanings
        femb_conf.test_cap = True
        femb_conf.pulse_dac = pulser_dac
        femb_conf.strobe_skip = 255
        femb_conf.strobe_delay = 255
        femb_conf.strobe_length = 255

    rep = wibpb.Status()
    print(
        'Configuring WIB with FEMB mask %s for pulser run with DAC value %i' %
        (str(femb_mask), pulser_dac))
    wib.send_command(req, rep)
    if not rep.success:
        print(rep.extra.decode('ascii'))
    print('Successful:', rep.success)
    return rep.success
Exemplo n.º 2
0
 def toggle_pulser(self):
     req = wib.Pulser()
     if self.pulser_button.text() == "Enable Pulser":
         req.start = True
         self.pulser_button.setText('Disable Pulser')
         print("Starting pulser")
     else:
         req.start = False
         self.pulser_button.setText('Enable Pulser')
         print("Stopping pulser")
     rep = wib.Status()
     self.send_command(req,rep);
Exemplo n.º 3
0
    def configure(self, config):

        if config is None:
            print('Loading defaults')
            req = self.defaults()
        else:
            print('Loading config')
            try:
                with open(config, 'rb') as fin:
                    config = json.load(fin)
            except Exception as e:
                print('Failed to load config:', e)
                return

            req = wibpb.ConfigureWIB()
            req.cold = config['cold']
            req.pulser = config['pulser']
            if 'adc_test_pattern' in config:
                req.adc_test_pattern = config['adc_test_pattern']
            if 'frame_dd' in config:
                req.frame_dd = config['frame_dd']

            for i in range(4):
                femb_conf = req.fembs.add()

                femb_conf.enabled = config['enabled_fembs'][i]

                fconfig = config['femb_configs'][i]

                #see wib.proto for meanings
                femb_conf.test_cap = fconfig['test_cap']
                femb_conf.gain = fconfig['gain']
                femb_conf.peak_time = fconfig['peak_time']
                femb_conf.baseline = fconfig['baseline']
                femb_conf.pulse_dac = fconfig['pulse_dac']

                femb_conf.leak = fconfig['leak']
                femb_conf.leak_10x = fconfig['leak_10x']
                femb_conf.ac_couple = fconfig['ac_couple']
                femb_conf.buffer = fconfig['buffer']

                femb_conf.strobe_skip = fconfig['strobe_skip']
                femb_conf.strobe_delay = fconfig['strobe_delay']
                femb_conf.strobe_length = fconfig['strobe_length']

        print('Sending ConfigureWIB command')
        rep = wibpb.Status()
        self.send_command(req, rep)
        print(rep.extra.decode('ascii'))
        print('Successful: ', rep.success)
        return rep.success
Exemplo n.º 4
0
def script(args):
    req = wibpb.Script()
    rep = wibpb.Status()
    if os.path.exists(args.filename):
        print('Executing local script...')
        with open(args.filename, 'rb') as fin:
            req.script = fin.read()
        req.file = False
    else:
        print('Executing remote script...')
        req.script = args.filename
        req.file = True
    wib.send_command(req, rep)
    print('Successful:', rep.success)
Exemplo n.º 5
0
 def configure_wib(self):
     if self.config is not None:
         print('Loading specified config: %s' % self.config)
         self.wib.configure(self.config)
     else:
         print('Generating %s config with FEMB %i enabled' %
               ('cold' if self.cold else 'warm', self.femb))
         req = self.wib.defaults()
         req.cold = self.cold
         req.adc_test_pattern = self.test
         req.fembs[self.femb].enabled = True
         rep = wibpb.Status()
         print('Configuring WIB')
         self.wib.send_command(req, rep)
         if not rep.success:
             print(rep.extra.decode('ascii'))
         print('Successful:', rep.success)
Exemplo n.º 6
0
    def configure_wib(self):
        print('Loading config')
        try:
            with open(self.config,'rb') as fin:
                config = json.load(fin)
        except Exception as e:
            print('Failed to load config:',e)
            return
            
        print('Configuring FEMBs')
        req = wib.ConfigureWIB()
        for i in range(4):
            femb_conf = req.fembs.add();
            
            femb_conf.enabled = config['enabled_fembs'][i]
            
            fconfig = config['femb_configs'][i]
            
            #see wib.proto for meanings
            femb_conf.test_cap = fconfig['test_cap']
            femb_conf.gain = fconfig['gain']
            femb_conf.peak_time = fconfig['peak_time']
            femb_conf.baseline = fconfig['baseline']
            femb_conf.pulse_dac = fconfig['pulse_dac']

            femb_conf.leak = fconfig['leak']
            femb_conf.leak_10x = fconfig['leak_10x']
            femb_conf.ac_couple = fconfig['ac_couple']
            femb_conf.buffer = fconfig['buffer']

            femb_conf.strobe_skip = fconfig['strobe_skip']
            femb_conf.strobe_delay = fconfig['strobe_delay']
            femb_conf.strobe_length = fconfig['strobe_length']
        
        print('Sending ConfigureWIB command')
        rep = wib.Status()
        self.send_command(req,rep);
Exemplo n.º 7
0
        '-s',
        choices=['full', 'pre', 'post'],
        default='full',
        help=
        'Run full power ON sequence or pre/post ADC synchronization stages [default: full]'
    )
    parser.add_argument('FEMB_0', choices=['on', 'off'], help='Power FEMB_0')
    parser.add_argument('FEMB_1', choices=['on', 'off'], help='Power FEMB_1')
    parser.add_argument('FEMB_2', choices=['on', 'off'], help='Power FEMB_2')
    parser.add_argument('FEMB_3', choices=['on', 'off'], help='Power FEMB_3')
    args = parser.parse_args()

    wib = WIB(args.wib_server)
    req = wibpb.PowerWIB()
    req.femb0 = args.FEMB_0 == 'on'
    req.femb1 = args.FEMB_1 == 'on'
    req.femb2 = args.FEMB_2 == 'on'
    req.femb3 = args.FEMB_3 == 'on'
    req.cold = args.cold
    if args.stage == 'full':
        req.stage = 0
    elif args.stage == 'pre':
        req.stage = 1
    elif args.stage == 'post':
        req.stage = 2
    rep = wibpb.Status()
    print('Sending PowerWIB command...')
    wib.send_command(req, rep)
    print(rep.extra.decode('ascii'))
    print('Successful:', rep.success)
Exemplo n.º 8
0
def log(args):
    req = wibpb.Calibrate()
    rep = wibpb.Status()
    wib.send_command(req, rep)
    print(rep.extra.decode('ascii'), end='')
    print('Successful:', rep.success)