示例#1
0
def get_search_parameters(info):
    ret = dict()
    # if not info.has_key('search') or not info['search']:
    #    return ret
    level = my_get(info, 'level', 0)
    mwf_logger.debug("get_search param=%s" % info)
    mwf_logger.debug("level=%s" % level)
    if level > 0:
        ret['l1'] = int(level)
        ret['l2'] = int(level)
    else:
        level_range = my_get(info, 'level_range', '').split('..')
        if len(level_range) == 0:
            ret['l1'] = 0
            ret['l2'] = 0
        elif len(level_range) == 1:
            ret['l1'] = level_range[0]
            ret['l2'] = level_range[0]
        else:
            ret['l1'] = level_range[0]
            ret['l2'] = level_range[1]
    character = my_get(info, 'character', 1)
    mwf_logger.info("character: %s" % character)
    if character > 1:
        ret['ch1'] = int(character)
        ret['ch2'] = int(character)
    weight = my_get(info, 'weight', -1)
    if weight > -1:
        ret['wt1'] = float(weight)
        ret['wt2'] = float(weight)
    else:
        weight_range = my_get(info, 'weight_range', '').split('..')
        if len(weight_range) == 0:
            ret['wt1'] = 0
            ret['wt2'] = 0
        elif len(weight_range) == 1:
            ret['wt1'] = weight_range[0]
            ret['wt2'] = weight_range[0]
        else:
            ret['wt1'] = weight_range[0]
            ret['wt2'] = weight_range[1]

    ret['rec_start'] = my_get(info, 'rec_start', 1, int)
    ret['limit'] = my_get(info, 'limit', 2000, int)
    # ret['weight']=my_get(info,'weight',0,int)
    ev_range = my_get(info, 'ev_range', '').split('..')
    if len(ev_range) == 0:
        ret['r1'] = 0
        ret['r2'] = 0
    elif len(ev_range) == 1:
        mwf_logger.debug("ev_range=%s" % ev_range)
        # ev_range[0]=float(ev_range[0]); ev_range[1]=float(ev_range[1])
        ret['r1'] = ev_range[0]
        ret['r2'] = ev_range[0]
    else:
        ev_range[0] = float(ev_range[0])
        ev_range[1] = float(ev_range[1])
        ret['r1'] = ev_range[0]
        ret['r2'] = ev_range[1]
    return ret
示例#2
0
文件: mwf_utils.py 项目: koffie/lmfdb
def get_search_parameters(info):
    ret = dict()
    # if not info.has_key('search') or not info['search']:
    #    return ret
    level = my_get(info, 'level', 0)
    mwf_logger.debug("get_search param=%s" % info)
    mwf_logger.debug("level=%s" % level)
    if level > 0:
        ret['l1'] = int(level)
        ret['l2'] = int(level)
    else:
        level_range = my_get(info, 'level_range', '').split('..')
        if len(level_range) == 0:
            ret['l1'] = 0
            ret['l2'] = 0
        elif len(level_range) == 1:
            ret['l1'] = level_range[0]
            ret['l2'] = level_range[0]
        else:
            ret['l1'] = level_range[0]
            ret['l2'] = level_range[1]
    character = my_get(info, 'character', 1)
    mwf_logger.info("character: %s" % character)
    if character > 1:
        ret['ch1'] = int(character)
        ret['ch2'] = int(character)
    weight = my_get(info, 'weight', -1)
    if weight > -1:
        ret['wt1'] = float(weight)
        ret['wt2'] = float(weight)
    else:
        weight_range = my_get(info, 'weight_range', '').split('..')
        if len(weight_range) == 0:
            ret['wt1'] = 0
            ret['wt2'] = 0
        elif len(weight_range) == 1:
            ret['wt1'] = weight_range[0]
            ret['wt2'] = weight_range[0]
        else:
            ret['wt1'] = weight_range[0]
            ret['wt2'] = weight_range[1]

    ret['rec_start'] = my_get(info, 'rec_start', 1, int)
    ret['limit'] = my_get(info, 'limit', 2000, int)
    # ret['weight']=my_get(info,'weight',0,int)
    ev_range = my_get(info, 'ev_range', '').split('..')
    if len(ev_range) == 0:
        ret['r1'] = 0
        ret['r2'] = 0
    elif len(ev_range) == 1:
        mwf_logger.debug("ev_range=%s" % ev_range)
        # ev_range[0]=float(ev_range[0]); ev_range[1]=float(ev_range[1])
        ret['r1'] = ev_range[0]
        ret['r2'] = ev_range[0]
    else:
        ev_range[0] = float(ev_range[0])
        ev_range[1] = float(ev_range[1])
        ret['r1'] = ev_range[0]
        ret['r2'] = ev_range[1]
    return ret
示例#3
0
def make_table_of_coefficients(maass_id, number=100):
    c = get_maassform_by_id(maass_id, fields=['Coefficient'])['Coefficient']
    mwf_logger.info("ID=%s" % maass_id)
    mwf_logger.info("number=%s" % number)
    s = "<table border=\"1\">\n<thead><tr><td>\(n\)</td>"
    s += "<td>&nbsp;</td>"
    s += "<td>\(a(n)\)</td></tr></thead>\n"
    s += "<tbody>\n"
    number = min(number, len(c))
    for n in xrange(number):
        s += "<tr><td> %s </td><td></td><td>%s </td> \n" % (n + 1, c[n])
    s += "</tbody></table>\n"
    return s
示例#4
0
def make_table_of_coefficients(maass_id, number=100):
    c = get_maassform_by_id(maass_id, fields=['Coefficient'])['Coefficient']
    mwf_logger.info("ID=%s" % maass_id)
    mwf_logger.info("number=%s" % number)
    s = "<table border=\"1\">\n<thead><tr><td>\(n\)</td>"
    s += "<td>&nbsp;</td>"
    s += "<td>\(a(n)\)</td></tr></thead>\n"
    s += "<tbody>\n"
    number = min(number, len(c))
    for n in xrange(number):
        s += "<tr><td> %s </td><td></td><td>%s </td> \n" % (n + 1, c[n])
    s += "</tbody></table>\n"
    return s