def render_bmf_space_webpage(field_label, level_label): info = {} t = "Bianchi modular forms of level %s over %s" % (level_label, field_label) credit = bianchi_credit bread = [('Bianchi modular forms', url_for(".index")), (field_pretty(field_label), url_for(".render_bmf_field_dim_table_gl2", field_label=field_label)), (level_label, '')] friends = [] properties2 = [] if not field_label_regex.match(field_label): info[ 'err'] = "%s is not a valid label for an imaginary quadratic field" % field_label else: pretty_field_label = field_pretty(field_label) if not db_dims().find({'field_label': field_label}): info[ 'err'] = "no dimension information exists in the database for field %s" % pretty_field_label else: t = "Bianchi Modular Forms of level %s over %s" % ( level_label, pretty_field_label) data = db_dims().find({ 'field_label': field_label, 'level_label': level_label }) nres = data.count() if nres == 0: info[ 'err'] = "no dimension information exists in the database for level %s and field %s" % ( level_label, pretty_field_label) else: data = data.next() info['label'] = data['label'] nf = WebNumberField(field_label) info['base_galois_group'] = nf.galois_string() info['field_label'] = field_label info['pretty_field_label'] = pretty_field_label info['level_label'] = level_label info['level_norm'] = data['level_norm'] info['field_degree'] = nf.degree() info['field_classno'] = nf.class_number() info['field_disc'] = str(nf.disc()) info['field_poly'] = teXify_pol(str(nf.poly())) info['field_knowl'] = nf_display_knowl(field_label, getDBConnection(), pretty_field_label) w = 'i' if nf.disc() == -4 else 'a' L = nf.K().change_names(w) alpha = L.gen() info['field_gen'] = latex(alpha) I = ideal_from_label(L, level_label) info['level_gen'] = latex(I.gens_reduced()[0]) info['level_fact'] = latex(I.factor()) dim_data = data['gl2_dims'] weights = dim_data.keys() weights.sort(key=lambda w: int(w)) for w in weights: dim_data[w]['dim'] = dim_data[w]['cuspidal_dim'] info['dim_data'] = dim_data info['weights'] = weights info['nweights'] = len(weights) newdim = data['gl2_dims']['2']['new_dim'] newforms = db_forms().find({ 'field_label': field_label, 'level_label': level_label }).sort('label_suffix', ASCENDING) info['nfdata'] = [{ 'label': f['short_label'], 'url': url_for(".render_bmf_webpage", field_label=f['field_label'], level_label=f['level_label'], label_suffix=f['label_suffix']), 'wt': f['weight'], 'dim': f['dimension'], 'sfe': "+1" if f['sfe'] == 1 else "-1", 'bc': bc_info(f['bc']), 'cm': cm_info(f['CM']), } for f in newforms] info['nnewforms'] = len(info['nfdata']) properties2 = [('Base field', pretty_field_label), ('Level', info['level_label']), ('Norm', str(info['level_norm'])), ('New dimension', str(newdim))] friends = [('Newform {}'.format(f['label']), f['url']) for f in info['nfdata']] return render_template("bmf-space.html", info=info, credit=credit, title=t, bread=bread, properties2=properties2, friends=friends)
def bianchi_modular_form_search(**args): """Function to handle requests from the top page, either jump to one newform or do a search. """ info = to_dict(args) # what has been entered in the search boxes if 'label' in info: # The Label button has been pressed. return bianchi_modular_form_by_label(info['label']) query = {} for field in ['field_label', 'weight', 'level_norm', 'dimension']: if info.get(field): if field == 'weight': query['weight'] = info[field] elif field == 'field_label': parse_nf_string(info, query, field, 'base number field', field) elif field == 'label': query[field] = info[field] elif field == 'dimension': query['dimension'] = int(info[field]) elif field == 'level_norm': query[field] = parse_range(info[field]) else: query[field] = info[field] if not 'sfe' in info: info['sfe'] = "any" elif info['sfe'] != "any": query['sfe'] = int(info['sfe']) if 'include_cm' in info: if info['include_cm'] == 'exclude': query['CM'] = 0 elif info['include_cm'] == 'only': query['CM'] = {'$nin': [0, '?']} if 'include_base_change' in info and info['include_base_change'] == 'off': query['bc'] = 0 else: info['include_base_change'] = "on" start = 0 if 'start' in request.args: start = int(request.args['start']) count = 50 if 'count' in request.args: count = int(request.args['count']) info['query'] = dict(query) res = db_forms().find(query).sort([('level_norm', ASCENDING), ('label', ASCENDING) ]).skip(start).limit(count) nres = res.count() if nres > 0: info['field_pretty_name'] = field_pretty(res[0]['field_label']) else: info['field_pretty_name'] = '' info['number'] = nres if nres == 1: info['report'] = 'unique match' elif nres == 2: info['report'] = 'displaying both matches' else: if nres > count or start != 0: info['report'] = 'displaying items %s-%s of %s matches' % ( start + 1, min(nres, start + count), nres) else: info['report'] = 'displaying all %s matches' % nres res_clean = [] for v in res: v_clean = {} v_clean['field_label'] = v['field_label'] v_clean['short_label'] = v['short_label'] v_clean['level_label'] = v['level_label'] v_clean['label_suffix'] = v['label_suffix'] v_clean['label'] = v['label'] v_clean['level_ideal'] = teXify_pol(v['level_ideal']) v_clean['dimension'] = v['dimension'] v_clean['sfe'] = "+1" if v['sfe'] == 1 else "-1" v_clean['url'] = url_for('.render_bmf_webpage', field_label=v['field_label'], level_label=v['level_label'], label_suffix=v['label_suffix']) v_clean['bc'] = bc_info(v['bc']) v_clean['cm'] = cm_info(v['CM']) res_clean.append(v_clean) info['forms'] = res_clean info['count'] = count info['start'] = start info['more'] = int(start + count < nres) t = 'Bianchi modular form search results' bread = [('Bianchi Modular Forms', url_for(".index")), ('Search results', ' ')] properties = [] return render_template("bmf-search_results.html", info=info, title=t, properties=properties, bread=bread, learnmore=learnmore_list())
def bmf_field_dim_table(**args): argsdict = to_dict(args) argsdict.update(to_dict(request.args)) gl_or_sl = argsdict['gl_or_sl'] field_label = argsdict['field_label'] field_label = nf_string_to_label(field_label) start = 0 if 'start' in argsdict: start = int(argsdict['start']) info = {} info['gl_or_sl'] = gl_or_sl # level_flag controls whether to list all levels ('all'), only # those with positive cuspidal dimension ('cusp'), or only those # with positive new dimension ('new'). Default is 'cusp'. level_flag = argsdict.get('level_flag', 'cusp') info['level_flag'] = level_flag count = 50 if 'count' in argsdict: count = int(argsdict['count']) pretty_field_label = field_pretty(field_label) bread = [('Bianchi Modular Forms', url_for(".index")), (pretty_field_label, ' ')] properties = [] if gl_or_sl == 'gl2_dims': info['group'] = 'GL(2)' info['bgroup'] = '\GL(2,\mathcal{O}_K)' else: info['group'] = 'SL(2)' info['bgroup'] = '\SL(2,\mathcal{O}_K)' t = ' '.join([ 'Dimensions of spaces of {} Bianchi modular forms over'.format( info['group']), pretty_field_label ]) query = {} query['field_label'] = field_label query[gl_or_sl] = {'$exists': True} if level_flag != 'all': # find which weights are present (TODO: get this from a stats collection) wts = list( sum((Set(d.keys()) for d in db_dims().distinct(gl_or_sl)), Set())) if level_flag == 'cusp': # restrict the query to only return levels where at least one # cuspidal dimension is positive: query.update({ '$or': [{ gl_or_sl + '.{}.cuspidal_dim'.format(w): { '$gt': 0 } } for w in wts] }) if level_flag == 'new': # restrict the query to only return levels where at least one # new dimension is positive: query.update({ '$or': [{ gl_or_sl + '.{}.new_dim'.format(w): { '$gt': 0 } } for w in wts] }) data = db_dims().find(query) data = data.sort([('level_norm', ASCENDING)]) info['number'] = nres = data.count() if nres > count or start != 0: info['report'] = 'Displaying items %s-%s of %s levels,' % ( start + 1, min(nres, start + count), nres) else: info['report'] = 'Displaying all %s levels,' % nres data = list(data.skip(start).limit(count)) info['field'] = field_label info['field_pretty'] = pretty_field_label nf = WebNumberField(field_label) info['base_galois_group'] = nf.galois_string() info['field_degree'] = nf.degree() info['field_disc'] = str(nf.disc()) info['field_poly'] = teXify_pol(str(nf.poly())) weights = set() for dat in data: weights = weights.union(set(dat[gl_or_sl].keys())) weights = list([int(w) for w in weights]) weights.sort() info['weights'] = weights info['nweights'] = len(weights) info['count'] = count info['start'] = start info['more'] = int(start + count < nres) dims = {} for dat in data: dims[dat['level_label']] = d = {} for w in weights: sw = str(w) if sw in dat[gl_or_sl]: d[w] = { 'd': dat[gl_or_sl][sw]['cuspidal_dim'], 'n': dat[gl_or_sl][sw]['new_dim'] } else: d[w] = {'d': '?', 'n': '?'} info['nlevels'] = len(data) dimtable = [{ 'level_label': dat['level_label'], 'level_norm': dat['level_norm'], 'level_space': url_for(".render_bmf_space_webpage", field_label=field_label, level_label=dat['level_label']) if gl_or_sl == 'gl2_dims' else "", 'dims': dims[dat['level_label']] } for dat in data] print("Length of dimtable = {}".format(len(dimtable))) info['dimtable'] = dimtable return render_template("bmf-field_dim_table.html", info=info, title=t, properties=properties, bread=bread)
def bianchi_modular_form_search(**args): """Function to handle requests from the top page, either jump to one newform or do a search. """ info = to_dict(args) # what has been entered in the search boxes if 'label' in info: # The Label button has been pressed. label = info['label'] dat = label.split("-") if len(dat)==2: # assume field & level, display space return render_bmf_space_webpage(dat[0], dat[1]) else: # assume single newform label; will display an error if invalid return bianchi_modular_form_by_label(label) query = {} for field in ['field_label', 'weight', 'level_norm', 'dimension']: if info.get(field): if field == 'weight': query['weight'] = info[field] elif field == 'field_label': parse_nf_string(info,query,field,'base number field',field) elif field == 'label': query[field] = info[field] elif field == 'dimension': query['dimension'] = int(info[field]) elif field == 'level_norm': query[field] = parse_range(info[field]) else: query[field] = info[field] if not 'sfe' in info: info['sfe'] = "any" elif info['sfe'] != "any": query['sfe'] = int(info['sfe']) if 'include_cm' in info: if info['include_cm'] == 'exclude': query['CM'] = 0 elif info['include_cm'] == 'only': query['CM'] = {'$nin' : [0,'?']} if 'include_base_change' in info and info['include_base_change'] == 'off': query['bc'] = 0 else: info['include_base_change'] = "on" start = 0 if 'start' in request.args: start = int(request.args['start']) count = 50 if 'count' in request.args: count = int(request.args['count']) info['query'] = dict(query) res = db_forms().find(query).sort([('level_norm', ASCENDING), ('label', ASCENDING)]).skip(start).limit(count) nres = res.count() if nres > 0: info['field_pretty_name'] = field_pretty(res[0]['field_label']) else: info['field_pretty_name'] = '' info['number'] = nres if nres == 1: info['report'] = 'unique match' elif nres == 2: info['report'] = 'displaying both matches' else: if nres > count or start != 0: info['report'] = 'displaying items %s-%s of %s matches' % (start + 1, min(nres, start + count), nres) else: info['report'] = 'displaying all %s matches' % nres res_clean = [] for v in res: v_clean = {} v_clean['field_label'] = v['field_label'] v_clean['short_label'] = v['short_label'] v_clean['level_label'] = v['level_label'] v_clean['level_norm'] = v['level_norm'] v_clean['level_number'] = v['level_label'].split(".")[1] v_clean['label_suffix'] = v['label_suffix'] v_clean['label'] = v['label'] v_clean['level_ideal'] = teXify_pol(v['level_ideal']) v_clean['dimension'] = v['dimension'] v_clean['sfe'] = "+1" if v['sfe']==1 else "-1" v_clean['url'] = url_for('.render_bmf_webpage',field_label=v['field_label'], level_label=v['level_label'], label_suffix=v['label_suffix']) v_clean['bc'] = bc_info(v['bc']) v_clean['cm'] = cm_info(v['CM']) res_clean.append(v_clean) res_clean.sort(key=lambda x: [int(x['level_norm']), int(x['level_number']), x['label_suffix']]) info['forms'] = res_clean info['count'] = count info['start'] = start info['more'] = int(start + count < nres) t = 'Bianchi modular form search results' bread = [('Bianchi Modular Forms', url_for(".index")), ( 'Search Results', ' ')] properties = [] return render_template("bmf-search_results.html", info=info, title=t, properties=properties, bread=bread, learnmore=learnmore_list())
def bmf_field_dim_table(**args): argsdict = to_dict(args) argsdict.update(to_dict(request.args)) gl_or_sl = argsdict['gl_or_sl'] field_label=argsdict['field_label'] field_label = nf_string_to_label(field_label) start = 0 if 'start' in argsdict: start = int(argsdict['start']) info={} info['gl_or_sl'] = gl_or_sl # level_flag controls whether to list all levels ('all'), only # those with positive cuspidal dimension ('cusp'), or only those # with positive new dimension ('new'). Default is 'cusp'. level_flag = argsdict.get('level_flag', 'cusp') info['level_flag'] = level_flag count = 50 if 'count' in argsdict: count = int(argsdict['count']) pretty_field_label = field_pretty(field_label) bread = [('Bianchi Modular Forms', url_for(".index")), ( pretty_field_label, ' ')] properties = [] if gl_or_sl=='gl2_dims': info['group'] = 'GL(2)' info['bgroup'] = '\GL(2,\mathcal{O}_K)' else: info['group'] = 'SL(2)' info['bgroup'] = '\SL(2,\mathcal{O}_K)' t = ' '.join(['Dimensions of Spaces of {} Bianchi Modular Forms over'.format(info['group']), pretty_field_label]) query = {} query['field_label'] = field_label query[gl_or_sl] = {'$exists': True} data = db_dims().find(query) data = data.sort([('level_norm', ASCENDING)]) info['number'] = nres = data.count() if nres > count or start != 0: info['report'] = 'Displaying items %s-%s of %s levels,' % (start + 1, min(nres, start + count), nres) else: info['report'] = 'Displaying all %s levels,' % nres # convert data to a list and eliminate levels where all # new/cuspidal dimensions are 0. (This could be done at the # search stage, but that requires adding new fields to each # record.) def filter(dat, flag): dat1 = dat[gl_or_sl] return any([int(dat1[w][flag])>0 for w in dat1]) flag = 'cuspidal_dim' if level_flag=='cusp' else 'new_dim' data = [dat for dat in data if level_flag == 'all' or filter(dat, flag)] data = data[start:start+count] info['field'] = field_label info['field_pretty'] = pretty_field_label nf = WebNumberField(field_label) info['base_galois_group'] = nf.galois_string() info['field_degree'] = nf.degree() info['field_disc'] = str(nf.disc()) info['field_poly'] = teXify_pol(str(nf.poly())) weights = set() for dat in data: weights = weights.union(set(dat[gl_or_sl].keys())) weights = list([int(w) for w in weights]) weights.sort() info['weights'] = weights info['nweights'] = len(weights) info['count'] = count info['start'] = start info['more'] = int(start + count < nres) data.sort(key = lambda x: [int(y) for y in x['level_label'].split(".")]) dims = {} for dat in data: dims[dat['level_label']] = d = {} for w in weights: sw = str(w) if sw in dat[gl_or_sl]: d[w] = {'d': dat[gl_or_sl][sw]['cuspidal_dim'], 'n': dat[gl_or_sl][sw]['new_dim']} else: d[w] = {'d': '?', 'n': '?'} info['nlevels'] = len(data) dimtable = [{'level_label': dat['level_label'], 'level_norm': dat['level_norm'], 'level_space': url_for(".render_bmf_space_webpage", field_label=field_label, level_label=dat['level_label']) if gl_or_sl=='gl2_dims' else "", 'dims': dims[dat['level_label']]} for dat in data] info['dimtable'] = dimtable return render_template("bmf-field_dim_table.html", info=info, title=t, properties=properties, bread=bread)
def render_bmf_space_webpage(field_label, level_label): info = {} t = "Bianchi modular forms of level %s over %s" % (level_label, field_label) credit = bianchi_credit bread = [('Modular Forms', url_for('mf.modular_form_main_page')), ('Bianchi Modular Forms', url_for(".index")), (field_pretty(field_label), url_for(".render_bmf_field_dim_table_gl2", field_label=field_label)), (level_label, '')] friends = [] properties2 = [] if not field_label_regex.match(field_label): info['err'] = "%s is not a valid label for an imaginary quadratic field" % field_label else: pretty_field_label = field_pretty(field_label) if not db_dims().find({'field_label': field_label}): info['err'] = "no dimension information exists in the database for field %s" % pretty_field_label else: t = "Bianchi Modular Forms of level %s over %s" % (level_label, pretty_field_label) data = db_dims().find({'field_label': field_label, 'level_label': level_label}) nres = data.count() if nres==0: info['err'] = "no dimension information exists in the database for level %s and field %s" % (level_label, pretty_field_label) else: data = data.next() info['label'] = data['label'] info['nf'] = nf = WebNumberField(field_label) info['field_label'] = field_label info['pretty_field_label'] = pretty_field_label info['level_label'] = level_label info['level_norm'] = data['level_norm'] info['field_poly'] = teXify_pol(str(nf.poly())) info['field_knowl'] = nf_display_knowl(field_label, getDBConnection(), pretty_field_label) w = 'i' if nf.disc()==-4 else 'a' L = nf.K().change_names(w) alpha = L.gen() info['field_gen'] = latex(alpha) I = ideal_from_label(L,level_label) info['level_gen'] = latex(I.gens_reduced()[0]) info['level_fact'] = web_latex_ideal_fact(I.factor(), enclose=False) dim_data = data['gl2_dims'] weights = dim_data.keys() weights.sort(key=lambda w: int(w)) for w in weights: dim_data[w]['dim']=dim_data[w]['cuspidal_dim'] info['dim_data'] = dim_data info['weights'] = weights info['nweights'] = len(weights) newdim = data['gl2_dims']['2']['new_dim'] newforms = db_forms().find({'field_label':field_label, 'level_label':level_label}).sort('label_suffix', ASCENDING) info['nfdata'] = [{ 'label': f['short_label'], 'url': url_for(".render_bmf_webpage",field_label=f['field_label'], level_label=f['level_label'], label_suffix=f['label_suffix']), 'wt': f['weight'], 'dim': f['dimension'], 'sfe': "+1" if f['sfe']==1 else "-1", 'bc': bc_info(f['bc']), 'cm': cm_info(f['CM']), } for f in newforms] info['nnewforms'] = len(info['nfdata']) properties2 = [('Base field', pretty_field_label), ('Level',info['level_label']), ('Norm',str(info['level_norm'])), ('New dimension',str(newdim))] friends = [('Newform {}'.format(f['label']), f['url']) for f in info['nfdata'] ] return render_template("bmf-space.html", info=info, credit=credit, title=t, bread=bread, properties2=properties2, friends=friends)
def bmf_field_dim_table(**args): argsdict = to_dict(args) argsdict.update(to_dict(request.args)) gl_or_sl = argsdict['gl_or_sl'] field_label=argsdict['field_label'] field_label = nf_string_to_label(field_label) start = 0 if 'start' in argsdict: start = int(argsdict['start']) info={} info['gl_or_sl'] = gl_or_sl # level_flag controls whether to list all levels ('all'), only # those with positive cuspidal dimension ('cusp'), or only those # with positive new dimension ('new'). Default is 'cusp'. level_flag = argsdict.get('level_flag', 'cusp') info['level_flag'] = level_flag count = 50 if 'count' in argsdict: count = int(argsdict['count']) pretty_field_label = field_pretty(field_label) bread = [('Bianchi Modular Forms', url_for(".index")), ( pretty_field_label, ' ')] properties = [] if gl_or_sl=='gl2_dims': info['group'] = 'GL(2)' info['bgroup'] = '\GL(2,\mathcal{O}_K)' else: info['group'] = 'SL(2)' info['bgroup'] = '\SL(2,\mathcal{O}_K)' t = ' '.join(['Dimensions of spaces of {} Bianchi modular forms over'.format(info['group']), pretty_field_label]) query = {} query['field_label'] = field_label query[gl_or_sl] = {'$exists': True} data = db_dims().find(query) data = data.sort([('level_norm', ASCENDING)]) info['number'] = nres = data.count() if nres > count or start != 0: info['report'] = 'Displaying items %s-%s of %s levels,' % (start + 1, min(nres, start + count), nres) else: info['report'] = 'Displaying all %s levels,' % nres # convert data to a list and eliminate levels where all # new/cuspidal dimensions are 0. (This could be done at the # search stage, but that requires adding new fields to each # record.) def filter(dat, flag): dat1 = dat[gl_or_sl] return any([int(dat1[w][flag])>0 for w in dat1]) flag = 'cuspidal_dim' if level_flag=='cusp' else 'new_dim' data = [dat for dat in data if level_flag == 'all' or filter(dat, flag)] data = data[start:start+count] info['field'] = field_label info['field_pretty'] = pretty_field_label nf = WebNumberField(field_label) info['base_galois_group'] = nf.galois_string() info['field_degree'] = nf.degree() info['field_disc'] = str(nf.disc()) info['field_poly'] = teXify_pol(str(nf.poly())) weights = set() for dat in data: weights = weights.union(set(dat[gl_or_sl].keys())) weights = list([int(w) for w in weights]) weights.sort() info['weights'] = weights info['nweights'] = len(weights) info['count'] = count info['start'] = start info['more'] = int(start + count < nres) data.sort(key = lambda x: [int(y) for y in x['level_label'].split(".")]) dims = {} for dat in data: dims[dat['level_label']] = d = {} for w in weights: sw = str(w) if sw in dat[gl_or_sl]: d[w] = {'d': dat[gl_or_sl][sw]['cuspidal_dim'], 'n': dat[gl_or_sl][sw]['new_dim']} else: d[w] = {'d': '?', 'n': '?'} info['nlevels'] = len(data) dimtable = [{'level_label': dat['level_label'], 'level_norm': dat['level_norm'], 'level_space': url_for(".render_bmf_space_webpage", field_label=field_label, level_label=dat['level_label']) if gl_or_sl=='gl2_dims' else "", 'dims': dims[dat['level_label']]} for dat in data] info['dimtable'] = dimtable return render_template("bmf-field_dim_table.html", info=info, title=t, properties=properties, bread=bread)
@search_wrap(template="bmf-search_results.html", table=db.bmf_forms, title='Bianchi Modular Form Search Results', err_title='Bianchi Modular Forms Search Input Error', shortcuts={'label': bianchi_modular_form_jump}, projection=[ 'label', 'field_label', 'short_label', 'level_label', 'level_norm', 'label_suffix', 'level_ideal', 'dimension', 'sfe', 'bc', 'CM' ], cleaners={ "level_number": lambda v: v['level_label'].split(".")[1], "level_ideal": lambda v: teXify_pol(v['level_ideal']), "sfe": lambda v: "+1" if v.get('sfe', None) == 1 else ("-1" if v.get('sfe', None) == -1 else "?"), "url": lambda v: url_for('.render_bmf_webpage', field_label=v['field_label'], level_label=v['level_label'], label_suffix=v['label_suffix']), "bc": lambda v: bc_info(v['bc']), "cm": lambda v: cm_info(v.pop('CM', '?')) }, bread=lambda: [('Bianchi Modular Forms', url_for(".index")), ('Search Results', '.')],
def bmf_field_dim_table(**args): argsdict = to_dict(args) argsdict.update(to_dict(request.args)) gl_or_sl = argsdict['gl_or_sl'] field_label=argsdict['field_label'] field_label = nf_string_to_label(field_label) start = 0 if 'start' in argsdict: start = int(argsdict['start']) info={} info['gl_or_sl'] = gl_or_sl # level_flag controls whether to list all levels ('all'), only # those with positive cuspidal dimension ('cusp'), or only those # with positive new dimension ('new'). Default is 'cusp'. level_flag = argsdict.get('level_flag', 'cusp') info['level_flag'] = level_flag count = 50 if 'count' in argsdict: count = int(argsdict['count']) pretty_field_label = field_pretty(field_label) bread = [('Bianchi Modular Forms', url_for(".index")), ( pretty_field_label, ' ')] properties = [] if gl_or_sl=='gl2_dims': info['group'] = 'GL(2)' info['bgroup'] = '\GL(2,\mathcal{O}_K)' else: info['group'] = 'SL(2)' info['bgroup'] = '\SL(2,\mathcal{O}_K)' t = ' '.join(['Dimensions of spaces of {} Bianchi modular forms over'.format(info['group']), pretty_field_label]) query = {} query['field_label'] = field_label query[gl_or_sl] = {'$exists': True} if level_flag != 'all': # find which weights are present (TODO: get this from a stats collection) wts = list(sum((Set(d.keys()) for d in db_dims().distinct(gl_or_sl)),Set())) if level_flag == 'cusp': # restrict the query to only return levels where at least one # cuspidal dimension is positive: query.update( {'$or':[{gl_or_sl+'.{}.cuspidal_dim'.format(w):{'$gt':0}} for w in wts]} ) if level_flag == 'new': # restrict the query to only return levels where at least one # new dimension is positive: query.update( {'$or':[{gl_or_sl+'.{}.new_dim'.format(w):{'$gt':0}} for w in wts]} ) data = db_dims().find(query) data = data.sort([('level_norm', ASCENDING)]) info['number'] = nres = data.count() if nres > count or start != 0: info['report'] = 'Displaying items %s-%s of %s levels,' % (start + 1, min(nres, start + count), nres) else: info['report'] = 'Displaying all %s levels,' % nres data = list(data.skip(start).limit(count)) info['field'] = field_label info['field_pretty'] = pretty_field_label nf = WebNumberField(field_label) info['base_galois_group'] = nf.galois_string() info['field_degree'] = nf.degree() info['field_disc'] = str(nf.disc()) info['field_poly'] = teXify_pol(str(nf.poly())) weights = set() for dat in data: weights = weights.union(set(dat[gl_or_sl].keys())) weights = list([int(w) for w in weights]) weights.sort() info['weights'] = weights info['nweights'] = len(weights) info['count'] = count info['start'] = start info['more'] = int(start + count < nres) dims = {} for dat in data: dims[dat['level_label']] = d = {} for w in weights: sw = str(w) if sw in dat[gl_or_sl]: d[w] = {'d': dat[gl_or_sl][sw]['cuspidal_dim'], 'n': dat[gl_or_sl][sw]['new_dim']} else: d[w] = {'d': '?', 'n': '?'} info['nlevels'] = len(data) dimtable = [{'level_label': dat['level_label'], 'level_norm': dat['level_norm'], 'level_space': url_for(".render_bmf_space_webpage", field_label=field_label, level_label=dat['level_label']) if gl_or_sl=='gl2_dims' else "", 'dims': dims[dat['level_label']]} for dat in data] print("Length of dimtable = {}".format(len(dimtable))) info['dimtable'] = dimtable return render_template("bmf-field_dim_table.html", info=info, title=t, properties=properties, bread=bread)
def bianchi_modular_form_postprocess(res, info, query): if info['number'] > 0: info['field_pretty_name'] = field_pretty(res[0]['field_label']) else: info['field_pretty_name'] = '' res.sort(key=lambda x: [x['level_norm'], int(x['level_number']), x['label_suffix']]) return res @search_wrap(template="bmf-search_results.html", table=db.bmf_forms, title='Bianchi Modular Form Search Results', err_title='Bianchi Modular Forms Search Input Error', shortcuts={'label': bianchi_modular_form_jump}, projection=['label','field_label','short_label','level_label','level_norm','label_suffix','level_ideal','dimension','sfe','bc','CM'], cleaners={"level_number": lambda v: v['level_label'].split(".")[1], "level_ideal": lambda v: teXify_pol(v['level_ideal']), "sfe": lambda v: "+1" if v['sfe']==1 else "-1", "url": lambda v: url_for('.render_bmf_webpage',field_label=v['field_label'], level_label=v['level_label'], label_suffix=v['label_suffix']), "bc": lambda v: bc_info(v['bc']), "cm": lambda v: cm_info(v.pop('CM'))}, bread=lambda:[('Bianchi Modular Forms', url_for(".index")), ('Search Results', '.')], learnmore=learnmore_list, properties=lambda: []) def bianchi_modular_form_search(info, query): """Function to handle requests from the top page, either jump to one newform or do a search. """ for field in ['field_label', 'weight', 'level_norm', 'dimension']: if info.get(field): if field == 'weight':