예제 #1
0
def secondary(ops, count):
    args.outfile.write("\n# SECONDARY OPERATORS----------------\n\n")
    newops = []
    for op in ops[:count]:
        words = op.split()
        base, chan, mom1, irrep1, op1, mom2, irrep2, op2 = words
        op1, op2 = op1.strip(']")'), op2.strip(']")')
        _, type1, type2 = base.split("_")
        psqr_1 = sum([int(i)**2 for i in mom1[4:-1].split(",")])
        psqr_2 = sum([int(i)**2 for i in mom2[4:-1].split(",")])
        m1 = irreps.momentums[psqr_1]
        m2 = irreps.momentums[psqr_2]
        isomap = {"pion": "1", "kaon": "1h", "eta": "0", "phi": "0"}
        op1_choices = getprunedops(isomap[type1], m1)[irrep1]
        op2_choices = getprunedops(isomap[type2], m2)[irrep2]
        print "op1 choices {}".format(" ".join(op1_choices))
        print "op2 choices {}".format(" ".join(op2_choices))
        while True:
            print "Select secondary operator for this level, the primary is:\n {}".format(op)
            print "newop1 {} {} {}? primary is {}".format(type1, mom1, irrep1, op1)
            secondaryop1 = readinput.selectchoices(op1_choices, default=op1)
            print "newop2 {} {} {}? primary is {}".format(type2, mom2, irrep2, op2)
            secondaryop2 = readinput.selectchoices(op2_choices, default=op2)
            secondaryopline = " ".join((base, chan, mom1, irrep1, secondaryop1+"]",
                                        mom2, irrep2, secondaryop2+']")'))+"\n"
            if secondaryopline in ops or secondaryopline in newops:
                print("That choice of ops, already exists in the primary set!!"
                      " Pick a different combination")
            elif secondaryopline in newops:
                print("That choice of ops, already exists in the secondary set!!"
                      " Pick a different combination")
            else:
                logging.info("Secondary operator accepted!")
                break
        newops.append(secondaryopline)
        args.outfile.write(secondaryopline)
예제 #2
0
def get_unspecified_parameters(args):

    if not args.hadrontype:
        print("Select hadron type")
        args.hadrontype = readinput.selectchoices(["meson", "baryon"], default="meson")

    if not args.isospin:
        print("Select isospin")
        args.isospin = readinput.selectchoices(["0", "1", "1h", "2"], default="1")

    if not args.strangeness:
        print("Select strangeness")
        args.strangeness = readinput.selectchoices(["0", "1", "2"], default="0")


    channel_list = os.listdir(coeffs_path.format(args.hadrontype, args.momray))
    if args.channel:
        if args.channel not in channel_list:
            logging.critical("format of input channel is not correct!"
                             " use e.g. {}".format(channel_list[0]))
            parser.exit()
    else:
        print("Select Channel")
        args.channel = readinput.selectchoices(sorted(channel_list))