Example #1
0
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)
Example #2
0
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)
Example #3
0
    def details(self, part, children, outfile=None):
        if part not in self.decaylist:
            print '%s not known. Have you read the file yet?' % part
            return
        final = children
        finalhash = {}
        termpartcpy = self.termpart[:]
        for p in final:
            finalhash[p] = finalhash.get(p,0) + 1
            if p in self.decaylist and p not in self.termpart:
                self.termpart.append(p)
        declist = self.getDecList(part)

        self.termpart[:] = termpartcpy
        sublist = []
        for dec in declist:
            if dec[1].daughters == finalhash:
                sublist.append(dec)

        decays = self.get_decays_dict(sublist)
        decays = self.normalize_rates(decays)
        aliases, decays = self.alias_decays(decays)

        f = UserFile()
        f.append('\n#\n')
        f.extend(aliases)
        f.append('#\n')
        f.extend(decays)
        f.output(outfile, verbose=1)