def init_g2c_stats(self): if self._stats: return g2c_logger.debug("Computing genus 2 curve stats...") counts = self._counts total = counts["ncurves"] stats = {} dists = [] for attr in stats_attribute_list: values = g2cdb().curves.distinct(attr['name']) values.sort() vcounts = [] rows = [] colcount = 0 avg = 0 for value in values: n = g2cdb().curves.find({attr['name']:value}).count() prop = format_percentage(n,total) if 'avg' in attr and attr['avg']: avg += n*value value_string = attr['format'](value) if 'format' in attr else value vcounts.append({'value': value_string, 'curves': n, 'query':url_for(".index_Q")+'?'+attr['name']+'='+str(value),'proportion': prop}) if len(vcounts) == 10: rows.append(vcounts) vcounts = [] if len(vcounts): rows.append(vcounts) if 'avg' in attr and attr['avg']: vcounts.append({'value':'\\mathrm{avg}\\ %.2f'%(float(avg)/total), 'curves':total, 'query':url_for(".index_Q") +'?'+attr['name'],'proportion':format_percentage(1,1)}) dists.append({'attribute':attr,'rows':rows}) stats["distributions"] = dists self._stats = stats g2c_logger.debug("... finished computing genus 2 curve stats.")
def init_g2c_stats(self): if self._stats: return g2c_logger.debug("Computing genus 2 curve stats...") counts = self._counts total = counts["ncurves"] stats = {} dists = [] for attr in stats_attribute_list: values = g2cdb().curves.distinct(attr['name']) values.sort() vcounts = [] rows = [] colcount = 0 avg = 0 for value in values: n = g2cdb().curves.find({attr['name']: value}).count() prop = format_percentage(n, total) if 'avg' in attr and attr['avg']: avg += n * value value_string = attr['format']( value) if 'format' in attr else value vcounts.append({ 'value': value_string, 'curves': n, 'query': url_for(".index_Q") + '?' + attr['name'] + '=' + str(value), 'proportion': prop }) if len(vcounts) == 10: rows.append(vcounts) vcounts = [] if len(vcounts): rows.append(vcounts) if 'avg' in attr and attr['avg']: vcounts.append({ 'value': '\\mathrm{avg}\\ %.2f' % (float(avg) / total), 'curves': total, 'query': url_for(".index_Q") + '?' + attr['name'], 'proportion': format_percentage(1, 1) }) dists.append({'attribute': attr, 'rows': rows}) stats["distributions"] = dists self._stats = stats g2c_logger.debug("... finished computing genus 2 curve stats.")
def by_g2c_label(label): g2c_logger.debug(label) return render_curve_webpage_by_label(label)
def by_full_label(conductor,iso_label, disc,number): full_label = str(conductor)+"."+iso_label+"."+str(disc)+"."+str(number) g2c_logger.debug(full_label) return render_curve_webpage_by_label(full_label)
def by_g2c_label(label): g2c_logger.debug(label) return render_curve_webpage_by_label(label)
def by_full_label(conductor,iso_label,disc,number): full_label = str(conductor)+"."+iso_label+"."+str(disc)+"."+str(number) g2c_logger.debug(full_label) return render_curve_webpage_by_label(full_label)