Skip to content

Commit

Permalink
Merge pull request #5685 from fchapoton/fix_one_typo_Siegel
Browse files Browse the repository at this point in the history
clean one file with amusing typo
  • Loading branch information
roed314 authored Oct 11, 2023
2 parents 93251bc + e189b85 commit 0cf2fb2
Showing 1 changed file with 19 additions and 13 deletions.
32 changes: 19 additions & 13 deletions lmfdb/siegel_modular_forms/sample.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# This file provides the class Sammple_Class which describes
# a sample of a collection of Sıegel modular forms.
# This file provides the class Sample_Class which describes
# a sample of a collection of Siegel modular forms.
#
# Author: Nils Skoruppa <[email protected]>

Expand All @@ -9,10 +9,12 @@
from ast import literal_eval
from lmfdb import db


def random_sample_name():
data = db.smf_samples.random(projection=['collection', 'name'])
return (data['collection'][0], data['name'])


class Sample_class (SageObject):
"""
A wrapper around a database entry providing various
Expand All @@ -24,10 +26,10 @@ def __init__(self, doc):
self.__name = doc.get('name')
self.__weight = doc.get('weight')
self.__degree_of_field = doc.get('fdeg')
self.__field_poly = PolynomialRing(QQ,'x')(str(doc.get('field_poly')))
self.__field = None # created on demand
self.__explicit_formula = None # create on demand
self.__explicit_formula_set = False # set to true once we try to get it to avoid repeatedly trying to fetch an explicit formula that is not there
self.__field_poly = PolynomialRing(QQ, 'x')(str(doc.get('field_poly')))
self.__field = None # created on demand
self.__explicit_formula = None # create on demand
self.__explicit_formula_set = False # set to true once we try to get it to avoid repeatedly trying to fetch an explicit formula that is not there
self.__type = doc.get('type')
self.__is_eigenform = doc.get('is_eigenform')
self.__is_integral = doc.get('is_integral')
Expand All @@ -54,13 +56,13 @@ def field_poly(self):

def field(self):
if not self.__field:
f = PolynomialRing(ZZ,name='x')(str(self.__field_poly))
self.__field = QQ if f.degree() == 1 else NumberField(f,'a')
f = PolynomialRing(ZZ, name='x')(str(self.__field_poly))
self.__field = QQ if f.degree() == 1 else NumberField(f, 'a')
return self.__field

def explicit_formula(self):
if not self.__explicit_formula_set:
self.__explicit_formula = db.smf_samples.lucky({'id_link':self.__id}, 'explicit_formula')
self.__explicit_formula = db.smf_samples.lucky({'id_link': self.__id}, 'explicit_formula')
self.__explicit_formula_set = True
return self.__explicit_formula

Expand Down Expand Up @@ -97,7 +99,9 @@ def Fourier_coefficients(self, det_list):
query = {'owner_id': self.__id, 'det': {'$in': det_list}}
fcs = db.smf_fc.search(query, ['det', 'data'])
P = PolynomialRing(self.__field, names='x,y')
return {fcd['det']: {tuple(literal_eval(f)): P(str(poly)) for f, poly in fcd['data'].items() } for fcd in fcs}
return {fcd['det']: {tuple(literal_eval(f)): P(str(poly))
for f, poly in fcd['data'].items()}
for fcd in fcs}


def Sample(collection, name):
Expand All @@ -113,8 +117,10 @@ def Samples(query):
"""
Return a result of a database query as list of light instances of Sample_class.
"""
docs = db.smf_samples.search(query, {'Fourier_coefficients': False, 'eigenvalues': False, 'explicit_formula': False })
return [ Sample_class(doc) for doc in docs]
docs = db.smf_samples.search(query, {'Fourier_coefficients': False,
'eigenvalues': False,
'explicit_formula': False})
return [Sample_class(doc) for doc in docs]


def export(collection, name):
Expand All @@ -135,7 +141,7 @@ def export(collection, name):
doc['eigenvalues'] = {ev['index']: ev['data'] for ev in evs}

label = doc['collection'][0] + '.' + doc['name']
doc['label']= label
doc['label'] = label

import json
return json.dumps(doc, sort_keys=True, indent=4)

0 comments on commit 0cf2fb2

Please sign in to comment.