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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ Results are framed by **astronomy instrument** (HST, Euclid, JWST, …) rather t

| Cell | Instrument | Platform | Inversion path | Step-sum total | PyAutoLens version |
|------|------------|----------|----------------|----------------|--------------------|
| `cluster/image_plane` | — | local_cpu_fp64 | dense (mapping) | 4.99 s | v2026.7.6.649 |
| `cluster/source_plane` | — | local_cpu_fp64 | dense (mapping) | 3.1 ms | v2026.7.6.649 |
| `cluster/image_plane` | — | local_cpu_fp64 | dense (mapping) | 10.25 s | v2026.7.23.1 |
| `cluster/source_plane` | — | local_cpu_fp64 | dense (mapping) | 4.5 ms | v2026.7.23.1 |
| `datacube/delaunay` | alma_high | hpc_a100_fp64 | dense (mapping) | — | v2026.7.6.649 |
| `datacube/delaunay` | alma_high | hpc_a100_mp | dense (mapping) | — | v2026.7.6.649 |
| `datacube/inversion` | alma_high | hpc_a100_fp64 | dense (mapping) | — | v2026.7.6.649 |
Expand Down
42 changes: 42 additions & 0 deletions results/breakdown/cluster/image_plane_breakdown_v2026.7.23.1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"autolens_version": "2026.7.23.1",
"device": {
"backend": "cpu",
"device": "cpu:0",
"xla_flags": "--xla_disable_hlo_passes=constant_folding --xla_gpu_autotune_level=0",
"omp_num_threads": "1",
"cpu_count": 8
},
"configuration": {
"n_systems": 2,
"n_images_total": 6,
"n_planes": 3,
"n_mass_profiles": 13,
"likelihood": "image_plane (FitPositionsImagePairRepeat)",
"solver_grid": "200x200 @ 0.7 arcsec",
"solver_pixel_scale_precision": 0.01
},
"steps": {
"1 source centres (back-trace)": 0.012421499995980412,
"2.point_0 PointSolver solve (z=1.0)": 0.583530866667085,
"2.point_1 PointSolver solve (z=2.0)": 0.3362739999987146,
"3.point_0 FitPositionsImagePairRepeat (fit total)": 4.335666899998614,
"3.point_1 FitPositionsImagePairRepeat (fit total)": 4.9793703999966965,
"4.point_0 FitPositionsImagePairRepeatSolved (fit total, analytic \u03b2*)": 4.929903699994611,
"4.point_1 FitPositionsImagePairRepeatSolved (fit total, analytic \u03b2*)": 4.697616299999936
},
"total_step_by_step": 10.24726366665709,
"log_likelihood": -51694194.57333637,
"solved": {
"fit_positions_cls": "FitPositionsImagePairRepeatSolved",
"log_likelihood": -11022861.386487413,
"total_step_solved_extra": 9.627519999994547,
"delta_per_system_s": {
"point_0": 0.594236799995997,
"point_1": -0.2817540999967605
},
"delta_total_s": 0.3124826999992365,
"free_centre_params_removed_per_point_source": 2,
"free_centre_params_removed_total": 4
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
44 changes: 44 additions & 0 deletions results/breakdown/cluster/source_plane_breakdown_v2026.7.23.1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"autolens_version": "2026.7.23.1",
"device": {
"backend": "cpu",
"device": "cpu:0",
"xla_flags": "--xla_disable_hlo_passes=constant_folding --xla_gpu_autotune_level=0",
"omp_num_threads": "1",
"cpu_count": 8
},
"configuration": {
"n_systems": 2,
"n_images_total": 6,
"n_planes": 3,
"n_mass_profiles": 13,
"likelihood": "source_plane (FitPositionsSource)"
},
"steps": {
"1.0 ray-trace point_0 (3 img)": 0.0010556900000665338,
"1.1 ray-trace point_1 (3 img)": 0.0008053600002313032,
"2.0 magnification (hessian) point_0": 0.0017030000002705493,
"2.1 magnification (hessian) point_1": 0.0008346700000402052,
"3.0 weighted chi2 point_0": 3.963000053772703e-05,
"3.1 weighted chi2 point_1": 3.6700000055134294e-05,
"4 log-likelihood assembly": 6.836999964434653e-05,
"5.point_0 FitPositionsSource (fit total)": 0.06679779999831226,
"5.point_1 FitPositionsSource (fit total)": 0.047178799999528565,
"6.point_0 FitPositionsSourceSolved (fit total, analytic \u03b2*)": 0.07292849999794271,
"6.point_1 FitPositionsSourceSolved (fit total, analytic \u03b2*)": 0.061136500000429805
},
"total_step_by_step": 0.004543420000845799,
"reference_log_likelihood": -40135921.91112596,
"solved": {
"fit_positions_cls": "FitPositionsSourceSolved",
"log_likelihood": -4230422.577412412,
"total_step_solved_extra": 0.24804159999621334,
"delta_per_system_s": {
"point_0": 0.006130699999630451,
"point_1": 0.01395770000090124
},
"delta_total_s": 0.020088400000531692,
"free_centre_params_removed_per_point_source": 2,
"free_centre_params_removed_total": 4
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"autolens_version": "2026.7.23.1",
"dataset": "simple",
"fit_positions_cls": "FitPositionsImagePairAllSolved",
"configuration": {
"observed_image_positions": 4,
"positions_noise_sigma": 0.05,
"free_parameters": 5,
"free_parameters_image_plane_plain": 8,
"free_parameters_delta": -3,
"point_source_profile": "PointSolved"
},
"eager_per_call": 0.27352910000045083,
"eager_log_likelihood": 7.743201200876817,
"full_pipeline_single_jit": 0.03859548000036739,
"full_pipeline_log_likelihood": 7.743201200876806,
"repeat_fit_class_steady_state": {
"fit_positions_cls": "FitPositionsImagePairRepeatSolved",
"per_call": 0.047158170000329847,
"log_likelihood": 4.981203683959095
},
"vmap": {
"batch_size": 3,
"batch_time": 0.084402240000054,
"per_call": 0.028134080000018002,
"speedup_vs_single_jit": 1.4
},
"pinned_expected": 7.743201200876817,
"pinned_drift": []
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"autolens_version": "2026.7.23.1",
"dataset": "simple",
"fit_positions_cls": "FitPositionsSourceSolved",
"configuration": {
"observed_image_positions": 4,
"positions_noise_sigma": 0.05,
"free_parameters": 5,
"free_parameters_source_plane_plain": 8,
"free_parameters_delta": -3,
"point_source_profile": "PointSolved"
},
"eager_per_call": 0.010933216999983415,
"eager_log_likelihood": 0.5986504297427313,
"full_pipeline_jits": true,
"full_pipeline_single_jit": 0.0003383600000233855,
"full_pipeline_log_likelihood": 0.5986504555530896,
"vmap": {
"batch_size": 3,
"batch_time": 0.00035438000049907713,
"per_call": 0.00011812666683302571,
"speedup_vs_single_jit": 2.9
},
"pinned_expected": 0.5986504555530896,
"pinned_drift": []
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
59 changes: 59 additions & 0 deletions results/simulators/cluster_summary_v2026.7.23.1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"autolens_version": "2026.7.23.1",
"type": "cluster",
"configuration": {
"imaging_grid_shape": [
1000,
1000
],
"solver_grid_shape": [
800,
800
],
"pixel_scales": 0.1,
"n_sources": 2,
"source_redshifts": [
1.0,
2.0
],
"n_lens_galaxies": 2,
"host_halo_mass_at_200": 1995262314968882.8,
"over_sample_sub_sizes": [
32,
8,
2
]
},
"phases": {
"setup_imaging_grid": 0.19407199999841396,
"setup_galaxies": 0.0070218999971984886,
"setup_tracer": 1.0099996870849282e-05,
"register_pytrees": 0.4693944999962696,
"solver_build": 0.04854239999986021,
"jitted_solve_src0_lower": 17.030921099998523,
"jitted_solve_src0_compile": 1.4590461999978288,
"jitted_solve_src0_first_call": 6.7645153000048595,
"jitted_solve_src0_steady_x3": 23.18231260000175,
"jitted_solve_src1_lower": 1.540487199999916,
"jitted_solve_src1_compile": 1.6291495000041323,
"jitted_solve_src1_first_call": 7.864882399997441,
"jitted_solve_src1_steady_x3": 18.281628900003852,
"setup_psf_simulator": 0.000654800001939293,
"via_tracer_from": 141.9311338999978,
"output_fits": 0.11429460000363179,
"output_scaling_galaxies_csv": 0.0002865999995265156,
"output_point_datasets": 0.00159939999866765,
"output_json": 0.017929999994521495
},
"diagnostic": {
"solver_compile_total_s": 3.088195700001961,
"solver_lower_total_s": 18.57140829999844,
"solver_steady_total_s": 41.4639415000056,
"via_tracer_from_s": 141.9311338999978,
"compile_vs_via_tracer_ratio": 0.02
},
"positions_found": {
"src0": 3,
"src1": 3
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
105 changes: 103 additions & 2 deletions scripts/cluster/likelihood_breakdown/image_plane.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,24 @@
one-off compile stays at minutes; production precision (0.001") multiplies
the triangle fan-out, not the structure of the breakdown.

Solved-variant addendum (issue #657 phase 3)
----------------------------------------------

Alongside the plain ``FitPositionsImagePairRepeat`` steps above, step 4
times ``FitPositionsImagePairRepeatSolved`` per system against a second
tracer (``tracer_solved``) built with zero-parameter ``al.ps.PointSolved``
profiles in place of ``al.ps.Point`` — the analytic β* extension in the
image plane. This is a glafic-style extension, **not** a result from
Lombardi 2024 (arXiv:2406.15280); see ``autolens/point/fit/solved.py``'s
module docstring for the attribution split. Step 2's forward-solve is
unaffected by (and shared with) the solved variant: ``solver.solve()`` only
consumes an explicit ``source_plane_coordinate`` + the tracer's mass
profiles, never the point-source profile type, so only step 3's non-solved
fit and step 4's solved fit differ. A printed summary reports the
per-system fit-total runtime delta (step 4 − step 3), to be weighed against
the 2 fewer free centre parameters per point source (4 total for this
cluster's 2 systems) a full model-fit would otherwise sample.

Output
------

Expand Down Expand Up @@ -215,6 +233,17 @@ def jit_profile(func, label, *args, n_repeats=10):
n_mass_profiles = len(main_lens_galaxies) + len(scaling_galaxies) + 1
print(f"Tracer: {len(tracer.planes)} planes, {n_mass_profiles} mass components.")

# Solved-variant tracer: `al.ps.PointSolved` (0 params) in place of `al.ps.Point`
# (2 centre params) per source, name-paired the same way. Used only by step 4
# below — step 1/2's back-trace + forward-solve don't read the point-source
# profile type at all, so they're shared as-is with the plain-path tracer.
source_galaxies_solved = [
al.Galaxy(redshift=float(d.redshift), **{d.name: al.ps.PointSolved()}) for d in dataset_list
]
tracer_solved = al.Tracer(
galaxies=main_lens_galaxies + scaling_galaxies + [host_halo_galaxy] + source_galaxies_solved
)

positions_list = [np.atleast_2d(np.asarray(d.positions)) for d in dataset_list]
plane_indices = [
tracer.plane_index_via_redshift_from(redshift=float(d.redshift)) for d in dataset_list
Expand Down Expand Up @@ -308,6 +337,7 @@ def solve(source_plane_coordinate, _z=float(dataset.redshift)):
# pairing overhead is the difference from step 2).
# ---------------------------------------------------------------------------
fit_log_likelihoods = []
fit_total_times = []
for dataset in dataset_list:
with timer.section(f"step3_fit_total_{dataset.name}"):
fit = al.FitPositionsImagePairRepeat(
Expand All @@ -318,13 +348,64 @@ def solve(source_plane_coordinate, _z=float(dataset.redshift)):
solver=solver,
)
fit_log_likelihoods.append(float(fit.log_likelihood))
fit_total_times.append(timer.records[-1][1])
likelihood_steps.append(
(f"3.{dataset.name} FitPositionsImagePairRepeat (fit total)", timer.records[-1][1])
)

log_likelihood_total = sum(fit_log_likelihoods)
print(f"\n image-plane log likelihood (sum over systems): {log_likelihood_total:.6e}")

# ---------------------------------------------------------------------------
# Step 4 — FitPositionsImagePairRepeatSolved per system: same forward-solve
# machinery as steps 2/3, but the source-plane centre driving the
# PointSolver is analytically solved (β*, tensor-weighted precision) rather
# than read from a centre-bearing profile. `tracer_solved` carries
# `PointSolved` in place of `Point` so the *Solved fit class's name-pairing
# finds a parameter-free profile — pairing a centre-bearing profile with a
# *Solved fit class raises `PointProfileMismatchException`. Eager-timed,
# matching step 3's pattern (the fit re-runs the forward-solve internally).
# ---------------------------------------------------------------------------
_n_plain_steps = len(likelihood_steps)

fit_solved_log_likelihoods = []
fit_solved_total_times = []
for dataset in dataset_list:
with timer.section(f"step4_fit_total_solved_{dataset.name}"):
fit_solved = al.FitPositionsImagePairRepeatSolved(
name=dataset.name,
data=dataset.positions,
noise_map=dataset.positions_noise_map,
tracer=tracer_solved,
solver=solver,
)
fit_solved_log_likelihoods.append(float(fit_solved.log_likelihood))
fit_solved_total_times.append(timer.records[-1][1])
likelihood_steps.append(
(
f"4.{dataset.name} FitPositionsImagePairRepeatSolved (fit total, analytic β*)",
timer.records[-1][1],
)
)

log_likelihood_total_solved = sum(fit_solved_log_likelihoods)
print(
f"\n image-plane log likelihood, solved (sum over systems): {log_likelihood_total_solved:.6e}"
)

print("\n--- Solved vs plain: per-system fit-total runtime delta ---")
delta_per_system = {}
for dataset, plain_t, solved_t in zip(dataset_list, fit_total_times, fit_solved_total_times):
delta = solved_t - plain_t
pct = 100.0 * delta / plain_t if plain_t else float("nan")
delta_per_system[dataset.name] = delta
print(
f" {dataset.name}: plain={plain_t:.6f}s solved={solved_t:.6f}s "
f"delta={delta:+.6f}s ({pct:+.1f}%) -- vs -2 free centre params/source if sampled"
)
delta_total = sum(delta_per_system.values())
print(f" TOTAL delta across {len(dataset_list)} systems: {delta_total:+.6f}s")


# ===================================================================
# PART B — Summary + artifacts
Expand All @@ -344,12 +425,23 @@ def solve(source_plane_coordinate, _z=float(dataset.redshift)):
print(f"PER-STEP BREAKDOWN SUMMARY — CLUSTER IMAGE-PLANE — v{al_version}")
print("=" * 70)
max_label = max(len(label) for label, _ in likelihood_steps)
# `step_total` stays scoped to the original (plain-path) decomposition —
# steps 1-3 — so it keeps meaning "sum of the decomposed likelihood steps"
# for the README auto-table / XLA-fusion-caveat comparison against
# full_pipeline_single_jit. Step 4 (solved) is an additive extra
# measurement, not part of that decomposition; its cost is reported
# separately as `total_step_solved_extra`.
step_total = 0.0
step_total_solved_extra = 0.0
for i, (label, per_call) in enumerate(likelihood_steps, 1):
print(f" {i:>2}. {label:<{max_label}} {per_call:>12.6f} s")
step_total += per_call
if i <= _n_plain_steps:
step_total += per_call
else:
step_total_solved_extra += per_call
print("-" * 70)
print(f" {'TOTAL (step-by-step)':<{max_label}} {step_total:>12.6f} s")
print(f" {'TOTAL (step-by-step, plain)':<{max_label}} {step_total:>12.6f} s")
print(f" {'TOTAL (solved, extra)':<{max_label}} {step_total_solved_extra:>12.6f} s")
print("=" * 70)

breakdown_summary = {
Expand All @@ -367,6 +459,15 @@ def solve(source_plane_coordinate, _z=float(dataset.redshift)):
"steps": {label: per_call for label, per_call in likelihood_steps},
"total_step_by_step": step_total,
"log_likelihood": log_likelihood_total,
"solved": {
"fit_positions_cls": "FitPositionsImagePairRepeatSolved",
"log_likelihood": log_likelihood_total_solved,
"total_step_solved_extra": step_total_solved_extra,
"delta_per_system_s": delta_per_system,
"delta_total_s": delta_total,
"free_centre_params_removed_per_point_source": 2,
"free_centre_params_removed_total": 2 * len(dataset_list),
},
}

dict_path, chart_path = resolve_output_paths(
Expand Down
Loading
Loading