Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
AndrewVSutherland
GitHub Repository: AndrewVSutherland/lmfdb
Path: blob/main/scripts/hecke_algebras/hecke_algebras_mod_l_data.py
1128 views
1
# -*- coding: utf-8 -*-
2
""" Complete the entries for l adic orbits of Hecke algebra adding structure data if needed.
3
4
Author: Samuele Anni
5
"""
6
7
import os
8
9
from pymongo.mongo_client import MongoClient
10
C= MongoClient(port=37010)
11
import yaml
12
pw_dict = yaml.load(open(os.path.join(os.getcwd(), "passwords.yaml")))
13
username = pw_dict['data']['username']
14
password = pw_dict['data']['password']
15
C['hecke_algebras'].authenticate('editor', password)
16
hecke_orb_l = C['hecke_algebras'].hecke_algebras_l_adic
17
18
19
20
def do_import(ll):
21
field,structure,properties,operators= ll
22
mykeys = ['field','structure','properties','operators']
23
data = {}
24
for j in range(len(mykeys)):
25
data[mykeys[j]] = ll[j]
26
for i in [0,1,3]:
27
data['field'][i]=int(data['field'][i])
28
data['field'][2]=str(data['field'][2])
29
for i in [0,1]:
30
data['structure'][i]=int(data['structure'][i])
31
for i in [2,3]:
32
data['structure'][i]=str(data['structure'][i])
33
data['properties'][0]=[int(i) for i in data['properties'][0]]
34
data['properties'][1]=int(data['properties'][1])
35
data['operators']=[[int(i) for i in j] for j in data['operators']]
36
return data
37
38
39
def check_mod_l_data(orbit_label, index, ell, ll, fix=False):
40
query = {}
41
query['orbit_label'] = str(orbit_label)
42
query['ell'] = int(ell)
43
query['index'] = int(index)
44
45
orb_set = hecke_orb_l.find(query)
46
print("%s Hecke orbits to examine with orbit label %s for ell = %s" % (orb_set.count(), orbit_label, ell))
47
if orb_set.count() == 0:
48
return None
49
print("Checking whether the mod %s data is stored..." %ell)
50
for o in orb_set:
51
print("Testing orbit index %s" % o['index'])
52
if 'structure' not in o.keys():
53
print("NOT stored")
54
if fix:
55
d=do_import(ll)
56
print(d)
57
hecke_orb_l.update({"_id": o["_id"]}, {"$set":{'field': d['field'], 'structure': d['structure'],'properties': d['properties'], 'operators': d['operators']}}, upsert=True)
58
print("Fixed orbit label %s index %s" % (orbit_label, o['index']))
59
else:
60
print("Already stored")
61
62