def download_full_space(self, label, lang='text'): try: space = WebGamma1Space.by_label(label) except ValueError: return abort(404, "Label not found: %s"%label) data = {} for attr in ['level', 'weight', 'label', 'oldspaces']: data[attr] = getattr(space, attr) data['newspaces'] = [spc['label'] for spc, forms in space.decomp] data['newforms'] = sum([[form['label'] for form in forms] for spc, forms in space.decomp], []) data['dimgrid'] = space.dim_grid._grid return self._wrap(Json.dumps(data), label, lang=lang, title='Stored data for newspace %s,'%(label))
def render_full_gamma1_space_webpage(label): try: space = WebGamma1Space.by_label(label) except (TypeError, KeyError, ValueError) as err: return abort(404, err.args) info = {} set_info_funcs(info) return render_template("cmf_full_gamma1_space.html", info=info, space=space, properties2=space.properties, downloads=space.downloads, credit=credit(), bread=space.bread, learnmore=learnmore_list(), title=space.title, friends=space.friends)
def paintSvgHoloGeneral(Nmin, Nmax, kmin, kmax, imagewidth, imageheight): # the import must be here to avoid circular import from lmfdb.classical_modular_forms.web_newform import WebNewform from lmfdb.classical_modular_forms.web_space import WebGamma1Space xfactor = 90 yfactor = 30 extraSpace = 20 ticlength = 4 radius = 3.3 xdotspacing = 0.30 # horizontal spacing of dots ydotspacing = 0.11 # vertical spacing of dots # colourplus = signtocolour(1) # not used # colourminus = signtocolour(-1) # not used maxdots = 5 # max number of dots to display ans = svgBegin() xMax = int(Nmax) yMax = int(kmax) width = xfactor * xMax + extraSpace height = yfactor * yMax + extraSpace # make the coordinate system ans += paintCSHoloTMP(width, height, xMax, yMax, xfactor, yfactor, ticlength) alphabet = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'] # create appearanceinfo, common to all points appearanceinfo = [] # loop over levels and weights, using plotsector to put the appropriate dots at each lattice point for x in range(int(Nmin), int(Nmax) + 1): # x is the level for y in range(int(kmin), int(kmax) + 1, 2): # y is the weight # lid = "(" + str(x) + "," + str(y) + ")" # not used # linkurl = "/L/ModularForm/GL2/Q/holomorphic/" + str(y) + "/" + str(x) + "/1/" # not used WS = WebGamma1Space( level=x, weight=y) # space of modular forms of weight y, level x galois_orbits = WS.decomp # make a list of Galois orbits numlabels = len(galois_orbits) # one label per Galois orbit thelabels = alphabet[ 0: numlabels] # list of labels for the Galois orbits for weight y, level x # countplus = 0 # count how many Galois orbits have sign Plus (+ 1) (not used) # countminus = 0 # count how many Galois orbits have sign Minus (- 1) (not used) # ybaseplus = y # baseline y-coord for plus cases (not used) # ybaseminus = y # baseline y-coord for minus cases (not used) # numpluslabels = 0 # not used # numminuslabels = 0 # not used # plotsector requires three dictionaries: dimensioninfo, appearanceinfo, and urlinfo # create dimensioninfo dimensioninfo = {} dimensioninfo['offset'] = [0, height] dimensioninfo['scale'] = [xfactor, -1 * yfactor] dimensioninfo['vertexlocation'] = [x, y] dimensioninfo['maxdots'] = maxdots dimensioninfo['dotspacing'] = [xdotspacing, ydotspacing] dimensioninfo['edge'] = [[0, 1], [1, 0] ] # unit vectors defining edges of sector # dimensioninfo['edgelength'] = [float(dimensioninfo['scale'][0])/float(Nmax), float(dimensioninfo['scale'][1])/float(kmax)] #add comment dimensioninfo['edgelength'] = [0.5, 0.5] dimensioninfo['dotradius'] = radius dimensioninfo[ 'connectinglinewidth'] = dimensioninfo['dotradius'] / 1.5 dimensioninfo['firstdotoffset'] = [0.0, 0.0] # appearanceinfo = {} # appearanceinfo['edgewidth'] = dimensioninfo['dotspacing'][0]/1.0 #just a guess appearanceinfo['edgewidth'] = [0, 0] # remove the sector edges appearanceinfo['edgestyle'] = 'stroke-dasharray:3,3' appearanceinfo['edgecolor'] = 'rgb(202,202,102)' appearanceinfo['fontsize'] = 'font-size:11px' appearanceinfo['fontweight'] = "" # urlinfo = {'base': '/L/ModularForm/GL2/Q/holomorphic?'} urlinfo['space'] = {'weight': y} urlinfo['space']['level'] = x urlinfo['space']['character'] = 0 # # scale = 1 # not used # Symmetry types: +1 or -1 symmetrytype = [1, -1] for signtmp in symmetrytype: # urlinfo['space']['orbits'] = [ [] for label in thelabels ] # initialise # an empty list for each orbit urlinfo['space']['orbits'] = [] for label in thelabels: # looping over Galois orbit: one label per orbit # do '+' case first MF = WebNewform.by_label( label=label ) # one of the Galois orbits for weight y, level x numberwithlabel = MF.degree( ) # number of forms in the Galois orbit if x == 1: # For level 1, the sign is always plus signfe = 1 else: # signfe = -1 frickeeigenvalue = prod(MF.atkin_lehner_eigenvalues( ).values()) # gives Fricke eigenvalue signfe = frickeeigenvalue * (-1)**float( y / 2) # sign of functional equation if signfe == signtmp: # we find an orbit with sign of "signtmp" if signfe == 1: dimensioninfo['edge'] = [[0, 1], [1, 0]] # unit vectors defining edges of sector for signfe positive else: # dimensioninfo['edge'] = [[0,1],[-1,0]] # unit vectors defining edges # of sector for signfe negative dimensioninfo['edge'] = [[0, -1], [-1, 0]] # unit vectors defining edges of sector for signfe negative dimensioninfo['dotspacing'] = [ signfe * xdotspacing, ydotspacing ] dimensioninfo['firstdotoffset'] = [ 0.5 * (dimensioninfo['dotspacing'][0] * dimensioninfo['edge'][0][0] + dimensioninfo['dotspacing'][1] * dimensioninfo['edge'][1][0]), 0 ] signcolour = signtocolour(signfe) appearanceinfo['edgecolor'] = signcolour orbitdescriptionlist = [] for n in range(numberwithlabel): orbitdescriptionlist.append({ 'label': label, 'number': n, 'color': signcolour }) urlinfo['space']['orbits'].append(orbitdescriptionlist) # urlinfo['space']['orbits'][0][0]['color'] = signtocolour(-1) # appearanceinfo['orbitcolor'] = 'rgb(102,102,102)' ans += plotsector(dimensioninfo, appearanceinfo, urlinfo) ans += svgEnd() return (ans)
def paintSvgHolo(Nmin, Nmax, kmin, kmax): # the import must be here to avoid circular import from lmfdb.classical_modular_forms.web_space import WebGamma1Space xfactor = 90 yfactor = 30 extraSpace = 20 ticlength = 4 radius = 3.3 xdotspacing = 0.11 # horizontal spacing of dots ydotspacing = 0.28 # vertical spacing of dots colourplus = signtocolour(1) colourminus = signtocolour(-1) maxdots = 5 # max number of dots to display ans = svgBegin() xMax = int(Nmax) yMax = int(kmax) width = xfactor * xMax + extraSpace height = yfactor * yMax + extraSpace ans += paintCSHolo(width, height, xMax, yMax, xfactor, yfactor, ticlength) # alphabet = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'] # loop over levels and weights for x in range(int(Nmin), int(Nmax) + 1): # x is the level for y in range(int(kmin), int(kmax) + 1): # y is the weight # lid = "(" + str(x) + "," + str(y) + ")" # not used linkurl = "/L/ModularForm/GL2/Q/holomorphic/" + str(x) + "/" + str( y) + "/1/" try: WS = WebGamma1Space(level=x, weight=y) except ValueError: continue newspaces = WS.decomp # numlabels = len(WS.decomp) # one label per Galois orbit # thelabels = alphabet[0:numlabels] # list of labels for the Galois orbits for weight y, level x # countplus = 0 # count how many Galois orbits have sign Plus (+ 1) # not used # countminus = 0 # count how many Galois orbits have sign Minus (- 1) # not used ybaseplus = y # baseline y-coord for plus cases ybaseminus = y # baseline y-coord for minus cases numpluslabels = 0 numminuslabels = 0 for newsp in newspaces: # looping over Galois orbit for MF in newsp[1]: print(MF) linkurl = "/L/ModularForm/GL2/Q/holomorphic/%d/%d/%s/%s/" % ( x, y, MF['char_orbit_label'], cremona_letter_code(MF['hecke_orbit'] - 1)) numberwithlabel = MF[ 'dim'] # number of forms in the Galois orbit # frickeeigenvalue = prod(MF.atkin_lehner_eigenvalues().values()) # gives Fricke eigenvalue self_dual = MF['char_is_real'] * (-1)**float( y / 2) # sign of functional equation xbase = x - self_dual * (xdotspacing / 2.0) if self_dual > 0: # go to right in BLUE if plus ybase = ybaseplus ybaseplus += ydotspacing thiscolour = colourplus numpluslabels += 1 else: # go to the left in RED of minus ybase = ybaseminus ybaseminus += ydotspacing thiscolour = colourminus numminuslabels += 1 if numberwithlabel > maxdots: # if more than maxdots in orbit, use number as symbol xbase += 1.5 * self_dual * xdotspacing if self_dual < 0: # move over more to position numbers on minus side. xbase += self_dual * xdotspacing ybase += -0.5 * ydotspacing if (self_dual > 0 and numpluslabels > 1) or ( self_dual < 0 and numminuslabels > 1): ybase += ydotspacing ans += "<a xlink:href='" + url_for( 'not_yet_implemented') + "' target='_top'>\n" # TODO: Implement when there is more than maxdots forms ans += ("<text x='" + str(float(xbase) * xfactor)[0:7] + "' y='" + str(height - float(ybase) * yfactor)[0:7] + "' style='fill:" + thiscolour + ";font-size:14px;font-weight:bold;'>" + str(numberwithlabel) + "</text>\n") ans += "</a>\n" if self_dual < 0: ybaseminus += 1.5 * ydotspacing else: ybaseplus += 1.5 * ydotspacing else: # otherwise, use one dot per form in orbit, connected with a line if numberwithlabel > 1: # join dots if there are at least two # add lines first and then dots to prevent line from hiding link firstcenterx = xbase + self_dual * xdotspacing firstcentery = ybase lastcenterx = xbase + (numberwithlabel * self_dual * xdotspacing) lastcentery = ybase ans += "<line x1='%s' " % str( float(firstcenterx) * xfactor)[0:7] ans += "y1='%s' " % str( float(height - firstcentery * yfactor))[0:7] ans += "x2='%s' " % str( float(lastcenterx) * xfactor)[0:7] ans += "y2='%s' " % str( float(height - lastcentery * yfactor))[0:7] ans += "style='stroke:%s;stroke-width:2.4'/>" % thiscolour for number in range(0, numberwithlabel): xbase += self_dual * xdotspacing ans += "<a xlink:href='" + linkurl + str( number + 1) + "/' target='_top'>\n" ans += "<circle cx='" + str( float(xbase) * xfactor)[0:7] ans += "' cy='" + str(height - float(ybase) * yfactor)[0:7] ans += "' r='" + str(radius) ans += "' style='fill:" + thiscolour + "'>" ans += "<title>" + str((x, y)).replace( "u", "").replace("'", "") + "</title>" ans += "</circle></a>\n" ans += svgEnd() return ans