Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
AndrewVSutherland
GitHub Repository: AndrewVSutherland/lmfdb
Path: blob/main/scripts/groups/Make-images/dump-modcurve-names.py
1136 views
1
import sys, os, re
2
from collections import defaultdict
3
HOME=os.path.expanduser("~")
4
sys.path.append(os.path.join(HOME, 'sage', 'lmfdb'))
5
from lmfdb import db
6
7
myhash = defaultdict(list)
8
9
triples = set((rec["level"], rec["index"], rec["genus"]) for rec in db.gps_gl2zhat_fine.search({"contains_negative_one":True}, ["level", "index", "genus"]))
10
11
FAM_RE = re.compile(r"X([^\(]*)\((\d+(,\d+)?)\)")
12
13
count = 1
14
with open("eqguts.tex", "w") as eqguts:
15
with open("prettyindex", "w") as prettyindex:
16
prettyindex.write('[1,"?"]\n')
17
eqguts.write(r'$?$'+'\n')
18
for (level, index, genus) in triples:
19
pp = "%s_{%s}^{%s}" % (level, index, genus)
20
eqguts.write(f'${pp}$\n')
21
count += 1
22
prettyindex.write('[%d, "%s"]\n'%(count, pp))
23
for name in db.gps_gl2zhat_fine.search({"name":{"$ne":""}}, "name"):
24
fam, n, _ = FAM_RE.fullmatch(name).groups()
25
if fam == "0":
26
fam = "_0"
27
elif fam == "1":
28
fam = "_1"
29
elif fam == "pm1":
30
fam = r"_{\pm 1}"
31
elif fam == "sp":
32
fam = r"_{\mathrm{sp}}"
33
elif fam == "ns":
34
fam = r"_{\mathrm{ns}}"
35
elif fam == "sp+":
36
fam = r"_{\mathrm{sp}}^+"
37
elif fam == "ns+":
38
fam = r"_{\mathrm{ns}}^+"
39
elif fam == "S4":
40
fam = r"_{S_4}"
41
elif fam != "":
42
raise ValueError(fam)
43
tex = f"X{fam}({n})"
44
pp = name
45
eqguts.write(f'${tex}$\n')
46
count += 1
47
prettyindex.write('[%d, "%s"]\n'%(count, pp))
48
49
print ("Max count is %d" % count)
50
51