示例#1
0
文件: pxarset.py 项目: puhep/cmspxl
def dac(args):
    rocs = get_rocs(args[0])
    dacpath = os.getcwd()
    for roc in rocs:
        inname = 'dacParameters_C%s.dat' %roc
        infile = os.path.join(dacpath, inname)
        dac = UserFile(infile)
        action = args[1]
        if action == 'set':
            key = args[2]
            value = args[3]
            dac.set_key_value(key, value, sep=' ', 
                              key_pos=1, value_pos=2, verbose=1)

        elif action == 'add':
            key = args[2]
            value = args[3]
            dac.add_key_value(key, value, sep=' ', 
                              key_pos=1, value_pos=2, verbose=1)
                        
        elif action == 'sub':
            key = args[2]
            value = args[3]
            dac.sub_key_value(key, value, sep=' ',
                              key_pos=1, value_pos=2, verbose=1)
                        
        else:
            raise NameError(args[1])
        dac.output(infile)
示例#2
0
文件: pxarset.py 项目: puhep/cmspxl
def board(args):
    cfgpath = os.getcwd()
    cfgname = 'boardConfigurationDataTaking.txt'
    cfgfile = os.path.join(cfgpath, cfgname)
    board = UserFile(cfgfile)

    action = args[0]
    if action == 'set':
        key = args[1]
        value = args[2]
        board.set_key_value(key, value, sep=' ', verbose=1)
    else:
        raise NameError(args[1])

    new_cfgname = cfgname.replace('.txt', '_%s_%s.txt' %(key, value))
    new_cfgfile = os.path.join(cfgpath, new_cfgname)

    board.output(new_cfgfile)