Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
AndrewVSutherland
GitHub Repository: AndrewVSutherland/lmfdb
Path: blob/main/scripts/number_fields/dump-label-data.py
1128 views
1
#!/usr/local/bin/sage -python
2
# -*- coding: utf-8 -*-
3
r"""
4
Dump existing label information
5
If a degree is given, just do that degree
6
"""
7
8
import sys, os
9
10
HOME=os.path.expanduser("~")
11
sys.path.append(os.path.join(HOME, 'lmfdb'))
12
13
from lmfdb import db
14
15
fields = db.nf_fields
16
17
saving = True
18
19
count = 0
20
#t = time.time()
21
first = 0
22
deg=0
23
24
dlist = range(1,48)
25
if(len(sys.argv)>1):
26
dlist = [int(i) for i in sys.argv[1:]]
27
28
for deg in dlist:
29
fn = "label-data-%d"%(deg)
30
info = {}
31
cur = fields.search({'degree': deg}, info=info)
32
if info['number']>0:
33
outf=open(fn, 'w')
34
for f in cur:
35
pol = f['coeffs']
36
pol = str(pol)
37
pol = pol.replace("L","")
38
disc = f['disc_abs']
39
n = int(f['degree'])
40
sig = n-2*f['r2']
41
outf.write("[%s,%s,%d,%d]\n"%(pol,n,disc,sig))
42
outf.close()
43
44
45