Esempio n. 1
0
import json
import re
import tarfile
from lmfdb.base import app, getDBConnection, fmtdatetime
from flask import render_template, request, abort, Blueprint, url_for
from flask.ext.login import login_required, current_user
from gridfs import GridFS
from os import path
from bson.objectid import ObjectId
from urlparse import urlparse
from urllib import urlopen
from lmfdb.utils import MongoDBPagination, make_logger
from lmfdb.users import admin_required

upload_page = Blueprint("upload", __name__, template_folder='templates')
logging = make_logger(upload_page)

# blueprint specific definition of the body_class variable


@upload_page.context_processor
def body_class():
    return {'body_class': 'upload'}


def get_bread():
    return [("Upload", url_for(".index"))]


@upload_page.route("/")
@login_required
Esempio n. 2
0
# -*- coding: utf-8 -*-
from lmfdb.base import app
from lmfdb.utils import make_logger
from flask import Blueprint

motive_page = Blueprint("motive", __name__, template_folder='templates', static_folder="static")
motive_logger = make_logger(motive_page)


@motive_page.context_processor
def body_class():
    return {'body_class': 'motive'}

import main

app.register_blueprint(motive_page, url_prefix="/Motive")
Esempio n. 3
0
# -*- coding: utf-8 -*-
import re
from pymongo import ASCENDING, DESCENDING
import lmfdb.base
from lmfdb.utils import comma, make_logger


def format_percentage(num, denom):
    return "%10.2f" % ((100.0 * num) / denom)


logger = make_logger("ec")

the_ECstats = None


def get_stats():
    global the_ECstats
    if the_ECstats is None:
        the_ECstats = ECstats()
    return the_ECstats


class ECstats(object):
    """
    Class for creating and displaying statistics for elliptic curves over Q
    """
    def __init__(self):
        logger.debug("Constructing an instance of ECstats")
        self.ecdb = lmfdb.base.getDBConnection().elliptic_curves.curves
        self._counts = {}
Esempio n. 4
0
# -*- coding: utf-8 -*-
from lmfdb.base import app
from lmfdb.utils import make_logger
from flask import Blueprint

tensor_products_page = Blueprint("tensor_products",
                                 __name__,
                                 template_folder='templates',
                                 static_folder="static")
tensor_products_logger = make_logger("tensor_products", hl=True)

tensor_products_logger.info("Initializing tensor products blueprint")


@tensor_products_page.context_processor
def body_class():
    return {'body_class': 'tensor_products'}


import main
assert main  #silence pyflakes

app.register_blueprint(tensor_products_page, url_prefix="/TensorProducts")
Esempio n. 5
0
# -*- coding: utf-8 -*-
import re
import os
import pymongo
from pymongo import ASCENDING, DESCENDING
from flask import url_for, make_response
import lmfdb.base
from lmfdb.utils import comma, make_logger, web_latex, encode_plot
from lmfdb.genus2_curves.web_g2c import g2c_page, g2c_logger, list_to_min_eqn, end_alg_name, st_group_name
from sage.all import QQ, PolynomialRing, factor,ZZ
from lmfdb.WebNumberField import field_pretty

logger = make_logger("g2c")

g2cdb = None

def db_g2c():
    global g2cdb
    if g2cdb is None:
        g2cdb = lmfdb.base.getDBConnection().genus2_curves
    return g2cdb

def list_to_poly(s):
    return str(PolynomialRing(QQ, 'x')(s)).replace('*','')

def list_to_factored_poly(s):
    return str(factor(PolynomialRing(ZZ, 't')(s))).replace('*','')

def list_to_factored_poly_otherorder(s):
    if len(s) == 1:
        return str(s[0])
Esempio n. 6
0
# -*- coding: utf-8 -*-
from lmfdb.base import app
from lmfdb.utils import make_logger
from flask import Blueprint

rep_galois_modl_page = Blueprint("rep_galois_modl", __name__, template_folder='templates', static_folder="static")
rep_galois_modl_logger = make_logger(rep_galois_modl_page)


@rep_galois_modl_page.context_processor
def body_class():
    return {'body_class': 'rep_galois_modl'}

import main

app.register_blueprint(rep_galois_modl_page, url_prefix="/Representation/Galois/ModL")
Esempio n. 7
0
# -*- coding: utf-8 -*-

from lmfdb.utils import make_logger
from flask import Blueprint

MWF = "mwf"  # Maass waveforms
mwf = Blueprint(MWF,
                __name__,
                template_folder="views/templates",
                static_folder="views/static")
mwf_logger = make_logger(mwf)

import backend
assert backend
import views
assert views
Esempio n. 8
0
# -*- coding: utf-8 -*-
from lmfdb.base import app
from lmfdb.utils import make_logger
from flask import Blueprint

local_fields_page = Blueprint("local_fields",
                              __name__,
                              template_folder='templates',
                              static_folder="static")
logger = make_logger(local_fields_page)


@local_fields_page.context_processor
def body_class():
    return {'body_class': 'local_fields'}


import main

app.register_blueprint(local_fields_page, url_prefix="/LocalNumberField")
Esempio n. 9
0
# -*- coding: utf-8 -*-
from lmfdb.base import app
from lmfdb.utils import make_logger
from flask import Blueprint

lattice_page = Blueprint("lattice", __name__, template_folder='templates', static_folder="static")
lattice_logger = make_logger(lattice_page)


@lattice_page.context_processor
def body_class():
    return {'body_class': 'lattice'}

import main

app.register_blueprint(lattice_page, url_prefix="/Lattice")
Esempio n. 10
0
# -*- coding: utf-8 -*-
from lmfdb.base import app
from lmfdb.utils import make_logger
from flask import Blueprint

nfgg_page = Blueprint("number_field_galois_groups",
                      __name__,
                      template_folder='templates',
                      static_folder="static")
nfgg_logger = make_logger(nfgg_page)


@nfgg_page.context_processor
def body_class():
    return {'body_class': 'nfgg'}


import main

app.register_blueprint(nfgg_page, url_prefix="/NFGG")
Esempio n. 11
0
# -*- coding: utf-8 -*-
from lmfdb.base import app
from lmfdb.utils import make_logger
from flask import Blueprint

g2c_page = Blueprint("g2c", __name__, template_folder='templates',
        static_folder="static")
g2c_logger = make_logger(g2c_page)
g2c_logger.info("Initializing genus 2 curves blueprint")

@g2c_page.context_processor
def body_class():
    return {'body_class': 'g2c'}

import genus2_curve

app.register_blueprint(g2c_page, url_prefix="/Genus2Curve")
Esempio n. 12
0
from lmfdb.utils import make_logger
from flask import Blueprint

MWF = "mwf"  # Maass waveforms
mwf = Blueprint(MWF, __name__, template_folder="views/templates", static_folder="views/static")
mwf_logger = make_logger(mwf)

import backend
import views
from backend import *
from views import *
Esempio n. 13
0
# / modular_forms/__init__.py
import lmfdb.base
import lmfdb.utils
from lmfdb.utils import make_logger
import flask

MF_TOP = "Modular Forms"
MF = "mf"
mf = flask.Blueprint(MF, __name__, template_folder="views/templates", static_folder="views/static")
mf_logger = make_logger(mf)

import views
import backend
import elliptic_modular_forms
import maass_forms
from elliptic_modular_forms import *
from maass_forms import *

lmfdb.base.app.register_blueprint(mf, url_prefix="/ModularForm/")
lmfdb.base.app.register_blueprint(mf, url_prefix="/AutomorphicForm/")
lmfdb.base.app.register_blueprint(elliptic_modular_forms.emf, url_prefix="/ModularForm/GL2/Q/holomorphic")
lmfdb.base.app.register_blueprint(maass_forms.maassf, url_prefix="/ModularForm/Maass")
lmfdb.base.app.register_blueprint(maass_forms.maass_waveforms.mwf, url_prefix="/ModularForm/GL2/Q/Maass")
lmfdb.base.app.register_blueprint(maass_forms.picard.mwfp, url_prefix="/ModularForm/GL2/C/Maass")
Esempio n. 14
0
# -*- coding: utf-8 -*-
from lmfdb.base import app
from lmfdb.utils import make_logger
from flask import Blueprint

belyi_page = Blueprint("belyi", __name__, template_folder='templates',
        static_folder="static")
belyi_logger = make_logger(belyi_page)

@belyi_page.context_processor
def body_class():
    return {'body_class': 'belyi'}

import main
assert main # silence pyflakes

app.register_blueprint(belyi_page, url_prefix="/Belyi")
Esempio n. 15
0
# -*- coding: utf-8 -*-
from lmfdb.base import app
from lmfdb.utils import make_logger
from flask import Blueprint

local_fields_page = Blueprint("local_fields", __name__, template_folder='templates', static_folder="static")
logger = make_logger(local_fields_page)


@local_fields_page.context_processor
def body_class():
    return {'body_class': 'local_fields'}

import main

app.register_blueprint(local_fields_page, url_prefix="/LocalNumberField")
Esempio n. 16
0
# -*- coding: utf-8 -*-
# Author: Pascal Molin, [email protected]
from sage.misc.cachefunc import cached_method
from sage.all import gcd, Rational, power_mod, Integers, gp, xsrange
from flask import url_for
import lmfdb
from lmfdb.utils import make_logger, web_latex_split_on_pm
logger = make_logger("DC")
from lmfdb.nfutils.psort import ideal_label, ideal_from_label
from WebNumberField import WebNumberField
try:
    from dirichlet_conrey import DirichletGroup_conrey, DirichletCharacter_conrey
except:
    logger.critical("dirichlet_conrey.pyx cython file is not available ...")
from lmfdb.characters.HeckeCharacters import HeckeChar, RayClassGroup
from lmfdb.characters.TinyConrey import ConreyCharacter, kronecker_symbol, symbol_numerator
from lmfdb.characters.utils import url_character, complex2str, evalpolelt

"""
Any character object is obtained as a double inheritance of

1. a family (currently: Dirichlet/Z or Hecke/K)

2. an object type (list of groups, character group, character)

The code thus defines, from the generic top class WebCharObject

1. the mathematical family classes

   - WebDirichlet
Esempio n. 17
0
# -*- coding: utf-8 -*-
from lmfdb.base import app
from lmfdb.utils import make_logger
from flask import Blueprint

modlmf_page = Blueprint("modlmf",
                        __name__,
                        template_folder='templates',
                        static_folder="static")
modlmf_logger = make_logger(modlmf_page)


@modlmf_page.context_processor
def body_class():
    return {'body_class': 'modlmf'}


import main
assert main

app.register_blueprint(modlmf_page, url_prefix="/ModularForm/GL2/ModL")
Esempio n. 18
0
# -*- coding: utf-8 -*-
import sage
from sage.all import gcd, Set, ZZ, is_even, is_odd, euler_phi, CyclotomicField, gap, AbelianGroup, QQ, gp, NumberField, PolynomialRing, latex, pari, valuation
import yaml, os
from sage.misc.cachefunc import cached_function
from lmfdb.utils import make_logger, web_latex, coeff_to_poly, pol_to_html, display_multiset
from flask import url_for
from collections import Counter
from lmfdb.transitive_group import group_display_short, WebGaloisGroup, group_display_knowl, galois_module_knowl
from lmfdb.db_backend import db
wnflog = make_logger("WNF")

dir_group_size_bound = 10000
dnc = 'data not computed'

# Dictionary of field label: n for abs(disc(Q(zeta_n)))
# Does all cyclotomic fields of degree n s.t. 2<n<24
cycloinfo = {
    '4.0.125.1': 5,
    '6.0.16807.1': 7,
    '4.0.256.1': 8,
    '6.0.19683.1': 9,
    '10.0.2357947691.1': 11,
    '4.0.144.1': 12,
    '12.0.1792160394037.1': 13,
    '8.0.1265625.1': 15,
    '8.0.16777216.1': 16,
    '16.0.2862423051509815793.1': 17,
    '18.0.5480386857784802185939.1': 19,
    '8.0.4000000.1': 20,
    '12.0.205924456521.1': 21,
Esempio n. 19
0
# -*- coding: utf-8 -*-
from lmfdb.base import app
from lmfdb.utils import make_logger
from flask import Blueprint

hiwf_page = Blueprint("hiwf",
                      __name__,
                      template_folder='templates',
                      static_folder="static")
hiwf_logger = make_logger(hiwf_page)


@hiwf_page.context_processor
def body_class():
    return {'body_class': 'hiwf'}


import half_integral_form

app.register_blueprint(hiwf_page,
                       url_prefix="/ModularForm/GL2/Q/holomorphic/half")
Esempio n. 20
0
# -*- coding: utf-8 -*-
import re
from pymongo import ASCENDING, DESCENDING
import lmfdb.base
from lmfdb.base import app
from lmfdb.utils import make_logger, comma

def format_percentage(num, denom):
    return "%10.2f"%((100.0*num)/denom)

logger = make_logger("Lattices")

the_Latticestats = None

def get_stats():
    global the_Latticestats
    if the_Latticestats is None:
       the_Latticestats = Latticestats()
    return the_Latticestats


def lattice_summary():
    counts = get_stats().counts()
    return r"<p>The database currently contains %s <a title='integral lattices [lattice.definition]' knowl='lattice.definition' kwargs=''>integral lattices</a>. It includes data from the <a title='Catalogue of Lattices [lattice.catalogue_of_lattices]' knowl='lattice.catalogue_of_lattices' kwargs=''>Catalogue of Lattices</a>.<br>The largest  <a title='dimension [lattice.class_number]' knowl='lattice.dimension' kwargs=''>class number</a> is %s, the largest <a title='dimension [lattice.dimension]' knowl='lattice.dimension' kwargs=''>dimension</a> is %s and the largest <a title='determinant [lattice.determinant]' knowl='lattice.determinant' kwargs=''>determinant</a> is %s.</br>In the case of <a title='primitive [lattice.primitive]' knowl='lattice.primitive' kwargs=''>primitive</a> <a title='integral lattices [lattice.definition]' knowl='lattice.definition' kwargs=''>integral lattices</a> of <a title='class number[lattice.class_number]' knowl='lattice.class_number' kwargs=''>class number</a> one the database is complete.</p>" % (str(counts['nlattice_c']), str(counts['max_class_number_c']), str(counts['max_dim_c']), str(counts['max_det']))


@app.context_processor
def ctx_lattice_summary():
    return {'lattice_summary': lattice_summary}

class Latticestats(object):
Esempio n. 21
0
# -*- coding: utf-8 -*-
from lmfdb.base import app
from lmfdb.utils import make_logger
from flask import Blueprint

permutations_page = Blueprint("permutations", __name__, template_folder='templates', static_folder="static")
logger = make_logger(permutations_page)


@permutations_page.context_processor
def body_class():
    return {'body_class': 'Permutations'}

import main
assert main

app.register_blueprint(permutations_page, url_prefix="/Permutations")
Esempio n. 22
0
import json
import re
import tarfile
from lmfdb.base import app, getDBConnection, fmtdatetime
from flask import render_template, request, abort, Blueprint, url_for
from flask.ext.login import login_required, current_user
from gridfs import GridFS
from os import path
from bson.objectid import ObjectId
from urlparse import urlparse
from urllib import urlopen
from lmfdb.utils import MongoDBPagination, make_logger
from lmfdb.users import admin_required

upload_page = Blueprint("upload", __name__, template_folder='templates')
logging = make_logger(upload_page)

# blueprint specific definition of the body_class variable


@upload_page.context_processor
def body_class():
    return {'body_class': 'upload'}


def get_bread():
    return [("Upload", url_for(".index"))]


@upload_page.route("/")
@login_required
Esempio n. 23
0
# -*- coding: utf-8 -*-
from lmfdb.base import app
from lmfdb.utils import make_logger
from flask import Blueprint

belyi_page = Blueprint("belyi",
                       __name__,
                       template_folder='templates',
                       static_folder="static")
belyi_logger = make_logger(belyi_page)


@belyi_page.context_processor
def body_class():
    return {'body_class': 'belyi'}


import main
assert main  # silence pyflakes

app.register_blueprint(belyi_page, url_prefix="/Belyi")
Esempio n. 24
0
# -*- coding: utf-8 -*-

# Class created to aid in uploading HMF data from the Magma output data files.
# Incomplete, and currently not used for real work.
#
# In particular this code assumes that all the data for one HMF is in
# a single collection, which is no longer the case.

from sage.all import QQ, polygen

from lmfdb.db_backend import db
from lmfdb.hilbert_modular_forms.hilbert_field import HilbertNumberField
from lmfdb.utils import make_logger

logger = make_logger("hmf")

def construct_full_label(field_label, weight, level_label, label_suffix):
    if all([w==2 for w in weight]):           # Parellel weight 2
        weight_label = ''
    elif all([w==weight[0] for w in weight]): # Parellel weight
        weight_label = str(weight[0]) + '-'
    else:                                     # non-parallel weight
        weight_label = str(weight) + '-'
    return ''.join([field_label, '-', weight_label, level_label, '-', label_suffix])


class WebHMF(object):
    """
    Class for an Hilbert Modular Newform
    """
    def __init__(self, dbdata=None, label_or_field=None, L=None):
Esempio n. 25
0
# -*- coding: utf-8 -*-
from lmfdb.base import app, getDBConnection
from lmfdb.utils import make_logger, comma

logger = make_logger("lattice")


def db_latstats():
    return getDBConnection().Lattices.lat.stats


def lattice_summary():
    latstats = db_latstats()

    integral = '<a knowl="lattice.definition">integral lattices</a>'
    positivedef = '<a knowl="lattice.postive_definite">positive definite</a>'
    catalogue = '<a knowl="lattice.catalogue_of_lattices">Catalogue of Lattices</a>'
    cn = '<a knowl="lattice.class_number">class number</a>'
    dim = '<a knowl="lattice.dimension">dimension</a>'
    det = '<a knowl="lattice.determinant">determinant</a>'
    pri = '<a knowl="lattice.primitive">primitive</a>'
    cn_data = latstats.find_one('class_number')
    number = cn_data['total']
    max_cn = cn_data['max']
    dim_data = latstats.find_one('dim')
    max_dim = dim_data['max']
    det_data = latstats.find_one('det')
    max_det = det_data['max']

    return ''.join([
        r'<p>The database currently contains {} '.format(comma(number)),
Esempio n. 26
0
def field_data(s):
    r"""
    Returns full field data from field label.
    """
    deg, r1, abs_disc, n = [int(c) for c in s.split(".")]
    sig = [r1, (deg - r1) // 2]
    return [s, deg, sig, abs_disc]

def sort_field(F):
    r"""
    Returns data to sort by, from field label.
    """
    return [int(c) for c in F.split(".")]

logger = make_logger("ecnf")

def ecnf_summary():
    ecnfstats = db_ecnfstats()
    ec_knowl = '<a knowl="ec">elliptic curves</a>'
    iso_knowl = '<a knowl="ec.isogeny_class">isogeny classes</a>'
    nf_knowl = '<a knowl="nf">number fields</a>'
    deg_knowl = '<a knowl="nf.degree">degree</a>'
    data = ecnfstats.find_one({'_id':'conductor_norm'})
    ncurves = comma(data['ncurves'])
    nclasses = comma(data['nclasses'])
    data = ecnfstats.find_one({'_id':'field_label'})
    nfields = len(data['counts'])
    data = ecnfstats.find_one({'_id':'signatures_by_degree'})
    maxdeg = max(int(d) for d in data if d!='_id')
    return ''.join([r'The database currently contains {} '.format(ncurves),
Esempio n. 27
0
# -*- coding: utf-8 -*-
from lmfdb.base import app
from lmfdb.utils import make_logger
from flask import Blueprint

characters_page = Blueprint("characters", __name__, template_folder='templates',
    static_folder="static")
logger = make_logger(characters_page)


@characters_page.context_processor
def body_class():
    return {'body_class': 'characters'}

import main

app.register_blueprint(characters_page, url_prefix="/Character")
Esempio n. 28
0
# -*- coding: utf-8 -*-
from lmfdb.base import app
from lmfdb.utils import make_logger
from flask import Blueprint

nf_page = Blueprint("number_fields",
                    __name__,
                    template_folder='templates',
                    static_folder="static")
nf_logger = make_logger(nf_page)


@nf_page.context_processor
def body_class():
    return {'body_class': 'nf'}


from number_field import *

app.register_blueprint(nf_page, url_prefix="/NumberField")
Esempio n. 29
0
# -*- coding: utf-8 -*-
import sage
from sage.all import gcd, Set, ZZ, is_even, is_odd, euler_phi, CyclotomicField, gap, AbelianGroup, QQ, gp, NumberField, PolynomialRing, latex, pari, valuation
import yaml, os
from sage.misc.cachefunc import cached_function
from lmfdb.utils import make_logger, web_latex, coeff_to_poly, pol_to_html, display_multiset
from flask import url_for
from collections import Counter
from lmfdb.transitive_group import group_display_short, WebGaloisGroup, group_display_knowl, galois_module_knowl
from lmfdb.db_backend import db
wnflog = make_logger("WNF")

dir_group_size_bound = 10000
dnc = 'data not computed'

# Dictionary of field label: n for abs(disc(Q(zeta_n)))
# Does all cyclotomic fields of degree n s.t. 2<n<24
cycloinfo = {'4.0.125.1': 5, '6.0.16807.1': 7, '4.0.256.1': 8,
  '6.0.19683.1': 9, '10.0.2357947691.1': 11, '4.0.144.1': 12,
  '12.0.1792160394037.1': 13, '8.0.1265625.1': 15, '8.0.16777216.1': 16,
  '16.0.2862423051509815793.1': 17, '18.0.5480386857784802185939.1': 19,
  '8.0.4000000.1': 20, '12.0.205924456521.1': 21,
  '22.0.39471584120695485887249589623.1': 23, '8.0.5308416.1': 24,
  '20.0.2910383045673370361328125.1': 25,
  '18.0.2954312706550833698643.1': 27, '12.0.1157018619904.1': 28,
  '16.0.18446744073709551616.1': 32, '20.0.328307557444402776721569.1': 33,
  '24.0.304383340063522342681884765625.1': 35,
  '12.0.1586874322944.1': 36,
  '24.0.1706902865139206151939937338729.1': 39,
  '16.0.1048576000000000000.1': 40,
  '20.0.5829995856912430117421056.1': 44,
Esempio n. 30
0
default_display_bprec = 26  # The default number of bits of precision to display for floating point data
default_max_height = 90
from sage.env import SAGE_VERSION
version_major, version_minor = [int(x) for x in SAGE_VERSION.split('.')[:2]]
#if (version_major, version_minor) >= (6,9):
#    emf_version = 1.3
#elif (version_major, version_minor) >= (6,8):
#    emf_version = 1.3
#else:
#    emf_version = 1.1
emf_version = 1.3

EMF_TOP = "Holomorphic Modular Forms"  # The name to use for the top of this catergory
EMF = "emf"  # The current blueprint name
emf = flask.Blueprint(EMF, __name__, template_folder="views/templates", static_folder="views/static")
emf_logger = make_logger(emf)
emf_logger.info("Initializing elliptic modular forms blueprint with Sage version %s, emf version %s" % (SAGE_VERSION, emf_version))

### Maximum values for computations
N_max_comp = 50
k_max_comp = 12
N_max_Gamma1_fdraw = 33
N_max_Gamma0_fdraw = 300
N_max_db = 5000
k_max_db = 12
N_max_extra_comp = 500

## Don't ever change this, see
## https://github.com/LMFDB/lmfdb/pull/1409#issuecomment-220733555
use_cache = False
Esempio n. 31
0
# -*- coding: utf-8 -*-
from lmfdb.base import app
from lmfdb.utils import make_logger
from flask import Blueprint

modlmf_page = Blueprint("modlmf", __name__, template_folder="templates", static_folder="static")
modlmf_logger = make_logger(modlmf_page)


@modlmf_page.context_processor
def body_class():
    return {"body_class": "modlmf"}


import main

assert main

app.register_blueprint(modlmf_page, url_prefix="/ModularForm/GL2/ModL")
Esempio n. 32
0
# based on /lmfdb/elliptic_curves/ec_stats.py

import re
from lmfdb.db_backend import db
from sage.all import UniqueRepresentation, cached_method
from lmfdb.utils import make_logger

logger = make_logger("hgcwa")


def oldstat(name):
    return db.hgcwa_passports.stats.get_oldstat(name)


def max_group_order(counts):
    orders = []
    for count in counts:
        group = count[0]
        order = int(re.search(r'\[(\d+)', group).group(1))
        orders.append(order)
    return max(orders)


class HGCWAstats(UniqueRepresentation):
    """
    Class for creating and displaying statistics for higher genus curves with automorphisms
    """
    #TODO provide getter for subset of stats (e.g. for top matter)
    @cached_method
    def stats(self):
        logger.debug("Computing elliptic curve stats...")
Esempio n. 33
0
from lmfdb.utils import make_logger

databases_logger = make_logger("databases_logger", hl=True)

from type_generation import *
from standard_types import *
from Dokchitser_databases import *
Esempio n. 34
0
# -*- coding: utf-8 -*-
from lmfdb.base import app
from lmfdb.utils import make_logger
from flask import Blueprint

l_function_page = Blueprint("l_functions", __name__, template_folder='templates', static_folder="static")
logger = make_logger("LF")


@l_function_page.context_processor
def body_class():
    return {'body_class': 'l_functions'}

import main

app.register_blueprint(l_function_page, url_prefix="/L")


## How to solve this redirection easily?
##
##@app.route("/Lfunction/")
##@app.route("/Lfunction/<arg1>/")
##@app.route("/Lfunction/<arg1>/<arg2>/")
##@app.route("/Lfunction/<arg1>/<arg2>/<arg3>/")
##@app.route("/Lfunction/<arg1>/<arg2>/<arg3>/<arg4>/")
##@app.route("/Lfunction/<arg1>/<arg2>/<arg3>/<arg4>/<arg5>/")
##@app.route("/Lfunction/<arg1>/<arg2>/<arg3>/<arg4>/<arg5>/<arg6>/")
##@app.route("/Lfunction/<arg1>/<arg2>/<arg3>/<arg4>/<arg5>/<arg6>/<arg7>/")
##@app.route("/Lfunction/<arg1>/<arg2>/<arg3>/<arg4>/<arg5>/<arg6>/<arg7>/<arg8>/")
##@app.route("/Lfunction/<arg1>/<arg2>/<arg3>/<arg4>/<arg5>/<arg6>/<arg7>/<arg8>/<arg9>/")
##@app.route("/L-function/")
Esempio n. 35
0
# -*- coding: utf-8 -*-
from lmfdb.base import app
from lmfdb.utils import make_logger
from flask import Blueprint
from lmfdb.api2.searchers import register_search_function, register_singleton
import searchers

ec_page = Blueprint("ec",
                    __name__,
                    template_folder='templates',
                    static_folder="static")
ec_logger = make_logger(ec_page)
ec_logger.info("Initializing elliptic curves blueprint")


@ec_page.context_processor
def body_class():
    return {'body_class': 'ec'}


import elliptic_curve
assert elliptic_curve  # for pyflakes

app.register_blueprint(ec_page, url_prefix="/EllipticCurve/Q")

register_search_function("elliptic_curves_q", "Elliptic Curves over Rationals",
                         "Search over elliptic curves defined over rationals",
                         searchers.get_searchers, None)
register_singleton('EllipticCurve/Q',
                   'elliptic_curves',
                   'curves',
Esempio n. 36
0
# -*- coding: utf-8 -*-
from lmfdb.base import app
from lmfdb.utils import make_logger
from flask import Blueprint

ec_page = Blueprint("ec", __name__, template_folder='templates', static_folder="static")
ec_logger = make_logger(ec_page)


@ec_page.context_processor
def body_class():
    return {'body_class': 'ec'}

#from elliptic_curves import *
import elliptic_curve

app.register_blueprint(ec_page, url_prefix="/EllipticCurve/Q")
Esempio n. 37
0
# -*- coding: utf-8 -*-
from lmfdb.base import app
from lmfdb.utils import make_logger
from flask import Blueprint

knowledge_page = Blueprint("knowledge", __name__, template_folder='templates')
logger = make_logger(knowledge_page)

import main
assert main

app.register_blueprint(knowledge_page, url_prefix="/knowledge")
Esempio n. 38
0
# -*- coding: utf-8 -*-
import lmfdb.base
from lmfdb.base import app
from lmfdb.utils import make_logger, comma


def format_percentage(num, denom):
    return "%10.2f" % ((100.0 * num) / denom)


logger = make_logger("rep_galois_modls")

the_rep_galois_modlstats = None


def get_stats():
    global the_rep_galois_modlstats
    if the_rep_galois_modlstats is None:
        the_rep_galois_modlstats = rep_galois_modlstats()
    return the_rep_galois_modlstats


def rep_galois_modl_summary():
    counts = get_stats().counts()
    return r"<p>The database currently contains %s <a title='mod &#x2113; Galois representation'[rep_galois_modl.definition]' knowl='rep_galois_modl.definition' kwargs=''>mod &#x2113; Galois representations</a>.</p>" % (
        str(counts['nrep_galois_modl_c']))


@app.context_processor
def ctx_rep_galois_modl_summary():
    return {'rep_galois_modl_summary': rep_galois_modl_summary}
Esempio n. 39
0
# -*- coding: utf-8 -*-
from lmfdb.base import app
from lmfdb.utils import make_logger
from flask import Blueprint

crystals_page = Blueprint("crystals", __name__, template_folder='templates', static_folder="static")
logger = make_logger(crystals_page)


@crystals_page.context_processor
def body_class():
    return {'body_class': 'Crystals'}

import main

app.register_blueprint(crystals_page, url_prefix="/Crystals")
Esempio n. 40
0
# -*- coding: utf-8 -*-
from lmfdb.base import app
from lmfdb.utils import make_logger
from flask import Blueprint

ecnf_page = Blueprint("ecnf",
                      __name__,
                      template_folder='templates',
                      static_folder="static")
logger = make_logger(ecnf_page)


@ecnf_page.context_processor
def body_class():
    return {'body_class': 'ecnf'}


import main

app.register_blueprint(ecnf_page, url_prefix="/EllipticCurve")
Esempio n. 41
0
# -*- coding: utf-8 -*-
from lmfdb.base import app
from lmfdb.utils import make_logger
from flask import Blueprint

hmf_page = Blueprint("hmf",
                     __name__,
                     template_folder='templates',
                     static_folder="static")
hmf_logger = make_logger(hmf_page)


@hmf_page.context_processor
def body_class():
    return {'body_class': 'hmf'}


import hilbert_modular_form
assert hilbert_modular_form

app.register_blueprint(hmf_page, url_prefix="/ModularForm/GL2/TotallyReal")
Esempio n. 42
0
from lmfdb.base import app
from lmfdb.utils import make_logger
from flask import Blueprint

cmf_page = Blueprint("cmf", __name__, template_folder='templates', static_folder="static")
cmf = cmf_page
cmf_logger = make_logger(cmf_page)

import main
assert main # silence pyflakes

app.register_blueprint(cmf_page, url_prefix="/ModularForm/GL2/Q/holomorphic")
Esempio n. 43
0
# -*- coding: utf-8 -*-
from lmfdb.base import getDBConnection
from lmfdb.utils import make_logger
from lmfdb.WebNumberField import nf_display_knowl, field_pretty
from lmfdb.elliptic_curves.web_ec import split_lmfdb_label
from lmfdb.modular_forms.elliptic_modular_forms.backend.emf_utils import newform_label, is_newform_in_db
from lmfdb.nfutils.psort import primes_iter, ideal_from_label, ideal_label
from lmfdb.utils import web_latex
from flask import url_for
from sage.all import QQ, PolynomialRing, NumberField

logger = make_logger("bmf")

def db_dims():
    return getDBConnection().bmfs.dimensions

def db_dimstats():
    return getDBConnection().bmfs.dimensions.stats

def db_forms():
    return getDBConnection().bmfs.forms

def db_nf_fields():
    return getDBConnection().numberfields.fields

def db_ecnf():
    return getDBConnection().elliptic_curves.nfcurves

def is_bmf_in_db(label):
    return db_forms().find({"label": label}).limit(1).count(True) > 0
Esempio n. 44
0
from lmfdb.utils import make_logger
typed_data_logger = make_logger("typed_data_logger", hl=True)

import type_generation
assert type_generation
import standard_types
assert standard_types
import artin_types
assert artin_types
Esempio n. 45
0
# -*- coding: utf-8 -*-
from lmfdb.base import app
from lmfdb.utils import make_logger
from flask import Blueprint

higher_genus_w_automorphisms_page = Blueprint("higher_genus_w_automorphisms",
                                       __name__, template_folder='templates',
                                       static_folder="static")
logger = make_logger(higher_genus_w_automorphisms_page)


@higher_genus_w_automorphisms_page.context_processor
def body_class():
    return {'body_class': 'higher_genus_w_automorphisms'}

import main

app.register_blueprint(higher_genus_w_automorphisms_page, url_prefix="/HigherGenus/C/aut")
Esempio n. 46
0
def match_lmfdb_iso_label(lab):
    return lmfdb_iso_label_regex.match(lab)

def match_cremona_label(lab):
    return cremona_label_regex.match(lab)

def split_lmfdb_label(lab):
    return lmfdb_label_regex.match(lab).groups()

def split_lmfdb_iso_label(lab):
    return lmfdb_iso_label_regex.match(lab).groups()

def split_cremona_label(lab):
    return cremona_label_regex.match(lab).groups()

logger = make_logger("ec")

ecdb = None
padicdb = None

def db_ec():
    global ecdb
    if ecdb is None:
        ecdb = lmfdb.base.getDBConnection().elliptic_curves.curves
    return ecdb

def padic_db():
    global padicdb
    if padicdb is None:
        padicdb = lmfdb.base.getDBConnection().elliptic_curves.padic_db
    return padicdb
Esempio n. 47
0
# -*- coding: utf-8 -*-
from lmfdb.base import app
from lmfdb.utils import make_logger
from flask import Blueprint

smf_page = Blueprint('smf',
                     __name__,
                     template_folder='templates',
                     static_folder='static')
smf_logger = make_logger(smf_page)


@smf_page.context_processor
def body_class():
    return {'body_class': 'smf'}


import siegel_modular_form
assert siegel_modular_form  #silence pyflakes

app.register_blueprint(smf_page, url_prefix='/ModularForm/GSp/Q')
Esempio n. 48
0
# -*- coding: utf-8 -*-
# Author: Pascal Molin, [email protected]
from sage.misc.cachefunc import cached_method
from sage.all import gcd, Rational, power_mod, Mod, Integer, Integers, gp, xsrange
import re
from flask import url_for
import lmfdb
from lmfdb.utils import make_logger
logger = make_logger("DC")
from WebNumberField import WebNumberField
try:
    from dirichlet_conrey import DirichletGroup_conrey, DirichletCharacter_conrey
except:
    logger.critical("dirichlet_conrey.pyx cython file is not available ...")
from HeckeCharacters import HeckeChar, RayClassGroup

"""
Any character object is obtained as a double inheritance of

1. a family (currently: Dirichlet/Z or Hecke/K)

2. an object type (list of groups, character group, character)

The code thus defines, from the generic top class WebCharObject

1. the mathematical family classes

   - WebDirichlet

   - WebHecke
Esempio n. 49
0
# -*- coding: utf-8 -*-
from lmfdb.base import app
from lmfdb.db_backend import db
from lmfdb.utils import make_logger, comma
from sage.misc.cachefunc import cached_method

logger = make_logger("modlmfs")

the_modlmf_stats = None


def get_stats():
    global the_modlmf_stats
    if the_modlmf_stats is None:
        the_modlmf_stats = modlmf_stats()
    return the_modlmf_stats


def modlmf_summary():
    counts = get_stats().counts()
    return r"<p>The database currently contains %s <a title='mod &#x2113; modular forms [modlmf.definition]' knowl='modlmf.definition' kwargs=''>mod &#x2113; modular forms</a>. <br>The largest <a title='level [modlmf.level]' knowl='modlmf.level' kwargs=''>level</a> is %s, the largest <a title='weight [modlmf.weight]' knowl='modlmf.weight' kwargs=''>weight</a> is %s.</p>" % (
        str(counts['nmodlmf_c']), str(
            counts['max_level_c']), str(counts['max_weight_c']))


@app.context_processor
def ctx_modlmf_summary():
    return {'modlmf_summary': modlmf_summary}


class modlmf_stats(object):
Esempio n. 50
0
# -*- coding: utf-8 -*-
from lmfdb.base import app
from lmfdb.utils import make_logger
from flask import Blueprint

hypergm_page = Blueprint("hypergm", __name__, template_folder='templates', static_folder="static")
hgm_logger = make_logger(hypergm_page)


@hypergm_page.context_processor
def body_class():
    return {'body_class': 'hypergm'}

import main

app.register_blueprint(hypergm_page, url_prefix="/Motives/Hypergeometric/Q")
Esempio n. 51
0
# -*- coding: utf-8 -*-
from lmfdb.db_backend import db
from lmfdb.utils import make_logger
from lmfdb.WebNumberField import nf_display_knowl, field_pretty
from lmfdb.elliptic_curves.web_ec import split_lmfdb_label
from lmfdb.modular_forms.elliptic_modular_forms.backend.emf_utils import newform_label, is_newform_in_db
from lmfdb.nfutils.psort import primes_iter, ideal_from_label, ideal_label
from lmfdb.utils import web_latex
from flask import url_for
from sage.all import QQ, PolynomialRing, NumberField

logger = make_logger("bmf")


def is_bmf_in_db(label):
    return db.bmf_forms.lookup(label, projection=0) is not None


class WebBMF(object):
    """
    Class for an Bianchi Newform
    """
    def __init__(self, dbdata):
        """Arguments:

            - dbdata: the data from the database

        dbdata is expected to be a database entry from which the class
        is initialised.

        """
Esempio n. 52
0
# -*- coding: utf-8 -*-
import re
import os
import pymongo
from pymongo import ASCENDING, DESCENDING
from flask import url_for, make_response
import lmfdb.base
from lmfdb.utils import comma, make_logger, web_latex, encode_plot
from lmfdb.genus2_curves.web_g2c import g2c_page, g2c_logger, list_to_min_eqn, end_alg_name, st_group_name
from sage.all import QQ, PolynomialRing, factor, ZZ
from lmfdb.WebNumberField import field_pretty

logger = make_logger("g2c")

g2cdb = None


def db_g2c():
    global g2cdb
    if g2cdb is None:
        g2cdb = lmfdb.base.getDBConnection().genus2_curves
    return g2cdb


def list_to_poly(s):
    return str(PolynomialRing(QQ, 'x')(s)).replace('*', '')


def list_to_factored_poly(s):
    return str(factor(PolynomialRing(ZZ, 't')(s))).replace('*', '')
Esempio n. 53
0
from collections import Counter

from lmfdb.utils import make_logger, encode_plot

from lmfdb.db_backend import db
from lmfdb.base import app

from sage.rings.all import Integer, QQ, RR
from sage.plot.all import line, points, circle, Graphics

from lmfdb.utils import list_to_factored_poly_otherorder
from lmfdb.WebNumberField import nf_display_knowl, field_pretty
from lmfdb.transitive_group import group_display_knowl
from lmfdb.abvar.fq.web_abvar import av_display_knowl, av_data  #, av_knowl_guts

logger = make_logger("abvarfq")

#########################
#   Label manipulation
#########################


def validate_label(label):
    parts = label.split('.')
    if len(parts) != 3:
        raise ValueError(
            "it must be of the form g.q.iso, with g a dimension and q a prime power"
        )
    g, q, iso = parts
    try:
        g = int(g)
Esempio n. 54
0
import ast
import StringIO
import lmfdb.base
from lmfdb.base import app
from lmfdb.utils import to_dict, make_logger, random_object_from_collection
from lmfdb.abvar.fq import abvarfq_page
from lmfdb.search_parsing import parse_ints, parse_list_start, parse_count, parse_start, parse_range, parse_nf_string
from search_parsing import parse_newton_polygon, parse_abvar_decomp
from isog_class import validate_label, AbvarFq_isoclass
from stats import AbvarFqStats
from flask import flash, render_template, url_for, request, redirect, send_file
from markupsafe import Markup
from sage.misc.cachefunc import cached_function
from sage.rings.all import PolynomialRing, ZZ

logger = make_logger("abvarfq")

#########################
#   Database connection
#########################

@cached_function
def db():
    return lmfdb.base.getDBConnection().abvar.fq_isog

#########################
#    Top level
#########################

def get_bread(*breads):
    bc = [('Abelian Varieties', url_for(".abelian_varieties")),
Esempio n. 55
0
# -*- coding: utf-8 -*-
from lmfdb.base import app
from lmfdb.utils import make_logger
from flask import Blueprint

bmf_page = Blueprint("bmf", __name__, template_folder='templates', static_folder="static")
bmf_logger = make_logger(bmf_page)


@bmf_page.context_processor
def body_class():
    return {'body_class': 'bmf'}

import bianchi_modular_form
assert bianchi_modular_form

app.register_blueprint(bmf_page, url_prefix="/ModularForm/GL2/ImaginaryQuadratic")