Skip to content

Commit

Permalink
Merge pull request #18 from roed314/dir_induced
Browse files Browse the repository at this point in the history
Dir induced
  • Loading branch information
AndrewVSutherland authored Nov 20, 2024
2 parents 1e69e17 + 1074796 commit 9d8ae91
Show file tree
Hide file tree
Showing 11 changed files with 346 additions and 40 deletions.
14 changes: 13 additions & 1 deletion lmfdb/api/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,22 @@ def get_database_info(show_hidden=False):
info[database].append((table, table[i+1:], coll.count()))
return info

@api_page.route("/options")
def options():
return render_template(
"database_options.html",
title="Access options for the LMFDB database",
learnmore=[("API", url_for(".index")),
("Table statistics", url_for(".stats")),
("lmfdb-lite", "https://www.github.com/roed314/lmfdb-lite"),
("Install the LMFDB locally", "https://github.com/LMFDB/lmfdb/blob/main/GettingStarted.md")],
bread=[("Access options", " ")],
)

@api_page.route("/")
def index(show_hidden=False):
databases = get_database_info(show_hidden)
title = "Database"
title = "API"
return render_template("api.html", **locals())

@api_page.route("/all")
Expand Down
54 changes: 54 additions & 0 deletions lmfdb/api/templates/database_options.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{% extends 'homepage.html' %}

{% block content %}

<div style="max-width:700px;">
<p>
There are three options available to access large amounts of data from the LMFDB.
</p>
</div>

<h3>Downloads from search result pages</h3>

<div style="max-width:700px;">
{{KNOWL_INC('intro.download_search')}}
</div>

<h3>The API</h3>

<div style="max-width:700px;">
{{KNOWL_INC('intro.api')}}
</div>

<h3>Direct SQL connection</h3>

<div style="max-width:700px;">
{{KNOWL_INC('intro.direct_sql')}}
</div>

<h3>SQL Mirror Access</h3>

<table class="ntdata">
<tr>
<th>host</th>
<td>devmirror.lmfdb.xyz</td>
</tr>
<tr>
<th>port</th>
<td>5432</td>
</tr>
<tr>
<th>dbname</th>
<td>lmfdb</td>
</tr>
<tr>
<th>user</th>
<td>lmfdb</td>
</tr>
<tr>
<th>password</th>
<td>lmfdb</td>
</tr>
</table>

{% endblock %}
16 changes: 14 additions & 2 deletions lmfdb/characters/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
TextBox, CountBox, parse_bool, parse_ints, search_wrap, raw_typeset_poly,
StatsDisplay, totaler, proportioners, comma, flash_warning, Downloader)
from lmfdb.utils.interesting import interesting_knowls
from lmfdb.utils.search_parsing import parse_range3
from lmfdb.utils.search_columns import SearchColumns, MathCol, LinkCol, CheckCol, ProcessedCol, MultiProcessedCol
from lmfdb.characters.utils import url_character
from lmfdb.characters.TinyConrey import ConreyCharacter
Expand Down Expand Up @@ -176,15 +177,26 @@ def common_parse(info, query):
primitive_orbit = class_to_int(parts_of_label[1])+1
if db.char_dirichlet.count({'modulus':primitive_modulus,'is_primitive':True,'orbit':primitive_orbit}) == 0:
raise ValueError("Primitive character orbit not found")
if 'conductor' in query and query['conductor'] != primitive_modulus:
def incompatible(query):
cond = query.get('conductor')
if cond is None:
return False
if isinstance(cond, int):
return cond != primitive_modulus
opts = parse_range3(info['conductor'], lower_bound=1, upper_bound=ORBIT_MAX_MOD)
for opt in opts:
if (isinstance(opt, int) and opt == primitive_modulus or
not isinstance(opt, int) and opt[0] <= primitive_modulus <= opt[1]):
return False
return True
if incompatible(query):
query["primitive_orbit"] = 0
else:
query["conductor"] = primitive_modulus
query["primitive_orbit"] = primitive_orbit
except ValueError:
flash_error("%s is not the label of a primitive character in the database", info['inducing'])
raise ValueError
return redirect(url_for(".render_DirichletNavigation"))
if 'parity' in info:
parity = info['parity']
if parity == 'even':
Expand Down
37 changes: 22 additions & 15 deletions lmfdb/elliptic_curves/elliptic_curve.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,21 +398,6 @@ def url_for_label(label):
modm_no_negative = r'(\d+)\.(\d+)\.(\d+)-(\d+)\.([a-z]+)\.(\d+)\.(\d+)'
modm_image_label_regex = re.compile(modm_full + "|" + modm_not_computed + "|" + modm_no_negative)

class EC_download(Downloader):
table = db.ec_curvedata
title = "Elliptic curves"
inclusions = {
"curve": (
["ainvs"],
{
"sage": 'curve = EllipticCurve(out["ainvs"])',
"magma": 'curve := EllipticCurve(out`ainvs);',
"gp": 'curve = ellinit(mapget(out, "ainvs"));',
"oscar": 'curve = EllipticCurve(out["ainvs"])',
}
)
}

def ec_postprocess(res, info, query):
labels = [rec["lmfdb_label"] for rec in res]
mwgens = {rec["lmfdb_label"]: rec["gens"] for rec in db.ec_mwbsd.search({"lmfdb_label":{"$in":labels}}, ["lmfdb_label", "gens"])}
Expand Down Expand Up @@ -493,6 +478,28 @@ def modify_query(self, info, query):
if info.get("optimal") == "on":
query["__one_per__"] = "lmfdb_iso"

inclusions = {
"curve": (
["ainvs"],
{
"sage": 'curve = EllipticCurve(out["ainvs"])',
"magma": 'curve := EllipticCurve(out`ainvs);',
"gp": 'curve = ellinit(mapget(out, "ainvs"));',
"oscar": 'curve = EllipticCurve(out["ainvs"])',
}
)
}

def postprocess(self, row, info, query):
# Unfortunately, I don't see a good way to batch these database calls
# given how the download iterator works
if "mwgens" in info.get("showcol", "").split("."):
gens = db.ec_mwbsd.lucky({"lmfdb_label": row["lmfdb_label"]}, "gens")
if gens is not None:
gens = [(ZZ(a)/c, ZZ(b)/c) for (a,b,c) in gens]
row["mwgens"] = gens
return row

@search_wrap(table=db.ec_curvedata,
title='Elliptic curve search results',
err_title='Elliptic curve search input error',
Expand Down
83 changes: 83 additions & 0 deletions lmfdb/galois_groups/transitive_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -936,3 +936,86 @@ def get_aliases():
aliases[ky].append(nt)
aliases[ky].sort()
return aliases

# These dictionaries are used by number field parsing code when user requests a dihedral galois group
dihedral_gal = {
2: "2T1",
4: "4T2",
6: "6T2",
8: "8T4",
10: "10T2",
12: "12T3",
14: "14T2",
16: "16T13",
18: "18T5",
20: "20T4",
22: "22T2",
24: "24T13",
26: "26T2",
28: "28T4",
30: "30T3",
32: "32T31",
34: "34T2",
36: "36T10",
38: "38T2",
40: "40T12",
42: "42T5",
44: "44T4",
46: "46T2",
}

dihedral_ngal = {
3: "3T2",
4: "4T3",
5: "5T2",
6: "6T3",
7: "7T2",
8: "8T6",
9: "9T3",
10: "10T3",
11: "11T2",
12: "12T12",
13: "13T2",
14: "14T3",
15: "15T2",
16: "16T56",
17: "17T2",
18: "18T13",
19: "19T2",
20: "20T10",
21: "21T5",
22: "22T3",
23: "23T2",
24: "24T34",
25: "25T4",
26: "26T3",
27: "27T8",
28: "28T10",
29: "29T2",
30: "30T14",
31: "31T2",
32: "32T374",
33: "33T3",
34: "34T3",
35: "35T4",
36: "36T47",
37: "37T2",
38: "38T3",
39: "39T4",
40: "40T46",
41: "41T2",
42: "42T11",
43: "43T2",
44: "44T9",
45: "45T4",
46: "46T3",
47: "47T2",
}

multiquad = {
2: "2T1",
4: "4T2",
8: "8T3",
16: "16T4",
32: "32T39",
}
3 changes: 2 additions & 1 deletion lmfdb/homepage/index_boxes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ links:
- [ 0,0 ]
---
title: Announcements
content: <p>The first <a href="https://icerm.brown.edu/events/sc-23-lucant/">LuCaNT</a> conference took place July 10-14, 2023 at <a href="https://icerm.brown.edu">ICERM</a>. Thanks to everyone who attended! Conference proceedings will be published soon.</p>
content: <p>Continuing the <a href="https://lucant.org">LuCaNT</a> series of conferences after a successful first <a href="https://icerm.brown.edu/events/sc-23-lucant/">LuCaNT</a> at <a href="https://icerm.brown.edu">ICERM</a>, we invite you to join us at <a href="https://icerm.brown.edu/program/topical_workshop/tw-25-lucant/">LuCaNT 2025</a> with a <a href="https://lucant.org/submissions/">call for papers</a>!<p>
<p>Check out the recently updated <a href="/Groups/Abstract/">abstract groups</a> database [beta].</p>
<p>Check out the new <a href="/ModularCurve/Q/">modular curves</a> database [beta].</p>
image: announcements
Expand All @@ -31,6 +31,7 @@ content: <ul>
<li><a href="https://github.com/LMFDB/lmfdb">Source code repository</li>
<li><a href="/management">Editorial board</li>
<li><a href="/acknowledgment">Acknowledgments</li>
<li><a href="/acknowledgement/activities">Activities</li>
</ul>
control: 0
links:
Expand Down
2 changes: 1 addition & 1 deletion lmfdb/homepage/sidebar.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@
type: single
heading:
title: Database
url_for: "API.index"
url_for: "API.options"
type: knowl

...
4 changes: 2 additions & 2 deletions lmfdb/knowledge/knowl.py
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ def needs_review(self, days):
tdelta = timedelta(days=days)
time = now - tdelta
fields = ['id'] + self._default_fields
selecter = SQL("SELECT {0} FROM (SELECT DISTINCT ON (id) {0} FROM kwl_knowls WHERE timestamp >= %s AND status >= %s AND (type = 1 OR type = -1) ORDER BY id, timestamp DESC) knowls WHERE status = 0 ORDER BY timestamp DESC").format(SQL(", ").join(map(Identifier, fields)))
selecter = SQL("SELECT {0} FROM (SELECT DISTINCT ON (id) {0} FROM kwl_knowls WHERE timestamp >= %s AND status >= %s AND type >= -1 AND type <= 1 ORDER BY id, timestamp DESC) knowls WHERE status = 0 ORDER BY timestamp DESC").format(SQL(", ").join(map(Identifier, fields)))
L = self._safe_execute(selecter, [time, 0])
knowls = [Knowl(rec[0], data=dict(zip(fields, rec))) for rec in L]

Expand Down Expand Up @@ -738,7 +738,7 @@ def is_locked(self, knowlid, delta_min=10):
tdelta = timedelta(minutes=delta_min)
time = now - tdelta
selecter = SQL("SELECT username, timestamp FROM kwl_locks WHERE id = %s AND timestamp >= %s LIMIT 1")
L = self._execute(selecter, (knowlid, time))
L = self._safe_execute(selecter, (knowlid, time))
if L:
return dict(zip(["username", "timestamp"], L[0]))

Expand Down
Loading

0 comments on commit 9d8ae91

Please sign in to comment.