Skip to content

feat: magnification latent from raw fluxes, no magzero (arc phase 7a) - #813

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/magnification-latent-raw-flux
Oct 30, 2026
Merged

Jammy2211 merged 1 commit into
mainfrom
feature/magnification-latent-raw-flux

Conversation

@Jammy2211

Copy link
Copy Markdown
Collaborator

Summary

Arc phase 7a (epic cluster-strong-lensing). The magnification latent was the ratio of the two µJy latents, so it was NaN unless the Analysis had a magzero — even though the ratio is dimensionless. It is now total_lensed_source_flux / total_source_flux (the raw-flux latents), identical for positive fluxes because the µJy conversion is one common factor. Works for light-profile and pixelized sources as before.

Human ruling 2026-10-30: keep it opt-in (default false) and explain latents only where results are explained (config/latent.yaml + autolens_workspace guides/results/latent_variables.py), not in every workspace script. Per-image point / area magnifications are not latents (the number of images differs between lenses); latent.yaml says so.

API Changes

magnification latent no longer needs magzero (its magzero argument is now optional and unused); default unchanged (off).
See full details below.

Test Plan

  • New test_magnification_needs_no_magzero: finite with magzero=None, equals the raw-flux ratio, same value with magzero=25; fails without the change
  • test_autolens/analysis/test_latent.py: 38 passed; full PyAutoLens suite 1016 passed, 1 xfailed
Full API Changes (for automation & release notes)

Changed Behaviour

  • autolens.analysis.latent.magnification(fit, magzero=None, xp=np) — computed from total_lensed_source_flux / total_source_flux; was total_lensed_source_flux_mujy / total_source_flux_mujy (NaN without magzero)

Heart at ship: STALE (release validation stale: source moved since rehearsal).

Generated by the PyAutoLabs agent workflow.

🤖 Generated with Claude Code

magnification = total_lensed_source_flux / total_source_flux (was the µJy
latents, NaN without magzero; identical for positive fluxes since the µJy
factor cancels). Stays default false (opt-in); latent.yaml documents it and
why per-image magnifications are not latents.

Closes #812

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Jammy2211

Copy link
Copy Markdown
Collaborator Author

Workspace PR: PyAutoLabs/autolens_workspace#609

@Jammy2211
Jammy2211 merged commit a20c002 into main Oct 30, 2026
4 checks passed
@Jammy2211
Jammy2211 deleted the feature/magnification-latent-raw-flux branch October 30, 2026 16:27
@pyautolabs-bot pyautolabs-bot Bot removed the pending-release PR queued for the next release build label Nov 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant