Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
AndrewVSutherland
GitHub Repository: AndrewVSutherland/lmfdb
Path: blob/main/scripts/lfunctions/populate_origin_ECQ.py
1128 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
def upsert_origin(id_row):
8
Lhash = db.lfunc_lfunctions.lucky({'id':id_row}, projection = 'Lhash')
9
url = list(db.lfunc_instances.search({'Lhash': Lhash, 'type' : 'ECQ'}, projection = 'url'))
10
assert len(url) == 1
11
url = url[0]
12
assert 'EllipticCurve/Q/' in url, "%s" % url
13
print(url, Lhash)
14
db.lfunc_lfunctions.upsert({'id': id_row}, {'origin': url})
15
16
import sys
17
if len(sys.argv) == 3:
18
mod = int(sys.argv[1])
19
c = int(sys.argv[2])
20
for i in db.lfunc_lfunctions.search({'load_key':'Cremona', 'origin':None}, projection='id'):
21
if (i % mod) == c:
22
upsert_origin(i)
23
else:
24
print(r"""Usage:
25
You should run this on legendre as: (this will use 40 cores):
26
# parallel -u -j 40 --halt 2 --progress sage -python %s 40 ::: {0..39}""" % sys.argv[0])
27
28
29