Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
AndrewVSutherland
GitHub Repository: AndrewVSutherland/lmfdb
Path: blob/main/scripts/abvar/check_correctness.sage
1128 views
1
sys.path.append("../..")
2
from collections import defaultdict
3
from lmfdb import db
4
5
'''
6
Reads files from counts_filenames, and for each prime power q,
7
add the number of isogeny labels of genus 1 over F_q
8
from each of the files. Then we check if it matches the LMFDB data.
9
'''
10
11
counts_filenames = ["counts23_0_1728.txt", "counts.txt"]
12
13
counts = defaultdict(int)
14
15
for filename in counts_filenames:
16
with open(filename, "r") as file:
17
for line in file:
18
line = line.replace(" ", "")
19
if not line:
20
continue
21
tokens = line.split(",")
22
23
if all(token.isdigit() for token in tokens) and len(tokens)>1:
24
counts[int(tokens[0])] += int(tokens[1])
25
26
lmfdb_counts = db.av_fq_isog.stats.column_counts(["g", "q"])
27
28
for key in sorted(counts):
29
assert lmfdb_counts[(1, key)] == counts[key], "Number of labels for q=%s does not match." % (key)
30
31
print("SUCCESS: we just verified that the number of labels in our output matches the lmfdb data.")
32