print "getting connection"
base._init(27017, "") #37010
print "I have it"

base.getDBConnection()

# Doing an iteration on degrees, so it is easier to stop the script and restart it again
for degree in range(1,100):
    total = NF.collection().find({"TransitiveDegree":degree, "label": {"$exists": False}}).count()
    tmp = 0

    for nf_dict in NF.collection().find({"TransitiveDegree":degree, "label": {"$exists": False}}).sort("QpRts-p", -1):
        tmp += 1
        print tmp, " out of ", total, " at degree ", degree, " (with QpRts-p ", nf_dict["QpRts-p"], ")"
        from copy import deepcopy
        nf_dict2 = deepcopy(nf_dict)
        nf = NF(data=nf_dict)
        #if True:
        if int(nf.polynomial()[0]) != -45 and len(nf.polynomial()) != 9:
            # This is needed to avoid a bug that appears sometimes with pari(x^8-45).polredabs()
            # It looks like this bug was fixed upstream in an upcoming release of pari
            if nf.label():
                print nf.polynomial(), nf.polredabs(), nf.label()
                nf_dict2["label"] = nf.label()
                NF.collection().save(nf_dict2)
            else:
                print nf.polynomial(), "No label added!"

print "Done, in ", NF.collection()
Ejemplo n.º 2
0
sys.path.append("../")

print "Importing sage in base"
import base
from lmfdb.math_classes import NumberFieldGaloisGroup as NF
print "Sage loaded"

print "getting connection"
base._init(37010, "")
print "I have it"

base.getDBConnection()

for nf_dict in NF.collection().find({"label": {"$exists": False}}):
    from copy import deepcopy
    nf_dict2 = deepcopy(nf_dict)
    nf = NF(data=nf_dict)
    print nf.polynomial()
    if int(nf.polynomial()[0]) != -45 and len(nf.polynomial()) != 9:
        # This is needed to avoid a bug that appears sometimes with pari(x^8-45).polredabs()
        # It looks like this bug was fixed upstream in an upcoming release of pari
        print nf.polredabs()
        if nf.label():
            print nf.label()
            nf_dict2["label"] = nf.label()
            NF.collection().save(nf_dict2)
        else:
            print "No label added!"

print "Done, in ", NF.collection()