-
Notifications
You must be signed in to change notification settings - Fork 200
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5685 from fchapoton/fix_one_typo_Siegel
clean one file with amusing typo
- Loading branch information
Showing
1 changed file
with
19 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]> | ||
|
||
|
@@ -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 | ||
|
@@ -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') | ||
|
@@ -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 | ||
|
||
|
@@ -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): | ||
|
@@ -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): | ||
|
@@ -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) |