-
Notifications
You must be signed in to change notification settings - Fork 1
/
analyze.sage
47 lines (41 loc) · 1.26 KB
/
analyze.sage
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import sys
import json
load("spinor_norm_internals.spyx")
load("spinor_norm.sage")
load("isotropic.sage")
load("p_neighbor.sage")
load("p_neighbor_internals.spyx")
load("algform.sage")
print "analyze %s %s"%(sys.argv[1], sys.argv[2])
def jsonize_space(A):
# We've got a bit of annoyance due to some creeping factors of two I need to understand
# Conductor isn't easy to read off
eigs = A.eigenforms()
array = [ jsonize_eig(eig) for eig in eigs]
datadict = dict()
datadict['eigenforms'] = array
datadict['dimension'] = A.dimension()
return json.dumps(datadict, indent=4, sort_keys=True, separators ={',', ':'})
def jsonize_eig(eig):
field = eig.coeff_field()
poly = ''
if field.degree() == 1:
poly = 'a-1'
else:
poly = field.defining_polynomial()
data = dict()
data['def_poly'] = str(poly)
data['is_SK'] = eig.is_SK()
data['is_Yoshida']=eig.is_Yoshida()
plist = primes(100)
euler_factors = dict()
for p in plist:
euler_factors[str(p)] = str(eig.euler_factor(p))
data['euler_factors'] = euler_factors
return data
fin_name = sys.argv[1]
fout_name = sys.argv[2]
fin = open(fin_name, "r")
A = Algforms(s=fin.read())
fout = open(fout_name, "w")
fout.write(jsonize_space(A))