Path: blob/main/scripts/lfunctions/populate_trace_hash_ECQG2Q.py
1128 views
1import sys, os2sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)),"../.."))3from lmfdb.db_backend import db45def upsert_hash(id_number, skip = False):6row = db.lfunc_lfunctions.lucky({'id':id_number}, projection = ['id', 'Lhash','trace_hash','origin'])7if skip and 'trace_hash' in row:8return9trace_hash = int(row['Lhash'])10assert trace_hash < 2**6111if 'origin' not in row:12print(row)13sys.exit(1)14assert "Genus2Curve/Q/" in row['origin'] or "EllipticCurve/Q/" in row['origin'], "%s" % row15print(row['origin'], trace_hash)16db.lfunc_lfunctions.upsert({'id': row['id']}, {'trace_hash':trace_hash})1718import sys19if len(sys.argv) == 3:20mod = int(sys.argv[1])21c = int(sys.argv[2])22for key in ['G2Q','Cremona']:23for i in db.lfunc_lfunctions.search({'load_key':key}, projection='id'):24if (i % mod) == c:25upsert_hash(i)26else:27print(r"""Usage:28You should run this on legendre as: (this will use 40 cores):29# parallel -u -j 40 --halt 2 --progress sage -python %s 40 ::: {0..39}""" % sys.argv[0])3031323334