Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,10 @@ _(median)_: the steady median (>= 5 warm calls, median of individually timed cal
| `imaging/rectangular` | jwst | `jax_gpu_dense_fp64` | hpc_a100 | dense (mapping) | 75.4 ms | v2026.8.17.1 |
| `imaging/rectangular` | jwst | `jax_gpu_sparse_fp64` | hpc_a100 | sparse (w-tilde) | 125.6 ms | v2026.8.17.1 |
| `imaging/rectangular/light_fixed` | hst | `jax_gpu_dense_fp64` | hpc_a100 | dense (mapping) | — | v2026.8.17.1 |
| `imaging/rectangular/source_pixels_784` | hst | `numba_cpu_sparse_fp64` | hpc_ral_cpu | sparse (numba) | 628.9 ms | v2026.8.17.1 |
| `imaging/rectangular/source_pixels_784` | hst | `jax_cpu_sparse_fp64` | hpc_a100 | sparse (w-tilde) | 1.34 s | v2026.8.17.1 |
| `imaging/rectangular/source_pixels_784` | hst | `jax_gpu_dense_fp64` | hpc_a100 | dense (mapping) | 32.3 ms | v2026.8.17.1 |
| `imaging/rectangular/source_pixels_784` | hst | `jax_gpu_sparse_fp64` | hpc_a100 | sparse (w-tilde) | 49.9 ms | v2026.8.17.1 |
| `interferometer/delaunay` | alma | `jax_cpu_sparse_fp64_wtilde` | local_laptop | sparse (w-tilde) | 4.18 s | v2026.8.17.1 |
| `interferometer/delaunay` | alma | `jax_cpu_sparse_fp64_wtilde` | hpc_ral_cpu | sparse (w-tilde) | 2.88 s | v2026.8.17.1 |
| `interferometer/delaunay` | alma | `numba_cpu_sparse_fp64_wtilde` | hpc_ral_cpu | sparse (numba) | 1.27 s | v2026.8.17.1 |
Expand Down
46 changes: 35 additions & 11 deletions _production_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,9 @@ def preset_for(cell_family: str, instrument: str, variant: str = "production"):
STANDARD_RECT_PIXELS_YX = 35


def standard_size_preset(cell_family: str, instrument: str) -> ProductionPreset:
def standard_size_preset(
cell_family: str, instrument: str, source_pixels: int | None = None
) -> ProductionPreset:
"""The production preset of ``cell_family`` at ``instrument``, at the standard size.

``--standard-size`` (phase 2 of the likelihood-lifecycle epic) measures every instrument at
Expand All @@ -569,6 +571,11 @@ def standard_size_preset(cell_family: str, instrument: str) -> ProductionPreset:
and ``size_override``. Whenever anything changed, ``size_override`` says why, and the cells
skip the preset's pinned value and production witness (both describe the preset as
recorded). HST Delaunay is already 1250 + 30, so it comes back unchanged.

``source_pixels`` (rectangular only) builds the same cell at a declared size variant
instead (``catalogue/size_variants.json``, ``--standard-size --source-pixels``; #468): an
exact square, e.g. 784 = 28 x 28, the hst production preset's own mesh. None, or the
standard 1225, is the standard size.
"""
from dataclasses import replace

Expand All @@ -581,18 +588,24 @@ def standard_size_preset(cell_family: str, instrument: str) -> ProductionPreset:
variant="production",
)
if base.mesh_kind == "delaunay":
if source_pixels is not None and source_pixels != STANDARD_HILBERT_PIXELS:
raise ValueError("Delaunay has no declared size variant; it runs at the standard size")
resized = base.hilbert_pixels != STANDARD_HILBERT_PIXELS
size = {"hilbert_pixels": STANDARD_HILBERT_PIXELS}
what = (
f"Hilbert {base.hilbert_pixels} -> {STANDARD_HILBERT_PIXELS} (+{base.edge_pixels} edge)"
)
else:
resized = base.rect_pixels_yx != STANDARD_RECT_PIXELS_YX
size = {"rect_pixels_yx": STANDARD_RECT_PIXELS_YX}
what = (
f"rectangular {base.rect_pixels_yx}x{base.rect_pixels_yx} -> "
f"{STANDARD_RECT_PIXELS_YX}x{STANDARD_RECT_PIXELS_YX}"
)
side = STANDARD_RECT_PIXELS_YX
if source_pixels is not None and source_pixels != STANDARD_RECT_PIXELS_YX**2:
side = int(round(source_pixels**0.5))
if side * side != source_pixels:
raise ValueError(
f"a rectangular size variant must be a square, not {source_pixels}"
)
resized = base.rect_pixels_yx != side
size = {"rect_pixels_yx": side}
what = f"rectangular {base.rect_pixels_yx}x{base.rect_pixels_yx} -> {side}x{side}"
reasons = [
"production data (human ruling 2026-10-24): subtracted S/N adapt image, uncapped "
"over-sampling cut"
Expand All @@ -603,13 +616,22 @@ def standard_size_preset(cell_family: str, instrument: str) -> ProductionPreset:
f"no {instrument} production reference: borrows the "
f"{STANDARD_SIZE_REFERENCE_INSTRUMENT} preset {base.name!r} with the {instrument} dataset"
)
if resized:
variant_size = size.get("rect_pixels_yx", STANDARD_RECT_PIXELS_YX) != STANDARD_RECT_PIXELS_YX
if variant_size:
reasons.append(
f"declared size variant (catalogue/size_variants.json, #468): "
f"{size['rect_pixels_yx'] ** 2} source pixels"
+ (f", {what}" if resized else f", the preset's own {what.split(' -> ')[1]} mesh")
)
elif resized:
reasons.append(f"standard size (human ruling 2026-10-23): {what}")
note = "; ".join(reasons)
return replace(
base,
production_data=True,
name=f"{base.name}_standard" + (f"_{instrument}" if borrowed else ""),
name=f"{base.name}_standard"
+ (f"_n{size['rect_pixels_yx'] ** 2}" if variant_size else "")
+ (f"_{instrument}" if borrowed else ""),
provenance=f"{base.provenance} — {note}",
size_override=note,
**size,
Expand Down Expand Up @@ -1314,6 +1336,7 @@ def standard_jax_cell(
memo: str = "off",
use_mixed_precision: bool = False,
rect_mesh_cls=None,
source_pixels: int | None = None,
):
"""Everything a JAX standard-size cell takes from the production preset, built once.

Expand All @@ -1322,11 +1345,12 @@ def standard_jax_cell(
(Delaunay family, else None), ``n_source_pixels``, ``model``, ``instance`` (the first draw of
the preset's seeded iid sequence — the numba cells' instance 0), ``settings``,
``memo_provenance``, ``positions_likelihood_list``, ``reg_scheme``, ``reg_provenance`` and
``record`` (what the row stores as ``configuration.production_preset``).
``record`` (what the row stores as ``configuration.production_preset``). ``source_pixels``:
a declared rectangular size variant (:func:`standard_size_preset`), else the standard size.
"""
import autolens as al

preset = standard_size_preset(STANDARD_FAMILY[variant], instrument)
preset = standard_size_preset(STANDARD_FAMILY[variant], instrument, source_pixels)
if preset.mesh_kind == "delaunay":
grid = production_image_mesh_grid(dataset, adapt_image, preset, mask_radius)
n_source_pixels = int(grid.shape[0])
Expand Down
48 changes: 44 additions & 4 deletions _profile_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,10 @@ def _profile_parser() -> argparse.ArgumentParser:
"built, and the catalogue's size rule matches on the requested count. Unlike "
"``--source-pixels`` the row is a canonical cell: no ``_n<N>`` suffix, no scan "
"placement. Cells without a source mesh (MGE) ignore it. Exclusive with "
"``--source-pixels``."
"``--source-pixels``, except a declared size variant "
"(``catalogue/size_variants.json``, e.g. rectangular 784 = 28x28, the SLaM "
"production preset): ``--standard-size --source-pixels 784`` builds the same "
"production cell at that count."
),
)

Expand Down Expand Up @@ -402,6 +405,12 @@ def parse_profile_cli(default_config_name: str | None = None, *, argv=None) -> P
for f in STANDARD_SIZE_EXCLUSIVE
if any(t == f or t.startswith(f + "=") for t in tokens)
]
# A declared size variant is the one ``--source-pixels`` that is not a silent
# replacement: it names a production-preset size beside the standard one (#468).
if args.source_pixels is not None and args.source_pixels in {
n for counts in declared_size_variants().values() for n in counts
}:
given = [f for f in given if f != "--source-pixels"]
if given:
parser.error(
f"--standard-size builds the production cell and would silently replace "
Expand Down Expand Up @@ -441,21 +450,52 @@ def parse_profile_cli(default_config_name: str | None = None, *, argv=None) -> P
def requested_source_pixels(cli: ProfileCLI, variant: str) -> int | None:
"""The source-pixel count a cell of likelihood ``variant`` is asked to build, or None.

``--standard-size`` -> :data:`STANDARD_SOURCE_PIXELS` of ``variant``; else ``--source-pixels``;
else None (the cell keeps its own fiducial). Rectangular cells build the nearest square
``--standard-size`` -> :data:`STANDARD_SOURCE_PIXELS` of ``variant``, or its declared size
variant when ``--source-pixels`` names one (:func:`declared_size_variants`; any other count
raises); else ``--source-pixels``; else None (the cell keeps its own fiducial). Rectangular cells build the nearest square
(``round(sqrt(N))`` per side; 1225 -> 35x35 exactly); Delaunay-family cells build N Hilbert
vertices (the standard-size production cells add the preset's 30 zeroed edge points).
"""
if getattr(cli, "standard_size", False):
try:
return STANDARD_SOURCE_PIXELS[variant]
standard = STANDARD_SOURCE_PIXELS[variant]
except KeyError:
raise ValueError(
f"--standard-size has no standard count for variant {variant!r}"
) from None
if cli.source_pixels is None:
return standard
if cli.source_pixels not in declared_size_variants().get(variant, ()):
raise ValueError(
f"--standard-size --source-pixels {cli.source_pixels}: not a declared size "
f"variant of {variant!r} ({SIZE_VARIANTS})"
)
return cli.source_pixels
return cli.source_pixels


#: The declared size variants (``{variant: [source pixels]}``, imaging): the one copy is
#: ``catalogue/size_variants.json``, which the catalogue keys and labels by as well.
SIZE_VARIANTS = "catalogue/size_variants.json"


def declared_size_variants(root: Path | None = None) -> dict[str, tuple[int, ...]]:
"""``{likelihood variant: (source-pixel counts,)}`` from :data:`SIZE_VARIANTS` ({} if absent).

Only ``imaging`` variants: every ``--standard-size`` cell is an imaging cell.
"""
import json

path = (Path(__file__).resolve().parent if root is None else Path(root)) / SIZE_VARIANTS
if not path.is_file():
return {}
out: dict[str, tuple[int, ...]] = {}
for entry in json.loads(path.read_text())["variants"]:
if entry["dataset_type"] == "imaging":
out[entry["variant"]] = (*out.get(entry["variant"], ()), int(entry["source_pixels"]))
return out


def rectangular_side(requested: int | None, fiducial: int) -> int:
"""The rectangular mesh side for a requested source-pixel count (``fiducial`` when None)."""
import math
Expand Down
6 changes: 6 additions & 0 deletions catalogue/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ The rules live in [`catalogue_lifecycle.py`](../scripts/misc/tooling/catalogue_l
- **Coverage**: `coverage_matrix.py` renders [`dashboard/coverage.md`](../dashboard/coverage.md)
(current / stale / superseded / missing per likelihood x class x measurement; a cell
covered only by a `size_fallback` row is missing). Re-run it after `build_catalogue.py`.
- **size variants** ([size_variants.json](size_variants.json), autolens_profiling#468): a
declared source-pixel count measured beside the standard size (rectangular 784 = 28x28, the
SLaM inference mesh). Its rows live in the cell's `source_pixels_<n>/` folder, are keyed on
their own (`regime: source_pixels_<n>`) and are `current` there beside the standard row, with
a `size_variant` limitation and no `size_fallback` note. Coverage and the trend dashboard
read only the standard rows.
- **measured_at**: a row with no recorded timestamp is dated by the UTC day its file was first
committed to git (an upper bound on the measurement date), from
[measured_at_first_commit.json](measured_at_first_commit.json), and says so in
Expand Down
14 changes: 14 additions & 0 deletions catalogue/size_variants.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"schema": "size-variants",
"version": 1,
"note": "Declared source-pixel sizes measured beside the standard size (human size rule 2026-10-23: rectangular 35x35 = 1225, Delaunay 1250). A size variant is the standard-size production cell (--standard-size) built at the declared count instead (--standard-size --source-pixels <n>); its rows live in the cell's source_pixels_<n>/ folder, are keyed on their own (regime source_pixels_<n>) and are current there beside the standard row, without a size_fallback note. Coverage and the trend dashboard stay standard-only. Read by _profile_cli.py (which counts --source-pixels may join --standard-size) and scripts/misc/tooling/catalogue_lifecycle.py (keys and status).",
"variants": [
{
"dataset_type": "imaging",
"variant": "rectangular",
"source_pixels": 784,
"reason": "the rectangular mesh the SLaM inference runs use (mesh_shape 28x28 = 784; the standard-size production cell is otherwise unchanged: hst_rect_adapt 32x32 resized to 28x28 instead of 35x35), so the autolens_inference wall-time rows pair with a profiling runtime row of the same size (autolens_inference#47 size_match)",
"ruling": "human 2026-10-26, autolens_profiling#468 (\"Profile 28² too\")"
}
]
}
2 changes: 1 addition & 1 deletion dashboard/catalogue.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dashboard/catalogue/setups.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dashboard/catalogue/shards/00774c3f82b98f7c6d84.json

Large diffs are not rendered by default.

Loading
Loading