示例#1
0
def render_one_maass_waveform_wp(info, prec=9):
    r"""
    Render the webpage of one Maass waveform.

    The precision kwarg `prec` is passed to the coefficient table, and
    indicates to round to 0 when the difference is less than 1e-`prec`.
    """
    info["check"] = []
    maass_id = info['maass_id']
    mwf_logger.debug("id1={0}".format(maass_id))
    try:
        MF = WebMaassForm(maass_id)
    except KeyError:
        return flask.abort(404)
    info['MF'] = MF
    info['title'] = "Maass Form"
    info['bread'] = [('Modular Forms', url_for('mf.modular_form_main_page')),
                     ('Maass Forms', url_for('.render_maass_waveforms'))]
    if hasattr(MF, 'level'):
        info['bread'].append(('Level {0}'.format(MF.level),
                              url_for('.render_maass_waveforms',
                                      level=MF.level)))
        info['title'] += r" on \(\Gamma_{0}( %s )\)" % info['MF'].level
        if hasattr(MF, 'R') and MF.R:
            info['title'] += r" with \(R=%s\)" % info['MF'].R

    # make sure all the expected attributes of a WebMaassForm are actually present
    missing = [
        attr for attr in ['level', 'dim', 'num_coeff', 'R', 'character']
        if not hasattr(MF, attr)
    ]
    if missing:
        mwf_logger.critical(
            "Unable to render Maass form {0}; required attributes {1} missing from database record."
            .format(maass_id, missing))
        info['explain'] = "Unable to render Maass form {0} because the following required attributes were missing from the database record:".format(maass_id) \
                      + "<ul>" + "".join(["<li>"+attr+"</li>" for attr in missing]) + "</ul>"
        return render_template("problem.html", **info)

    level = info['MF'].level
    dim = info['MF'].dim
    # numc = info['MF'].num_coeff # never used
    # if info['MF'].has_plot(): # and level == 1: # Bara level = 1 har rätt format för tillfället //Lemurell
    #    info['plotlink'] = url_for('mwf.plot_maassform', maass_id=maass_id)
    # Create the link to the L-function (put in '/L' at the beginning and '/' before '?'
    Llink = "/L" + url_for('mwf.render_one_maass_waveform',
                           maass_id=maass_id)  # + '/?db=' + info['db']
    if dim == 1:
        info["friends"] = [("L-function", Llink)]

    # Navigation to previous and next form
    # next_form_id = info['MF'].next_maassform_id()
    # if next_form_id:
    #    next_data = ('next', r"$f_{\text next}$", url_for('mwf.render_one_maass_waveform', maass_id = next_form_id) )
    # else:
    #    next_data = ('','','')
    # prev_form_id = info['MF'].prev_maassform_id()
    # if prev_form_id:
    #    prev_data = ('previous', r"$f_{\text prev}$", url_for('mwf.render_one_maass_waveform', maass_id = prev_form_id) )
    # else:
    #    prev_data = ('','','')

    # info['navi'] = ( prev_data, next_data )

    info["downloads"] = [('All stored data of the form',
                          url_for('mwf.render_one_maass_waveform',
                                  maass_id=maass_id,
                                  download='all')),
                         ('All coefficients of the form',
                          url_for('mwf.render_one_maass_waveform',
                                  maass_id=maass_id,
                                  download='coefficients'))]
    mwf_logger.debug("count={0}".format(maass_db.count()))
    ch = info['MF'].character
    s = r"\( \chi_{" + str(level) + "}(" + str(ch) + r",\cdot) \)"
    # Q: Is it possible to get the knowls into the properties?
    # A: Not in a nice way and this is not done elsewhere in the LMFDB; the knowls should appear on labels in the template
    # knowls = {'level': 'mf.maass.mwf.level',
    #                   'weight': 'mf.maass.mwf.weight',
    #                   'char': 'mf.maass.mwf.character',
    #                   'R': 'mf.maass.mwf.eigenvalue',
    #                   'sym': 'mf.maass.mwf.symmetry',
    #                   'prec': 'mf.maass.mwf.precision',
    #                   'mult': 'mf.maass.mwf.dimension',
    #                   'ncoeff': 'mf.maass.mwf.ncoefficients',
    #                   'fricke': 'cmf.fricke',
    #                   'atkinlehner': 'cmf.atkin-lehner'}
    properties = [
        ('Level', [info['MF'].level]),
        ('Symmetry', [info['MF'].even_odd()]),
        ('Weight', [info['MF'].the_weight()]),
        ('Character', [s]),
        ('Multiplicity', [dim]),
        ('Precision', [info['MF'].precision()]),
        ('Fricke Eigenvalue', [info['MF'].fricke()]),
        ('Atkin-Lehner Eigenvalues', [info['MF'].atkinlehner()]),
    ]
    if dim > 1 and info['MF'].the_character() == "trivial":
        properties.append(("Possibly oldform", []))
    info['properties'] = properties

    # The precision in set_table indicates which coefficients to set to zero.
    # For instance, if the imaginary part is less than the precision in
    # absolute value, then it is set to 0 in set_table.
    # The value 1e-9 is chosen arbitrarily, as recommended in issue #2076.
    info['MF'].set_table(prec=prec)
    cols = [{
        "aaSorting": "asc",
        "sWidth": "10%",
        "bSortable": "true",
        "bSearchable": "false",
        "sType": "numeric"
    }]
    negc = info['MF'].table.get('negc', 0)
    for j in range(dim):
        if not negc:
            col = {
                "bSortable": "false",
                "bSearchable": "true",
                "sClass": "alignLeft",
                "fnRender": "text-align:left",
                "sType": "numeric"
            }
            cols.append(col)
        else:
            col1 = {
                "bSortable": "false",
                "bSearchable": "true",
                "sClass": "alignLeft",
                "fnRender": "text-align:left",
                "sType": "numeric"
            }
            col2 = {
                "bSortable": "false",
                "bSearchable": "true",
                "sClass": "alignLeft",
                "fnRender": "text-align:left",
                "sType": "numeric"
            }
            cols.append(col1)
            cols.append(col2)
    info['credit'] = info['MF'].contributor_name
    info['coeff_aoColumns'] = cols  # json.dumps(cols)
    mwf_logger.debug("col={0}".format(cols))
    return render_template("mwf_one_form.html", **info)
示例#2
0
def render_one_maass_waveform_wp(info):
    r"""
    Render the webpage of one Maass waveform.
    """
    info["check"] = []
    DB = connect_db()
    maass_id = info['maass_id']
    mwf_logger.debug("id1={0}".format(maass_id))
    try:
        MF = WebMaassForm(DB, maass_id)
    except KeyError:
        return flask.abort(404)
    info['MF'] = MF
    info['title'] = "Maass form"
    info['bread'] = [('Modular forms', url_for('mf.modular_form_main_page')),
                     ('Maass waveforms', url_for('.render_maass_waveforms'))]
    if hasattr(MF,'level'):
        info['bread'].append(('Level {0}'.format(MF.level), url_for('.render_maass_waveforms', level=MF.level)))
        info['title'] += " on \(\Gamma_{0}( %s )\)" % info['MF'].level
        if hasattr(MF, 'R') and MF.R:
            info['title'] += " with \(R=%s\)" % info['MF'].R

    # make sure all the expected attributes of a WebMaassForm are actually present
    missing = [attr for attr in ['level', 'dim', 'num_coeff', 'R', 'character'] if not hasattr(MF, attr)]
    if missing:
        mwf_logger.critical("Unable to render Maass form {0}; required attributes {1} missing from database record.".format(maass_id,missing))
        info['explain'] = "Unable to render Maass form {0} because the following required attributes were missing from the database record:".format(maass_id) \
                      + "<ul>" + "".join(["<li>"+attr+"</li>" for attr in missing]) + "</ul>"
        return render_template("problem.html", **info)

    level = info['MF'].level
    dim = info['MF'].dim
    # numc = info['MF'].num_coeff # never used
    if info['MF'].has_plot(): # and level == 1: # Bara level = 1 har rätt format för tillfället //Lemurell
        info['plotlink'] = url_for('mwf.plot_maassform', maass_id=maass_id)
    # Create the link to the L-function (put in '/L' at the beginning and '/' before '?'
    Llink = "/L" + url_for('mwf.render_one_maass_waveform', maass_id=maass_id)  # + '/?db=' + info['db']
    if dim == 1:
        info["friends"] = [("L-function", Llink)]

    # Navigation to previous and next form
    next_form_id = info['MF'].next_maassform_id()
    if next_form_id:
        next_data = ('next', r"$f_{\text next}$", url_for('mwf.render_one_maass_waveform',
                                                                maass_id = next_form_id) )
    else:
        next_data = ('','','')
    prev_form_id = info['MF'].prev_maassform_id()
    if prev_form_id:
        prev_data = ('previous', r"$f_{\text prev}$", url_for('mwf.render_one_maass_waveform',
                                                                maass_id = prev_form_id) )
    else:
        prev_data = ('','','')
        
    info['navi'] = ( prev_data, next_data )
    
    info["downloads"] = [ ('All stored data of the form',
                           url_for('mwf.render_one_maass_waveform', maass_id=maass_id,
                                   download='all')),
                          ('All coefficients of the form',
                           url_for('mwf.render_one_maass_waveform', maass_id=maass_id,
                                   download='coefficients')) ]
    mwf_logger.debug("count={0}".format(DB.count()))
    ch = info['MF'].character
    s = "\( \chi_{" + str(level) + "}(" + str(ch) + ",\cdot) \)"
    # Q: Is it possible to get the knowls into the properties?
    # A: Not in a nice way and this is not done elsewhere in the LMFDB; the knowls should appear on labels in the template
    # knowls = {'level': 'mf.maass.mwf.level',
    #                   'weight': 'mf.maass.mwf.weight',
    #                   'char': 'mf.maass.mwf.character',
    #                   'R': 'mf.maass.mwf.eigenvalue',
    #                   'sym': 'mf.maass.mwf.symmetry',
    #                   'prec': 'mf.maass.mwf.precision',
    #                   'mult': 'mf.maass.mwf.dimension',
    #                   'ncoeff': 'mf.maass.mwf.ncoefficients',
    #                   'fricke': 'mf.maass.mwf.fricke',
    #                   'atkinlehner': 'mf.maass.mwf.atkinlehner'}
    properties = [('Level', [info['MF'].level]),
                  ('Symmetry', [info['MF'].even_odd()]),
                  ('Weight', [info['MF'].the_weight()]),
                  ('Character', [s]),
                  ('Multiplicity', [dim]),
                  ('Precision', [info['MF'].precision()]),
                  ('Fricke Eigenvalue', [info['MF'].fricke()]),
                  ('Atkin-Lehner Eigenvalues', [info['MF'].atkinlehner()]),
                  ]
    if dim > 1 and info['MF'].the_character() == "trivial":
        properties.append(("Possibly oldform", []))
    info['properties2'] = properties

    info['MF'].set_table()
    cols = [{"aaSorting": "asc", "sWidth": "10%", "bSortable": "true", "bSearchable": "false",
             "sType": "numeric"}]
    negc = info['MF'].table.get('negc', 0)
    for j in range(dim):
        if not negc:
            col = {"bSortable": "false", "bSearchable": "true", "sClass": "alignLeft",
                   "fnRender": "text-align:left", "sType": "numeric"}
            cols.append(col)
        else:
            col1 = {"bSortable": "false", "bSearchable": "true", "sClass": "alignLeft",
                    "fnRender": "text-align:left", "sType": "numeric"}
            col2 = {"bSortable": "false", "bSearchable": "true", "sClass": "alignLeft",
                    "fnRender": "text-align:left", "sType": "numeric"}
            cols.append(col1)
            cols.append(col2)
    info['credit'] = info['MF'].contributor_name
    info['coeff_aoColumns'] = cols  # json.dumps(cols)
    mwf_logger.debug("col={0}".format(cols))
    return render_template("mwf_one_form.html", **info)
示例#3
0
import pymongo
from flask import render_template, url_for, request, redirect, make_response, send_file
from lmfdb.utils import *
from lmfdb.modular_forms.elliptic_modular_forms.backend.plot_dom import *
from lmfdb.modular_forms.maass_forms.maass_waveforms import MWF, mwf_logger, mwf
from lmfdb.modular_forms.maass_forms.maass_waveforms.backend.maass_forms_db import MaassDB
# from knowledge.knowl import Knowl
# from psage.modform.maass.lpkbessel import *
# build extensions

try:
    #  from modular_forms.maass_forms.backend.lpkbessel import *
    from lpkbessel import *
except Exception as ex:
    mwf_logger.critical(
        "maass_waveforms/views/mwf_utils.py: couldn't load backend. Exception: '%s' To enable full Maass waveform functionality: compile the cython file lpkbessel.pyx with sage -c create_local_so('lpkbessel.pyx')"
        % ex)
    # try:
    #  # Builds the kbessel extension build_ext --inplace $*
    #  execfile("setup.py")
    # except Exception as ex1:

mwf_dbname = 'MaassWaveForm'
available_collections = ['FS', 'HT']

_DB = None


def connect_db():
    global _DB
    if _DB is None:
示例#4
0
import StringIO
import pymongo
from sage.all import is_odd, is_even, dumps, loads
# mwf = flask.Blueprint('mwf', __name__, template_folder="templates",static_folder="static")
from lmfdb.modular_forms.maass_forms.maass_waveforms import MWF, mwf_logger, mwf
from lmfdb.modular_forms.maass_forms.maass_waveforms.backend.mwf_utils import *
from lmfdb.modular_forms.maass_forms.maass_waveforms.backend.mwf_classes import MaassFormTable, WebMaassForm
from lmfdb.modular_forms.maass_forms.maass_waveforms.backend.maass_forms_db import MaassDB
from mwf_upload_data import *
from mwf_plot import paintSvgMaass
logger = mwf_logger
import json
try:
    from dirichlet_conrey import *
except:
    mwf_logger.critical("Could not import dirichlet_conrey!")


# this is a blueprint specific default for the tempate system.
# it identifies the body tag of the html website with class="wmf"
@mwf.context_processor
def body_class():
    return {'body_class': MWF}

met = ['GET', 'POST']


@mwf.route("/", methods=met)
@mwf.route("/<int:level>/", methods=met)
@mwf.route("/<int:level>/<int:weight>/", methods=met)
@mwf.route("/<int:level>/<int:weight>/<int:character>/", methods=met)
示例#5
0
import lmfdb.base
import pymongo
from flask import render_template, url_for, request, redirect, make_response, send_file
from lmfdb.utils import *
from lmfdb.modular_forms.elliptic_modular_forms.backend.plot_dom import *
from lmfdb.modular_forms.maass_forms.maass_waveforms import MWF, mwf_logger, mwf
from lmfdb.modular_forms.maass_forms.maass_waveforms.backend.maass_forms_db import MaassDB
# from knowledge.knowl import Knowl
# from psage.modform.maass.lpkbessel import *
# build extensions

try:
    #  from modular_forms.maass_forms.backend.lpkbessel import *
    from lpkbessel import *
except Exception as ex:
    mwf_logger.critical("maass_waveforms/views/mwf_utils.py: couldn't load backend. Exception: '%s' To enable full Maass waveform functionality: compile the cython file lpkbessel.pyx with sage -c create_local_so('lpkbessel.pyx')" % ex)
    # try:
    #  # Builds the kbessel extension build_ext --inplace $*
    #  execfile("setup.py")
    # except Exception as ex1:

mwf_dbname = 'MaassWaveForm'
available_collections = ['FS', 'HT']

_DB = None


def connect_db():
    global _DB
    if _DB is None:
        host = lmfdb.base.getDBConnection().host