Skip to content

Commit

Permalink
Merge pull request #5686 from LMFDB/master
Browse files Browse the repository at this point in the history
master -> web
  • Loading branch information
AndrewVSutherland authored Oct 11, 2023
2 parents 712c3cc + 0cf2fb2 commit b09a959
Show file tree
Hide file tree
Showing 49 changed files with 199 additions and 197 deletions.
7 changes: 1 addition & 6 deletions .github/workflows/matrix_includes.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,6 @@
"folders": "lfunctions",
"server": "devmirror"
},
{
"files": "lmfdb/groups/abstract/test_browse_page.py lmfdb/groups/abstract/test_abstract_groups.py",
"folders": "groups/abstract",
"server": "proddb"
},
{
"files": "lmfdb/groups/abstract/test_browse_page.py lmfdb/groups/abstract/test_abstract_groups.py",
"folders": "groups/abstract",
Expand All @@ -119,4 +114,4 @@
"folders": "modular_curves",
"server": "devmirror"
}
]
]
4 changes: 2 additions & 2 deletions lmfdb/abvar/fq/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,11 @@ def _counts(self):

@lazy_attribute
def qs(self):
return sorted(set(q for g, q in self._counts))
return sorted({q for g, q in self._counts})

@lazy_attribute
def gs(self):
return sorted(set(g for g, q in self._counts))
return sorted({g for g, q in self._counts})

@lazy_attribute
def isogeny_knowl(self):
Expand Down
10 changes: 5 additions & 5 deletions lmfdb/api/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,15 +130,15 @@ def split_db(tablename):
info['dataSize'] = mb(dataSize)
info['indexSize'] = mb(indexSize)
if info['sortby'] == 'name':
sortedkeys = sorted(list(stats))
sortedkeys = sorted(stats)
elif info['sortby'] == 'objects' and info['groupby'] == 'db':
sortedkeys = sorted(list(stats),key=lambda x: (-stats[x]['dbObjects'],stats[x]['db'],-stats[x]['nrows'],stats[x]['table']))
sortedkeys = sorted(stats, key=lambda x: (-stats[x]['dbObjects'],stats[x]['db'],-stats[x]['nrows'],stats[x]['table']))
elif info['sortby'] == 'objects':
sortedkeys = sorted(list(stats),key=lambda x: (-stats[x]['nrows'],stats[x]['db'],stats[x]['table']))
sortedkeys = sorted(stats, key=lambda x: (-stats[x]['nrows'],stats[x]['db'],stats[x]['table']))
elif info['sortby'] == 'size' and info['groupby'] == 'db':
sortedkeys = sorted(list(stats),key=lambda x: (-stats[x]['dbSize'],stats[x]['db'],-stats[x]['size'],stats[x]['table']))
sortedkeys = sorted(stats, key=lambda x: (-stats[x]['dbSize'],stats[x]['db'],-stats[x]['size'],stats[x]['table']))
else:
sortedkeys = sorted(list(stats),key=lambda x: (-stats[x]['size'],stats[x]['db'],stats[x]['table']))
sortedkeys = sorted(stats, key=lambda x: (-stats[x]['size'],stats[x]['db'],stats[x]['table']))
info['stats'] = [stats[key] for key in sortedkeys]
return render_template('api-stats.html', info=info)

Expand Down
2 changes: 1 addition & 1 deletion lmfdb/api2/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ def simple_search_postgres(search_dict, projection=None):
metadata['record_count'] = info['number']
metadata['correct_count'] = info['exact_count']
if data:
data_out = list(list(data))
data_out = list(data)
else:
data_out = []
metadata['view_count'] = len(data_out)
Expand Down
4 changes: 2 additions & 2 deletions lmfdb/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ def modify_url(**replace):
@app.context_processor
def inject_sidebar():
from .homepage import get_sidebar
return dict(sidebar=get_sidebar())
return {"sidebar": get_sidebar()}

##############################
# Bottom link to google code #
Expand Down Expand Up @@ -657,7 +657,7 @@ def add_colors():
if color is None:
from .utils.config import Configuration
color = Configuration().get_color()
return dict(color=all_color_schemes[color].dict())
return {"color": all_color_schemes[color].dict()}


@app.route("/style.css")
Expand Down
2 changes: 1 addition & 1 deletion lmfdb/backend/searchtable.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def _parse_projection(self, projection):
elif projection == 3:
return tuple(["id"] + self.search_cols), tuple(self.extra_cols)
elif isinstance(projection, dict):
projvals = set(bool(val) for val in projection.values())
projvals = {bool(val) for val in projection.values()}
if len(projvals) > 1:
raise ValueError("You cannot both include and exclude.")
including = projvals.pop()
Expand Down
4 changes: 2 additions & 2 deletions lmfdb/backend/statstable.py
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ def column_counts(self, cols, constraint=None, threshold=1, split_list=False):
ccols, cvals, allcols = Json([]), Json([]), cols
else:
ccols, cvals = self._split_dict(constraint)
allcols = sorted(list(set(cols + list(constraint))))
allcols = sorted(set(cols + list(constraint)))
# Ideally we would include the constraint in the query, but it's not easy to do that
# So we check the results in Python
jcols = Json(cols)
Expand Down Expand Up @@ -1155,7 +1155,7 @@ def _process_constraint(self, cols, constraint):
else:
ccols, cvals = self._split_dict(constraint)
# We need to include the constraints in the count table if we're not grouping by that column
allcols = sorted(list(set(cols + list(constraint))))
allcols = sorted(set(cols + list(constraint)))
if any(key.startswith("$") for key in constraint):
raise ValueError("Top level special keys not allowed")
qstr, values = self.table._parse_dict(constraint)
Expand Down
42 changes: 9 additions & 33 deletions lmfdb/belyi/templates/belyi_galmap.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,38 +36,17 @@ <h2>Curve</h2>
<table>
<tr class='std_eqn nodisplay'>
<td>
$\displaystyle {{ data.curve }}$
{% if data.g == 0 %}
{{ data.curve|safe }}
{%- if data.g == 0 -%}
, with affine coordinate $x$
{% endif %}
{% if data["curve_label"] %}
, isomorphic to
{% if data.g == 1 %}
elliptic
{% endif %}
{% if data.g == 2 %}
genus 2
{% endif %}
curve with label <a href={{data["curve_url"]}}>{{data["curve_label"]}} </a>
{% endif %}
</td>
<td>
</td>
</tr>
<tr class='plane_eqn'>
<td>
\(\displaystyle {{ data.plane_model }} = 0\)
{% if data["curve_label"] %}
, isomorphic to
{% if data.g == 1 %}
elliptic
{% endif %}
{% if data.g == 2 %}
genus 2
{% endif %}
curve with label <a href={{data["curve_url"]}}>{{data["curve_label"]}} </a>
{% endif %}
</td>
{{ data.plane_model|safe }}
<td>
</td>
</tr>
Expand All @@ -88,9 +67,9 @@ <h2>Curve</h2>
<h2>{{ KNOWL('belyi.galmap', 'Map') }}</h2>
<div class='std_eqn nodisplay'>
{% if data.g == 0 %}
<p> \(\displaystyle \phi(x) = {{data.map}}\) </p>
<p> \(\displaystyle \phi(x) =\) {{data.map|safe}} </p>
{% else %}
<p> \(\displaystyle \phi(x,y) = {{data.map}}\) </p>
<p> \(\displaystyle \phi(x,y) =\) {{data.map|safe}} </p>
{% endif %}
</div>
<div class='plane_eqn'>
Expand All @@ -105,20 +84,17 @@ <h2>{{ KNOWL('belyi.galmap', 'Map') }}</h2>
{% else %}
<h2>Curve</h2>
<p>
\(\displaystyle {{data.curve}}\)
{% if data.g == 0 %}
{{data.curve|safe}}
{%- if data.g == 0 -%}
, with affine coordinate $x$
{% endif %}
{% if data["curve_label"] %}
, isomorphic to curve with label <a href={{data["curve_url"]}}>{{data["curve_label"]}} </a>
{% endif %}
</p>

<h2>{{ KNOWL('belyi.galmap', 'Map') }}</h2>
{% if data.g == 0 %}
<p> \(\displaystyle \phi(x) = {{data.map}}\) </p>
<p> \(\displaystyle \phi(x) =\) {{data.map|safe}} </p>
{% else %}
<p> \(\displaystyle \phi(x,y) = {{data.map}}\) </p>
<p> \(\displaystyle \phi(x,y) =\) {{data.map|safe}} </p>
{% endif %}
{% endif %}

Expand Down
5 changes: 3 additions & 2 deletions lmfdb/belyi/test_belyi.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ def test_passport(self):
self.check_args("/Belyi/9T33-5.2.2_5.3.1_2.2.2.2.1-a", "3.1.14175.1")

def test_smooth_equation(self):
self.check_args("/Belyi/9T33-9_5.1.1.1.1_5.1.1.1.1-a", r"\phi(x) = 9075734485907514624 \frac{x^{9}}{4537867242953757312 x^{9} - 10520021716426424475 x^{8} + 12447550725170242500 x^{6} - 9941569340991356250 x^{4} + 4201111257707812500 x^{2} - 724916949326171875}\)")
self.check_args("/Belyi/7T5-7_7_3.3.1-a", r"\frac{50000 x^{5} + 60000 x^{4} + \left(7000 \nu + 5000\right) x^{3} + 50000 x^{2} y + \left(7000 \nu - 11400\right) x^{2} + 40000 x y + \left(455 \nu - 1725\right) x + \left(500 \nu + 2500\right) y - 532 \nu + 284}{50000 x^{5} + 60000 x^{4} + \left(7000 \nu + 5000\right) x^{3} + \left(7000 \nu - 11400\right) x^{2} + \left(455 \nu - 1725\right) x - 532 \nu + 284}")
self.check_args("/Belyi/7T5-7_7_3.3.1-a", r"y^{2} = x^{6} + \frac{4}{5} x^{5} + \left(\frac{13}{50} \nu - \frac{19}{50}\right) x^{4} + \left(\frac{21}{125} \nu - \frac{7}{25}\right) x^{3} + \left(-\frac{709}{10000} \nu + \frac{279}{10000}\right) x^{2} + \left(-\frac{153}{6250} \nu + \frac{67}{6250}\right) x + \frac{83}{15625} \nu + \frac{47}{15625}")

def test_plane_equation(self):
self.check_args("/Belyi/9T33-9_5.1.1.1.1_5.1.1.1.1-a", r"x^{9} t + \left(-126 x^{4} + 420 x^{3} - 540 x^{2} + 315 x - 70\right) = 0")
self.check_args("/Belyi/9T33-9_5.1.1.1.1_5.1.1.1.1-a", r"x^{9} t + \left(-126 x^{4} + 420 x^{3} - 540 x^{2} + 315 x - 70")

# web pages

Expand Down
123 changes: 72 additions & 51 deletions lmfdb/belyi/web_belyi.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# -*- coding: utf-8 -*-

from lmfdb.utils import web_latex
from lmfdb.number_fields.web_number_field import WebNumberField
from lmfdb.galois_groups.transitive_group import transitive_group_display_knowl
from sage.all import gcd, latex, CC, QQ, FractionField, PolynomialRing, NumberField, factor
from lmfdb.utils import names_and_urls, prop_int_pretty
from sage.all import gcd, latex, CC, QQ, FractionField, PolynomialRing
from lmfdb.utils import (names_and_urls, prop_int_pretty, raw_typeset,
web_latex, compress_expression)
from flask import url_for
import re

from lmfdb import db

Expand Down Expand Up @@ -111,37 +112,46 @@ def make_map_latex(map_str, nu=None):
phi_str = lc_str + "\\frac{%s}{%s}" % (num_str, den_str)
return phi_str

def make_plane_model_latex(crv_str, nu=None):
if "nu" not in crv_str:
R0 = QQ
else:
R0 = PolynomialRing(QQ, "nu")
R = PolynomialRing(R0, 2, "t,x")
f = R(crv_str)
#return teXify_pol(f)
return latex(f)+"=0"

def make_plane_model_latex_factored(crv_str, numfld_cs, nu=None):
R0 = PolynomialRing(QQ,"T")
K = NumberField(R0(numfld_cs), "nu") # sage factors out constants, ruining integrality
S0 = PolynomialRing(K,"x")
S = PolynomialRing(S0,"t")
t = S.gens()[0]
f = S(crv_str)
cs = f.coefficients()
cs.reverse()
mons = f.monomials()
L = len(cs)
f_str = ""
for i in range(0,L-1):
f_str += "%s%s" % (latex(factor(cs[i])), latex(t**(L-i-1)))
if i != L-2:
f_str += "+"
if mons[-1] == 1:
f_str += latex(factor(cs[-1]))
else:
f_str += latex(factor(cs[-1])) + latex(mons[-1])
return f_str
#def make_plane_model_latex(crv_str, nu=None):
# if "nu" not in crv_str:
# R0 = QQ
# else:
# R0 = PolynomialRing(QQ, "nu")
# R = PolynomialRing(R0, 2, "t,x")
# f = R(crv_str)
# #return teXify_pol(f)
# return latex(f)+"=0"
#
#def make_plane_model_latex_factored(crv_str, numfld_cs, nu=None):
# R0 = PolynomialRing(QQ,"T")
# K = NumberField(R0(numfld_cs), "nu") # sage factors out constants, ruining integrality
# S0 = PolynomialRing(K,"x")
# S = PolynomialRing(S0,"t")
# t = S.gens()[0]
# f = S(crv_str)
# cs = f.coefficients()
# cs.reverse()
# mons = f.monomials()
# L = len(cs)
# f_str = ""
# for i in range(0,L-1):
# f_str += "%s%s" % (latex(factor(cs[i])), latex(t**(L-i-1)))
# if i != L-2:
# f_str += "+"
# if mons[-1] == 1:
# f_str += latex(factor(cs[-1]))
# else:
# f_str += latex(factor(cs[-1])) + latex(mons[-1])
# return f_str

def belyi_latex(s):
str = s.replace('*',' ')
str = str.replace('(',r'\left(')
str = str.replace(')',r'\right)')
str = str.replace('nu',r'\nu')
# multidigit exponents
str = re.sub(r'\^\s*(\d+)', r'^{\1}',str)
return str

###############################################################################
# Belyi map class definitions
Expand Down Expand Up @@ -253,17 +263,41 @@ def __init__(self, galmap, triple=None):
my_dict['embedding'] = embed_strs[i]
data['embeddings_and_triples'].append(my_dict)

# Friends
self.friends = [("Passport", url_for_belyi_passport_label(galmap["plabel"]))]
if galmap['label'] != galmap['primitivization']:
self.friends.append(("Primitivization", url_for_belyi_galmap_label(galmap["primitivization"])))
self.friends.extend(names_and_urls(galmap['friends']))

curve_ref = ''
# add curve link, if in LMFDB
if 'curve_label' in galmap.keys():
data['curve_label'] = galmap['curve_label']
for name, url in self.friends:
if "curve" in name.lower() and data['curve_label'] in name:
data["curve_url"] = url

# curve reference
curve_ref = ', isomorphic to '
if galmap['g'] == 1:
curve_ref += 'elliptic'
if galmap['g'] == 2:
curve_ref += 'genus 2'
curve_ref += rf' curve with label <a href="{url}">{data["curve_label"]}</a>'

# curve equations
crv_str = galmap["curve"]
if crv_str == "PP1":
data["curve"] = r"\mathbb{P}^1"
data["curve"] = r"$\mathbb{P}^1$"
else:
data["curve"] = make_curve_latex(crv_str, nu=self.embedding)
data["curve"] = raw_typeset(crv_str, r'$\displaystyle '+compress_expression(make_curve_latex(crv_str, nu=self.embedding))+'$', extra=curve_ref)

data["map"] = make_map_latex(galmap["map"], nu=self.embedding)
data["map"] = raw_typeset(galmap["map"], r'$\displaystyle '+compress_expression(make_map_latex(galmap["map"], nu=self.embedding))+'$')
data["lambdas"] = [str(c)[1:-1] for c in galmap["lambdas"]]
# plane model
if galmap.get("plane_model"):
data["plane_model"] = galmap["plane_model_latex"]
data["plane_model"] = raw_typeset(compress_expression(galmap["plane_model"])+'=0', r'$\displaystyle '+belyi_latex(galmap["plane_model"])+'=0$', extra=curve_ref)

if galmap.get('plane_map_constant_factored'):
data['plane_map_constant_factored'] = galmap['plane_map_constant_factored']

Expand All @@ -284,19 +318,6 @@ def __init__(self, galmap, triple=None):
]
self.properties = properties

# Friends
self.friends = [("Passport", url_for_belyi_passport_label(galmap["plabel"]))]
if galmap['label'] != galmap['primitivization']:
self.friends.append(("Primitivization", url_for_belyi_galmap_label(galmap["primitivization"])))
self.friends.extend(names_and_urls(galmap['friends']))

# add curve link, if in LMFDB
if 'curve_label' in galmap.keys():
data['curve_label'] = galmap['curve_label']
for name, url in self.friends:
if "curve" in name.lower() and data['curve_label'] in name:
data["curve_url"] = url

# Downloads
data_label = data["label"]
if galmap["g"] <= 2:
Expand Down
3 changes: 1 addition & 2 deletions lmfdb/characters/HeckeCharacters.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@ def lift(self, x):
return self.exp(x.exponents())

def iter_exponents(self):
for e in xmrange(self.invariants(), tuple):
yield e
yield from xmrange(self.invariants(), tuple)

def iter_ideals(self):
for e in self.iter_exponents():
Expand Down
Loading

0 comments on commit b09a959

Please sign in to comment.