def render_maass_waveforms(level=0, weight=-1, character=-1, r1=0, r2=0, **kwds): info = get_args_mwf(level=level, weight=weight, character=character, r1=r1, r2=r2, **kwds) info["credit"] = "" info["learnmore"] = learnmore_list() mwf_logger.debug("args=%s" % request.args) mwf_logger.debug("method=%s" % request.method) mwf_logger.debug("req.form=%s" % request.form) mwf_logger.debug("info=%s" % info) mwf_logger.debug("level,weight,char={0},{1},{2}".format(level, weight, character)) if info.get('maass_id', None) and info.get('db', None): return render_one_maass_waveform_wp(**info) if info['search'] or (info['browse'] and int(info['weight']) != 0): search = get_search_parameters(info) mwf_logger.debug("search=%s" % search) return render_search_results_wp(info, search) if info['browse']: mwf_logger.debug("browse info=%s" % info) return render_browse_all_eigenvalues(**info) info['cur_character'] = character if level > 0: info['maass_weight'] = maass_db.weights(int(level)) info['cur_level'] = level if weight > -1: info['cur_weight'] = weight if level > 0: info['maass_character'] = maass_db.characters(int(level), float(weight)) if character > - 1: info['cur_character'] = character if level > 0 or weight > -1 or character > -1: search = get_search_parameters(info) mwf_logger.debug("info=%s" % info) mwf_logger.debug("search=%s" % search) return render_search_results_wp(info, search) title = 'Maass Forms' info['list_of_levels'] = maass_db.levels() if info['list_of_levels']: info['max_level'] = max(info['list_of_levels']) else: info['max_level'] = 0 mwf_logger.debug("info3=%s" % info) bread = [('Modular Forms', url_for('mf.modular_form_main_page')), ('Maass Forms', url_for('.render_maass_waveforms'))] info['bread'] = bread info['title'] = title maass_db.set_table() maass_db.table['ncols'] = 10 info['DB'] = maass_db info['dbcount'] = maass_db.count() info['limit'] = maxNumberOfResultsToShow return render_template("mwf_navigate.html", **info)
def render_maass_waveforms(level=0, weight=-1, character=-1, r1=0, r2=0, **kwds): info = get_args_mwf(level=level, weight=weight, character=character, r1=r1, r2=r2, **kwds) info[ "credit"] = u"Data computed by Stefan Lemurell and Fredrik Str\u00f6mberg." info["bread"] = [('Modular Forms', url_for('mf.modular_form_main_page')), ('Maass Forms', url_for('.render_maass_waveforms'))] info["learnmore"] = learnmore_list() mwf_logger.debug("args=%s" % request.args) mwf_logger.debug("method=%s" % request.method) mwf_logger.debug("req.form=%s" % request.form) mwf_logger.debug("info=%s" % info) mwf_logger.debug("level,weight,char={0},{1},{2}".format( level, weight, character)) if info.get('maass_id', None) and info.get('db', None): return render_one_maass_waveform_wp(**info) if info['search'] or (info['browse'] and int(info['weight']) != 0): # This isn't the right place to do input validation, but it is easier to flash errors here (this is a hack to address issue #1820) if info.get('level_range'): if not re.match(POSINT_RE, info['level_range']): if "-" in info['level_range']: info['level_range'] = "..".join( info['level_range'].split("-")) if not re.match(POSINT_RANGE_RE, info['level_range']): flash_error( "%s is not a level, please specify a positive integer <span style='color:black'>n</span> or postivie integer range <span style='color:black'>m..n</span>.", info['level_range']) return render_template('mwf_navigate.html', **info) if info['character'] != -1: if info['character'] == '1' or info['character'] == '1.1': info['character'] = '1' else: try: N = int(info.get('level_range', '0')) except: flash_error( "Only the trivial character can be specified in combination with a range of levels.", info['character']) return render_template('mwf_navigate.html', **info) if re.match(POSINT_RE, info['character']): if N == 0: flash_error( "Character %s is ambiguous. Please either specify a level or use a character label of the form <span style='color:black'>q.n</span>, where q specifies the level.", info['character']) return render_template('mwf_navigate.html', **info) n = int(info['character']) if gcd(N, n) != 1: flash_error( "Character %s is not coprime to the level %s.", info['character'], str(N)) return render_template('mwf_navigate.html', **info) else: if not re.match(r'^[1-9][0-9]*\.[1-9][0-9]*$', info['character']): flash_error( "%s is not a valid label for a Dirichlet character. It should be either be 1 (for the trivial character) or of the form <span style='color:black'>q.n</span>, where q and n are coprime positive integers with n < q, or q=n=1.", info['character']) return render_template('mwf_navigate.html', **info) s = info['character'].split('.') q, n = int(s[0]), int(s[1]) if n > q or gcd(q, n) != 1: flash_error( "%s is not a valid label for a Dirichlet character. It should be of the form <span style='color:black'>q.n</span>, where q and n are coprime positive integers with n < q, or q=n=1.", info['character']) return render_template('mwf_navigate.html', **info) if N > 0 and q != N: flash_error( "The specified character %s is not compatible with the level %s.", info['character'], info['level']) return render_template('mwf_navigate.html', **info) info['level_range'] = str(q) info['character'] = str(n) if info['weight'] != -1: if not re.match(INT_RE, info['weight']): flash_error( "%s is not a valid weight. It should be a nonnegative integer.", info['weight']) return render_template('mwf_navigate.html', **info) if info.get('ev_range'): if not re.match(FLOAT_RE, info['ev_range']): if "-" in info['ev_range']: info['ev_range'] = "..".join(info['ev_range'].split("-")) s = info['ev_range'].split("..") if len(s) != 2: flash_error( "%s is not a valid eigenvalue range. It should be postive real interval.", info['ev_range']) return render_template('mwf_navigate.html', **info) if not re.match(FLOAT_RE, s[0]) or not re.match( FLOAT_RE, s[1]): flash_error( "%s is not a valid eigenvalue range. It should be postive real interval.", info['ev_range']) return render_template('mwf_navigate.html', **info) search = get_search_parameters(info) mwf_logger.debug("search=%s" % search) return render_search_results_wp(info, search) if info['browse']: mwf_logger.debug("browse info=%s" % info) return render_browse_all_eigenvalues(**info) info['cur_character'] = character if level > 0: info['maass_weight'] = maass_db.weights(int(level)) info['cur_level'] = level if weight > -1: info['cur_weight'] = weight if level > 0: info['maass_character'] = maass_db.characters( int(level), float(weight)) if character > -1: info['cur_character'] = character if level > 0 or weight > -1 or character > -1: search = get_search_parameters(info) mwf_logger.debug("info=%s" % info) mwf_logger.debug("search=%s" % search) return render_search_results_wp(info, search) title = 'Maass Forms' info['list_of_levels'] = maass_db.levels() if info['list_of_levels']: info['max_level'] = max(info['list_of_levels']) else: info['max_level'] = 0 mwf_logger.debug("info3=%s" % info) bread = [('Modular Forms', url_for('mf.modular_form_main_page')), ('Maass Forms', url_for('.render_maass_waveforms'))] info['bread'] = bread info['title'] = title maass_db.set_table() maass_db.table['ncols'] = 10 info['DB'] = maass_db info['dbcount'] = maass_db.count() info['limit'] = maxNumberOfResultsToShow return render_template("mwf_navigate.html", **info)
def render_maass_waveforms(level=0, weight=-1, character=-1, r1=0, r2=0, **kwds): info = get_args_mwf(level=level, weight=weight, character=character, r1=r1, r2=r2, **kwds) info["credit"] = "" info["learnmore"] = [] mwf_logger.debug("args=%s" % request.args) mwf_logger.debug("method=%s" % request.method) mwf_logger.debug("req.form=%s" % request.form) mwf_logger.debug("info=%s" % info) mwf_logger.debug("level,weight,char={0},{1},{2}".format( level, weight, character)) if info.get('maass_id', None) and info.get('db', None): return render_one_maass_waveform_wp(**info) if info['search'] or (info['browse'] and int(info['weight']) != 0): search = get_search_parameters(info) mwf_logger.debug("search=%s" % search) return render_search_results_wp(info, search) if info['browse']: mwf_logger.debug("browse info=%s" % info) return render_browse_all_eigenvalues(**info) info['cur_character'] = character if level > 0: info['maass_weight'] = maass_db.weights(int(level)) info['cur_level'] = level if weight > -1: info['cur_weight'] = weight if level > 0: info['maass_character'] = maass_db.characters( int(level), float(weight)) if character > -1: info['cur_character'] = character if level > 0 or weight > -1 or character > -1: search = get_search_parameters(info) mwf_logger.debug("info=%s" % info) mwf_logger.debug("search=%s" % search) return render_search_results_wp(info, search) title = 'Maass Forms' info['list_of_levels'] = maass_db.levels() if info['list_of_levels']: info['max_level'] = max(info['list_of_levels']) else: info['max_level'] = 0 mwf_logger.debug("info3=%s" % info) bread = [('Modular Forms', url_for('mf.modular_form_main_page')), ('Maass Forms', url_for('.render_maass_waveforms'))] info['bread'] = bread info['title'] = title maass_db.set_table() maass_db.table['ncols'] = 10 info['DB'] = maass_db info['dbcount'] = maass_db.count() info['limit'] = maxNumberOfResultsToShow return render_template("mwf_navigate.html", **info)
def set_table(self, data={}): # data = maass_db.get_search_parameters(data,kwds mwf_logger.debug("set table, data = {0}".format(data)) mwf_logger.debug("skip= {0}".format(self.skip)) mwf_logger.debug("limit= {0}".format(self.limit)) self.table = [] data['skip'] = self.skip data['limit'] = self.limit l1 = self.keys.index('Level') level_ll = (self.skip[l1]) * self.limit[l1] level_ul = (self.skip[l1] + 1) * self.limit[l1] ev_limit = self.limit[self.keys.index('Eigenvalue')] ev_skip = self.skip[self.keys.index('Eigenvalue')] * ev_limit new_cols = [] levels = maass_db.levels() mwf_logger.debug("levels= {0}".format(levels)) cur_level = data.get('level', None) cur_wt = data.get('weight', None) print("cur_level=", cur_level) print("cur_wt=", cur_wt) for N in levels: if cur_level and cur_level != N: continue N = int(N) if N < level_ll or N > level_ul: continue print("N=", N) weights = maass_db.weights(N) print("weights=", weights) self.wt = weights for k in weights: if cur_wt is not None and cur_wt != k: continue print("k=", k) k = int(k) evs = [] query = {'Level': N, 'Weight': k} totalc = maass_db.count(query) finds = maass_db.get_Maass_forms(query, limit=ev_limit, offset=ev_skip) for rec in finds: row = {} maass_id = rec.get('_id', None) row['R'] = rec.get('Eigenvalue', None) row['st'] = rec.get("Symmetry") row['cusp_evs'] = rec.get("Cusp_evs") row['err'] = rec.get('Error', 0) row['url'] = url_for('mwf.render_one_maass_waveform', maass_id=maass_id) row['numc'] = rec.get('Numc', 0) evs.append(row) kmax = int(totalc / ev_limit) paging = [] for j in range(ev_skip, kmax): k0 = (j) * ev_limit k1 = (j + 1) * ev_limit url = url_for('mwf.render_maass_waveforms', level=N, weight=k, skip=ev_skip + j, limit=ev_limit) skip = { 'url': url, 'k0': k0, 'k1': k1, 'cur_skip': ev_skip, 'cur_limit': ev_limit, "skip": j } paging.append(skip) # s+="]" self.paging = paging smalltbl = {'N': N, 'k': k, 'evs': evs, 'paging': paging} if len(evs) > 0: self.table.append(smalltbl) print("table=", self.table) self.cols = new_cols
def set_table(self, data={}): # data = maass_db.get_search_parameters(data,kwds mwf_logger.debug("set table, data = {0}".format(data)) mwf_logger.debug("skip= {0}".format(self.skip)) mwf_logger.debug("limit= {0}".format(self.limit)) self.table = [] data['skip'] = self.skip data['limit'] = self.limit l1 = self.keys.index('Level') level_ll = (self.skip[l1]) * self.limit[l1] level_ul = (self.skip[l1] + 1) * self.limit[l1] ev_limit = self.limit[self.keys.index('Eigenvalue')] ev_skip = self.skip[self.keys.index('Eigenvalue')] * ev_limit new_cols = [] levels = maass_db.levels() mwf_logger.debug("levels= {0}".format(levels)) cur_level = data.get('level', None) cur_wt = data.get('weight', None) print "cur_level=", cur_level print "cur_wt=", cur_wt for N in levels: if cur_level and cur_level != N: continue N = int(N) if N < level_ll or N > level_ul: continue print "N=", N weights = maass_db.weights(N) print "weights=", weights self.wt = weights for k in weights: if cur_wt is not None and cur_wt != k: continue print "k=", k k = int(k) evs = [] query = {'Level': N, 'Weight': k} totalc = maass_db.count(query) finds = maass_db.get_Maass_forms(query, limit=ev_limit, offset=ev_skip) for rec in finds: row = {} maass_id = rec.get('_id', None) row['R'] = rec.get('Eigenvalue', None) row['st'] = rec.get("Symmetry") row['cusp_evs'] = rec.get("Cusp_evs") row['err'] = rec.get('Error', 0) row['url'] = url_for('mwf.render_one_maass_waveform', maass_id=maass_id) row['numc'] = rec.get('Numc', 0) evs.append(row) kmax = int(totalc / ev_limit) paging = [] for j in range(ev_skip, kmax): k0 = (j) * ev_limit k1 = (j + 1) * ev_limit url = url_for( 'mwf.render_maass_waveforms', level=N, weight=k, skip=ev_skip + j, limit=ev_limit) skip = {'url': url, 'k0': k0, 'k1': k1, 'cur_skip': ev_skip, 'cur_limit': ev_limit, "skip": j} paging.append(skip) # s+="]" self.paging = paging smalltbl = {'N': N, 'k': k, 'evs': evs, 'paging': paging} if len(evs) > 0: self.table.append(smalltbl) print "table=", self.table self.cols = new_cols
def render_maass_waveforms(level=0, weight=-1, character=-1, r1=0, r2=0, **kwds): info = get_args_mwf(level=level, weight=weight, character=character, r1=r1, r2=r2, **kwds) info["credit"] = "" info["learnmore"] = learnmore_list() mwf_logger.debug("args=%s" % request.args) mwf_logger.debug("method=%s" % request.method) mwf_logger.debug("req.form=%s" % request.form) mwf_logger.debug("info=%s" % info) mwf_logger.debug("level,weight,char={0},{1},{2}".format(level, weight, character)) if info.get('maass_id', None) and info.get('db', None): return render_one_maass_waveform_wp(**info) if info['search'] or (info['browse'] and int(info['weight']) != 0): # This isn't the right place to do input validation, but it is easier to flash errors here (this is a hack to address issue #1820) if info.get('level_range'): if not re.match(POSINT_RE, info['level_range']): if "-" in info['level_range']: info['level_range'] = "..".join(info['level_range'].split("-")) if not re.match(POSINT_RANGE_RE, info['level_range']): flash_error("%s is not a level, please specify a positive integer <span style='color:black'>n</span> or postivie integer range <span style='color:black'>m..n</span>.", info['level_range']) return render_template('mwf_navigate.html', **info) if info['character'] != -1: try: N = int(info.get('level_range','0')) except: flash_error("Character %s cannot be specified in combination with a range of levels.", info['character']) return render_template('mwf_navigate.html', **info) if not re.match(r'^[1-9][0-9]*\.[1-9][0-9]*$', info['character']): flash_error("%s is not a valid label for a Dirichlet character. It should be of the form <span style='color:black'>q.n</span>, where q and n are coprime positive integers with n < q, or q=n=1.", info['character']) return render_template('mwf_navigate.html', **info) s = info['character'].split('.') q,n = int(s[0]), int(s[1]) if n > q or gcd(q,n) != 1 or (N > 0 and q != N): flash_error("%s is not a valid label for a Dirichlet character. It should be of the form <span style='color:black'>q.n</span>, where q and n are coprime positive integers with n < q, or q=n=1.", info['character']) return render_template('mwf_navigate.html', **info) info['level_range'] = str(q) info['character'] = str(n) if info['weight'] != -1: if not re.match(INT_RE, info['weight']): flash_error("%s is not a valid weight. It should be a nonnegative integer.", info['weight']) return render_template('mwf_navigate.html', **info) if info.get('ev_range'): if not re.match(FLOAT_RE,info['ev_range']): if "-" in info['ev_range']: info['ev_range'] = "..".join(info['ev_range'].split("-")) s = info['ev_range'].split("..") if len(s) != 2: flash_error("%s is not a valid eigenvalue range. It should be postive real interval.", info['ev_range']) return render_template('mwf_navigate.html', **info) if not re.match(FLOAT_RE,s[0]) or not re.match(FLOAT_RE,s[1]): flash_error("%s is not a valid eigenvalue range. It should be postive real interval.", info['ev_range']) return render_template('mwf_navigate.html', **info) search = get_search_parameters(info) mwf_logger.debug("search=%s" % search) return render_search_results_wp(info, search) if info['browse']: mwf_logger.debug("browse info=%s" % info) return render_browse_all_eigenvalues(**info) info['cur_character'] = character if level > 0: info['maass_weight'] = maass_db.weights(int(level)) info['cur_level'] = level if weight > -1: info['cur_weight'] = weight if level > 0: info['maass_character'] = maass_db.characters(int(level), float(weight)) if character > - 1: info['cur_character'] = character if level > 0 or weight > -1 or character > -1: search = get_search_parameters(info) mwf_logger.debug("info=%s" % info) mwf_logger.debug("search=%s" % search) return render_search_results_wp(info, search) title = 'Maass Forms' info['list_of_levels'] = maass_db.levels() if info['list_of_levels']: info['max_level'] = max(info['list_of_levels']) else: info['max_level'] = 0 mwf_logger.debug("info3=%s" % info) bread = [('Modular Forms', url_for('mf.modular_form_main_page')), ('Maass Forms', url_for('.render_maass_waveforms'))] info['bread'] = bread info['title'] = title maass_db.set_table() maass_db.table['ncols'] = 10 info['DB'] = maass_db info['dbcount'] = maass_db.count() info['limit'] = maxNumberOfResultsToShow return render_template("mwf_navigate.html", **info)