Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
AndrewVSutherland
GitHub Repository: AndrewVSutherland/lmfdb
Path: blob/main/scripts/classical_modular_forms/populate_trace_hash_Lfunctions.py
1448 views
1
2
import sys, os
3
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)),"../.."))
4
from lmfdb.db_backend import db
5
6
7
8
9
def upsert_trace_hash(id_number):
10
newform = db.mf_newforms.lucky({'id':id_number}, projection=['label','trace_hash','dim','weight'])
11
if newform is None or newform['dim'] > 81 or newform['weight'] == 1:
12
return
13
if 'trace_hash' not in newform:
14
assert newform['dim'] > 20
15
newform['trace_hash'] = None
16
base_url = "ModularForm/GL2/Q/holomorphic/" + newform['label'].replace(".","/")
17
trace_hash = newform['trace_hash']
18
Lhash = db.lfunc_instances.lucky({'url': base_url}, projection='Lhash')
19
assert Lhash is not None
20
db.lfunc_lfunctions.upsert({'Lhash': Lhash}, {'trace_hash' : trace_hash})
21
22
import sys
23
if len(sys.argv) == 3:
24
bound = db.mf_newforms.max_id()
25
k = int(sys.argv[1])
26
start = int(sys.argv[2])
27
assert k > start
28
ids = list(range(start, bound + 1, k))
29
for i in ids:
30
upsert_trace_hash(i)
31
else:
32
print(r"""Usage:
33
You should run this on legendre as: (this will use 40 cores):
34
# parallel -u -j 40 --halt 2 --progress sage -python %s 40 ::: {0..39}""" % sys.argv[0])
35
36