Path: blob/main/scripts/number_fields/dump-label-data.py
1128 views
#!/usr/local/bin/sage -python1# -*- coding: utf-8 -*-2r"""3Dump existing label information4If a degree is given, just do that degree5"""67import sys, os89HOME=os.path.expanduser("~")10sys.path.append(os.path.join(HOME, 'lmfdb'))1112from lmfdb import db1314fields = db.nf_fields1516saving = True1718count = 019#t = time.time()20first = 021deg=02223dlist = range(1,48)24if(len(sys.argv)>1):25dlist = [int(i) for i in sys.argv[1:]]2627for deg in dlist:28fn = "label-data-%d"%(deg)29info = {}30cur = fields.search({'degree': deg}, info=info)31if info['number']>0:32outf=open(fn, 'w')33for f in cur:34pol = f['coeffs']35pol = str(pol)36pol = pol.replace("L","")37disc = f['disc_abs']38n = int(f['degree'])39sig = n-2*f['r2']40outf.write("[%s,%s,%d,%d]\n"%(pol,n,disc,sig))41outf.close()42434445