def show_ecnf(nf, conductor_label, class_label, number): conductor_label = unquote(conductor_label) conductor_label = convert_IQF_label(nf,conductor_label) try: nf_label = nf_string_to_label(nf) except ValueError: return search_input_error() label = "".join(["-".join([nf_label, conductor_label, class_label]), number]) ec = ECNF.by_label(label) bread = [("Elliptic Curves", url_for(".index"))] if not ec: info = {'query':{}} info['err'] = 'No elliptic curve in the database has label %s.' % label return search_input_error(info, bread) title = "Elliptic Curve %s over Number Field %s" % (ec.short_label, ec.field.field_pretty()) bread = [("Elliptic Curves", url_for(".index"))] bread.append((ec.field.field_pretty(), ec.urls['field'])) bread.append((ec.conductor_label, ec.urls['conductor'])) bread.append((ec.iso_label, ec.urls['class'])) bread.append((ec.number, ec.urls['curve'])) code = ec.code() code['show'] = {'magma':'','pari':'','sage':''} # use default show names info = {} return render_template("ecnf-curve.html", credit=ecnf_credit, title=title, bread=bread, ec=ec, code = code, # properties = ec.properties, properties2=ec.properties, friends=ec.friends, info=info, learnmore=learnmore_list())
def lfunction_friend_from_url(url): if url[0] == '/': url = url[1:] parts = url.split("/") if parts[0] == "Genus2Curve" and parts[1] == "Q": label = parts[2] + "." + parts[3] return ("Isogeny class " + label, "/" + url) if parts[0] == "EllipticCurve" and parts[1] == "Q": label = parts[2] + "." + parts[3] return ("EC isogeny class " + label, "/" + url) if parts[0] == "EllipticCurve": cond = convert_IQF_label(parts[1], parts[2]) label = parts[1] + "-" + cond + "-" + parts[3] return ("EC isogeny class " + label, "/" + url) if parts[0] == "ModularForm" and parts[1] == "GL2" and parts[ 2] == "TotallyReal" and parts[4] == "holomorphic": label = parts[5] return ("Hilbert MF " + label, "/" + url) if parts[0] == "ModularForm" and parts[1] == "GL2" and parts[ 2] == "ImaginaryQuadratic": label = '.'.join(parts[4:6]) return ("Bianchi MF " + label, "/" + url) if parts[0] == "ModularForm" and parts[1] == "GL2" and parts[ 2] == "Q" and parts[3] == "holomorphic": label = '.'.join(parts[4:8]) return ("Modular form " + label, "/" + url) return (url, "/" + url)
def show_ecnf_isoclass(nf, conductor_label, class_label): conductor_label = unquote(conductor_label) conductor_label = convert_IQF_label(nf,conductor_label) try: nf_label, nf_pretty = get_nf_info(nf) except ValueError: return search_input_error() label = "-".join([nf_label, conductor_label, class_label]) full_class_label = "-".join([conductor_label, class_label]) cl = ECNF_isoclass.by_label(label) bread = [("Elliptic curves", url_for(".index"))] if not isinstance(cl, ECNF_isoclass): info = {'query':{}, 'err':'No elliptic curve isogeny class in the database has label %s.' % label} return search_input_error(info, bread) title = "Elliptic curve isogeny class %s over number field %s" % (full_class_label, cl.field_name) bread.append((nf_pretty, url_for(".show_ecnf1", nf=nf))) bread.append((conductor_label, url_for(".show_ecnf_conductor", nf=nf_label, conductor_label=conductor_label))) bread.append((class_label, url_for(".show_ecnf_isoclass", nf=nf_label, conductor_label=quote(conductor_label), class_label=class_label))) return render_template("ecnf-isoclass.html", credit=ecnf_credit, title=title, bread=bread, cl=cl, properties=cl.properties, friends=cl.friends, learnmore=learnmore_list())
def show_ecnf_conductor(nf, conductor_label): conductor_label = unquote(conductor_label) conductor_label = convert_IQF_label(nf, conductor_label) try: nf_label, nf_pretty = get_nf_info(nf) conductor_norm = conductor_label_norm(conductor_label) except ValueError: return search_input_error() info = to_dict(request.args) info['title'] = 'Elliptic Curves over %s of conductor %s' % ( nf_pretty, conductor_label) info['bread'] = [('Elliptic Curves', url_for(".index")), (nf_pretty, url_for(".show_ecnf1", nf=nf)), (conductor_label, url_for(".show_ecnf_conductor", nf=nf, conductor_label=conductor_label))] if len(request.args) > 0: # if requested field or conductor norm differs from nf or conductor_lable, redirect to general search if ('field' in request.args and request.args['field'] != nf_label) or \ ('conductor_norm' in request.args and request.args['conductor_norm'] != conductor_norm): return redirect(url_for(".index", **request.args), 307) info['title'] += ' search results' info['bread'].append(('search results', '')) info['field'] = nf_label info['conductor_label'] = conductor_label info['conductor_norm'] = conductor_norm return elliptic_curve_search(info)
def show_ecnf_isoclass(nf, conductor_label, class_label): if not FIELD_RE.fullmatch(nf): return abort(404) conductor_label = unquote(conductor_label) conductor_label = convert_IQF_label(nf,conductor_label) try: nf_label, nf_pretty = get_nf_info(nf) except ValueError: flash_error("%s is not a valid number field label", nf_label) return redirect(url_for(".index")) label = "-".join([nf_label, conductor_label, class_label]) if not CLASS_LABEL_RE.fullmatch(label): flash_error("%s is not a valid elliptic curve isogeny class label", label) return redirect(url_for(".index")) full_class_label = "-".join([conductor_label, class_label]) cl = ECNF_isoclass.by_label(label) if not isinstance(cl, ECNF_isoclass): flash_error("There is no elliptic curve isogeny class with label %s in the database", label) return redirect(url_for(".index")) bread = [("Elliptic curves", url_for(".index"))] title = "Elliptic curve isogeny class %s over number field %s" % (full_class_label, cl.field_name) bread.append((nf_pretty, url_for(".show_ecnf1", nf=nf))) bread.append((conductor_label, url_for(".show_ecnf_conductor", nf=nf_label, conductor_label=conductor_label))) bread.append((class_label, url_for(".show_ecnf_isoclass", nf=nf_label, conductor_label=quote(conductor_label), class_label=class_label))) return render_template("ecnf-isoclass.html", title=title, bread=bread, cl=cl, properties=cl.properties, friends=cl.friends, learnmore=learnmore_list())
def show_ecnf(nf, conductor_label, class_label, number): conductor_label = unquote(conductor_label) conductor_label = convert_IQF_label(nf,conductor_label) try: nf_label = nf_string_to_label(nf) except ValueError: return search_input_error() label = "".join(["-".join([nf_label, conductor_label, class_label]), number]) ec = ECNF.by_label(label) bread = [("Elliptic Curves", url_for(".index"))] if not ec: info = {'query':{}} info['err'] = 'No elliptic curve in the database has label %s.' % label return search_input_error(info, bread) title = "Elliptic Curve %s over Number Field %s" % (ec.short_label, ec.field.field_pretty()) bread = [("Elliptic Curves", url_for(".index"))] bread.append((ec.field.field_pretty(), ec.urls['field'])) bread.append((ec.conductor_label, ec.urls['conductor'])) bread.append((ec.iso_label, ec.urls['class'])) bread.append((ec.number, ec.urls['curve'])) code = ec.code() code['show'] = {'magma':'','pari':'','sage':''} # use default show names info = {} return render_template("ecnf-curve.html", credit=ecnf_credit, title=title, bread=bread, ec=ec, code = code, # properties = ec.properties, properties2=ec.properties, friends=ec.friends, info=info, learnmore=learnmore_list())
def show_ecnf_isoclass(nf, conductor_label, class_label): conductor_label = unquote(conductor_label) conductor_label = convert_IQF_label(nf,conductor_label) try: nf_label, nf_pretty = get_nf_info(nf) except ValueError: return search_input_error() label = "-".join([nf_label, conductor_label, class_label]) full_class_label = "-".join([conductor_label, class_label]) cl = ECNF_isoclass.by_label(label) bread = [("Elliptic Curves", url_for(".index"))] if not isinstance(cl, ECNF_isoclass): info = {'query':{}, 'err':'No elliptic curve isogeny class in the database has label %s.' % label} return search_input_error(info, bread) title = "Elliptic Curve isogeny class %s over Number Field %s" % (full_class_label, cl.field_name) bread.append((nf_pretty, url_for(".show_ecnf1", nf=nf))) bread.append((conductor_label, url_for(".show_ecnf_conductor", nf=nf_label, conductor_label=conductor_label))) bread.append((class_label, url_for(".show_ecnf_isoclass", nf=nf_label, conductor_label=quote(conductor_label), class_label=class_label))) return render_template("ecnf-isoclass.html", credit=ecnf_credit, title=title, bread=bread, cl=cl, properties2=cl.properties, friends=cl.friends, learnmore=learnmore_list())
def show_ecnf_conductor(nf, conductor_label): if not FIELD_RE.fullmatch(nf): flash_error("%s is not a valid number field label", nf) return redirect(url_for(".index")) conductor_label = unquote(conductor_label) conductor_label = convert_IQF_label(nf, conductor_label) try: nf_label, nf_pretty = get_nf_info(nf) conductor_norm = conductor_label_norm(conductor_label) except ValueError: return abort(404) info = to_dict(request.args, search_array=ECNFSearchArray()) info['title'] = 'Elliptic curves over %s of conductor %s' % ( nf_pretty, conductor_label) info['bread'] = [('Elliptic curves', url_for(".index")), (nf_pretty, url_for(".show_ecnf1", nf=nf)), (conductor_label, url_for(".show_ecnf_conductor", nf=nf, conductor_label=conductor_label))] if len(request.args) > 0: # if requested field or conductor norm differs from nf or conductor_lable, redirect to general search if ('field' in request.args and request.args['field'] != nf_label) or \ ('conductor_norm' in request.args and request.args['conductor_norm'] != conductor_norm): return redirect(url_for(".index", **request.args), 307) info['title'] += ' Search results' info['bread'].append(('Search results', '')) info['field'] = nf_label info['conductor_label'] = conductor_label info['conductor_norm'] = conductor_norm return elliptic_curve_search(info)
def url_for_ec(label): if not '-' in label: return url_for('ec.by_ec_label', label = label) else: (nf, cond, isog, num) = split_ecnf_label(label) cond = convert_IQF_label(nf,cond) url = url_for('ecnf.show_ecnf', nf = nf, conductor_label = cond, class_label = isog, number = num) return url
def url_for_ec(label): if not '-' in label: return url_for('ec.by_ec_label', label = label) else: (nf, cond, isog, num) = split_ecnf_label(label) cond = convert_IQF_label(nf,cond) url = url_for('ecnf.show_ecnf', nf = nf, conductor_label = cond, class_label = isog, number = num) return url
def url_for_ec_class(ec_label): if not '-' in ec_label: (cond, iso, num) = split_lmfdb_label(ec_label) return url_for('ec.by_double_iso_label', conductor=cond, iso_label=iso) else: (nf, cond, isog, num) = split_ecnf_label(ec_label) cond = convert_IQF_label(nf,cond) return url_for('ecnf.show_ecnf_isoclass', nf=nf, conductor_label=cond, class_label=isog)
def url_for_ec_class(ec_label): if not '-' in ec_label: (cond, iso, num) = split_lmfdb_label(ec_label) return url_for('ec.by_double_iso_label', conductor=cond, iso_label=iso) else: (nf, cond, isog, num) = split_ecnf_label(ec_label) cond = convert_IQF_label(nf,cond) return url_for('ecnf.show_ecnf_isoclass', nf=nf, conductor_label=cond, class_label=isog)
def ECNF_convert_old_url(oldurl): # EllipticCurve/2.0.4.1/[4160,64,8]/a/ if '[' not in oldurl: return oldurl ec, fld, cond, iso = oldurl.rstrip('/').split('/') assert ec == 'EllipticCurve' if cond[0] == '[' and cond[-1] == ']': cond = convert_IQF_label(fld, cond) return '/'.join([ec, fld, cond, iso]) else: return oldurl
def ECNF_convert_old_url(oldurl): # EllipticCurve/2.0.4.1/[4160,64,8]/a/ if '[' not in oldurl: return oldurl ec, fld, cond, iso = oldurl.rstrip('/').split('/') assert ec == 'EllipticCurve' if cond[0] == '[' and cond[-1] == ']': cond = convert_IQF_label(fld, cond) return '/'.join([ec, fld, cond, iso]) else: return oldurl
def show_ecnf(nf, conductor_label, class_label, number): if not FIELD_RE.fullmatch(nf): return abort(404) conductor_label = unquote(conductor_label) conductor_label = convert_IQF_label(nf, conductor_label) try: nf_label = nf_string_to_label(nf) except ValueError: flash_error("%s is not a valid number field label", nf_label) return redirect(url_for(".index")) label = "".join( ["-".join([nf_label, conductor_label, class_label]), str(number)]) if not LABEL_RE.fullmatch(label): flash_error("%s is not a valid elliptic curve label", label) return redirect(url_for(".index")) ec = ECNF.by_label(label) if not isinstance(ec, ECNF): flash_error("There is no elliptic curve with label %s in the database", label) return redirect(url_for(".index")) bread = [("Elliptic curves", url_for(".index"))] title = "Elliptic curve %s over number field %s" % ( ec.short_label, ec.field.field_pretty()) bread = [("Elliptic curves", url_for(".index"))] bread.append((ec.field.field_pretty(), ec.urls['field'])) bread.append((ec.conductor_label, ec.urls['conductor'])) bread.append((ec.iso_label, ec.urls['class'])) bread.append((ec.number, ec.urls['curve'])) code = ec.code() code['show'] = { 'magma': '', 'pari': '', 'sage': '' } # use default show names info = {} return render_template( "ecnf-curve.html", credit=ecnf_credit, title=title, bread=bread, ec=ec, code=code, # properties = ec.properties, properties=ec.properties, friends=ec.friends, downloads=ec.downloads, info=info, KNOWL_ID="ec.%s" % label, learnmore=learnmore_list())
def download_ECNF_all(nf,conductor_label,class_label,number): conductor_label = unquote(conductor_label) conductor_label = convert_IQF_label(nf,conductor_label) try: nf_label = nf_string_to_label(nf) except ValueError: return search_input_error() label = "".join(["-".join([nf_label, conductor_label, class_label]), number]) data = db.ec_nfcurves.lookup(label) if data is None: return search_input_error() response = make_response(Json.dumps(data)) response.headers['Content-type'] = 'text/plain' return response
def download_ECNF_all(nf,conductor_label,class_label,number): conductor_label = unquote(conductor_label) conductor_label = convert_IQF_label(nf,conductor_label) try: nf_label = nf_string_to_label(nf) except ValueError: return search_input_error() label = "".join(["-".join([nf_label, conductor_label, class_label]), number]) data = db.ec_nfcurves.lookup(label) if data is None: return search_input_error() response = make_response(Json.dumps(data)) response.headers['Content-type'] = 'text/plain' return response
def download_ECNF_all(nf,conductor_label,class_label,number): conductor_label = unquote(conductor_label) conductor_label = convert_IQF_label(nf,conductor_label) try: nf_label = nf_string_to_label(nf) except ValueError: return search_input_error() label = "".join(["-".join([nf_label, conductor_label, class_label]), number]) data = db_ecnf().find_one({'label':label}, {'_id':False}) if data is None: return search_input_error() import json response = make_response(json.dumps(data)) response.headers['Content-type'] = 'text/plain' return response
def download_ECNF_all(nf,conductor_label,class_label,number): conductor_label = unquote(conductor_label) conductor_label = convert_IQF_label(nf,conductor_label) try: nf_label = nf_string_to_label(nf) except ValueError: return search_input_error() label = "".join(["-".join([nf_label, conductor_label, class_label]), number]) data = db_ecnf().find_one({'label':label}, {'_id':False}) if data is None: return search_input_error() import json response = make_response(json.dumps(data)) response.headers['Content-type'] = 'text/plain' return response
def download_ECNF_all(nf,conductor_label,class_label,number): conductor_label = unquote(conductor_label) conductor_label = convert_IQF_label(nf,conductor_label) try: nf_label = nf_string_to_label(nf) except ValueError: flash_error("%s is not a valid number field label", nf_label) return redirect(url_for(".index")) label = "".join(["-".join([nf_label, conductor_label, class_label]), number]) if not LABEL_RE.fullmatch(label): flash_error("%s is not a valid elliptic curve label.", label) return redirect(url_for(".index")) data = db.ec_nfcurves.lookup(label) if data is None: flash_error("%s is not the label of an elliptic curve in the database.", label) return redirect(url_for(".index")) response = make_response(Json.dumps(data)) response.headers['Content-type'] = 'text/plain' return response
def show_ecnf_conductor(nf, conductor_label): conductor_label = unquote(conductor_label) conductor_label = convert_IQF_label(nf,conductor_label) try: nf_label, nf_pretty = get_nf_info(nf) conductor_norm = conductor_label_norm(conductor_label) except ValueError: return search_input_error() info = to_dict(request.args) info['title'] = 'Elliptic Curves over %s of conductor %s' % (nf_pretty, conductor_label) info['bread'] = [('Elliptic Curves', url_for(".index")), (nf_pretty, url_for(".show_ecnf1", nf=nf)), (conductor_label, url_for(".show_ecnf_conductor",nf=nf,conductor_label=conductor_label))] if len(request.args) > 0: # if requested field or conductor norm differs from nf or conductor_lable, redirect to general search if ('field' in request.args and request.args['field'] != nf_label) or \ ('conductor_norm' in request.args and request.args['conductor_norm'] != conductor_norm): return redirect (url_for(".index", **request.args), 307) info['title'] += ' Search Results' info['bread'].append(('Search Results','')) info['field'] = nf_label info['conductor_label'] = conductor_label info['conductor_norm'] = conductor_norm return elliptic_curve_search(info)
def ecnf_simple_label_search(search, baseurl, label): label_bits = label.split('/') try: nf = label_bits[0] conductor_label = label_bits[1] class_label = label_bits[2] number = label_bits[3] except IndexError: search['query'] = {'label': 'dummy'} return conductor_label = unquote(conductor_label) conductor_label = convert_IQF_label(nf, conductor_label) try: nf_label = nf_string_to_label(nf) except ValueError: search['query'] = {'label': 'dummy'} return label = "".join(["-".join(nf_label, conductor_label, class_label), number]) search['query'] = {'label': label}
def lfunction_friend_from_url(url): if url[0] == '/': url = url[1:] parts = url.split("/") if parts[0] == "Genus2Curve" and parts[1] == "Q": label = parts[2] + "." + parts[3] return ("Isogeny class " + label, "/" + url) if parts[0] == "EllipticCurve" and parts[1] == "Q": label = parts[2] + "." + parts[3] return ("EC isogeny class " + label, "/" + url) if parts[0] == "EllipticCurve": cond = convert_IQF_label(parts[1],parts[2]) label = parts[1] + "-" + cond + "-" + parts[3] return ("EC isogeny class " + label, "/" + url) if parts[0] == "ModularForm" and parts[1] == "GL2" and parts[2] == "TotallyReal" and parts[4] == "holomorphic": label = parts[5] return ("Hilbert MF " + label, "/" + url) if parts[0] == "ModularForm" and parts[1] == "GL2" and parts[2] == "ImaginaryQuadratic": label = '.'.join(parts[4:6]) return ("Bianchi MF " + label, "/" + url) if parts[0] == "ModularForm" and parts[1] == "GL2" and parts[2] == "Q" and parts[3] == "holomorphic": label = '.'.join(parts[4:8]) return ("Modular form " + label, "/" + url) return (url, "/" + url)
def name_and_object_from_url(url, check_existence=False): # the import is here to avoid circular imports from lmfdb.backend.database import db from lmfdb.ecnf.WebEllipticCurve import convert_IQF_label url_split = url.rstrip('/').lstrip('/').split("/") name = '??' obj_exists = False if url_split[0] == "EllipticCurve": # every EC instance was added from EC obj_exists = True if url_split[1] == 'Q': # EllipticCurve/Q/341641/a label_isogeny_class = ".".join(url_split[-2:]) if check_existence: obj_exists = db.ec_curves.exists({"lmfdb_iso" : label_isogeny_class}) else: # EllipticCurve/2.2.140.1/14.1/a field, cond, isog = url_split[-3:] # in the cond is written in the old format cond = convert_IQF_label(field, cond) label_isogeny_class = "-".join([field, cond, isog]) if check_existence: obj_exists = db.ec_nfcurves.exists({"class_label" : label_isogeny_class}) name = 'Isogeny class ' + label_isogeny_class elif url_split[0] == "Character": # Character/Dirichlet/19/8 assert url_split[1] == "Dirichlet" name = """Dirichlet Character \(\chi_{%s} (%s, \cdot) \)""" % tuple(url_split[-2:]) label = ".".join(url_split[-2:]) obj_exists = True if check_existence: obj_exists = db.char_dir_values.exists({"label" : label}) elif url_split[0] == "Genus2Curve": # Genus2Curve/Q/310329/a assert url_split[1] == 'Q' label_isogeny_class = ".".join(url_split[-2:]) obj_exists = True if check_existence: obj_exists = db.g2c_curves.exists({"class" : label_isogeny_class}) name = 'Isogeny class ' + label_isogeny_class elif url_split[0] == "ModularForm": if url_split[1] == 'GL2': if url_split[2] == 'Q' and url_split[3] == 'holomorphic': if len(url_split) == 10: # ModularForm/GL2/Q/holomorphic/24/2/f/a/11/2 newform_label = ".".join(url_split[-6:-2]) conrey_newform_label = ".".join(url_split[-6:]) name = 'Modular form ' + conrey_newform_label obj_exists = True if check_existence: obj_exists = db.mf_newforms.label_exists(newform_label) elif len(url_split) == 8: # ModularForm/GL2/Q/holomorphic/24/2/f/a newform_label = ".".join(url_split[-4:]) name = 'Modular form ' + newform_label obj_exists = True if check_existence: obj_exists = db.mf_newforms.label_exists(newform_label) elif url_split[2] == 'TotallyReal': # ModularForm/GL2/TotallyReal/2.2.140.1/holomorphic/2.2.140.1-14.1-a label = url_split[-1] name = 'Hilbert modular form ' + label obj_exists = True if check_existence: obj_exists = db.hmf_forms.label_exists(label) elif url_split[2] == 'ImaginaryQuadratic': # ModularForm/GL2/ImaginaryQuadratic/2.0.4.1/98.1/a label = '-'.join(url_split[-3:]) name = 'Bianchi modular form ' + label obj_exists = 'CM' not in label if check_existence: obj_exists = db.bmf_forms.label_exists(label) elif url_split[0] == "ArtinRepresentation": label = url_split[1] name = 'Artin representation ' + label obj_exists = True if check_existence: obj_exists = db.artin_reps.label_exists(label.split('c')[0]) elif url_split[0] == "SatoTateGroup": from lmfdb.sato_tate_groups.main import get_name name, label = get_name(url_split[1]) if name is None: name = label obj_exists = False else: name = 'Sato Tate group $%s$' % name obj_exists = True return name, obj_exists
def name_and_object_from_url(url, check_existence=False): # the import is here to avoid circular imports from lmfdb.backend import db from lmfdb.ecnf.WebEllipticCurve import convert_IQF_label url_split = url.rstrip('/').lstrip('/').split("/") name = '??' obj_exists = False if url_split[0] == "EllipticCurve": # every EC instance was added from EC obj_exists = True if url_split[1] == 'Q': # EllipticCurve/Q/341641/a label_isogeny_class = ".".join(url_split[-2:]) if check_existence: obj_exists = db.ec_curves.exists( {"lmfdb_iso": label_isogeny_class}) else: # EllipticCurve/2.2.140.1/14.1/a field, cond, isog = url_split[-3:] # in the cond is written in the old format cond = convert_IQF_label(field, cond) label_isogeny_class = "-".join([field, cond, isog]) if check_existence: obj_exists = db.ec_nfcurves.exists( {"class_label": label_isogeny_class}) name = 'Isogeny class ' + label_isogeny_class elif url_split[0] == "Character": # Character/Dirichlet/19/8 assert url_split[1] == "Dirichlet" name = r"Dirichlet Character \(\chi_{%s} (%s, \cdot) \)" % tuple( url_split[-2:]) label = ".".join(url_split[-2:]) obj_exists = True if check_existence: obj_exists = db.char_dir_values.exists({"label": label}) elif url_split[0] == "Genus2Curve": # Genus2Curve/Q/310329/a assert url_split[1] == 'Q' label_isogeny_class = ".".join(url_split[-2:]) obj_exists = True if check_existence: obj_exists = db.g2c_curves.exists({"class": label_isogeny_class}) name = 'Isogeny class ' + label_isogeny_class elif url_split[0] == "ModularForm": if url_split[1] == 'GL2': if url_split[2] == 'Q' and url_split[3] == 'holomorphic': if len(url_split) == 10: # ModularForm/GL2/Q/holomorphic/24/2/f/a/11/2 newform_label = ".".join(url_split[-6:-2]) conrey_newform_label = ".".join(url_split[-6:]) name = 'Modular form ' + conrey_newform_label obj_exists = True if check_existence: obj_exists = db.mf_newforms.label_exists(newform_label) elif len(url_split) == 8: # ModularForm/GL2/Q/holomorphic/24/2/f/a newform_label = ".".join(url_split[-4:]) name = 'Modular form ' + newform_label obj_exists = True if check_existence: obj_exists = db.mf_newforms.label_exists(newform_label) elif url_split[2] == 'TotallyReal': # ModularForm/GL2/TotallyReal/2.2.140.1/holomorphic/2.2.140.1-14.1-a label = url_split[-1] name = 'Hilbert modular form ' + label obj_exists = True if check_existence: obj_exists = db.hmf_forms.label_exists(label) elif url_split[2] == 'ImaginaryQuadratic': # ModularForm/GL2/ImaginaryQuadratic/2.0.4.1/98.1/a label = '-'.join(url_split[-3:]) name = 'Bianchi modular form ' + label obj_exists = 'CM' not in label if check_existence: obj_exists = db.bmf_forms.label_exists(label) elif url_split[0] == "ArtinRepresentation": label = url_split[1] name = 'Artin representation ' + label obj_exists = True if check_existence: obj_exists = db.artin_reps.label_exists(label.split('c')[0]) elif url_split[0] == "SatoTateGroup": from lmfdb.sato_tate_groups.main import get_name name, label = get_name(url_split[1]) if name is None: name = label obj_exists = False else: name = 'Sato Tate group $%s$' % name obj_exists = True return name, obj_exists
def name_and_object_from_url(url, check_existence=False): # the import is here to avoid circular imports from lmfdb import db from lmfdb.ecnf.WebEllipticCurve import convert_IQF_label url_split = url.rstrip('/').lstrip('/').split("/") name = '??' obj_exists = False if url_split[0] == "EllipticCurve": # every EC instance was added from EC obj_exists = True if url_split[1] == 'Q': if len(url_split) == 4: # isogeny class # EllipticCurve/Q/341641/a label_isogeny_class = ".".join(url_split[-2:]) if check_existence: obj_exists = db.ec_curvedata.exists( {"lmfdb_iso": label_isogeny_class}) elif len(url_split) == 5: # curve # EllipticCurve/Q/48/a/6 label_curve = ".".join(url_split[-3:-1]) + url_split[-1] if check_existence: obj_exists = db.ec_curvedata.exists( {"lmfdb_label": label_curve}) else: raise NotImplementedError else: if len(url_split) == 4: # isogeny class # EllipticCurve/2.2.140.1/14.1/a field, cond, isog = url_split[-3:] # in the cond is written in the old format cond = convert_IQF_label(field, cond) label_isogeny_class = "-".join([field, cond, isog]) if check_existence: obj_exists = db.ec_nfcurves.exists( {"class_label": label_isogeny_class}) elif len(url_split) == 5: # curve # EllipticCurve/2.0.4.1/1250.3/a/3 field, cond, isog, ind = url_split[-4:] # if the cond is written in the old format cond = convert_IQF_label(field, cond) label_curve = "-".join([field, cond, isog]) + ind if check_existence: obj_exists = db.ec_nfcurves.exists({"label": label_curve}) if len(url_split) == 4: # isogeny class #name = 'Isogeny class ' + label_isogeny_class name = 'Elliptic curve ' + label_isogeny_class elif len(url_split) == 5: # curve #name = 'Curve ' + label_curve name = 'Elliptic curve ' + label_curve elif url_split[0] == "Character": # Character/Dirichlet/19/8 assert url_split[1] == "Dirichlet" name = r"Dirichlet character \(\chi_{%s} (%s, \cdot) \)" % tuple( url_split[-2:]) label = ".".join(url_split[-2:]) obj_exists = True if check_existence: obj_exists = db.char_dir_values.exists({"label": label}) elif url_split[0] == "Genus2Curve": obj_exists = True assert url_split[1] == 'Q' if len(url_split) == 4: # isog class # Genus2Curve/Q/310329/a label_isogeny_class = ".".join(url_split[-2:]) if check_existence: obj_exists = db.g2c_curves.exists( {"class": label_isogeny_class}) #name = 'Isogeny class ' + label_isogeny_class name = 'Genus 2 curve ' + label_isogeny_class if len(url_split) == 6: # curve # Genus2Curve/Q/1728/b/442368/1 label_curve = ".".join(url_split[-4:]) if check_existence: obj_exists = db.g2c_curves.exists({"label": label_curve}) #name = 'Curve ' + label_curve name = 'Genus 2 curve ' + label_curve elif url_split[0] == "ModularForm": if url_split[1] == 'GL2': if url_split[2] == 'Q' and url_split[3] == 'holomorphic': if len(url_split) == 10: # ModularForm/GL2/Q/holomorphic/24/2/f/a/11/2 newform_label = ".".join(url_split[-6:-2]) conrey_newform_label = ".".join(url_split[-6:]) name = 'Modular form ' + conrey_newform_label obj_exists = True if check_existence: obj_exists = db.mf_newforms.label_exists(newform_label) elif len(url_split) == 8: # ModularForm/GL2/Q/holomorphic/24/2/f/a newform_label = ".".join(url_split[-4:]) name = 'Modular form ' + newform_label obj_exists = True if check_existence: obj_exists = db.mf_newforms.label_exists(newform_label) elif url_split[2] == 'TotallyReal': # ModularForm/GL2/TotallyReal/2.2.140.1/holomorphic/2.2.140.1-14.1-a label = url_split[-1] name = 'Hilbert modular form ' + label obj_exists = True if check_existence: obj_exists = db.hmf_forms.label_exists(label) elif url_split[2] == 'ImaginaryQuadratic': # ModularForm/GL2/ImaginaryQuadratic/2.0.4.1/98.1/a label = '-'.join(url_split[-3:]) name = 'Bianchi modular form ' + label obj_exists = 'CM' not in label if check_existence: obj_exists = db.bmf_forms.label_exists(label) elif url_split[0] == "ArtinRepresentation": label = url_split[1] name = 'Artin representation ' + label obj_exists = True if check_existence: obj_exists = db.artin_reps.label_exists(label.split('c')[0]) elif url_split[0] == "NumberField": from lmfdb.number_fields.web_number_field import field_pretty label = url_split[1] name = 'Number field ' + field_pretty(label) obj_exists = True if check_existence: obj_exists = db.number_fields.label_exists(label) elif url_split[0] == "SatoTateGroup": from lmfdb.sato_tate_groups.main import get_name name, label = get_name(url_split[1]) if name is None: name = label obj_exists = False else: name = 'Sato Tate group $%s$' % name obj_exists = True else: # FIXME #print("unknown url", url) pass return name, obj_exists