示例#1
0
文件: main.py 项目: manamiroy/lmfdb
def groups_per_genus(genus):
    group_stats = db.hgcwa_passports.stats.get_oldstat('bygenus/' + genus +
                                                       '/group')

    # Redirect to 404 if statistic is not found
    if not group_stats:
        return abort(
            404,
            'Group statistics for curves of genus %s not found in database.' %
            genus)

    # Groups are stored in sorted order
    groups = group_stats['counts']

    # Create isomorphism classes
    iso_classes = []

    for group in groups:
        iso_classes.append(sg_pretty(re.sub(hgcwa_group, r'\1.\2', group[0])))

    info = {'genus': genus, 'groups': groups, 'iso_classes': iso_classes}

    title = ('Families of Higher Genus Curves with Automorphisms: Genus ' +
             genus + ' Group Statistics')
    bread = get_bread([('Statistics', url_for('.statistics')),
                       ('Groups per Genus', url_for('.statistics')),
                       (str(genus), ' ')])

    return render_template("hgcwa-stats-groups-per-genus.html",
                           info=info,
                           credit=credit,
                           title=title,
                           learnmore=learnmore_list(),
                           bread=bread)
示例#2
0
def groups_per_genus(genus):
    group_stats = db_hgcwa_stats().find_one(
        {'_id': 'bygenus/' + genus + '/group'})

    # Redirect to 404 if statistic is not found
    if not group_stats:
        return abort(
            404,
            'Group statistics for curves of genus %s not found in database.' %
            genus)

    # Groups are stored in sorted order
    groups = group_stats['counts']

    # Create isomorphism classes
    hgcwa_group = re.compile(r'\[(\d+),(\d+)\]')
    iso_classes = []

    for group in groups:
        iso_classes.append(sg_pretty(re.sub(hgcwa_group, r'\1.\2', group[0])))

    info = {'genus': genus, 'groups': groups, 'iso_classes': iso_classes}

    title = 'Families of Higher Genus Curves with Automorphisms: genus ' + genus + ' group statistics'
    bread = get_bread([('statistics', url_for('.statistics')),
                       ('Groups per Genus', url_for('.statistics')),
                       (str(genus), ' ')])
    return render_template("hgcwa-stats-groups-per-genus.html",
                           info=info,
                           credit=credit,
                           title=title,
                           bread=bread)
示例#3
0
文件: main.py 项目: kedlaya/lmfdb
def groups_per_genus(genus):
    group_stats = db_hgcwa_stats().find_one({'_id':'bygenus/' + genus + '/group'})

    # Redirect to 404 if statistic is not found
    if not group_stats:
        return abort(404, 'Group statistics for curves of genus %s not found in database.' % genus)

    # Groups are stored in sorted order
    groups = group_stats['counts']

    # Create isomorphism classes
    hgcwa_group = re.compile(r'\[(\d+),(\d+)\]')
    iso_classes = []

    for group in groups:
        iso_classes.append(sg_pretty(re.sub(hgcwa_group, r'\1.\2', group[0])))

    info = {
        'genus' : genus,
        'groups': groups,
        'iso_classes' : iso_classes
    }

    title = 'Families of Higher Genus Curves with Automorphisms: Genus ' + genus + ' Group Statistics'
    bread = get_bread([('Statistics', url_for('.statistics')), ('Groups per Genus', url_for('.statistics')), (str(genus), ' ')])
    return render_template("hgcwa-stats-groups-per-genus.html", info=info, credit=credit, title=title, bread=bread)
示例#4
0
def topological_action(fam, cc):
    br_g, br_gp, br_sign = split_family_label(fam)
    cc_list = cc_to_list(cc)
    representative = fam + '.' + cc[2:]

     #Get the equivalence class
    topo_class = list(db.hgcwa_passports.search({'label': fam, 'topological': cc_list}))

    GG = ast.literal_eval(topo_class[0]['group'])
    gn = GG[0]
    gt = GG[1]

    gp_string = str(gn) + '.' + str(gt)
    pretty_group = sg_pretty(gp_string)

    bread_sign = label_to_breadcrumbs(br_sign)
    bread_gp = label_to_breadcrumbs(br_gp)

    bread = get_bread(
        [(br_g, '../?genus=' + br_g),
         ('$%s$' % pretty_group, '../?genus=%s&group=%s' % (br_g, bread_gp)),
         (bread_sign, '../' + fam),
         ('Topological Orbit for %s, %s' % (cc_list[0], cc_list[1]), ' ')
        ]
    )

    title = 'One Orbit Under Topological Action'

    downloads = [('Download Magma code', url_for(".hgcwa_code_download",  label=representative, download_type='rep_magma')),
                      ('Download Gap code', url_for(".hgcwa_code_download", label=representative, download_type='rep_gap'))]

    Lbraid = {}

    for element in topo_class:
       if str(element['braid']) in Lbraid:
           Lbraid[str(element['braid'])].append(
               (element['passport_label'],
                element['total_label'],
                ' '))
           # We include the space so that we don't have duplicate conjugacy
           # classes displayed
       else:
           Lbraid[str(element['braid'])] = [
               (element['passport_label'],
                element['total_label'],
                cc_display(ast.literal_eval(element['con'])))]

    # Sort braid ascending
    key_for_sorted = sorted(ast.literal_eval(key) for key in Lbraid)
    sorted_braid = [Lbraid[str(key)] for key in key_for_sorted]

    info = {'topological_class': sorted_braid, 'representative': representative, 'braid_num': len(Lbraid)}

    return render_template("hgcwa-topological-action.html", info=info, credit=credit, title=title, bread=bread, downloads=downloads)
示例#5
0
def groups_per_genus(genus):
    un_grps = db.hgcwa_unique_groups
    # Redirect to 404 if statistic is not found
    if not un_grps.count({'genus':genus}):
        return abort(404, 'Group statistics for curves of genus %s not found in database.' % genus)

    info = {}
    gp_data = un_grps.search({'genus':genus},projection=['group','g0_is_gt0','g0_gt0_list','gen_vectors','topological','braid'],info=info)

    # Make list groups_0 where each entry is a list [ group, gen_vectors, tops, braids
    groups_0 = []
    # Make list groups_gt0 where each entry is a list [group, gen_vectors]
    groups_gt0 = []

    complete_info = db.hgcwa_complete.lucky({'genus':genus})
    show_top_braid = complete_info['top_braid_compute']
    show_g0_gt0 = complete_info['g0_gt0_compute']

    for dataz in gp_data:
        group = dataz['group']
        group_str = str(dataz['group'])
        iso_class = sg_pretty("%s.%s" % tuple(group))
        if dataz['g0_is_gt0']:
            groups_gt0.append((iso_class, group_str, dataz['gen_vectors'], cc_display(dataz['g0_gt0_list'])))
        elif not show_top_braid:
            groups_0.append((iso_class, group_str, dataz['gen_vectors']))
        else:
            groups_0.append((iso_class, group_str, dataz['gen_vectors'], dataz['topological'], dataz['braid']))

    info = {
        'genus': genus,
        'groups_0': groups_0,
        'groups_gt0': groups_gt0,
        'show_top_braid' : show_top_braid,
        'show_g0_gt0' : show_g0_gt0,
        'group_display' : group_display
    }

    title = 'Families of higher genus curves with automorphisms: Genus %s group statistics' % genus
    bread = get_bread([('Statistics', url_for('.statistics')),
                       ('Groups per genus', url_for('.statistics')),
                       (str(genus), ' ')])

    return render_template("hgcwa-stats-groups-per-genus.html",
                           info=info,
                           credit=credit,
                           title=title,
                           learnmore=learnmore_list(),
                           bread=bread)
示例#6
0
文件: main.py 项目: lexmart/lmfdb
def render_passport(args):
    info = {}
    if 'passport_label' in args:
        label = clean_input(args['passport_label'])

        C = base.getDBConnection()

        dataz = C.curve_automorphisms.passports.find({'passport_label': label})
        if dataz.count() is 0:
            bread = get_bread([("Search error", url_for('.search'))])
            flash_error(
                "No refined passport with label %s was found in the database.",
                label)
            return redirect(url_for(".index"))
        data = dataz[0]
        g = data['genus']
        GG = ast.literal_eval(data['group'])
        gn = GG[0]
        gt = GG[1]

        gp_string = str(gn) + '.' + str(gt)
        pretty_group = sg_pretty(gp_string)

        if gp_string == pretty_group:
            spname = False
        else:
            spname = True

        numb = dataz.count()

        try:
            numgenvecs = request.args['numgenvecs']
            numgenvecs = int(numgenvecs)
        except:
            numgenvecs = 20
        info['numgenvecs'] = numgenvecs

        title = 'One refined passport of genus ' + str(
            g) + ' with automorphism group $' + pretty_group + '$'
        smallgroup = "[" + str(gn) + "," + str(gt) + "]"

        prop2 = [
            ('Genus', '\(%d\)' % g), ('Small Group', '\(%s\)' % pretty_group),
            ('Signature',
             '\(%s\)' % sign_display(ast.literal_eval(data['signature']))),
            ('Generating Vectors', '\(%d\)' % numb)
        ]
        info.update({
            'genus': data['genus'],
            'cc': cc_display(data['con']),
            'sign': sign_display(ast.literal_eval(data['signature'])),
            'group': pretty_group,
            'gpid': smallgroup,
            'numb': numb,
            'disp_numb': min(numb, numgenvecs)
        })

        if spname:
            info.update({'specialname': True})

        Ldata = []
        HypColumn = False
        Lfriends = []
        for i in range(0, min(numgenvecs, numb)):
            dat = dataz[i]
            x1 = dat['total_label']
            if 'full_auto' in dat:
                x2 = 'No'
                if dat['full_label'] not in Lfriends:
                    Lfriends.append(dat['full_label'])
            else:
                x2 = 'Yes'

            if 'hyperelliptic' in dat:
                x3 = tfTOyn(dat['hyperelliptic'])
                HypColumn = True
            else:
                x3 = ' '

            x4 = []
            for perm in dat['gen_vectors']:
                cycperm = Permutation(perm).cycle_string()

                x4.append(sep.join(split_perm(cycperm)))

            Ldata.append([x1, x2, x3, x4])

        info.update({'genvects': Ldata, 'HypColumn': HypColumn})

        info.update({'passport_cc': cc_display(ast.literal_eval(data['con']))})

        if 'eqn' in data:
            info.update({'eqns': data['eqn']})

        if 'ndim' in data:
            info.update({'Ndim': data['ndim']})

        other_data = False

        if 'hyperelliptic' in data:
            info.update({'ishyp': tfTOyn(data['hyperelliptic'])})
            other_data = True

        if 'hyp_involution' in data:
            inv = Permutation(data['hyp_involution']).cycle_string()
            info.update({'hypinv': sep.join(split_perm(inv))})

        if 'cyclic_trigonal' in data:
            info.update({'iscyctrig': tfTOyn(data['cyclic_trigonal'])})
            other_data = True

        if 'jacobian_decomp' in data:
            jcLatex, corrChar = decjac_format(data['jacobian_decomp'])
            info.update({'corrChar': corrChar, 'jacobian_decomp': jcLatex})

        if 'cinv' in data:
            cinv = Permutation(data['cinv']).cycle_string()
            info.update({'cinv': sep.join(split_perm(cinv))})

        info.update({'other_data': other_data})

        if 'full_auto' in data:
            full_G = ast.literal_eval(data['full_auto'])
            full_gn = full_G[0]
            full_gt = full_G[1]

            full_gp_string = str(full_gn) + '.' + str(full_gt)
            full_pretty_group = sg_pretty(full_gp_string)
            info.update({
                'fullauto': full_pretty_group,
                'signH': sign_display(ast.literal_eval(data['signH'])),
                'higgenlabel': data['full_label']
            })

        urlstrng, br_g, br_gp, br_sign, refined_p = split_passport_label(label)

        if Lfriends:
            for Lf in Lfriends:
                friends = [("Full automorphism " + Lf, Lf),
                           ("Family containing this refined passport ",
                            urlstrng)]

        else:
            friends = [("Family containing this refined passport", urlstrng)]

        bread_sign = label_to_breadcrumbs(br_sign)
        bread_gp = label_to_breadcrumbs(br_gp)

        bread = get_bread([(br_g, './?genus=' + br_g),
                           ('$' + pretty_group + '$',
                            './?genus=' + br_g + '&group=' + bread_gp),
                           (bread_sign, urlstrng), (data['cc'][0], ' ')])

        learnmore = [('Completeness of the data',
                      url_for(".completeness_page")),
                     ('Source of the data', url_for(".how_computed_page")),
                     ('Labeling convention', url_for(".labels_page"))]

        downloads = [('Download Magma code',
                      url_for(".hgcwa_code_download",
                              label=label,
                              download_type='magma')),
                     ('Download Gap code',
                      url_for(".hgcwa_code_download",
                              label=label,
                              download_type='gap'))]

        return render_template("hgcwa-show-passport.html",
                               title=title,
                               bread=bread,
                               info=info,
                               properties2=prop2,
                               friends=friends,
                               learnmore=learnmore,
                               downloads=downloads,
                               credit=credit)
示例#7
0
文件: main.py 项目: lexmart/lmfdb
def render_family(args):
    info = {}
    if 'label' in args:
        label = clean_input(args['label'])
        C = base.getDBConnection()
        dataz = C.curve_automorphisms.passports.find({'label': label})
        if dataz.count() is 0:
            flash_error("No family with label %s was found in the database.",
                        label)
            return redirect(url_for(".index"))
        data = dataz[0]
        g = data['genus']
        GG = ast.literal_eval(data['group'])
        gn = GG[0]
        gt = GG[1]

        gp_string = str(gn) + '.' + str(gt)
        pretty_group = sg_pretty(gp_string)

        if gp_string == pretty_group:
            spname = False
        else:
            spname = True
        title = 'Family of genus ' + str(
            g) + ' curves with automorphism group $' + pretty_group + '$'
        smallgroup = "[" + str(gn) + "," + str(gt) + "]"

        prop2 = [('Genus', '\(%d\)' % g), ('Group', '\(%s\)' % pretty_group),
                 ('Signature',
                  '\(%s\)' % sign_display(ast.literal_eval(data['signature'])))
                 ]
        info.update({
            'genus': data['genus'],
            'sign': sign_display(ast.literal_eval(data['signature'])),
            'group': pretty_group,
            'g0': data['g0'],
            'dim': data['dim'],
            'r': data['r'],
            'gpid': smallgroup
        })

        if spname:
            info.update({'specialname': True})

        Lcc = []
        Lall = []
        i = 1
        for dat in dataz:
            if ast.literal_eval(dat['con']) not in Lcc:
                urlstrng = dat['passport_label']
                Lcc.append(ast.literal_eval(dat['con']))
                Lall.append([
                    cc_display(ast.literal_eval(dat['con'])),
                    dat['passport_label'], urlstrng
                ])
                i = i + 1

        info.update({'passport': Lall})

        g2List = [
            '[2,1]', '[4,2]', '[8,3]', '[10,2]', '[12,4]', '[24,8]', '[48,29]'
        ]
        if g == 2 and data['group'] in g2List:
            g2url = "/Genus2Curve/Q/?geom_aut_grp_id=" + data['group']
            friends = [("Genus 2 curves over $\Q$", g2url)]
        else:
            friends = []

        br_g, br_gp, br_sign = split_family_label(label)

        bread_sign = label_to_breadcrumbs(br_sign)
        bread_gp = label_to_breadcrumbs(br_gp)

        bread = get_bread([(br_g, './?genus=' + br_g),
                           ('$' + pretty_group + '$',
                            './?genus=' + br_g + '&group=' + bread_gp),
                           (bread_sign, ' ')])
        learnmore = [('Completeness of the data',
                      url_for(".completeness_page")),
                     ('Source of the data', url_for(".how_computed_page")),
                     ('Labeling convention', url_for(".labels_page"))]

        downloads = [('Download Magma code',
                      url_for(".hgcwa_code_download",
                              label=label,
                              download_type='magma')),
                     ('Download Gap code',
                      url_for(".hgcwa_code_download",
                              label=label,
                              download_type='gap'))]

        return render_template("hgcwa-show-family.html",
                               title=title,
                               bread=bread,
                               info=info,
                               properties2=prop2,
                               friends=friends,
                               learnmore=learnmore,
                               downloads=downloads,
                               credit=credit)
示例#8
0
文件: main.py 项目: 370417/lmfdb
def render_family(args):
    info = {}
    if 'label' in args:
        label = clean_input(args['label'])
        C = base.getDBConnection()
        dataz = C.curve_automorphisms.passports.find({'label': label}).sort('cc.0', pymongo.ASCENDING)
        
        if dataz.count() is 0:
            flash_error( "No family with label %s was found in the database.", label)
            return redirect(url_for(".index"))

        data=dataz[0]

        g = data['genus']
        GG = ast.literal_eval(data['group'])
        gn = GG[0]
        gt = GG[1]

        gp_string=str(gn) + '.' + str(gt)
        pretty_group=sg_pretty(gp_string)

        if gp_string == pretty_group:
            spname=False
        else:
            spname=True
        title = 'Family of Genus ' + str(g) + ' Curves with Automorphism Group $' + pretty_group +'$'
        smallgroup="[" + str(gn) + "," +str(gt) +"]"

        prop2 = [
            ('Genus', '\(%d\)' % g),
            ('Group', '\(%s\)' %  pretty_group),
            ('Signature', '\(%s\)' % sign_display(ast.literal_eval(data['signature'])))
        ]
        info.update({'genus': data['genus'],
                    'sign': sign_display(ast.literal_eval(data['signature'])),
                     'group': pretty_group,
                    'g0':data['g0'],
                    'dim':data['dim'],
                    'r':data['r'],
                    'gpid': smallgroup
                   })

        if spname:
            info.update({'specialname': True})

        Lcc=[]
        Lall=[]
        Ltopo_rep=[] #List of topological representatives
        Lelements=[] #List of lists of equivalence classes    
        for dat in dataz:
            if ast.literal_eval(dat['con']) not in Lcc:
                urlstrng=dat['passport_label']
                Lcc.append(ast.literal_eval(dat['con']))
                Lall.append([cc_display(ast.literal_eval(dat['con'])),dat['passport_label'],
                             urlstrng])
                
            #Topological equivalence
            if 'topological' in dat:
                if dat['topological'] == dat['cc']:
                    x1=[] #A list of permutations of generating vectors of topo_rep
                    for perm in dat['gen_vectors']:
                        x1.append(sep.join(split_perm(Permutation(perm).cycle_string())))
                    Ltopo_rep.append([dat['passport_label'], dat['total_label'], x1])

                    topo_class = C.curve_automorphisms.passports.find({'label': dat['label'], 'topological': dat['cc']}).sort('cc.0', pymongo.ASCENDING)
                    elements=[] #An equivalence class
                    for element in topo_class:
                        elements.append((element['passport_label'], element['total_label']))
                    Lelements.append(elements)    

        Ltopo_class = zip(Ltopo_rep, Lelements)
        topo_length = len(Ltopo_rep)
        #Add topological equivalence to info
        info.update({'topological_rep': Ltopo_rep})
        info.update({'topological_class': Ltopo_class})
        info.update({'topological_num': topo_length})
        
        info.update({'passport': Lall})
        info.update({'passport_num': len(Lall)})

        
        g2List = ['[2,1]','[4,2]','[8,3]','[10,2]','[12,4]','[24,8]','[48,29]']
        if g  == 2 and data['group'] in g2List:
            g2url = "/Genus2Curve/Q/?geom_aut_grp_id=" + data['group']
            friends = [("Genus 2 curves over $\Q$", g2url ) ]
        else:
            friends = [ ]

        br_g, br_gp, br_sign = split_family_label(label)

        bread_sign = label_to_breadcrumbs(br_sign)
        bread_gp = label_to_breadcrumbs(br_gp)

        bread = get_bread([(br_g, './?genus='+br_g),('$'+pretty_group+'$','./?genus='+br_g + '&group='+bread_gp), (bread_sign,' ')])
        learnmore =[('Completeness of the data', url_for(".completeness_page")),
                ('Source of the data', url_for(".how_computed_page")),
                ('Labeling convention', url_for(".labels_page"))]
        if topo_length == 0:
            downloads = [('Download Magma code', url_for(".hgcwa_code_download",  label=label, download_type='magma')),
                             ('Download Gap code', url_for(".hgcwa_code_download", label=label, download_type='gap'))]
        else:
            downloads = [('Magma code', None),
                             (u'\u2003 All vectors', url_for(".hgcwa_code_download",  label=label, download_type='magma')),
                             (u'\u2003 Up to topological equivalence', url_for(".hgcwa_code_download", label=label, download_type='topo_magma')),
                             ('Gap code', None),
                             (u'\u2003 All vectors', url_for(".hgcwa_code_download", label=label, download_type='gap')),
                             (u'\u2003 Up to topological equivalence', url_for(".hgcwa_code_download", label=label, download_type='topo_gap'))] 

        return render_template("hgcwa-show-family.html",
                               title=title, bread=bread, info=info,
                               properties2=prop2, friends=friends,
                               learnmore=learnmore, downloads=downloads, credit=credit)
示例#9
0
文件: main.py 项目: kedlaya/lmfdb
def render_passport(args):
    info = {}
    if 'passport_label' in args:
        label = clean_input(args['passport_label'])
        dataz = list(db.hgcwa_passports.search({'passport_label': label}))
        if len(dataz) == 0:
            bread = get_bread([("Search Error", url_for('.index'))])
            flash_error( "No refined passport with label %s was found in the database.", label)
            return redirect(url_for(".index"))
        data=dataz[0]
        g = data['genus']
        GG = ast.literal_eval(data['group'])
        gn = GG[0]
        gt = GG[1]

        gp_string=str(gn) + '.' + str(gt)
        pretty_group=sg_pretty(gp_string)

        if gp_string == pretty_group:
            spname=False
        else:
            spname=True

        numb = len(dataz)

        try:
            numgenvecs = request.args['numgenvecs']
            numgenvecs = int(numgenvecs)
        except:
            numgenvecs = 20
        info['numgenvecs']=numgenvecs

        title = 'One Refined Passport of Genus ' + str(g) + ' with Automorphism Group $' + pretty_group +'$'
        smallgroup="[" + str(gn) + "," +str(gt) +"]"

        prop2 = [
            ('Genus', '\(%d\)' % g),
            ('Small Group', '\(%s\)' %  pretty_group),
            ('Signature', '\(%s\)' % sign_display(ast.literal_eval(data['signature']))),
            ('Generating Vectors','\(%d\)' % numb)
        ]
        info.update({'genus': data['genus'],
                    'cc': cc_display(data['con']),
                    'sign': sign_display(ast.literal_eval(data['signature'])),
                     'group': pretty_group,
                     'gpid': smallgroup,
                     'numb':numb,
                     'disp_numb':min(numb,numgenvecs)
                   })

        if spname:
            info.update({'specialname': True})

        Ldata=[]
        HypColumn = False
        Lfriends=[]
        for i in range (0, min(numgenvecs,numb)):
            dat= dataz[i]
            x1=dat['total_label']
            if 'full_auto' in dat:
                x2='No'
                if dat['full_label'] not in Lfriends:
                    Lfriends.append(dat['full_label'])
            else:
                x2='Yes'

            if 'hyperelliptic' in dat:
                x3=tfTOyn(dat['hyperelliptic'])
                HypColumn= True
            else:
                x3=' '

            x4=[]
            for perm in dat['gen_vectors']:
                cycperm=Permutation(perm).cycle_string()

                x4.append(sep.join(split_perm(cycperm)))

            Ldata.append([x1,x2,x3,x4])



        info.update({'genvects': Ldata, 'HypColumn' : HypColumn})

        info.update({'passport_cc': cc_display(ast.literal_eval(data['con']))})

        if 'eqn' in data:
            info.update({'eqns': data['eqn']})

        if 'ndim' in data:
            info.update({'Ndim': data['ndim']})

        other_data = False

        if 'hyperelliptic' in data:
            info.update({'ishyp':  tfTOyn(data['hyperelliptic'])})
            other_data = True

        if 'hyp_involution' in data:
            inv=Permutation(data['hyp_involution']).cycle_string()
            info.update({'hypinv': sep.join(split_perm(inv))})


        if 'cyclic_trigonal' in data:
            info.update({'iscyctrig':  tfTOyn(data['cyclic_trigonal'])})
            other_data = True

        if 'jacobian_decomp' in data:
            jcLatex, corrChar = decjac_format(data['jacobian_decomp'])
            info.update({'corrChar': corrChar, 'jacobian_decomp': jcLatex})


        if 'cinv' in data:
            cinv=Permutation(data['cinv']).cycle_string()
            info.update({'cinv': sep.join(split_perm(cinv))})

        info.update({'other_data': other_data})


        if 'full_auto' in data:
            full_G=ast.literal_eval(data['full_auto'])
            full_gn = full_G[0]
            full_gt = full_G[1]

            full_gp_string=str(full_gn) + '.' + str(full_gt)
            full_pretty_group=sg_pretty(full_gp_string)
            info.update({'fullauto': full_pretty_group,
                         'signH':sign_display(ast.literal_eval(data['signH'])),
                         'higgenlabel' : data['full_label'] })


        urlstrng,br_g, br_gp, br_sign, refined_p = split_passport_label(label)


        if Lfriends:
           for Lf in Lfriends:
              friends = [("Full automorphism " + Lf, Lf),("Family containing this refined passport ",  urlstrng) ]

        else:
            friends = [("Family containing this refined passport",  urlstrng) ]


        bread_sign = label_to_breadcrumbs(br_sign)
        bread_gp = label_to_breadcrumbs(br_gp)

        bread = get_bread([(br_g, './?genus='+br_g),('$'+pretty_group+'$','./?genus='+br_g + '&group='+bread_gp), (bread_sign, urlstrng),(data['cc'][0],' ')])

        learnmore =[('Completeness of the data', url_for(".completeness_page")),
                ('Source of the data', url_for(".how_computed_page")),
                ('Labeling convention', url_for(".labels_page"))]

        downloads = [('Download Magma code', url_for(".hgcwa_code_download",  label=label, download_type='magma')),
                     ('Download Gap code', url_for(".hgcwa_code_download", label=label, download_type='gap'))]

        return render_template("hgcwa-show-passport.html",
                               title=title, bread=bread, info=info,
                               properties2=prop2, friends=friends,
                               learnmore=learnmore, downloads=downloads, credit=credit)
示例#10
0
文件: main.py 项目: kedlaya/lmfdb
def render_family(args):
    info = {}
    if 'label' in args:
        label = clean_input(args['label'])
        dataz = list(db.hgcwa_passports.search({'label':label}))
        if len(dataz) == 0:
            flash_error( "No family with label %s was found in the database.", label)
            return redirect(url_for(".index"))
        data=dataz[0]
        g = data['genus']
        GG = ast.literal_eval(data['group'])
        gn = GG[0]
        gt = GG[1]

        gp_string = str(gn) + '.' + str(gt)
        pretty_group = sg_pretty(gp_string)

        if gp_string == pretty_group:
            spname = False
        else:
            spname = True
        title = 'Family of Genus ' + str(g) + ' Curves with Automorphism Group $' + pretty_group +'$'
        smallgroup="[" + str(gn) + "," +str(gt) + "]"

        prop2 = [
            ('Genus', '\(%d\)' % g),
            ('Group', '\(%s\)' %  pretty_group),
            ('Signature', '\(%s\)' % sign_display(ast.literal_eval(data['signature'])))
        ]
        info.update({'genus': data['genus'],
                    'sign': sign_display(ast.literal_eval(data['signature'])),
                     'group': pretty_group,
                    'g0':data['g0'],
                    'dim':data['dim'],
                    'r':data['r'],
                    'gpid': smallgroup
                   })

        if spname:
            info.update({'specialname': True})

        Lcc=[]
        Lall=[]
        i=1
        for dat in dataz:
            if ast.literal_eval(dat['con']) not in Lcc:
                urlstrng=dat['passport_label']
                Lcc.append(ast.literal_eval(dat['con']))
                Lall.append([cc_display(ast.literal_eval(dat['con'])),dat['passport_label'],
                             urlstrng])
                i=i+1

        info.update({'passport': Lall})


        g2List = ['[2,1]','[4,2]','[8,3]','[10,2]','[12,4]','[24,8]','[48,29]']
        if g  == 2 and data['group'] in g2List:
            g2url = "/Genus2Curve/Q/?geom_aut_grp_id=" + data['group']
            friends = [("Genus 2 curves over $\Q$", g2url ) ]
        else:
            friends = [ ]


        br_g, br_gp, br_sign = split_family_label(label)

        bread_sign = label_to_breadcrumbs(br_sign)
        bread_gp = label_to_breadcrumbs(br_gp)

        bread = get_bread([(br_g, './?genus='+br_g),('$'+pretty_group+'$','./?genus='+br_g + '&group='+bread_gp), (bread_sign,' ')])
        learnmore =[('Completeness of the data', url_for(".completeness_page")),
                ('Source of the data', url_for(".how_computed_page")),
                ('Labeling convention', url_for(".labels_page"))]

        downloads = [('Download Magma code', url_for(".hgcwa_code_download",  label=label, download_type='magma')),
                     ('Download Gap code', url_for(".hgcwa_code_download", label=label, download_type='gap'))]

        return render_template("hgcwa-show-family.html",
                               title=title, bread=bread, info=info,
                               properties2=prop2, friends=friends,
                               learnmore=learnmore, downloads=downloads, credit=credit)
示例#11
0
def group_display(strg):
    return sg_pretty(re.sub(hgcwa_group, r'\1.\2', strg))
示例#12
0
def render_passport(args):
    info = {}
    if 'passport_label' in args:
        label = clean_input(args['passport_label'])
        dataz = list(db.hgcwa_passports.search({'passport_label': label}))
        if not dataz:
            bread = get_bread([("Search Error", url_for('.index'))])
            flash_error("No refined passport with label %s was found in the database.", label)
            return redirect(url_for(".index"))
        data=dataz[0]
        g = data['genus']
        g0=data['g0']
        GG = ast.literal_eval(data['group'])
        gn = GG[0]
        gt = GG[1]

        gp_string=str(gn) + '.' + str(gt)
        pretty_group=sg_pretty(gp_string)

        if gp_string == pretty_group:
            spname=False
        else:
            spname=True

        numb = len(dataz)

        try:
            numgenvecs = int(request.args['numgenvecs'])
            numbraidreps = int(request.args['numbraidreps'])
        except Exception:
            numgenvecs = 20
            numbraidreps = 20

        info['numgenvecs']=numgenvecs
        info['numbraidreps']=numbraidreps

        title = 'One refined passport of genus ' + str(g) + ' with automorphism group $' + pretty_group +'$'
        smallgroup="[" + str(gn) + "," +str(gt) +"]"

        prop2 = [
            ('Label', label),
            ('Genus', r'\(%d\)' % g),
            ('Quotient genus', r'\(%d\)' % g0),
            ('Group', r'\(%s\)' % pretty_group),
            ('Signature', r'\(%s\)' % sign_display(ast.literal_eval(data['signature']))),
            ('Generating Vectors', r'\(%d\)' % numb)
        ]
        info.update({'genus': data['genus'],
                    'cc': cc_display(data['con']),
                    'sign': sign_display(ast.literal_eval(data['signature'])),
                     'group': pretty_group,
                     'gpid': smallgroup,
                     'numb': numb,
                     'disp_numb': min(numb, numgenvecs),
                     'g0': data['g0']
                   })

        if spname:
            info.update({'specialname': True})

        Ldata = []
        HypColumn = False
        Lfriends = []
        Lbraid = []
        for i in range(0, min(numgenvecs,numb)):
            dat = dataz[i]
            x1 = dat['total_label']
            if 'full_auto' in dat:
                x2 = 'no'
                if dat['full_label'] not in Lfriends:
                    Lfriends.append(dat['full_label'])
            else:
                x2 = 'yes'

            if 'hyperelliptic' in dat:
                x3 = tfTOyn(dat['hyperelliptic'])
                HypColumn = True
            else:
                x3 = ' '

            x4 = []
            if dat['g0'] == 0:
                for perm in dat['gen_vectors']:
                    cycperm = Permutation(perm).cycle_string()
                    x4.append(sep.join(split_perm(cycperm)))

            elif dat['g0'] > 0:
                for perm in dat['gen_vectors']:
                    cycperm = Permutation(perm).cycle_string()
                    #if display_perm == '()':
                    if cycperm == '()':
                        x4.append('Id(G)')
                    else:
                        x4.append(sep.join(split_perm(cycperm)))
            Ldata.append([x1, x2, x3, x4])

        info.update({'genvects': Ldata, 'HypColumn': HypColumn})
        info.update({'passport_cc': cc_display(ast.literal_eval(data['con']))})

        #Generate braid representatives
        if 'braid' in dataz[0]:
            braid_data = [entry for entry in dataz if entry['braid'] == entry['cc']]
            for dat in braid_data:
                x5 = []
                for perm in dat['gen_vectors']:
                    x5.append(sep.join(split_perm(Permutation(perm).cycle_string())))
                Lbraid.append([dat['total_label'], x5])

        braid_length = len(Lbraid)

        #Add braid equivalence into info
        info.update({'braid': Lbraid,
                    'braid_numb': braid_length,
                    'braid_disp_numb': min(braid_length, numbraidreps)})

        if 'eqn' in data:
            info.update({'eqns': data['eqn']})

        if 'ndim' in data:
            info.update({'Ndim': data['ndim']})

        other_data = False

        if 'hyperelliptic' in data:
            info.update({'ishyp':  tfTOyn(data['hyperelliptic'])})
            other_data = True

        if 'hyp_involution' in data:
            inv=Permutation(data['hyp_involution']).cycle_string()
            info.update({'hypinv': sep.join(split_perm(inv))})


        if 'cyclic_trigonal' in data:
            info.update({'iscyctrig':  tfTOyn(data['cyclic_trigonal'])})
            other_data = True

        if 'jacobian_decomp' in data:
            jcLatex, corrChar = decjac_format(data['jacobian_decomp'])
            info.update({'corrChar': corrChar, 'jacobian_decomp': jcLatex})


        if 'cinv' in data:
            cinv=Permutation(data['cinv']).cycle_string()
            info.update({'cinv': sep.join(split_perm(cinv))})

        info.update({'other_data': other_data})


        if 'full_auto' in data:
            full_G = ast.literal_eval(data['full_auto'])
            full_gn = full_G[0]
            full_gt = full_G[1]

            full_gp_string = str(full_gn) + '.' + str(full_gt)
            full_pretty_group = sg_pretty(full_gp_string)
            info.update({'fullauto': full_pretty_group,
                         'signH': sign_display(ast.literal_eval(data['signH'])),
                         'higgenlabel': data['full_label']})


        urlstrng, br_g, br_gp, br_sign, _ = split_passport_label(label)


        if Lfriends:
            friends = [("Full automorphism " + Lf, Lf) for Lf in Lfriends]
            friends += [("Family containing this refined passport ",  urlstrng)]
        else:
            friends = [("Family containing this refined passport",  urlstrng)]


        bread_sign = label_to_breadcrumbs(br_sign)
        bread_gp = label_to_breadcrumbs(br_gp)

        bread = get_bread([
            (br_g, './?genus='+br_g),
            ('$'+pretty_group+'$', './?genus='+br_g + '&group='+bread_gp),
            (bread_sign, urlstrng),
            (data['cc'][0], ' ')])

        if numb == 1 or braid_length == 0:
            downloads = [('Code to Magma', url_for(".hgcwa_code_download",  label=label, download_type='magma')),
                     ('Code to Gap', url_for(".hgcwa_code_download", label=label, download_type='gap'))]

        else:
            downloads = [('Code to Magma', None),
                             (u'\u2003 All vectors', url_for(".hgcwa_code_download",  label=label, download_type='magma')),
                             (u'\u2003 Up to braid equivalence', url_for(".hgcwa_code_download", label=label, download_type='braid_magma')),
                             ('Code to Gap', None),
                             (u'\u2003 All vectors', url_for(".hgcwa_code_download", label=label, download_type='gap')),
                             (u'\u2003 Up to braid equivalence', url_for(".hgcwa_code_download", label=label, download_type='braid_gap'))]
        downloads.append(('Underlying data', url_for(".hgcwa_data", label=label)))


        return render_template("hgcwa-show-passport.html",
                               title=title, bread=bread, info=info,
                               properties=prop2, friends=friends,
                               learnmore=learnmore_list(), downloads=downloads,
                               KNOWL_ID="curve.highergenus.aut.%s" % label)
示例#13
0
def render_family(args):
    info = {}
    if 'label' in args:
        label = clean_input(args['label'])
        dataz = list(db.hgcwa_passports.search({'label':label}))
        if not dataz:
            flash_error("No family with label %s was found in the database.", label)
            return redirect(url_for(".index"))
        data = dataz[0]
        g = data['genus']
        g0 = data['g0']
        GG = ast.literal_eval(data['group'])
        gn = GG[0]
        gt = GG[1]

        gp_string = str(gn) + '.' + str(gt)
        pretty_group = sg_pretty(gp_string)

        if gp_string == pretty_group:
            spname = False
        else:
            spname = True
        title = 'Family of genus ' + str(g) + ' curves with automorphism group $' + pretty_group +'$'
        smallgroup="[" + str(gn) + "," +str(gt) + "]"

        prop2 = [
            ('Label', label),
            ('Genus', r'\(%d\)' % g),
            ('Quotient genus', r'\(%d\)' % g0),
            ('Group', r'\(%s\)' % pretty_group),
            ('Signature', r'\(%s\)' % sign_display(ast.literal_eval(data['signature'])))
        ]
        info.update({'genus': data['genus'],
                    'sign': sign_display(ast.literal_eval(data['signature'])),
                     'group': pretty_group,
                    'g0': data['g0'],
                    'dim': data['dim'],
                    'r': data['r'],
                    'gpid': smallgroup,
                    'numb': len(dataz)
                   })

        if spname:
            info.update({'specialname': True})

        Lcc=[]
        Lall=[]
        Ltopo_rep=[] #List of topological representatives
        for dat in dataz:
            if ast.literal_eval(dat['con']) not in Lcc:
                urlstrng = dat['passport_label']
                Lcc.append(ast.literal_eval(dat['con']))
                Lall.append([cc_display(ast.literal_eval(dat['con'])),dat['passport_label'],
                             urlstrng,dat['cc']])

            #Topological equivalence
            if 'topological' in dat:
                if dat['topological'] == dat['cc']:
                    x1 = [] #A list of permutations of generating vectors of topo_rep
                    for perm in dat['gen_vectors']:
                        x1.append(sep.join(split_perm(Permutation(perm).cycle_string())))
                    Ltopo_rep.append([dat['total_label'],
                                      x1,
                                      dat['label'],
                                      'T.' + '.'.join(str(x) for x in dat['cc']),
                                      dat['cc']]) #2nd to last element is used for webpage tag

        #Add topological equivalence to info
        info.update({'topological_rep': Ltopo_rep})
        info.update({'topological_num': len(Ltopo_rep)})

        info.update({'passport': Lall})
        info.update({'passport_num': len(Lall)})


        g2List = ['[2,1]', '[4,2]', '[8,3]', '[10,2]', '[12,4]', '[24,8]', '[48,29]']
        if g == 2 and data['group'] in g2List:
            g2url = "/Genus2Curve/Q/?geom_aut_grp_label=" + ".".join(data['group'][1:-1].split(','))
            friends = [(r"Genus 2 curves over $\Q$", g2url)]
        else:
            friends = []


        br_g, br_gp, br_sign = split_family_label(label)

        bread_sign = label_to_breadcrumbs(br_sign)
        bread_gp = label_to_breadcrumbs(br_gp)

        bread = get_bread([(br_g, './?genus='+br_g),
                           ('$'+pretty_group+'$',
                            './?genus='+br_g + '&group='+bread_gp),
                           (bread_sign,' ')])

        if len(Ltopo_rep) == 0 or len(dataz) == 1:
            downloads = [('Code to Magma', url_for(".hgcwa_code_download", label=label, download_type='magma')),
                         ('Code to Gap', url_for(".hgcwa_code_download", label=label, download_type='gap'))]
        else:
            downloads = [('Code to Magma', None),
                         (u'\u2003 All vectors', url_for(".hgcwa_code_download",  label=label, download_type='magma')),
                         (u'\u2003 Up to topological equivalence', url_for(".hgcwa_code_download", label=label, download_type='topo_magma')),
                         ('Code to Gap', None),
                         (u'\u2003 All vectors', url_for(".hgcwa_code_download",  label=label, download_type='gap')),
                         (u'\u2003 Up to topological equivalence', url_for(".hgcwa_code_download", label=label, download_type='topo_gap'))]
        downloads.append(('Underlying data', url_for(".hgcwa_data", label=label)))
        return render_template("hgcwa-show-family.html",
                               title=title, bread=bread, info=info,
                               properties=prop2, friends=friends,
                               KNOWL_ID="curve.highergenus.aut.%s" % label,
                               learnmore=learnmore_list(), downloads=downloads)