Ejemplo n.º 1
0
def bianchi_modular_form_search(info, query):
    """Function to handle requests from the top page, either jump to one
    newform or do a search.
    """
    parse_nf_string(info, query, 'field_label', name='base number field')
    parse_noop(info, query, 'label')
    parse_ints(info, query, 'dimension')
    parse_ints(info, query, 'level_norm')
    parse_primes(info, query, 'field_bad_primes', name='field bad primes',
         qfield='field_bad_primes',mode=info.get('field_bad_quantifier'))
    parse_primes(info, query, 'level_bad_primes', name='level bad primes',
         qfield='level_bad_primes',mode=info.get('level_bad_quantifier'))
    if 'sfe' not in info:
        info['sfe'] = "any"
    elif info['sfe'] != "any":
        query['sfe'] = int(info['sfe'])
    if 'include_cm' in info:
        if info['include_cm'] in ['exclude', 'off']:
            query['CM'] = 0 # will exclude NULL values
        elif info['include_cm'] == 'only':
            query['CM'] = {'$ne': 0} # will exclude NULL values
    if info.get('include_base_change') =='exclude':
        query['bc'] = 0
    elif info.get('include_base_change') == 'only':
        query['bc'] = {'$ne': 0}
Ejemplo n.º 2
0
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'))
Ejemplo n.º 3
0
def number_field_jump(info):
    query = {'label_orig': info['jump']}
    try:
        parse_nf_string(info, query, 'jump', name="Label", qfield='label')
        return redirect(url_for(".by_label", label=query['label']))
    except ValueError:
        return redirect(url_for(".number_field_render_webpage"))
Ejemplo n.º 4
0
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'))
Ejemplo n.º 5
0
def hilbert_modular_form_search(info, query):
    parse_nf_string(info, query, 'field_label', name="Field")
    parse_ints(info, query, 'deg', name='Field degree')
    parse_ints(info, query, 'disc', name="Field discriminant")
    parse_ints(info, query, 'dimension')
    parse_ints(info, query, 'level_norm', name="Level norm")
    parse_hmf_weight(info,
                     query,
                     'weight',
                     qfield=('parallel_weight', 'weight'))
    parse_primes(info,
                 query,
                 'field_bad_primes',
                 name='field bad primes',
                 qfield='field_bad_primes',
                 mode=info.get('field_bad_quantifier'))
    parse_primes(info,
                 query,
                 'level_bad_primes',
                 name='level bad primes',
                 qfield='level_bad_primes',
                 mode=info.get('level_bad_quantifier'))
    if 'cm' in info:
        if info['cm'] == 'exclude':
            query['is_CM'] = 'no'
        elif info['cm'] == 'only':
            query['is_CM'] = 'yes'
    if 'bc' in info:
        if info['bc'] == 'exclude':
            query['is_base_change'] = 'no'
        elif info['bc'] == 'only':
            query['is_base_change'] = 'yes'
Ejemplo n.º 6
0
def number_field_jump(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:
        return redirect(url_for(".number_field_render_webpage"))
Ejemplo n.º 7
0
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
Ejemplo n.º 8
0
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:
        t_o = 1
        for n in query['torsion_structure']:
            t_o *= int(n)
        query['torsion_order'] = t_o
    parse_element_of(info,query,field='isodeg',qfield='isogeny_degrees',split_interval=1000)

    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')
        if not 'a' in info['jinv'] and not info.get('field'): # rational j-invariant allowed for any field
            parse_rational(info, query, 'jinv', name='j-invariant')
            if query.get('jinv'):
                query['jinv'] = {'$regex': '^' + query['jinv'] + '(,0)*$'} # nf elements like j,0,0,0
        else: # j-invariant is a number field element
            parse_nf_elt(info, query, 'jinv', name='j-invariant')
            if query.get('jinv'):
                query['jinv'] = ','.join(query['jinv'])

    if info.get('one') == "yes":
        info['number'] = 1
        query['number'] = 1

    if 'include_base_change' in info:
        if info['include_base_change'] in ['exclude', 'off']: # off for backward compat with urls
            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}
    parse_ints(info,query,field='cm_disc',qfield='cm')
    info['field_pretty'] = field_pretty
    info['web_ainvs'] = web_ainvs
Ejemplo n.º 9
0
def number_field_jump(info):
    query = {'label_orig': info['jump']}
    try:
        parse_nf_string(info, query, 'jump', name="Label", qfield='label')
        # we end up parsing the string twice, but that is okay
        F1, _, _ = input_string_to_poly(info['jump'])
        # we only use the output of input_string_to_poly with single-letter variable names
        if F1 and len(str(F1.parent().gen())) == 1 and F1.list() != db.nf_fields.lookup(query['label'], 'coeffs'):
            flash_info(r"The requested field $\Q[{}]/\langle {}\rangle$ is isomorphic to the field below, but uses a different defining polynomial.".format(str(F1.parent().gen()), latex(F1)))
        return redirect(url_for(".by_label", label=query['label']))
    except ValueError:
        return redirect(url_for(".number_field_render_webpage"))
Ejemplo n.º 10
0
def belyi_search(info, query):
    if "group" in query:
        info["group"] = query["group"]
    parse_bracketed_posints(info, query, "abc_list", "a, b, c", maxlength=3)
    if query.get("abc_list"):
        if len(query["abc_list"]) == 3:
            a, b, c = sorted(query["abc_list"])
            query["a_s"] = a
            query["b_s"] = b
            query["c_s"] = c
        elif len(query["abc_list"]) == 2:
            a, b = sorted(query["abc_list"])
            sub_query = []
            sub_query.append({"a_s": a, "b_s": b})
            sub_query.append({"b_s": a, "c_s": b})
            query["$or"] = sub_query
        elif len(query["abc_list"]) == 1:
            a = query["abc_list"][0]
            query["$or"] = [{"a_s": a}, {"b_s": a}, {"c_s": a}]
        query.pop("abc_list")

    # a naive hack
    if info.get("abc"):
        for elt in ["a_s", "b_s", "c_s"]:
            info_hack = {}
            info_hack[elt] = info["abc"]
            parse_ints(info_hack, query, elt)

    parse_ints(info, query, "g", "g")
    parse_ints(info, query, "deg", "deg")
    parse_ints(info, query, "orbit_size", "orbit_size")
    parse_ints(info, query, "pass_size", "pass_size")
    parse_nf_string(info,
                    query,
                    'field',
                    name="base number field",
                    qfield='base_field_label')
    # invariants and drop-list items don't require parsing -- they are all strings (supplied by us, not the user)
    for fld in ["geomtype", "group"]:
        if info.get(fld):
            query[fld] = info[fld]

    parse_bool(info, query, "is_primitive", name="is_primitive")
    if info.get("primitivization"):
        primitivization = info["primitivization"]
        if re.match(GALMAP_RE, primitivization):
            # 7T6-7_4.2.1_4.2.1-b
            query["primitivization"] = primitivization
        else:
            raise ValueError("%s is not a valid Belyi map label",
                             primitivization)
Ejemplo n.º 11
0
Archivo: main.py Proyecto: LMFDB/lmfdb
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
Ejemplo n.º 12
0
def belyi_search(info, query):
    info["geometry_types_list"] = geometry_types_list
    info["geometry_types_dict"] = geometry_types_dict
    info["belyi_galmap_url"] = url_for_belyi_galmap_label
    if "group" in query:
        info["group"] = query["group"]
    parse_bracketed_posints(info, query, "abc_list", "a, b, c", maxlength=3)
    if query.get("abc_list"):
        if len(query["abc_list"]) == 3:
            a, b, c = sorted(query["abc_list"])
            query["a_s"] = a
            query["b_s"] = b
            query["c_s"] = c
        elif len(query["abc_list"]) == 2:
            a, b = sorted(query["abc_list"])
            sub_query = []
            sub_query.append({"a_s": a, "b_s": b})
            sub_query.append({"b_s": a, "c_s": b})
            query["$or"] = sub_query
        elif len(query["abc_list"]) == 1:
            a = query["abc_list"][0]
            query["$or"] = [{"a_s": a}, {"b_s": a}, {"c_s": a}]
        query.pop("abc_list")

    # a naive hack
    if info.get("abc"):
        for elt in ["a_s", "b_s", "c_s"]:
            info_hack = {}
            info_hack[elt] = info["abc"]
            parse_ints(info_hack, query, elt)

    parse_ints(info, query, "g", "g")
    parse_ints(info, query, "deg", "deg")
    parse_ints(info, query, "orbit_size", "orbit_size")
    parse_ints(info, query, "pass_size", "pass_size")
    parse_nf_string(info,
                    query,
                    'field',
                    name="base number field",
                    qfield='base_field_label')
    # invariants and drop-list items don't require parsing -- they are all strings (supplied by us, not the user)
    for fld in ["geomtype", "group"]:
        if info.get(fld):
            query[fld] = info[fld]

    info["nf_link"] = lambda elt: field_display_gen(
        elt.get('base_field_label'), elt.get('base_field'), truncate=16)
    parse_bool(info, query, "is_primitive", name="is_primitive")
Ejemplo n.º 13
0
def hilbert_modular_form_search(info, query):
    parse_nf_string(info,query,'field_label',name="Field")
    parse_ints(info,query,'deg', name='Field degree')
    parse_ints(info,query,'disc',name="Field discriminant")
    parse_ints(info,query,'dimension')
    parse_ints(info,query,'level_norm', name="Level norm")
    parse_hmf_weight(info,query,'weight',qfield=('parallel_weight','weight'))
    if 'cm' in info:
        if info['cm'] == 'exclude':
            query['is_CM'] = 'no'
        elif info['cm'] == 'only':
            query['is_CM'] = 'yes'
    if 'bc' in info:
        if info['bc'] == 'exclude':
            query['is_base_change'] = 'no'
        elif info['bc'] == 'only':
            query['is_base_change'] = 'yes'
Ejemplo n.º 14
0
def bianchi_modular_form_search(info, query):
    """Function to handle requests from the top page, either jump to one
    newform or do a search.
    """
    parse_nf_string(info, query, 'field_label', name='base number field')
    parse_noop(info, query, 'label')
    parse_ints(info, query, 'dimension')
    parse_ints(info, query, 'level_norm')
    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 # will exclude NULL values
        elif info['include_cm'] == 'only':
            query['CM'] = {'$ne': 0} # will exclude NULL values
    if 'include_base_change' in info and info['include_base_change'] == 'off':
        query['bc'] = 0
    else:
        info['include_base_change'] = "on"
Ejemplo n.º 15
0
def bianchi_modular_form_search(info, query):
    """Function to handle requests from the top page, either jump to one
    newform or do a search.
    """
    parse_nf_string(info, query, 'field_label', name='base number field')
    parse_noop(info, query, 'label')
    parse_ints(info, query, 'dimension')
    parse_ints(info, query, 'level_norm')
    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 # will exclude NULL values
        elif info['include_cm'] == 'only':
            query['CM'] = {'$ne': 0} # will exclude NULL values
    if 'include_base_change' in info and info['include_base_change'] == 'off':
        query['bc'] = 0
    else:
        info['include_base_change'] = "on"
Ejemplo n.º 16
0
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,'rank')
    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:
        t_o = 1
        for n in query['torsion_structure']:
            t_o *= int(n)
        query['torsion_order'] = t_o
    parse_element_of(info,query,'isodeg',split_interval=1000,contained_in=ECNF_stats().isogeny_degrees)
    parse_bool(info,query,'semistable','semistable')
    parse_bool(info,query,'potential_good_reduction','potential_good_reduction')
    parse_ints(info,query,'class_size','class_size')
    parse_ints(info,query,'class_deg','class_deg')
    parse_ints(info,query,'sha','analytic order of Ш')
    parse_floats(info,query,'reg','regulator')

    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')
        if not 'a' in info['jinv'] and not info.get('field'): # rational j-invariant allowed for any field
            parse_rational(info, query, 'jinv', name='j-invariant')
            if query.get('jinv'):
                query['jinv'] = {'$regex': '^' + query['jinv'] + '(,0)*$'} # nf elements like j,0,0,0
        else: # j-invariant is a number field element
            parse_nf_elt(info, query, 'jinv', name='j-invariant')
            if query.get('jinv'):
                query['jinv'] = ','.join(query['jinv'])

    if info.get('one') == "yes":
        info['number'] = 1
        query['number'] = 1

    if 'include_base_change' in info:
        if info['include_base_change'] in ['exclude', 'off']: # off for backward compat with urls
            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'] == 'PCM':
            query['cm'] = {'$ne' : 0}
        elif info['include_cm'] == 'PCMnoCM':
            query['cm'] = {'$lt' : 0}
        elif info['include_cm'] == 'CM':
            query['cm'] = {'$gt' : 0}
        elif info['include_cm'] == 'noPCM':
            query['cm'] = 0

    parse_ints(info,query,field='cm_disc',qfield='cm')
    parse_primes(info, query, 'conductor_norm_factors', name='bad primes',
             qfield='conductor_norm_factors',mode=info.get('bad_quantifier'))
    info['field_pretty'] = field_pretty
    info['web_ainvs'] = web_ainvs
    parse_ints(info,query,'bf_deg',name='Base field degree',qfield='degree')
Ejemplo n.º 17
0
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, 'rank')
    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 'torsion_order' not in query:
        t_o = 1
        for n in query['torsion_structure']:
            t_o *= int(n)
        query['torsion_order'] = t_o
    parse_element_of(info,
                     query,
                     'isodeg',
                     split_interval=1000,
                     contained_in=ECNF_stats().isogeny_degrees)
    parse_bool(info, query, 'semistable', 'semistable')
    parse_bool(info, query, 'potential_good_reduction',
               'potential_good_reduction')
    parse_ints(info, query, 'class_size', 'class_size')
    parse_ints(info, query, 'class_deg', 'class_deg')
    parse_ints(info, query, 'sha', 'analytic order of Ш')
    parse_floats(info, query, 'reg', 'regulator')
    parse_nf_jinv(info,
                  query,
                  'jinv',
                  'j-invariant',
                  field_label=query.get('field_label'))

    if info.get('one') == "yes":
        info['number'] = 1
        query['number'] = 1

    if 'include_base_change' in info:
        if info['include_base_change'] in [
                'exclude', 'off'
        ]:  # off for backward compat with urls
            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

    parse_cm_list(info,
                  query,
                  field='cm_disc',
                  qfield='cm',
                  name="CM discriminant")

    if 'include_cm' in info:
        if info['include_cm'] == 'PCM':
            tmp = {'$ne': 0}
            if 'cm' in query:
                query['cm'] = {'$and': [tmp, query['cm']]}
            else:
                query['cm'] = tmp
        elif info['include_cm'] == 'PCMnoCM':
            tmp = {'$lt': 0}
            if 'cm' in query:
                query['cm'] = {'$and': [tmp, query['cm']]}
            else:
                query['cm'] = tmp
        elif info['include_cm'] == 'CM':
            tmp = {'$gt': 0}
            if 'cm' in query:
                query['cm'] = {'$and': [tmp, query['cm']]}
            else:
                query['cm'] = tmp
        elif info['include_cm'] == 'noPCM':
            tmp = 0
            if 'cm' in query:
                query['cm'] = {'$and': [tmp, query['cm']]}
            else:
                query['cm'] = tmp

    parse_primes(info,
                 query,
                 'conductor_norm_factors',
                 name='bad primes',
                 qfield='conductor_norm_factors',
                 mode=info.get('bad_quantifier'))
    info['field_pretty'] = field_pretty
    parse_ints(info,
               query,
               'bf_deg',
               name='Base field degree',
               qfield='degree')