From 88250ab7d0218f077eca1b5441de2dc60babe3fb Mon Sep 17 00:00:00 2001 From: AndrewVSutherland Date: Mon, 20 May 2024 15:02:08 -0400 Subject: [PATCH 01/14] fix sorts --- lmfdb/modular_curves/main.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lmfdb/modular_curves/main.py b/lmfdb/modular_curves/main.py index f38ba3e438..40d5b0a997 100644 --- a/lmfdb/modular_curves/main.py +++ b/lmfdb/modular_curves/main.py @@ -962,11 +962,12 @@ def __init__(self): [CPlabel], ] + _default = ["level", "index", "genus", "coarse_class_num", "coarse_level", "coarse_num", "fine_num"] sorts = [ - ("", "level", ["level", "index", "genus", "label"]), - ("index", "index", ["index", "level", "genus", "label"]), - ("genus", "genus", ["genus", "level", "index", "label"]), - ("rank", "rank", ["rank", "genus", "level", "index", "label"]), + ("level", "level", _default), + ("index", "index", ["index"] + _default), + ("genus", "genus", ["genus"] + _default), + ("rank", "rank", ["rank"] + _default), ] null_column_explanations = { 'simple': False, From 652edcde43fe13889c23a2a97393be2a72c2bdfe Mon Sep 17 00:00:00 2001 From: AndrewVSutherland Date: Mon, 20 May 2024 15:09:07 -0400 Subject: [PATCH 02/14] fix sorts --- lmfdb/modular_curves/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lmfdb/modular_curves/main.py b/lmfdb/modular_curves/main.py index 40d5b0a997..f2201e8b4d 100644 --- a/lmfdb/modular_curves/main.py +++ b/lmfdb/modular_curves/main.py @@ -964,7 +964,7 @@ def __init__(self): _default = ["level", "index", "genus", "coarse_class_num", "coarse_level", "coarse_num", "fine_num"] sorts = [ - ("level", "level", _default), + ("", "level", _default), ("index", "index", ["index"] + _default), ("genus", "genus", ["genus"] + _default), ("rank", "rank", ["rank"] + _default), From 16b57f830f866f5d1595d65706ce27bbc3d35acc Mon Sep 17 00:00:00 2001 From: David Roe Date: Mon, 20 May 2024 15:09:09 -0400 Subject: [PATCH 03/14] Remove duplicate columns from modular curve sorts --- lmfdb/modular_curves/main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lmfdb/modular_curves/main.py b/lmfdb/modular_curves/main.py index 40d5b0a997..f0c7156a5b 100644 --- a/lmfdb/modular_curves/main.py +++ b/lmfdb/modular_curves/main.py @@ -965,8 +965,8 @@ def __init__(self): _default = ["level", "index", "genus", "coarse_class_num", "coarse_level", "coarse_num", "fine_num"] sorts = [ ("level", "level", _default), - ("index", "index", ["index"] + _default), - ("genus", "genus", ["genus"] + _default), + ("index", "index", ["index", "level"] + _default[2:]), + ("genus", "genus", ["genus", "level", "index"] + _default[3:]), ("rank", "rank", ["rank"] + _default), ] null_column_explanations = { From d940cfae254fec033ec4ee634193204acc173104 Mon Sep 17 00:00:00 2001 From: David Roe Date: Mon, 20 May 2024 15:35:48 -0400 Subject: [PATCH 04/14] Move genus earlier in rank sort order --- lmfdb/modular_curves/main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lmfdb/modular_curves/main.py b/lmfdb/modular_curves/main.py index f4155681c4..976815388a 100644 --- a/lmfdb/modular_curves/main.py +++ b/lmfdb/modular_curves/main.py @@ -966,8 +966,8 @@ def __init__(self): sorts = [ ("", "level", _default), ("index", "index", ["index", "level"] + _default[2:]), - ("genus", "genus", ["genus", "level", "index"] + _default[3:]), - ("rank", "rank", ["rank"] + _default), + ("genus", "genus", ["genus"] + _default[:2] + _default[3:]), + ("rank", "rank", ["rank", "genus"] + default[:2] + _default[3:]), ] null_column_explanations = { 'simple': False, From d935073f4152c7bb0e1976bd1039f8df5806f1ab Mon Sep 17 00:00:00 2001 From: David Lowry-Duda Date: Mon, 20 May 2024 19:03:14 -0400 Subject: [PATCH 05/14] Typo correction I run a small typo checker and correct what shows up. --- Postgres_FAQ.md | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/Postgres_FAQ.md b/Postgres_FAQ.md index 25c656ebfa..81d4a86347 100644 --- a/Postgres_FAQ.md +++ b/Postgres_FAQ.md @@ -217,7 +217,7 @@ Developer configuration Adding and modifying data ------------------------- -Note that you need editor priviledges to add, delete or modify data. +Note that you need editor privileges to add, delete or modify data. 1. How do I create a new table? @@ -231,14 +231,14 @@ Note that you need editor priviledges to add, delete or modify data. `lookup` method, typically the `label` column if there is one. You should provide a default sort order if your table will be the primary table behind a section of the website (auxiliary tables may - not need a sort order). You also need to proved a short description + not need a sort order). You also need to provide a short description of the table, which will be shown in the banner when its contents are viewed on the database section of the website, as well as short descriptions of each of its columns which will be shown when users view the schema for the table in the database section (these will be used to populate knowls that can then be edited by you or anyone with an LMFDB account can edit, they don't need to be perfect). - + You can also give columns for an extra table (see the question two prior), using the same format as the second argument. Finally, you can specify the order of columns, which will be used by the `copy_from` and `copy_to` @@ -290,7 +290,7 @@ Note that you need editor priviledges to add, delete or modify data. ``` This column will be NULL for existing rows. - + 1. How do I delete a column? If you want to delete a column to an existing table, use the @@ -299,7 +299,7 @@ Note that you need editor priviledges to add, delete or modify data. ```python sage: db.test_table.drop_column("bad_primes") ``` - + 1. How do I insert new data? There are two main methods for adding data to a table. @@ -586,7 +586,7 @@ Statistics in which case the function will only compute counts of at least the threshold. You can also specify a dictionary of constraints (in fact, an arbitrary search query), in which case only rows - satsifying the query will be considered. + satisfying the query will be considered. For example, consider the following data. ``` @@ -634,11 +634,11 @@ Statistics Create a statistics object inheriting from `StatsDisplay` in `lmfdb/display_stats.py`. It should have attributes - - `short_summary` (which can be displayed at the top of your browse page), + - `short_summary` (which can be displayed at the top of your browse page), - `summary` (which will be displayed at the top of the statistics page), - `table` (the postgres table on which statistics are computed), - `baseurl_func` (the function giving your browse page, e.g. `'.index'`), - - `stat_list` (a list of dictionaries giving the statistics to be displayed; + - `stat_list` (a list of dictionaries giving the statistics to be displayed; - `'cols'`, `'row_title'` and `'knowl'` are required arguments, - and other optional arguments allow you to adjust the default behavior) @@ -648,6 +648,7 @@ Statistics using the `display_stats.html` template, passing your object in as the `info` parameter. Note that `DisplayStats` inherits from Sage's `UniqueRepresentation, so it will only be created once. + Sage's `UniqueRepresentation`, so it will only be created once. 1. How do I display statistics from multiple tables on one page? @@ -714,7 +715,7 @@ Data Validation utilities for writing such queries, such as `check_values`, `check_iff`, `check_count`. You can also write the query directly and use `_run_query`. If you want to run queries that check - consistency accross multiple tables, see the `check_crosstable` + consistency across multiple tables, see the `check_crosstable` utility functions. For fast queries you can use the `@overall` decorator; if your query takes longer than about a minute, you may want to use the `@overall_long` decorator instead. From e201d96a6abf1cb9a638fec4d1c2d236d7938138 Mon Sep 17 00:00:00 2001 From: David Lowry-Duda Date: Mon, 20 May 2024 19:28:36 -0400 Subject: [PATCH 06/14] backend doesn't exist anymore Also, constraints are not in `psycodict.table.py` instead of `psycodict.database.py` (and we had said `backends/database.py`). --- Postgres_FAQ.md | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/Postgres_FAQ.md b/Postgres_FAQ.md index 81d4a86347..7b1c4d3a5c 100644 --- a/Postgres_FAQ.md +++ b/Postgres_FAQ.md @@ -13,8 +13,10 @@ Changes 1. What's an overview of the changes? - There is a new folder, `lmfdb/backend/`, containing the - main components of the new interface to the Postgres database. + The main components of the interface to the Postgres database are + in [psycodict](https://github.com/roed314/psycodict/), which is the LMFDB + now depends on. This might be moved to the lmfdb organization later. + Postgres is a mature, open-source implementation of SQL. One of the main differences is that Postgres is a strongly-typed relational database, meaning that every table has a schema with @@ -48,11 +50,6 @@ Changes advantage of this restructuring to add some consistency to the naming scheme. -1. Why do I still see messages about mongo when I start the LMFDB? - - Classical modular forms are still using mongo. We're working on - revising them to use postgres, but in the mean time we're still - connecting to a mongo database. Database Interface ------------------ @@ -105,7 +102,7 @@ Database Interface ``` The first argument is a dictionary specifying the query (in a style - similar to what you're used to from MongoDB, but with custom + similar to what you may be used to from MongoDB, but with custom operators like `$contains` that are translated to Postgres expressions). You can project in order to obtain only a certain set of columns, and provide limits, offsets and custom sort orders. @@ -115,8 +112,8 @@ Database Interface The `info` argument is a dictionary that will be updated with various data that is commonly needed by templates populated by the - search functions. For more details, see the documentation in the folder - `lmfdb/backend`. + search functions. For more details, see the documentation at + https://github.com/roed314/psycodict/. 1. What if I only want a single entry, for example with a specified label? @@ -159,7 +156,7 @@ Database Interface If use `db._execute`, make sure to wrap your statements in the SQL class from `psycopg2.sql` (you can also import it from `psycodict`). You can see lots of examples of this - paradigm in `lmfdb/backend/`. + paradigm in https://github.com/roed314/psycodict/ ```python sage: from psycodict import db, SQL @@ -683,18 +680,15 @@ Data Validation 1. How can I add consistency checks for data in the LMFDB? One option is to add constraints to your table. To do so, use the - `create_constraint` method in `database.py`. You can see the - current constraints using `list_constraints`. + `create_constraint` method in `psycodict.table.py`. You can see the current + constraints using `list_constraints`. There are three supported types of constraints. The simplest is `not null`, which checks that a specified column is filled in for every row in the table. The second is `unique`, which checks that a column or set of columns is unique across all rows of a table. The final options is `check`, which runs an arbitrary SQL function - on a set of rows. We are building up a library of SQL functions - for use in this way; you can see them in `backend/utils.psql`. - Once written, these functions need to be added to postgres, at - which point they can be used in checks. + on a set of rows. Note that constraints are checked whenever a row is added or updated, so if they are complicated it will impose a speed penalty From 41fe81ae351688d9a17f0deb4e1769e17eec9c9e Mon Sep 17 00:00:00 2001 From: David Lowry-Duda Date: Mon, 20 May 2024 19:29:44 -0400 Subject: [PATCH 07/14] Markdown formatting nonsense --- Postgres_FAQ.md | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Postgres_FAQ.md b/Postgres_FAQ.md index 7b1c4d3a5c..d76a78a87e 100644 --- a/Postgres_FAQ.md +++ b/Postgres_FAQ.md @@ -603,9 +603,9 @@ Statistics ``` If you added stats for column `A`, it would record that there are - four instances of 2, three of 1, two of 5 and one each of 3, 4, and - 8. It would also record the minimum value (1), the maximum value - (6), the average (3), and the total (12 rows). + four instances of 2, three of 1, two of 5 and one each of 3, 4, + and 8. It would also record the minimum value (1), the maximum value (6), + the average (3), and the total (12 rows). If you specified a threshold of 3, it would only record that there are four instances of 2 and three of 1. Now the minimum and @@ -618,8 +618,8 @@ Statistics statistics. If you want to group values into buckets (for example, class - numbers of number fields split into ranges like 1 < h <= 10 and 10 - < h <= 100 and 100 < h <= 1000), you can use the + numbers of number fields split into ranges like `1 < h <= 10` and `10 + < h <= 100` and `100 < h <= 1000`), you can use the `add_bucketed_counts` method. If you want to add counts for many sets of columns (in order to @@ -644,7 +644,6 @@ Statistics collect the relevant statistics. You should also create a view using the `display_stats.html` template, passing your object in as the `info` parameter. Note that `DisplayStats` inherits from - Sage's `UniqueRepresentation, so it will only be created once. Sage's `UniqueRepresentation`, so it will only be created once. 1. How do I display statistics from multiple tables on one page? From 3c78a9d85cdce3f3c89462f11e886e3ed5c33bb6 Mon Sep 17 00:00:00 2001 From: David Lowry-Duda Date: Mon, 20 May 2024 19:36:56 -0400 Subject: [PATCH 08/14] Add example of creating a table with extras In particular, this shows what the name of the additional `kwarg` is to include the extras. --- Postgres_FAQ.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/Postgres_FAQ.md b/Postgres_FAQ.md index d76a78a87e..5463465995 100644 --- a/Postgres_FAQ.md +++ b/Postgres_FAQ.md @@ -262,6 +262,34 @@ Note that you need editor privileges to add, delete or modify data. search_order=['label', 'N', 'log_N', 'num_factors', 'mersenne_n', 'odd']) ``` + If there were `extras` (suppose we put `log_N` and `num_factors` in + `extras`), the table creation could look like + + ```python + db.create_table(name='perfect_numbers2', + search_columns={'numeric': ['N','mersenne_n'], + 'text': ['label'], + 'bool': ['odd'], + }, + label_col='label', + sort=['label'], + table_description='perfect numbers', + extra_columns={'double precision': ['log_N'], + 'int': ['num_factors'], + }, + col_description={'N': "Integer value of the perfect number", + 'log_N': "Natural logarithm of $N$", + 'num_factors': "The number of factors of the perfect number.", + 'mersenne_n': "For odd perfect numbers, the positive integer n for which $N=2^{n-1}(2^n-1)$, where $2^n-1$ is prime. Set to zero for even perfect numbers", + 'label': "Label of the perfect number", + 'odd': "True if $N$ is odd, false otherwise.", + }, + search_order=['label', 'N', 'log_N', 'num_factors', 'mersenne_n', 'odd']) + ``` + + In `perfect_numbers2`, the columns `log_N` and `num_factors` are now not in + the search columns. + Once this table exists, you can access it via the object `db.perfect_numers`, which is of type `PostgresTable`. From d66ef56b4ee8c18f1bb86701649694222f4fff81 Mon Sep 17 00:00:00 2001 From: David Lowry-Duda Date: Mon, 20 May 2024 19:38:51 -0400 Subject: [PATCH 09/14] Correct location of where to learn about extras --- Postgres_FAQ.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Postgres_FAQ.md b/Postgres_FAQ.md index 5463465995..10f36baeaa 100644 --- a/Postgres_FAQ.md +++ b/Postgres_FAQ.md @@ -236,10 +236,10 @@ Note that you need editor privileges to add, delete or modify data. be used to populate knowls that can then be edited by you or anyone with an LMFDB account can edit, they don't need to be perfect). - You can also give columns for an extra table (see the question two prior), - using the same format as the second argument. Finally, you can specify - the order of columns, which will be used by the `copy_from` and `copy_to` - functions by default. + You can also give columns for an extra table (see the question "What is an + `extra_table`?" later in this document), using the same format as the second + argument. Finally, you can specify the order of columns, which will be used + by the `copy_from` and `copy_to` functions by default. ```python db.create_table(name='perfect_numbers', From 248f8ddbda01d0151e3d1fae5bef0de3979842c7 Mon Sep 17 00:00:00 2001 From: roed314 Date: Mon, 20 May 2024 20:15:57 -0400 Subject: [PATCH 10/14] Update Postgres_FAQ.md --- Postgres_FAQ.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Postgres_FAQ.md b/Postgres_FAQ.md index 10f36baeaa..a82592cdfc 100644 --- a/Postgres_FAQ.md +++ b/Postgres_FAQ.md @@ -14,7 +14,7 @@ Changes 1. What's an overview of the changes? The main components of the interface to the Postgres database are - in [psycodict](https://github.com/roed314/psycodict/), which is the LMFDB + in [psycodict](https://github.com/roed314/psycodict/), which the LMFDB now depends on. This might be moved to the lmfdb organization later. Postgres is a mature, open-source implementation of SQL. One of @@ -707,7 +707,7 @@ Data Validation 1. How can I add consistency checks for data in the LMFDB? One option is to add constraints to your table. To do so, use the - `create_constraint` method in `psycodict.table.py`. You can see the current + `create_constraint` method in `psycodict/table.py`. You can see the current constraints using `list_constraints`. There are three supported types of constraints. The simplest is From cb0f7b425a4f21ff127d73464f66eb1d89572858 Mon Sep 17 00:00:00 2001 From: David Roe Date: Mon, 20 May 2024 20:18:25 -0400 Subject: [PATCH 11/14] Fix typo --- lmfdb/modular_curves/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lmfdb/modular_curves/main.py b/lmfdb/modular_curves/main.py index 976815388a..136695f212 100644 --- a/lmfdb/modular_curves/main.py +++ b/lmfdb/modular_curves/main.py @@ -967,7 +967,7 @@ def __init__(self): ("", "level", _default), ("index", "index", ["index", "level"] + _default[2:]), ("genus", "genus", ["genus"] + _default[:2] + _default[3:]), - ("rank", "rank", ["rank", "genus"] + default[:2] + _default[3:]), + ("rank", "rank", ["rank", "genus"] + _default[:2] + _default[3:]), ] null_column_explanations = { 'simple': False, From e65f038be7dc8a02ebc2ea8353450aef2e7dc380 Mon Sep 17 00:00:00 2001 From: AndrewVSutherland Date: Wed, 22 May 2024 18:44:57 -0400 Subject: [PATCH 12/14] fix #5979 --- lmfdb/local_fields/main.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/lmfdb/local_fields/main.py b/lmfdb/local_fields/main.py index f4140beb74..e22320c0c8 100644 --- a/lmfdb/local_fields/main.py +++ b/lmfdb/local_fields/main.py @@ -587,15 +587,15 @@ def reliability(): class LFSearchArray(SearchArray): noun = "field" - sorts = [("", "prime", ['p', 'n', 'c', 'label']), - ("n", "degree", ['n', 'p', 'c', 'label']), - ("c", "discriminant exponent", ['c', 'p', 'n', 'label']), - ("e", "ramification index", ['e', 'n', 'p', 'c', 'label']), - ("f", "residue degree", ['f', 'n', 'p', 'c', 'label']), - ("gal", "Galois group", ['n', 'galT', 'p', 'c', 'label']), - ("u", "Galois unramified degree", ['u', 'n', 'p', 'c', 'label']), - ("t", "Galois tame degree", ['t', 'n', 'p', 'c', 'label']), - ("s", "top slope", ['top_slope', 'p', 'n', 'c', 'label'])] + sorts = [("", "prime", ['p', 'n', 'c', 'num']), + ("n", "degree", ['n', 'p', 'c', 'num']), + ("c", "discriminant exponent", ['c', 'p', 'n', 'num']), + ("e", "ramification index", ['e', 'n', 'p', 'c', 'num']), + ("f", "residue degree", ['f', 'n', 'p', 'c', 'num']), + ("gal", "Galois group", ['n', 'galT', 'p', 'c', 'num']), + ("u", "Galois unramified degree", ['u', 'n', 'p', 'c', 'num']), + ("t", "Galois tame degree", ['t', 'n', 'p', 'c', 'num']), + ("s", "top slope", ['top_slope', 'p', 'n', 'c', 'num'])] jump_example = "2.4.6.7" jump_egspan = "e.g. 2.4.6.7" jump_knowl = "lf.search_input" From 8097c73474463f2fd627c7242fa67f47e1a69e14 Mon Sep 17 00:00:00 2001 From: AndrewVSutherland Date: Thu, 23 May 2024 17:14:21 -0400 Subject: [PATCH 13/14] remove dependencies on mf_hecke_newspace_traces --- lmfdb/classical_modular_forms/main.py | 36 +++++---------------- lmfdb/classical_modular_forms/test_cmf.py | 3 +- lmfdb/classical_modular_forms/test_cmf2.py | 5 --- lmfdb/verify/mf/mf_hecke_newspace_traces.py | 8 ----- lmfdb/verify/mf/mf_newspaces.py | 19 +---------- 5 files changed, 10 insertions(+), 61 deletions(-) delete mode 100644 lmfdb/verify/mf/mf_hecke_newspace_traces.py diff --git a/lmfdb/classical_modular_forms/main.py b/lmfdb/classical_modular_forms/main.py index edba379353..adf30c8f7c 100644 --- a/lmfdb/classical_modular_forms/main.py +++ b/lmfdb/classical_modular_forms/main.py @@ -182,8 +182,6 @@ def index(): return dimension_space_search(info) elif search_type == 'Traces': return trace_search(info) - elif search_type == 'SpaceTraces': - return space_trace_search(info) else: flash_error("Invalid search type; if you did not enter it in the URL please report") info["stats"] = CMF_stats() @@ -486,9 +484,9 @@ def mf_data(label): ocode = db.mf_newspaces.lookup(label, "hecke_orbit_code") if ocode is None: return abort(404, f"{label} not in database") - tables = ["mf_newspaces", "mf_subspaces", "mf_newspace_portraits", "mf_hecke_newspace_traces"] - labels = [label, label, label, ocode] - label_cols = ["label", "label", "label", "hecke_orbit_code"] + tables = ["mf_newspaces", "mf_subspaces", "mf_newspace_portraits"] + labels = [label, label, label] + label_cols = ["label", "label", "label"] title = f"Newspace data - {label}" elif len(slabel) == 2: tables = ["mf_gamma1", "mf_gamma1_portraits"] @@ -891,7 +889,7 @@ def newform_search(info, query): newform_parse(info, query) set_info_funcs(info) -def trace_postprocess(res, info, query, spaces=False): +def trace_postprocess(res, info, query): if res: if info.get('view_modp') == 'reductions': q = int(info['an_modulo']) @@ -899,7 +897,7 @@ def trace_postprocess(res, info, query, spaces=False): q = None hecke_codes = [mf['hecke_orbit_code'] for mf in res] trace_dict = defaultdict(dict) - table = db.mf_hecke_newspace_traces if spaces else db.mf_hecke_traces + table = db.mf_hecke_traces for rec in table.search({'n':{'$in': info['Tr_n']}, 'hecke_orbit_code':{'$in':hecke_codes}}, projection=['hecke_orbit_code', 'n', 'trace_an'], sort=[]): if q: trace_dict[rec['hecke_orbit_code']][rec['n']] = (rec['trace_an'] % q) @@ -962,22 +960,6 @@ def trace_search(info, query): process_an_constraints(info, query) set_info_funcs(info) -@search_wrap(template="cmf_space_trace_search_results.html", - table=db.mf_newspaces, - title='Newspace search results', - err_title='Newspace search input error', - shortcuts={'jump':jump_box, - 'download':CMF_download().download_multiple_space_traces}, - projection=['label', 'dim', 'hecke_orbit_code', 'weight'], - postprocess=space_trace_postprocess, - bread=get_search_bread, - learnmore=learnmore_list) -def space_trace_search(info, query): - set_Trn(info, query) - newspace_parse(info, query) - process_an_constraints(info, query) - set_info_funcs(info) - def set_rows_cols(info, query): """ Sets weight_list and level_list, which are the row and column headers @@ -1454,8 +1436,7 @@ class CMFSearchArray(SearchArray): _sort_forms = [(name, disp, sord + ['hecke_orbit']) for (name, disp, sord) in _sort] sorts = {'': _sort_forms, 'Traces': _sort_forms, - 'Spaces': _sort_spaces, - 'SpaceTraces': _sort_spaces} + 'Spaces': _sort_spaces} jump_example="3.6.a.a" jump_egspan="e.g. 3.6.a.a, 55.3.d or 20.5" jump_knowl="cmf.search_input" @@ -1746,7 +1727,7 @@ def main_array(self, info): if info is None: return self.browse_array search_type = info.get('search_type', info.get('hst', '')) - if search_type in ['Spaces', 'SpaceTraces']: + if search_type == 'Spaces': return self.space_array elif search_type == 'SpaceDimensions': return self.sd_array @@ -1761,7 +1742,6 @@ def search_types(self, info): ('Random', 'Random form')] spaces = [('Spaces', 'List of spaces'), ('SpaceDimensions', 'Dimension table'), - ('SpaceTraces', 'Traces table'), ('RandomSpace', 'Random')] if info is None: return basic @@ -1788,7 +1768,7 @@ def html(self, info=None): # We need to override html to add the trace inputs layout = [self.hidden_inputs(info), self.main_table(info), self.buttons(info)] st = self._st(info) - if st in ["Traces", "SpaceTraces"]: + if st in ["Traces"]: trace_table = self._print_table(self.traces_array, info, layout_type="box") layout.append(trace_table) return "\n".join(layout) diff --git a/lmfdb/classical_modular_forms/test_cmf.py b/lmfdb/classical_modular_forms/test_cmf.py index 2c0617fe31..5000b13bce 100644 --- a/lmfdb/classical_modular_forms/test_cmf.py +++ b/lmfdb/classical_modular_forms/test_cmf.py @@ -555,8 +555,7 @@ def test_underlying_data(self): data = self.tc.get('/ModularForm/GL2/Q/holomorphic/data/13.2.e').get_data(as_text=True) assert ('mf_newspaces' in data and 'num_forms' in data and 'mf_subspaces' in data and 'sub_mult' in data - and 'mf_newspace_portraits' in data and "data:image/png;base64" in data - and 'mf_hecke_newspace_traces' in data and 'trace_an' in data) + and 'mf_newspace_portraits' in data and "data:image/png;base64" in data) data = self.tc.get('/ModularForm/GL2/Q/holomorphic/data/13.2.e.a').get_data(as_text=True) assert ('mf_newforms' in data and 'field_disc_factorization' in data and diff --git a/lmfdb/classical_modular_forms/test_cmf2.py b/lmfdb/classical_modular_forms/test_cmf2.py index c8cd64e362..114cefc619 100644 --- a/lmfdb/classical_modular_forms/test_cmf2.py +++ b/lmfdb/classical_modular_forms/test_cmf2.py @@ -132,11 +132,6 @@ def test_download_search(self): for elt in ["20.5.b", "20.5.d", "20.5.f"]: assert elt in page.get_data(as_text=True) - page = self.tc.get('/ModularForm/GL2/Q/holomorphic/?Submit=sage&download=1&query=%7B%27dim%27%3A+%7B%27%24gte%27%3A+2000%7D%2C+%27num_forms%27%3A+%7B%27%24exists%27%3A+True%7D%7D&search_type=SpaceTraces', follow_redirects=True) - assert 'Error: We limit downloads of traces to' in page.get_data(as_text=True) - page = self.tc.get('/ModularForm/GL2/Q/holomorphic/?Submit=sage&download=1&query=%7B%27dim%27%3A+%7B%27%24gte%27%3A+30000%2C%27%24lte%27%3A30600%7D%2C%27num_forms%27%3A+%7B%27%24exists%27%3A+True%7D%7D&search_type=SpaceTraces', follow_redirects=True) - assert '863.2.c' in page.get_data(as_text=True) - def test_random(self): r""" Test that we don't hit any error on a random newform diff --git a/lmfdb/verify/mf/mf_hecke_newspace_traces.py b/lmfdb/verify/mf/mf_hecke_newspace_traces.py deleted file mode 100644 index 68c9f1fe86..0000000000 --- a/lmfdb/verify/mf/mf_hecke_newspace_traces.py +++ /dev/null @@ -1,8 +0,0 @@ - -from lmfdb import db -from .mf import TracesChecker - -class mf_hecke_newspace_traces(TracesChecker): - table = db.mf_hecke_newspace_traces - base_table = db.mf_newspaces - base_constraint = {'traces':{'$exists':True}} diff --git a/lmfdb/verify/mf/mf_newspaces.py b/lmfdb/verify/mf/mf_newspaces.py index db28feeafa..dc33070024 100644 --- a/lmfdb/verify/mf/mf_newspaces.py +++ b/lmfdb/verify/mf/mf_newspaces.py @@ -6,7 +6,7 @@ from lmfdb.lmfdb_database import db, SQL from .mf import MfChecker, check_analytic_conductor -from ..verification import overall, overall_long, fast, slow, accumulate_failures +from ..verification import overall, fast, slow, accumulate_failures @cached_function @@ -234,23 +234,6 @@ def check_hecke_orbit_dims_sorted(self): # TIME about 2s return self.check_sorted('hecke_orbit_dims') - ### mf_hecke_newspace_traces ### - @overall_long - def check_traces_count(self): - """ - there should be exactly 1000 records in mf_hecke_traces for each record in mf_newspaces with traces set - """ - # TIME about 800s - return self.check_crosstable_count('mf_hecke_newspace_traces', 1000, 'hecke_orbit_code', constraint={'traces':{'$exists':True}}) - - @overall_long - def check_traces_match(self): - """ - check that traces[n] matches trace_an in mf_hecke_newspace_traces - """ - # TIME about 1000s - return self.check_crosstable_aggregate('mf_hecke_newspace_traces', 'traces', 'hecke_orbit_code', 'trace_an', sort=['n'], truncate=1000, constraint={'traces':{'$exists':True}}) - ### mf_subspaces ### @overall def check_oldspace_decomposition_totaldim(self): From b2713c37c4776268dcfb85ca43d8a19c226f0f32 Mon Sep 17 00:00:00 2001 From: AndrewVSutherland Date: Thu, 23 May 2024 18:37:11 -0400 Subject: [PATCH 14/14] remove dependency on mf_subspaces --- lmfdb/classical_modular_forms/main.py | 6 ++-- lmfdb/classical_modular_forms/test_cmf.py | 1 - lmfdb/verify/mf/mf_newspaces.py | 10 ------ lmfdb/verify/mf/mf_subspaces.py | 41 ----------------------- lmfdb/verify/verification.py | 1 - 5 files changed, 3 insertions(+), 56 deletions(-) delete mode 100644 lmfdb/verify/mf/mf_subspaces.py diff --git a/lmfdb/classical_modular_forms/main.py b/lmfdb/classical_modular_forms/main.py index adf30c8f7c..bcd08f4fb1 100644 --- a/lmfdb/classical_modular_forms/main.py +++ b/lmfdb/classical_modular_forms/main.py @@ -484,9 +484,9 @@ def mf_data(label): ocode = db.mf_newspaces.lookup(label, "hecke_orbit_code") if ocode is None: return abort(404, f"{label} not in database") - tables = ["mf_newspaces", "mf_subspaces", "mf_newspace_portraits"] - labels = [label, label, label] - label_cols = ["label", "label", "label"] + tables = ["mf_newspaces", "mf_newspace_portraits"] + labels = [label, label] + label_cols = ["label", "label"] title = f"Newspace data - {label}" elif len(slabel) == 2: tables = ["mf_gamma1", "mf_gamma1_portraits"] diff --git a/lmfdb/classical_modular_forms/test_cmf.py b/lmfdb/classical_modular_forms/test_cmf.py index 5000b13bce..93a77ab99f 100644 --- a/lmfdb/classical_modular_forms/test_cmf.py +++ b/lmfdb/classical_modular_forms/test_cmf.py @@ -554,7 +554,6 @@ def test_underlying_data(self): data = self.tc.get('/ModularForm/GL2/Q/holomorphic/data/13.2.e').get_data(as_text=True) assert ('mf_newspaces' in data and 'num_forms' in data - and 'mf_subspaces' in data and 'sub_mult' in data and 'mf_newspace_portraits' in data and "data:image/png;base64" in data) data = self.tc.get('/ModularForm/GL2/Q/holomorphic/data/13.2.e.a').get_data(as_text=True) diff --git a/lmfdb/verify/mf/mf_newspaces.py b/lmfdb/verify/mf/mf_newspaces.py index dc33070024..3b14a485dc 100644 --- a/lmfdb/verify/mf/mf_newspaces.py +++ b/lmfdb/verify/mf/mf_newspaces.py @@ -234,16 +234,6 @@ def check_hecke_orbit_dims_sorted(self): # TIME about 2s return self.check_sorted('hecke_orbit_dims') - ### mf_subspaces ### - @overall - def check_oldspace_decomposition_totaldim(self): - """ - check that summing sub_dim * sub_mult over rows with a given label gives dim of S_k^old(N,chi) - """ - # TIME about 20s - # from mf_subspaces - return self.check_crosstable_dotprod('mf_subspaces', 'cusp_dim', 'label', ['sub_mult', 'sub_dim']) - ### mf_newspace_portraits ### @overall def check_portraits_count(self): diff --git a/lmfdb/verify/mf/mf_subspaces.py b/lmfdb/verify/mf/mf_subspaces.py deleted file mode 100644 index 92a0f7b078..0000000000 --- a/lmfdb/verify/mf/mf_subspaces.py +++ /dev/null @@ -1,41 +0,0 @@ - -from lmfdb import db -from .mf import SubspacesChecker -from ..verification import overall - -class mf_subspaces(SubspacesChecker): - table = db.mf_subspaces - label = ['level', 'weight', 'char_orbit_label'] - uniqueness_constraints = [['label', 'sub_label']] - - @overall - def check_sub_label(self): - """ - check that sub_label matches matches sub_level, weight, sub_char_orbit_index - """ - # TIME about 2s - return self.check_string_concatenation('sub_label', ['sub_level', 'weight', 'sub_char_orbit_label']) - - @overall - def check_char_orbit_label(self): - """ - check that char_orbit_label matches char_orbit_index - """ - # TIME about 20s - return self.check_letter_code('char_orbit_index', 'char_orbit_label') - - @overall - def check_sub_char_orbit_label(self): - """ - check that sub_char_orbit_label matches sub_char_orbit_index - """ - # TIME about 20s - return self.check_letter_code('sub_char_orbit_index', 'sub_char_orbit_label') - - @overall - def check_sub_dim(self): - """ - check that sub_dim = dim S_k^new(sub_level, sub_chi) - """ - # TIME about 20s - return self.check_crosstable('mf_newspaces', 'sub_dim', 'sub_label', 'dim', 'label') diff --git a/lmfdb/verify/verification.py b/lmfdb/verify/verification.py index 678c926f50..dbe83bc8c6 100644 --- a/lmfdb/verify/verification.py +++ b/lmfdb/verify/verification.py @@ -635,7 +635,6 @@ def check_crosstable_dotprod(self, other_table, col1, join1, col2, join2=None, c """ Check that col1 is the sum of the product of the values in the columns of col2 over rows of other_table with self.table.join1 = other_table.join2. - There are some peculiarities of this method, resulting from its application to mf_subspaces. col1 is allowed to be a pair, in which case the difference col1[0] - col1[1] will be compared. col2 does not take value col1 as a default, since they are playing different roles.