def artin_representation_search(info, query): query['Hide'] = 0 info['sign_code'] = 0 parse_primes(info, query, "unramified", name="Unramified primes", qfield="BadPrimes", mode="complement") parse_primes(info, query, "ramified", name="Ramified primes", qfield="BadPrimes", mode="append") parse_element_of(info, query, "root_number", qfield="GalConjSigns") parse_restricted(info, query, "frobenius_schur_indicator", qfield="Indicator", allowed=[1, 0, -1], process=int) parse_container(info, query, 'container', qfield='Container', name="Smallest permutation representation") parse_galgrp(info, query, "group", name="Group", qfield=("Galn", "Galt")) parse_ints(info, query, 'dimension', qfield='Dim') parse_ints(info, query, 'conductor', qfield='Conductor')
def abelian_variety_search(info, query): parse_ints(info,query,'q',name='base field') parse_ints(info,query,'g',name='dimension') parse_bool(info,query,'simple',qfield='is_simp') parse_bool(info,query,'primitive',qfield='is_prim') parse_bool_unknown(info, query, 'jacobian', qfield='is_jac') parse_bool_unknown(info, query, 'polarizable', qfield='is_pp') parse_ints(info,query,'p_rank') parse_ints(info,query,'ang_rank') parse_newton_polygon(info,query,'newton_polygon',qfield='slps') parse_string_start(info,query,'initial_coefficients',qfield='poly_str',initial_segment=["1"]) parse_string_start(info,query,'abvar_point_count',qfield='A_cnts_str') parse_string_start(info,query,'curve_point_count',qfield='C_cnts_str',first_field='pt_cnt') if info.get('simple_quantifier') == 'contained': parse_subset(info,query,'simple_factors',qfield='simple_distinct',mode='subsets') elif info.get('simple_quantifier') == 'exactly': parse_subset(info,query,'simple_factors',qfield='simple_distinct',mode='exact') elif info.get('simple_quantifier') == 'include': parse_submultiset(info,query,'simple_factors',mode='append') for n in range(1,6): parse_ints(info,query,'dim%s_factors'%n) for n in range(1,4): parse_ints(info,query,'dim%s_distinct'%n) parse_nf_string(info,query,'number_field',qfield='nf') parse_galgrp(info,query,qfield=('galois_n','galois_t'))
def artin_representation_search(**args): info = to_dict(args) if 'natural' in info: label = info['natural'] # test if it is ok try: label = parse_artin_label(label) except ValueError as err: flash(Markup("Error: %s" % (err)), "error") bread = get_bread([('Search results','')]) return search_input_error({'err':''}, bread) return render_artin_representation_webpage(label) title = 'Artin representation search results' bread = [('Artin representation', url_for(".index")), ('Search results', ' ')] sign_code = 0 query = {'Hide': 0} try: parse_primes(info,query,"unramified",name="Unramified primes", qfield="BadPrimes",mode="complement",to_string=True) parse_primes(info,query,"ramified",name="Ramified primes", qfield="BadPrimes",mode="append",to_string=True) parse_restricted(info,query,"root_number",qfield="GaloisConjugates.Sign", allowed=[1,-1],process=int) parse_restricted(info,query,"frobenius_schur_indicator",qfield="Indicator", allowed=[1,0,-1],process=int) parse_galgrp(info,query,"group",name="Group",qfield="Galois_nt",use_bson=False) parse_ints(info,query,'dimension',qfield='Dim') parse_ints(info,query,'conductor',qfield='Conductor_key', parse_singleton=make_cond_key) #parse_paired_fields(info,query,field1='conductor',qfield1='Conductor_key',parse1=parse_ints,kwds1={'parse_singleton':make_cond_key}, #field2='dimension',qfield2='Dim', parse2=parse_ints) except ValueError: return search_input_error(info, bread) count = parse_count(info,10) start = parse_start(info) data = ArtinRepresentation.collection().find(query).sort([("Dim", ASC), ("Conductor_key", ASC)]) nres = data.count() data = data.skip(start).limit(count) if(start >= nres): start -= (1 + (start - nres) / count) * count if(start < 0): start = 0 if nres == 1: report = 'unique match' else: if nres > count or start != 0: report = 'displaying matches %s-%s of %s' % (start + 1, min(nres, start + count), nres) else: report = 'displaying all %s matches' % nres if nres == 0: report = 'no matches' initfunc = ArtinRepresentation return render_template("artin-representation-search.html", req=info, data=data, title=title, bread=bread, query=query, start=start, report=report, nres=nres, initfunc=initfunc, sign_code=sign_code)
def local_field_search(info,query): parse_galgrp(info,query,'gal',qfield=('n','galT')) parse_ints(info,query,'p',name='Prime p') parse_ints(info,query,'n',name='Degree') parse_ints(info,query,'c',name='Discriminant exponent c') parse_ints(info,query,'e',name='Ramification index e') parse_rats(info,query,'topslope',qfield='top_slope',name='Top slope', process=ratproc) info['group_display'] = group_display_short info['display_poly'] = format_coeffs info['slopedisp'] = show_slope_content
def local_field_search(**args): info = to_dict(args) bread = get_bread([("Search results", ' ')]) C = base.getDBConnection() query = {} if 'jump_to' in info: return render_field_webpage({'label': info['jump_to']}) try: parse_galgrp(info, query, 'gal', use_bson=False) parse_ints(info, query, 'p', name='Prime p') parse_ints(info, query, 'n', name='Degree') parse_ints(info, query, 'c', name='Discriminant exponent c') parse_ints(info, query, 'e', name='Ramification index e') except ValueError: return search_input_error(info, bread) count = parse_count(info) start = parse_start(info) # logger.debug(query) res = C.localfields.fields.find(query).sort([('p', pymongo.ASCENDING), ('n', pymongo.ASCENDING), ('c', pymongo.ASCENDING), ('label', pymongo.ASCENDING)]) nres = res.count() res = res.skip(start).limit(count) if (start >= nres): start -= (1 + (start - nres) / count) * count if (start < 0): start = 0 info['fields'] = res info['number'] = nres info['group_display'] = group_display_shortC(C) info['display_poly'] = format_coeffs info['slopedisp'] = show_slope_content info['start'] = start if nres == 1: info['report'] = 'unique match' else: if nres > count or start != 0: info['report'] = 'displaying matches %s-%s of %s' % ( start + 1, min(nres, start + count), nres) else: info['report'] = 'displaying all %s matches' % nres return render_template("lf-search.html", info=info, title="Local Number Field Search Result", bread=bread, credit=LF_credit)
def abelian_variety_search(info, query): parse_ints(info,query,'q',name='base field') parse_ints(info,query,'g',name='dimension') if 'simple' in info: if info['simple'] == 'yes': query['is_simp'] = True elif info['simple'] == 'no': query['is_simp'] = False if 'primitive' in info: if info['primitive'] == 'yes': query['is_prim'] = True elif info['primitive'] == 'no': query['is_prim'] = False if 'jacobian' in info: jac = info['jacobian'] if jac == 'yes': query['is_jac'] = 1 elif jac == 'not_no': query['is_jac'] = {'$gt' : -1} elif jac == 'not_yes': query['is_jac'] = {'$lt' : 1} elif jac == 'no': query['is_jac'] = -1 if 'polarizable' in info: pol = info['polarizable'] if pol == 'yes': query['is_pp'] = 1 elif pol == 'not_no': query['is_pp'] = {'$gt' : -1} elif pol == 'not_yes': query['is_pp'] = {'$lt' : 1} elif pol == 'no': query['is_pp'] = -1 parse_ints(info,query,'p_rank') parse_ints(info,query,'ang_rank') parse_newton_polygon(info,query,'newton_polygon',qfield='slps') parse_string_start(info,query,'initial_coefficients',qfield='poly_str',initial_segment=["1"]) parse_string_start(info,query,'abvar_point_count',qfield='A_cnts_str') parse_string_start(info,query,'curve_point_count',qfield='C_cnts_str',first_field='pt_cnt') if info.get('simple_quantifier') == 'contained': parse_subset(info,query,'simple_factors',qfield='simple_distinct',mode='subsets') elif info.get('simple_quantifier') == 'exactly': parse_subset(info,query,'simple_factors',qfield='simple_distinct',mode='exact') elif info.get('simple_quantifier') == 'include': parse_submultiset(info,query,'simple_factors',mode='append') for n in range(1,6): parse_ints(info,query,'dim%s_factors'%n) for n in range(1,4): parse_ints(info,query,'dim%s_distinct'%n) parse_nf_string(info,query,'number_field',qfield='nf') parse_galgrp(info,query,qfield=('galois_n','galois_t'))
def artin_representation_search(info, query): query['Hide'] = 0 info['sign_code'] = 0 parse_primes(info,query,"unramified",name="Unramified primes", qfield="BadPrimes",mode="complement") parse_primes(info,query,"ramified",name="Ramified primes", qfield="BadPrimes",mode="append") parse_element_of(info,query,"root_number",qfield="GalConjSigns") parse_restricted(info,query,"frobenius_schur_indicator",qfield="Indicator", allowed=[1,0,-1],process=int) parse_container(info,query, 'container',qfield='Container', name="Smallest permutation representation") parse_galgrp(info,query,"group",name="Group",qfield=("Galn","Galt")) parse_ints(info,query,'dimension',qfield='Dim') parse_ints(info,query,'conductor',qfield='Conductor')
def local_field_search(**args): info = to_dict(args) bread = get_bread([("Search results", " ")]) C = base.getDBConnection() query = {} if info.get("jump_to"): return redirect(url_for(".by_label", label=info["jump_to"]), 301) try: parse_galgrp(info, query, "gal", use_bson=False) parse_ints(info, query, "p", name="Prime p") parse_ints(info, query, "n", name="Degree") parse_ints(info, query, "c", name="Discriminant exponent c") parse_ints(info, query, "e", name="Ramification index e") except ValueError: return search_input_error(info, bread) count = parse_count(info) start = parse_start(info) # logger.debug(query) res = C.localfields.fields.find(query).sort( [("p", pymongo.ASCENDING), ("n", pymongo.ASCENDING), ("c", pymongo.ASCENDING), ("label", pymongo.ASCENDING)] ) nres = res.count() res = res.skip(start).limit(count) if start >= nres: start -= (1 + (start - nres) / count) * count if start < 0: start = 0 info["fields"] = res info["number"] = nres info["group_display"] = group_display_shortC(C) info["display_poly"] = format_coeffs info["slopedisp"] = show_slope_content info["start"] = start if nres == 1: info["report"] = "unique match" else: if nres > count or start != 0: info["report"] = "displaying matches %s-%s of %s" % (start + 1, min(nres, start + count), nres) else: info["report"] = "displaying all %s matches" % nres return render_template( "lf-search.html", info=info, title="Local Number Field Search Result", bread=bread, credit=LF_credit )
def higher_genus_w_automorphisms_search(**args): info = to_dict(args) bread = get_bread([("Search results", url_for('.search'))]) C = base.getDBConnection() query = {} if 'jump_to' in info: return render_hgcwa_webpage({'label': info['jump_to']}) try: parse_galgrp(info, query, 'group') parse_ints(info, query, 'genus', name='Genus') parse_list(info, query, 'signature', name='Signature') except ValueError: return search_input_error(info, bread) count = parse_count(info) start = parse_start(info) res = C.curve_automorphisms.families.find(query).sort([ ('g', pymongo.ASCENDING), ('label', pymongo.ASCENDING) ]) nres = res.count() res = res.skip(start).limit(count) if (start >= nres): start -= (1 + (start - nres) / count) * count if (start < 0): start = 0 info['fields'] = res info['number'] = nres info['group_display'] = group_display_shortC(C) info['start'] = start if nres == 1: info['report'] = 'unique match' else: if nres > count or start != 0: info['report'] = 'displaying matches %s-%s of %s' % ( start + 1, min(nres, start + count), nres) else: info['report'] = 'displaying all %s matches' % nres return render_template( "hgcwa-search.html", info=info, title="Higher Genus Curves with Automorphisms Search Result", bread=bread, credit=HGCwA_credit)
def number_field_search(info, query): parse_ints(info, query, 'degree') parse_galgrp(info, query, qfield=('degree', 'galt')) parse_bracketed_posints(info, query, 'signature', qfield=('degree', 'r2'), exactlength=2, extractor=lambda L: (L[0] + 2 * L[1], L[1])) parse_signed_ints(info, query, 'discriminant', qfield=('disc_sign', 'disc_abs')) parse_ints(info, query, 'class_number') parse_bracketed_posints(info, query, 'class_group', check_divisibility='increasing', process=int) parse_primes(info, query, 'ur_primes', name='Unramified primes', qfield='ramps', mode='complement') # modes are now contained (in), exactly, include if 'ram_quantifier' in info and str(info['ram_quantifier']) == 'include': mode = 'append' elif 'ram_quantifier' in info and str( info['ram_quantifier']) == 'contained': mode = 'subsets' else: mode = 'exact' parse_primes(info, query, 'ram_primes', name='Ramified primes', qfield='ramps', mode=mode, radical='disc_rad') ## This seems not to be used #if 'lucky' in info: # label = db.nf_fields.lucky(query, 0) # if label: # return redirect(url_for(".by_label", label=clean_input(label))) info['wnf'] = WebNumberField.from_data
def local_field_search(**args): info = to_dict(args) bread = get_bread([("Search results", url_for('.search'))]) C = base.getDBConnection() query = {} if 'jump_to' in info: return render_field_webpage({'label': info['jump_to']}) try: parse_galgrp(info,query,'gal', use_bson=False) parse_ints(info,query,'p',name='Prime p') parse_ints(info,query,'n',name='Degree') parse_ints(info,query,'c',name='Discriminant exponent c') parse_ints(info,query,'e',name='Ramification index e') except ValueError: return search_input_error(info, bread) count = parse_count(info) start = parse_start(info) # logger.debug(query) res = C.localfields.fields.find(query).sort([('p', pymongo.ASCENDING), ( 'n', pymongo.ASCENDING), ('c', pymongo.ASCENDING), ('label', pymongo.ASCENDING)]) nres = res.count() res = res.skip(start).limit(count) if(start >= nres): start -= (1 + (start - nres) / count) * count if(start < 0): start = 0 info['fields'] = res info['number'] = nres info['group_display'] = group_display_shortC(C) info['display_poly'] = format_coeffs info['slopedisp'] = show_slope_content info['start'] = start if nres == 1: info['report'] = 'unique match' else: if nres > count or start != 0: info['report'] = 'displaying matches %s-%s of %s' % (start + 1, min(nres, start + count), nres) else: info['report'] = 'displaying all %s matches' % nres return render_template("lf-search.html", info=info, title="Local Number Field Search Result", bread=bread, credit=LF_credit)
def higher_genus_w_automorphisms_search(**args): info = to_dict(args) bread = get_bread([("Search results", url_for('.search'))]) C = base.getDBConnection() query = {} if 'jump_to' in info: return render_hgcwa_webpage({'label': info['jump_to']}) try: parse_galgrp(info,query,'group') parse_ints(info,query,'genus',name='Genus') parse_list(info,query,'signature',name='Signature') except ValueError: return search_input_error(info, bread) count = parse_count(info) start = parse_start(info) res = C.curve_automorphisms.families.find(query).sort([('g', pymongo.ASCENDING), ('label', pymongo.ASCENDING)]) nres = res.count() res = res.skip(start).limit(count) if(start >= nres): start -= (1 + (start - nres) / count) * count if(start < 0): start = 0 info['fields'] = res info['number'] = nres info['group_display'] = group_display_shortC(C) info['start'] = start if nres == 1: info['report'] = 'unique match' else: if nres > count or start != 0: info['report'] = 'displaying matches %s-%s of %s' % (start + 1, min(nres, start + count), nres) else: info['report'] = 'displaying all %s matches' % nres return render_template("hgcwa-search.html", info=info, title="Higher Genus Curves with Automorphisms Search Result", bread=bread, credit=HGCwA_credit)
def abelian_variety_search(info, query): parse_ints(info, query, 'q', name='base field') parse_ints(info, query, 'g', name='dimension') parse_bool(info, query, 'simple', qfield='is_simp') parse_bool(info, query, 'primitive', qfield='is_prim') parse_bool_unknown(info, query, 'jacobian', qfield='is_jac') parse_bool_unknown(info, query, 'polarizable', qfield='is_pp') parse_ints(info, query, 'p_rank') parse_ints(info, query, 'ang_rank') parse_newton_polygon(info, query, 'newton_polygon', qfield='slps') parse_string_start(info, query, 'initial_coefficients', qfield='poly_str', initial_segment=["1"]) parse_string_start(info, query, 'abvar_point_count', qfield='A_cnts_str') parse_string_start(info, query, 'curve_point_count', qfield='C_cnts_str', first_field='pt_cnt') if info.get('simple_quantifier') == 'contained': parse_subset(info, query, 'simple_factors', qfield='simple_distinct', mode='subsets') elif info.get('simple_quantifier') == 'exactly': parse_subset(info, query, 'simple_factors', qfield='simple_distinct', mode='exact') elif info.get('simple_quantifier') == 'include': parse_submultiset(info, query, 'simple_factors', mode='append') for n in range(1, 6): parse_ints(info, query, 'dim%s_factors' % n) for n in range(1, 4): parse_ints(info, query, 'dim%s_distinct' % n) parse_nf_string(info, query, 'number_field', qfield='nf') parse_galgrp(info, query, qfield=('galois_n', 'galois_t'))
def number_field_search(info, query): parse_ints(info,query,'degree') parse_galgrp(info,query, qfield=('degree', 'galt')) parse_bracketed_posints(info,query,'signature',qfield=('degree','r2'),exactlength=2,extractor=lambda L: (L[0]+2*L[1],L[1])) parse_signed_ints(info,query,'discriminant',qfield=('disc_sign','disc_abs')) parse_ints(info,query,'class_number') parse_bracketed_posints(info,query,'class_group',check_divisibility='increasing',process=int) parse_primes(info,query,'ur_primes',name='Unramified primes', qfield='ramps',mode='complement') # modes are now contained (in), exactly, include if 'ram_quantifier' in info and str(info['ram_quantifier']) == 'include': mode='append' elif 'ram_quantifier' in info and str(info['ram_quantifier']) == 'contained': mode='subsets' else: mode='exact' parse_primes(info,query,'ram_primes',name='Ramified primes', qfield='ramps',mode=mode,radical='disc_rad') ## This seems not to be used #if 'lucky' in info: # label = db.nf_fields.lucky(query, 0) # if label: # return redirect(url_for(".by_label", label=clean_input(label))) info['wnf'] = WebNumberField.from_data
def abelian_variety_search(**args): info = to_dict(args) if 'download' in info and info['download'] != 0: return download_search(info) bread = args.get('bread', get_bread(('Search Results', ' '))) if 'jump' in info: return by_label(info.get('label','')) query = {} try: parse_ints(info,query,'q',name='base field') parse_ints(info,query,'g',name='dimension') if 'simple' in info: if info['simple'] == 'yes': query['is_simp'] = True elif info['simple'] == 'no': query['is_simp'] = False if 'primitive' in info: if info['primitive'] == 'yes': query['is_prim'] = True elif info['primitive'] == 'no': query['is_prim'] = False if 'jacobian' in info: jac = info['jacobian'] if jac == 'yes': query['is_jac'] = 1 elif jac == 'not_no': query['is_jac'] = {'$gt' : -1} elif jac == 'not_yes': query['is_jac'] = {'$lt' : 1} elif jac == 'no': query['is_jac'] = -1 if 'polarizable' in info: pol = info['polarizable'] if pol == 'yes': query['is_pp'] = 1 elif pol == 'not_no': query['is_pp'] = {'$gt' : -1} elif pol == 'not_yes': query['is_pp'] = {'$lt' : 1} elif pol == 'no': query['is_pp'] = -1 parse_ints(info,query,'p_rank') parse_ints(info,query,'ang_rank') parse_newton_polygon(info,query,'newton_polygon',qfield='slps') # TODO parse_string_start(info,query,'initial_coefficients',qfield='poly',initial_segment=["1"]) parse_string_start(info,query,'abvar_point_count',qfield='A_cnts') parse_string_start(info,query,'curve_point_count',qfield='C_cnts',first_field='pt_cnt') parse_abvar_decomp(info,query,'decomposition',qfield='decomp',av_stats=AbvarFqStats()) parse_nf_string(info,query,'number_field',qfield='nf') parse_galgrp(info,query,qfield='gal') except ValueError: return search_input_error(info, bread) info['query'] = query count = parse_count(info, 50) start = parse_start(info) cursor = db().find(query) nres = cursor.count() if start >= nres: start -= (1 + (start - nres) / count) * count if start < 0: start = 0 res = cursor.sort([('sort', ASCENDING)]).skip(start).limit(count) res = list(res) info['abvars'] = [AbvarFq_isoclass(x) for x in res] info['number'] = nres info['start'] = start info['count'] = count info['more'] = int(start + count < nres) if nres == 1: info['report'] = 'unique match' elif nres == 0: info['report'] = 'no matches' elif nres > count or start != 0: info['report'] = 'displaying matches %s-%s of %s' %(start + 1, min(nres, start+count), nres) else: info['report'] = 'displaying all %s matches' % nres t = 'Abelian Variety search results' return render_template("abvarfq-search-results.html", info=info, credit=abvarfq_credit, bread=bread, title=t)
def number_field_search(**args): info = to_dict(args) info['learnmore'] = [('Global number field labels', url_for(".render_labels_page")), ('Galois group labels', url_for(".render_groups_page")), (Completename, url_for(".render_discriminants_page")), ('Quadratic imaginary class groups', url_for(".render_class_group_data"))] t = 'Global Number Field search results' bread = [('Global Number Fields', url_for(".number_field_render_webpage")), ('Search results', ' ')] # for k in info.keys(): # nf_logger.debug(str(k) + ' ---> ' + str(info[k])) # nf_logger.debug('******************* '+ str(info['search'])) if 'natural' in info: query = {'label_orig': info['natural']} try: parse_nf_string(info,query,'natural',name="Label",qfield='label') return redirect(url_for(".by_label", label= clean_input(query['label_orig']))) except ValueError: query['err'] = info['err'] return search_input_error(query, bread) query = {} try: parse_galgrp(info,query, qfield='galois') parse_ints(info,query,'degree') parse_bracketed_posints(info,query,'signature',split=False,exactlength=2) parse_signed_ints(info,query,'discriminant',qfield=('disc_sign','disc_abs_key'),parse_one=make_disc_key) parse_ints(info,query,'class_number') parse_bracketed_posints(info,query,'class_group',split=False,check_divisibility='increasing') parse_primes(info,query,'ur_primes',name='Unramified primes',qfield='ramps',mode='complement',to_string=True) # modes are now contained (in), exactly, include if 'ram_quantifier' in info and str(info['ram_quantifier']) == 'include': mode = 'append' parse_primes(info,query,'ram_primes','ramified primes','ramps',mode,to_string=True) elif 'ram_quantifier' in info and str(info['ram_quantifier']) == 'contained': parse_primes(info,query,'ram_primes','ramified primes','ramps_all','subsets',to_string=False) pass # build list else: mode = 'liststring' parse_primes(info,query,'ram_primes','ramified primes','ramps_all',mode) except ValueError: return search_input_error(info, bread) count = parse_count(info) start = parse_start(info) if info.get('paging'): try: paging = int(info['paging']) if paging == 0: start = 0 except: pass C = base.getDBConnection() # nf_logger.debug(query) info['query'] = dict(query) if 'lucky' in args: one = C.numberfields.fields.find_one(query) if one: label = one['label'] return redirect(url_for(".by_label", label=clean_input(label))) fields = C.numberfields.fields res = fields.find(query) res = res.sort([('degree', ASC), ('disc_abs_key', ASC),('disc_sign', ASC)]) if 'download' in info and info['download'] != '0': return download_search(info, res) nres = res.count() res = res.skip(start).limit(count) if(start >= nres): start -= (1 + (start - nres) / count) * count if(start < 0): start = 0 info['fields'] = res info['number'] = nres info['start'] = start if nres == 1: info['report'] = 'unique match' else: if nres > count or start != 0: info['report'] = 'displaying matches %s-%s of %s' % (start + 1, min(nres, start + count), nres) else: info['report'] = 'displaying all %s matches' % nres info['wnf'] = WebNumberField.from_data return render_template("number_field_search.html", info=info, title=t, bread=bread)
def number_field_search(info): info['learnmore'] = [ ('Global number field labels', url_for(".render_labels_page")), ('Galois group labels', url_for(".render_groups_page")), (Completename, url_for(".render_discriminants_page")), ('Quadratic imaginary class groups', url_for(".render_class_group_data")) ] t = 'Global Number Field search results' bread = [('Global Number Fields', url_for(".number_field_render_webpage")), ('Search results', ' ')] if 'natural' in info: query = {'label_orig': info['natural']} try: parse_nf_string(info, query, 'natural', name="Label", qfield='label') return redirect( url_for(".by_label", label=clean_input(query['label_orig']))) except ValueError: query['err'] = info['err'] return search_input_error(query, bread) if 'algebra' in info: fields = info['algebra'].split('_') fields2 = [WebNumberField.from_coeffs(a) for a in fields] for j in range(len(fields)): if fields2[j] is None: fields2[j] = WebNumberField.fakenf(fields[j]) t = 'Number field algebra' info = {} info = {'fields': fields2} return render_template("number_field_algebra.html", info=info, title=t, bread=bread) query = {} try: parse_galgrp(info, query, qfield='galois') parse_ints(info, query, 'degree') parse_bracketed_posints(info, query, 'signature', split=False, exactlength=2) parse_signed_ints(info, query, 'discriminant', qfield=('disc_sign', 'disc_abs_key'), parse_one=make_disc_key) parse_ints(info, query, 'class_number') parse_bracketed_posints(info, query, 'class_group', split=False, check_divisibility='increasing') parse_primes(info, query, 'ur_primes', name='Unramified primes', qfield='ramps', mode='complement', to_string=True) # modes are now contained (in), exactly, include if 'ram_quantifier' in info and str( info['ram_quantifier']) == 'include': mode = 'append' parse_primes(info, query, 'ram_primes', 'ramified primes', 'ramps', mode, to_string=True) elif 'ram_quantifier' in info and str( info['ram_quantifier']) == 'contained': parse_primes(info, query, 'ram_primes', 'ramified primes', 'ramps_all', 'subsets', to_string=False) pass # build list else: mode = 'liststring' parse_primes(info, query, 'ram_primes', 'ramified primes', 'ramps_all', mode) except ValueError: return search_input_error(info, bread) count = parse_count(info) start = parse_start(info) # nf_logger.debug(query) info['query'] = dict(query) if 'lucky' in info: one = nfdb().find_one(query) if one: label = one['label'] return redirect(url_for(".by_label", label=clean_input(label))) fields = nfdb() res = fields.find(query) res = res.sort([('degree', ASC), ('disc_abs_key', ASC), ('disc_sign', ASC)]) if 'download' in info and info['download'] != '0': return download_search(info, res) nres = res.count() res = res.skip(start).limit(count) if (start >= nres): start -= (1 + (start - nres) / count) * count if (start < 0): start = 0 info['fields'] = res info['number'] = nres info['start'] = start if nres == 1: info['report'] = 'unique match' else: if nres > count or start != 0: info['report'] = 'displaying matches %s-%s of %s' % ( start + 1, min(nres, start + count), nres) else: info['report'] = 'displaying all %s matches' % nres info['wnf'] = WebNumberField.from_data return render_template("number_field_search.html", info=info, title=t, bread=bread)
def number_field_search(info): info['learnmore'] = [('Global number field labels', url_for(".render_labels_page")), ('Galois group labels', url_for(".render_groups_page")), (Completename, url_for(".render_discriminants_page")), ('Quadratic imaginary class groups', url_for(".render_class_group_data"))] t = 'Global Number Field search results' bread = [('Global Number Fields', url_for(".number_field_render_webpage")), ('Search Results', ' ')] if 'natural' in info: query = {'label_orig': info['natural']} try: parse_nf_string(info,query,'natural',name="Label",qfield='label') return redirect(url_for(".by_label", label=query['label'])) except ValueError: query['err'] = info['err'] return search_input_error(query, bread) if 'algebra' in info: fields=info['algebra'].split('_') fields2=[WebNumberField.from_coeffs(a) for a in fields] for j in range(len(fields)): if fields2[j] is None: fields2[j] = WebNumberField.fakenf(fields[j]) t = 'Number field algebra' info = {} info = {'fields': fields2} return render_template("number_field_algebra.html", info=info, title=t, bread=bread) query = {} try: parse_galgrp(info,query, qfield='galois') parse_ints(info,query,'degree') parse_bracketed_posints(info,query,'signature',split=False,exactlength=2) parse_signed_ints(info,query,'discriminant',qfield=('disc_sign','disc_abs_key'),parse_one=make_disc_key) parse_ints(info,query,'class_number') parse_bracketed_posints(info,query,'class_group',split=False,check_divisibility='increasing') parse_primes(info,query,'ur_primes',name='Unramified primes',qfield='ramps',mode='complement',to_string=True) # modes are now contained (in), exactly, include if 'ram_quantifier' in info and str(info['ram_quantifier']) == 'include': mode = 'append' parse_primes(info,query,'ram_primes','ramified primes','ramps',mode,to_string=True) elif 'ram_quantifier' in info and str(info['ram_quantifier']) == 'contained': parse_primes(info,query,'ram_primes','ramified primes','ramps_all','subsets',to_string=False) pass # build list else: mode = 'liststring' parse_primes(info,query,'ram_primes','ramified primes','ramps_all',mode) except ValueError: return search_input_error(info, bread) count = parse_count(info) start = parse_start(info) # nf_logger.debug(query) info['query'] = dict(query) if 'lucky' in info: one = nfdb().find_one(query) if one: label = one['label'] return redirect(url_for(".by_label", label=clean_input(label))) fields = nfdb() res = fields.find(query) res = res.sort([('degree', ASC), ('disc_abs_key', ASC),('disc_sign', ASC)]) if 'download' in info and info['download'] != '0': return download_search(info, res) # equivalent to # nres = res.count() #if(start >= nres): # start -= (1 + (start - nres) / count) * count #if(start < 0): # start = 0 # res = res.skip(start).limit(count) try: start, nres, res = search_cursor_timeout_decorator(res, start, count); except ValueError as err: info['err'] = err; return search_input_error(info, bread) info['fields'] = res info['number'] = nres info['start'] = start if nres == 1: info['report'] = 'unique match' else: if nres > count or start != 0: info['report'] = 'displaying matches %s-%s of %s' % (start + 1, min(nres, start + count), nres) else: info['report'] = 'displaying all %s matches' % nres info['wnf'] = WebNumberField.from_data return render_template("number_field_search.html", info=info, title=t, bread=bread)
def artin_representation_search(**args): info = to_dict(args) if 'natural' in info: label = info['natural'] # test if it is ok try: label = parse_artin_label(label) except ValueError as err: flash(Markup("Error: %s" % (err)), "error") bread = get_bread([('Search results', '')]) return search_input_error({'err': ''}, bread) return render_artin_representation_webpage(label) title = 'Artin representation search results' bread = [('Artin representation', url_for(".index")), ('Search results', ' ')] sign_code = 0 query = {'Hide': 0} try: parse_primes(info, query, "unramified", name="Unramified primes", qfield="BadPrimes", mode="complement", to_string=True) parse_primes(info, query, "ramified", name="Ramified primes", qfield="BadPrimes", mode="append", to_string=True) parse_restricted(info, query, "root_number", qfield="GaloisConjugates.Sign", allowed=[1, -1], process=int) parse_restricted(info, query, "frobenius_schur_indicator", qfield="Indicator", allowed=[1, 0, -1], process=int) parse_galgrp(info, query, "group", name="Group", qfield="Galois_nt", use_bson=False) parse_ints(info, query, 'dimension', qfield='Dim') parse_ints(info, query, 'conductor', qfield='Conductor_key', parse_singleton=make_cond_key) #parse_paired_fields(info,query,field1='conductor',qfield1='Conductor_key',parse1=parse_ints,kwds1={'parse_singleton':make_cond_key}, #field2='dimension',qfield2='Dim', parse2=parse_ints) except ValueError: return search_input_error(info, bread) count = parse_count(info, 10) start = parse_start(info) data = ArtinRepresentation.collection().find(query).sort([("Dim", ASC), ("Conductor_key", ASC)]) nres = data.count() data = data.skip(start).limit(count) if (start >= nres): start -= (1 + (start - nres) / count) * count if (start < 0): start = 0 if nres == 1: report = 'unique match' else: if nres > count or start != 0: report = 'displaying matches %s-%s of %s' % ( start + 1, min(nres, start + count), nres) else: report = 'displaying all %s matches' % nres if nres == 0: report = 'no matches' initfunc = ArtinRepresentation return render_template("artin-representation-search.html", req=info, data=data, title=title, bread=bread, query=query, start=start, report=report, nres=nres, initfunc=initfunc, sign_code=sign_code)
def number_field_search(**args): info = to_dict(args) info["learnmore"] = [ ("Global number field labels", url_for(".render_labels_page")), ("Galois group labels", url_for(".render_groups_page")), (Completename, url_for(".render_discriminants_page")), ("Quadratic imaginary class groups", url_for(".render_class_group_data")), ] t = "Global Number Field search results" bread = [("Global Number Fields", url_for(".number_field_render_webpage")), ("Search results", " ")] # for k in info.keys(): # nf_logger.debug(str(k) + ' ---> ' + str(info[k])) # nf_logger.debug('******************* '+ str(info['search'])) if "natural" in info: query = {"label_orig": info["natural"]} try: parse_nf_string(info, query, "natural", name="Label", qfield="label") return redirect(url_for(".by_label", label=clean_input(query["label"]))) except ValueError: query["err"] = info["err"] return search_input_error(query, bread) query = {} try: parse_galgrp(info, query, qfield="galois") parse_ints(info, query, "degree") parse_bracketed_posints(info, query, "signature", split=False, exactlength=2) parse_signed_ints(info, query, "discriminant", qfield=("disc_sign", "disc_abs_key"), parse_one=make_disc_key) parse_ints(info, query, "class_number") parse_bracketed_posints(info, query, "class_group", split=False, check_divisibility="increasing") parse_primes( info, query, "ur_primes", name="Unramified primes", qfield="ramps", mode="complement", to_string=True ) if "ram_quantifier" in info and str(info["ram_quantifier"]) == "some": mode = "append" else: mode = "exact" parse_primes(info, query, "ram_primes", "ramified primes", "ramps", mode, to_string=True) except ValueError: return search_input_error(info, bread) count = parse_count(info) start = parse_start(info) if info.get("paging"): try: paging = int(info["paging"]) if paging == 0: start = 0 except: pass C = base.getDBConnection() # nf_logger.debug(query) info["query"] = dict(query) if "lucky" in args: one = C.numberfields.fields.find_one(query) if one: label = one["label"] return redirect(url_for(".by_label", clean_input(label))) fields = C.numberfields.fields res = fields.find(query) if "download" in info and info["download"] != "0": return download_search(info, res) res = res.sort([("degree", ASC), ("disc_abs_key", ASC), ("disc_sign", ASC)]) nres = res.count() res = res.skip(start).limit(count) if start >= nres: start -= (1 + (start - nres) / count) * count if start < 0: start = 0 info["fields"] = res info["number"] = nres info["start"] = start if nres == 1: info["report"] = "unique match" else: if nres > count or start != 0: info["report"] = "displaying matches %s-%s of %s" % (start + 1, min(nres, start + count), nres) else: info["report"] = "displaying all %s matches" % nres info["wnf"] = WebNumberField.from_data return render_template("number_field_search.html", info=info, title=t, bread=bread)
def number_field_search(**args): info = to_dict(args) info['learnmore'] = [('Global number field labels', url_for(".render_labels_page")), ('Galois group labels', url_for(".render_groups_page")), (Completename, url_for(".render_discriminants_page")), ('Quadratic imaginary class groups', url_for(".render_class_group_data"))] t = 'Global Number Field search results' bread = [('Global Number Fields', url_for(".number_field_render_webpage")), ('Search results', ' ')] # for k in info.keys(): # nf_logger.debug(str(k) + ' ---> ' + str(info[k])) # nf_logger.debug('******************* '+ str(info['search'])) if 'natural' in info: query = {'label_orig': info['natural']} try: parse_nf_string(info,query,'natural',name="Label",qfield='label') return redirect(url_for(".by_label", label= clean_input(query['label']))) except ValueError: query['err'] = info['err'] return search_input_error(query, bread) query = {} try: parse_galgrp(info,query, qfield='galois') parse_ints(info,query,'degree') parse_bracketed_posints(info,query,'signature',split=False,exactlength=2) parse_signed_ints(info,query,'discriminant',qfield=('disc_sign','disc_abs_key'),parse_one=make_disc_key) parse_ints(info,query,'class_number') parse_bracketed_posints(info,query,'class_group',split=False,check_divisibility='increasing') parse_primes(info,query,'ur_primes',name='Unramified primes',qfield='ramps',mode='complement',to_string=True) if 'ram_quantifier' in info and str(info['ram_quantifier']) == 'some': mode = 'append' else: mode = 'exact' parse_primes(info,query,'ram_primes','ramified primes','ramps',mode,to_string=True) except ValueError: return search_input_error(info, bread) count = parse_count(info) start = parse_start(info) if info.get('paging'): try: paging = int(info['paging']) if paging == 0: start = 0 except: pass C = base.getDBConnection() # nf_logger.debug(query) info['query'] = dict(query) if 'lucky' in args: one = C.numberfields.fields.find_one(query) if one: label = one['label'] return redirect(url_for(".by_label", clean_input(label))) fields = C.numberfields.fields res = fields.find(query) if 'download' in info and info['download'] != '0': return download_search(info, res) res = res.sort([('degree', ASC), ('disc_abs_key', ASC),('disc_sign', ASC)]) nres = res.count() res = res.skip(start).limit(count) if(start >= nres): start -= (1 + (start - nres) / count) * count if(start < 0): start = 0 info['fields'] = res info['number'] = nres info['start'] = start if nres == 1: info['report'] = 'unique match' else: if nres > count or start != 0: info['report'] = 'displaying matches %s-%s of %s' % (start + 1, min(nres, start + count), nres) else: info['report'] = 'displaying all %s matches' % nres info['wnf'] = WebNumberField.from_data return render_template("number_field_search.html", info=info, title=t, bread=bread)
def abelian_variety_search(info, query): parse_ints(info, query, 'q', name='base field') parse_ints(info, query, 'g', name='dimension') if 'simple' in info: if info['simple'] == 'yes': query['is_simp'] = True elif info['simple'] == 'no': query['is_simp'] = False if 'primitive' in info: if info['primitive'] == 'yes': query['is_prim'] = True elif info['primitive'] == 'no': query['is_prim'] = False if 'jacobian' in info: jac = info['jacobian'] if jac == 'yes': query['is_jac'] = 1 elif jac == 'not_no': query['is_jac'] = {'$gt': -1} elif jac == 'not_yes': query['is_jac'] = {'$lt': 1} elif jac == 'no': query['is_jac'] = -1 if 'polarizable' in info: pol = info['polarizable'] if pol == 'yes': query['is_pp'] = 1 elif pol == 'not_no': query['is_pp'] = {'$gt': -1} elif pol == 'not_yes': query['is_pp'] = {'$lt': 1} elif pol == 'no': query['is_pp'] = -1 parse_ints(info, query, 'p_rank') parse_ints(info, query, 'ang_rank') parse_newton_polygon(info, query, 'newton_polygon', qfield='slps') parse_string_start(info, query, 'initial_coefficients', qfield='poly_str', initial_segment=["1"]) parse_string_start(info, query, 'abvar_point_count', qfield='A_cnts_str') parse_string_start(info, query, 'curve_point_count', qfield='C_cnts_str', first_field='pt_cnt') if info.get('simple_quantifier') == 'contained': parse_subset(info, query, 'simple_factors', qfield='simple_distinct', mode='subsets') elif info.get('simple_quantifier') == 'exactly': parse_subset(info, query, 'simple_factors', qfield='simple_distinct', mode='exact') elif info.get('simple_quantifier') == 'include': parse_submultiset(info, query, 'simple_factors', mode='append') for n in range(1, 6): parse_ints(info, query, 'dim%s_factors' % n) for n in range(1, 4): parse_ints(info, query, 'dim%s_distinct' % n) parse_nf_string(info, query, 'number_field', qfield='nf') parse_galgrp(info, query, qfield=('galois_n', 'galois_t'))