def elliptic_curve_search(info, query): parse_nf_string(info, query, 'field', name="base number field", qfield='field_label') if query.get('field_label') == '1.1.1.1': return redirect(url_for("ec.rational_elliptic_curves", **request.args), 301) parse_ints(info, query, 'conductor_norm') parse_noop(info, query, 'conductor_label') parse_ints(info, query, 'torsion', name='Torsion order', qfield='torsion_order') parse_bracketed_posints(info, query, 'torsion_structure', maxlength=2) if 'torsion_structure' in query and not 'torsion_order' in query: query['torsion_order'] = reduce( mul, [int(n) for n in query['torsion_structure']], 1) parse_ints(info, query, field='isodeg', qfield='isogeny_degrees') if 'jinv' in info: if info.get('field', '').strip() == '2.2.5.1': info['jinv'] = info['jinv'].replace('phi', 'a') if info.get('field', '').strip() == '2.0.4.1': info['jinv'] = info['jinv'].replace('i', 'a') parse_nf_elt(info, query, 'jinv', name='j-invariant') if query.get('jinv'): query['jinv'] = ','.join(query['jinv']) if 'include_isogenous' in info and info['include_isogenous'] == 'off': info['number'] = 1 query['number'] = 1 if 'include_base_change' in info: if info['include_base_change'] == 'off': query['base_change'] = [] if info['include_base_change'] == 'only': query['base_change'] = {'$ne': []} else: info['include_base_change'] = "on" if 'include_Q_curves' in info: if info['include_Q_curves'] == 'exclude': query['q_curve'] = False elif info['include_Q_curves'] == 'only': query['q_curve'] = True if 'include_cm' in info: if info['include_cm'] == 'exclude': query['cm'] = 0 elif info['include_cm'] == 'only': query['cm'] = {'$ne': 0} info['field_pretty'] = field_pretty info['web_ainvs'] = web_ainvs
def elliptic_curve_search(info, query): parse_nf_string(info,query,'field',name="base number field",qfield='field_label') if query.get('field_label') == '1.1.1.1': return redirect(url_for("ec.rational_elliptic_curves", **request.args), 301) parse_ints(info,query,'conductor_norm') parse_noop(info,query,'conductor_label') parse_ints(info,query,'torsion',name='Torsion order',qfield='torsion_order') parse_bracketed_posints(info,query,'torsion_structure',maxlength=2) if 'torsion_structure' in query and not 'torsion_order' in query: query['torsion_order'] = reduce(mul,[int(n) for n in query['torsion_structure']],1) parse_ints(info,query,field='isodeg',qfield='isogeny_degrees') if 'jinv' in info: if info.get('field','').strip() == '2.2.5.1': info['jinv'] = info['jinv'].replace('phi','a') if info.get('field','').strip() == '2.0.4.1': info['jinv'] = info['jinv'].replace('i','a') parse_nf_elt(info,query,'jinv',name='j-invariant') if query.get('jinv'): query['jinv'] =','.join(query['jinv']) if 'include_isogenous' in info and info['include_isogenous'] == 'off': info['number'] = 1 query['number'] = 1 if 'include_base_change' in info: if info['include_base_change'] == 'off': query['base_change'] = [] if info['include_base_change'] == 'only': query['base_change'] = {'$ne':[]} else: info['include_base_change'] = "on" if 'include_Q_curves' in info: if info['include_Q_curves'] == 'exclude': query['q_curve'] = False elif info['include_Q_curves'] == 'only': query['q_curve'] = True if 'include_cm' in info: if info['include_cm'] == 'exclude': query['cm'] = 0 elif info['include_cm'] == 'only': query['cm'] = {'$ne' : 0} info['field_pretty'] = field_pretty info['web_ainvs'] = web_ainvs
def elliptic_curve_search(**args): info = to_dict(args['data']) if 'download' in info and info['download'] != 0: return download_search(info) if not 'query' in info: info['query'] = {} bread = [('Elliptic Curves', url_for(".index")), ('Search Results', '.')] if 'jump' in info: label = info.get('label', '').replace(" ", "") # This label should be a full isogeny class label or a full # curve label (including the field_label component) try: nf, cond_label, iso_label, number = split_full_label(label.strip()) except ValueError: info['err'] = '' return search_input_error(info, bread) return show_ecnf(nf, cond_label, iso_label, number) query = {} try: parse_ints(info,query,'conductor_norm') parse_noop(info,query,'conductor_label') parse_nf_string(info,query,'field',name="base number field",qfield='field_label') parse_nf_elt(info,query,'jinv',name='j-invariant') parse_ints(info,query,'torsion',name='Torsion order',qfield='torsion_order') parse_bracketed_posints(info,query,'torsion_structure',maxlength=2) if 'torsion_structure' in query and not 'torsion_order' in query: query['torsion_order'] = reduce(mul,[int(n) for n in query['torsion_structure']],1) except ValueError: return search_input_error(info, bread) if 'include_isogenous' in info and info['include_isogenous'] == 'off': info['number'] = 1 query['number'] = 1 if 'include_base_change' in info and info['include_base_change'] == 'off': query['base_change'] = [] else: info['include_base_change'] = "on" if 'include_Q_curves' in info: if info['include_Q_curves'] == 'exclude': query['q_curve'] = False elif info['include_Q_curves'] == 'only': query['q_curve'] = True if 'include_cm' in info: if info['include_cm'] == 'exclude': query['cm'] = 0 elif info['include_cm'] == 'only': query['cm'] = {'$ne' : 0} info['query'] = query count = parse_count(info, 50) start = parse_start(info) # make the query and trim results according to start/count: cursor = db_ecnf().find(query) nres = cursor.count() if(start >= nres): start -= (1 + (start - nres) / count) * count if(start < 0): start = 0 res = cursor.sort([('field_label', ASC), ('conductor_norm', ASC), ('conductor_label', ASC), ('iso_nlabel', ASC), ('number', ASC)]).skip(start).limit(count) res = list(res) for e in res: e['numb'] = str(e['number']) e['field_knowl'] = nf_display_knowl(e['field_label'], getDBConnection(), field_pretty(e['field_label'])) info['curves'] = res # [ECNF(e) for e in res] info['number'] = nres info['start'] = start info['count'] = count info['more'] = int(start + count < nres) info['field_pretty'] = field_pretty info['web_ainvs'] = web_ainvs 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 t = 'Elliptic Curve search results' return render_template("ecnf-search-results.html", info=info, credit=ecnf_credit, bread=bread, title=t)
def elliptic_curve_search(info): if info.get('download') == '1' and info.get('Submit') and info.get( 'query'): return download_search(info) if not 'query' in info: info['query'] = {} bread = info.get('bread', [('Elliptic Curves', url_for(".index")), ('Search Results', '.')]) if 'jump' in info: label = info.get('label', '').replace(" ", "") # This label should be a full isogeny class label or a full # curve label (including the field_label component) try: nf, cond_label, iso_label, number = split_full_label(label.strip()) except ValueError: info['err'] = '' return search_input_error(info, bread) return redirect( url_for(".show_ecnf", nf=nf, conductor_label=cond_label, class_label=iso_label, number=number), 301) query = {} if 'jinv' in info: if info.get('field', '').strip() == '2.2.5.1': info['jinv'] = info['jinv'].replace('phi', 'a') if info.get('field', '').strip() == '2.0.4.1': info['jinv'] = info['jinv'].replace('i', 'a') try: parse_ints(info, query, 'conductor_norm') parse_noop(info, query, 'conductor_label') parse_nf_string(info, query, 'field', name="base number field", qfield='field_label') parse_nf_elt(info, query, 'jinv', name='j-invariant') parse_ints(info, query, 'torsion', name='Torsion order', qfield='torsion_order') parse_bracketed_posints(info, query, 'torsion_structure', maxlength=2) if 'torsion_structure' in query and not 'torsion_order' in query: query['torsion_order'] = reduce( mul, [int(n) for n in query['torsion_structure']], 1) parse_ints(info, query, field='isodeg', qfield='isogeny_degrees') except (TypeError, ValueError): return search_input_error(info, bread) if query.get('jinv'): query['jinv'] = ','.join(query['jinv']) if query.get('field_label') == '1.1.1.1': return redirect(url_for("ec.rational_elliptic_curves", **request.args), 301) if 'include_isogenous' in info and info['include_isogenous'] == 'off': info['number'] = 1 query['number'] = 1 if 'include_base_change' in info and info['include_base_change'] == 'off': query['base_change'] = [] else: info['include_base_change'] = "on" if 'include_Q_curves' in info: if info['include_Q_curves'] == 'exclude': query['q_curve'] = False elif info['include_Q_curves'] == 'only': query['q_curve'] = True if 'include_cm' in info: if info['include_cm'] == 'exclude': query['cm'] = 0 elif info['include_cm'] == 'only': query['cm'] = {'$ne': 0} info['query'] = query count = parse_count(info, 50) start = parse_start(info) # make the query and trim results according to start/count: cursor = db_ecnf().find(query) nres = cursor.count() if (start >= nres): start -= (1 + (start - nres) / count) * count if (start < 0): start = 0 res = cursor.sort([('field_label', ASC), ('conductor_norm', ASC), ('conductor_label', ASC), ('iso_nlabel', ASC), ('number', ASC)]).skip(start).limit(count) res = list(res) for e in res: e['numb'] = str(e['number']) e['field_knowl'] = nf_display_knowl(e['field_label'], getDBConnection(), field_pretty(e['field_label'])) info['curves'] = res # [ECNF(e) for e in res] info['number'] = nres info['start'] = start info['count'] = count info['more'] = int(start + count < nres) info['field_pretty'] = field_pretty info['web_ainvs'] = web_ainvs 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 t = info.get('title', 'Elliptic Curve search results') return render_template("ecnf-search-results.html", info=info, credit=ecnf_credit, bread=bread, title=t)
def elliptic_curve_search(**args): info = to_dict(args["data"]) if "download" in info and info["download"] != 0: return download_search(info) if not "query" in info: info["query"] = {} bread = [("Elliptic Curves", url_for(".index")), ("Search Results", ".")] if "jump" in info: label = info.get("label", "").replace(" ", "") # This label should be a full isogeny class label or a full # curve label (including the field_label component) try: nf, cond_label, iso_label, number = split_full_label(label.strip()) except ValueError: info["err"] = "" return search_input_error(info, bread) return show_ecnf(nf, cond_label, iso_label, number) query = {} try: parse_ints(info, query, "conductor_norm") parse_noop(info, query, "conductor_label") parse_nf_string(info, query, "field", name="base number field", qfield="field_label") parse_nf_elt(info, query, "jinv", name="j-invariant") parse_ints(info, query, "torsion", name="Torsion order", qfield="torsion_order") parse_bracketed_posints(info, query, "torsion_structure", maxlength=2) if "torsion_structure" in query and not "torsion_order" in query: query["torsion_order"] = reduce(mul, [int(n) for n in query["torsion_structure"]], 1) except ValueError: return search_input_error(info, bread) if "include_isogenous" in info and info["include_isogenous"] == "off": info["number"] = 1 query["number"] = 1 if "include_base_change" in info and info["include_base_change"] == "off": query["base_change"] = [] else: info["include_base_change"] = "on" if "include_Q_curves" in info: if info["include_Q_curves"] == "exclude": query["q_curve"] = False elif info["include_Q_curves"] == "only": query["q_curve"] = True if "include_cm" in info: if info["include_cm"] == "exclude": query["cm"] = 0 elif info["include_cm"] == "only": query["cm"] = {"$ne": 0} info["query"] = query count = parse_count(info, 50) start = parse_start(info) # make the query and trim results according to start/count: cursor = db_ecnf().find(query) nres = cursor.count() if start >= nres: start -= (1 + (start - nres) / count) * count if start < 0: start = 0 res = ( cursor.sort( [ ("field_label", ASC), ("conductor_norm", ASC), ("conductor_label", ASC), ("iso_nlabel", ASC), ("number", ASC), ] ) .skip(start) .limit(count) ) res = list(res) for e in res: e["numb"] = str(e["number"]) e["field_knowl"] = nf_display_knowl(e["field_label"], getDBConnection(), field_pretty(e["field_label"])) info["curves"] = res # [ECNF(e) for e in res] info["number"] = nres info["start"] = start info["count"] = count info["more"] = int(start + count < nres) info["field_pretty"] = field_pretty info["web_ainvs"] = web_ainvs 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 t = "Elliptic Curve search results" return render_template("ecnf-search-results.html", info=info, credit=ecnf_credit, bread=bread, title=t)
def elliptic_curve_search(**args): info = to_dict(args['data']) if 'download' in info and info['download'] != 0: return download_search(info) bread = [('Elliptic Curves', url_for(".index")), ('Search Results', '.')] if 'jump' in info: label = info.get('label', '').replace(" ", "") # This label should be a full isogeny class label or a full # curve label (including the field_label component) try: nf, cond_label, iso_label, number = split_full_label(label.strip()) except ValueError: if not 'query' in info: info['query'] = {} info['err'] = '' return search_input_error(info, bread) return show_ecnf(nf, cond_label, iso_label, number) query = {} try: parse_ints(info,query,'conductor_norm') parse_noop(info,query,'conductor_label') parse_nf_string(info,query,'field',name="base number field",qfield='field_label') parse_nf_elt(info,query,'jinv',name='j-invariant') parse_ints(info,query,'torsion',name='Torsion order',qfield='torsion_order') parse_bracketed_posints(info,query,'torsion_structure',maxlength=2) except ValueError: return search_input_error(info, bread) if 'include_isogenous' in info and info['include_isogenous'] == 'off': info['number'] = 1 query['number'] = 1 if 'include_base_change' in info and info['include_base_change'] == 'off': query['base_change'] = [] else: info['include_base_change'] = "on" info['query'] = query count = parse_count(info, 50) start = parse_start(info) # make the query and trim results according to start/count: cursor = db_ecnf().find(query) nres = cursor.count() if(start >= nres): start -= (1 + (start - nres) / count) * count if(start < 0): start = 0 res = cursor.sort([('field_label', ASC), ('conductor_norm', ASC), ('conductor_label', ASC), ('iso_nlabel', ASC), ('number', ASC)]).skip(start).limit(count) res = list(res) for e in res: e['numb'] = str(e['number']) e['field_knowl'] = nf_display_knowl(e['field_label'], getDBConnection(), field_pretty(e['field_label'])) info['curves'] = res # [ECNF(e) for e in res] info['number'] = nres info['start'] = start info['count'] = count info['more'] = int(start + count < nres) info['field_pretty'] = field_pretty info['web_ainvs'] = web_ainvs 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 t = 'Elliptic Curve search results' return render_template("ecnf-search-results.html", info=info, credit=ecnf_credit, bread=bread, title=t)