Skip to content

planet: radius is inactive where nothing reads it (review 2.8.17) - #608

Merged
jdeast merged 2 commits into
masterfrom
fix/2.8.17-planet-radius-mulens
Nov 18, 2026
Merged

jdeast merged 2 commits into
masterfrom
fix/2.8.17-planet-radius-mulens

Conversation

@jdeast

@jdeast jdeast commented Nov 18, 2026 •

Copy link
Copy Markdown
Owner

What

A microlensing planet is read through its mass (the lens's q). Nothing in a 2L1S likelihood reads its radius, but Planet.register_parameters declared planet.radius as a sampled leaf on every planet anyway. The result was one dead, prior-only dimension per lens planet, plus R_P, rho_P and log g_P table rows that were pure prior. This is review item 2.8.17. Ruling (JDE 2026-11-18): "planet.radius shouldn't enter the manifest for microlensing-only fits."

planet.radius is now a parameter of a fit only where something in the likelihood reads it. Everywhere else it is inactive: no raw coordinate, no prior or potential, no table row, no trace report.

  • Planet.radius_consumers(system) is the single readership predicate. Its readers are:
    • a transit block, an rvinstrument rm: key, or dopptom. All three read p = R_P/R_*, and each marks every planet.
    • the Chen & Kipping relation on that planet. This relation is on by default in RV- and astrometry-only fits, so those fits keep their radius.
    • an orbit that samples the transit chord (fitchord). That orbit derives cos i from p. The planet asks through the new side-effect-free Orbit.chord_planets, because stage 3 follows config key order.
    • a user mu/sigma/lower/upper on radius, p, density or logg. As for stars, sigma: 0 counts as a pin that the inactive role already covers, and an initval alone does not count as a reader.
  • Planet._apply_radius_activity masks the radius on planets with no reader. density, logg and, with an orbit, p, along with everything derived from them, inherit the inactive role through Component._inherit_inactivity.
  • The user-prior lookup moves from Star to Component (user_constrained_elements, user_entry_elements). The star and planet predicates now share one definition. Star's behavior is unchanged.

Why the inactive role and not dropping the key

The ruling's wording is "shouldn't enter the manifest". I used the element-role mechanism instead of omitting the key, and the effect is the same: nothing is sampled, constrained or reported. The inactive role is the codebase's established mechanism for exactly this case. Star._apply_structure_activity gives the same treatment to a star radius, teff or feh that nothing reads, for the same reason:

  1. planet.density and planet.logg (always), and planet.p (with an orbit), name radius in their deps. Dropping the key would be a build-graph error unless those were dropped too. With an orbit, the cascade continues through p into b, the transit durations, delta and the transit probabilities. The inactive role prunes all of them automatically through _inherit_inactivity.
  2. Readership is per planet. A user prior or chen: true on one planet keeps that planet's radius and no other. Manifest keys are whole-component, while the mask is per element.

Measurements

Prepared every shipped config (examples/*/*.yaml, examples/*/configs/*.yaml). Only these change:

  • the microlensing configs with a planet: DC2018_128 and its DC2018/configs variants, KMT-2019-BLG-1806, kb180087_obj3, MOA-2008-BLG-379, ob170114 and OGLE_0383LD;
  • examples/HD114762, an astrometric stellar companion with chen: false.

Every transit, RV and astrometry-with-Chen config declares the radius exactly as before.

Built master vs. this branch and evaluated every per-term start logp:

example free RVs start logp (master -> branch) per-term
DC2018_128 14 -> 14 3352.743675873128, identical all bit-identical
KMT-2019-BLG-1806 20 -> 20 45506.420741762384, identical all bit-identical
kb180087_obj3 14 -> 14 56811.290722927784, identical all bit-identical
MOA-2008-BLG-379 26 -> 26 20412.973766991672, identical all bit-identical
OGLE_0383LD 17 -> 17 26724.955563615826, identical all bit-identical
HD114762 22 -> 22 -13696.620314964943, identical all bit-identical
ob170114 26 -> 25 5851.727910976616 -> 5857.2620710116635 planet.radius_raw and logit_uniform_prior.planet.radius gone (sum -5.534160035047); every other term bit-identical
hat3, kelt4_rvonly (controls) unchanged identical all bit-identical

All of the changed examples except ob170114 already pinned the radius by hand (sigma: 0). Those pins are now redundant, and I left them in place. The DC2018 generators also write them, so removing them would be a separate cleanup.

Tests

New tests/test_planet_radius_activity.py:

  • A 2L1S planet's radius is inactive.
  • A user prior, bound, prior on a derived quantity (density), or chen: true keeps it active.
  • A user sigma: 0 pin leaves it inactive.
  • Slow tests build the 2L1S model with and without the rule:
    • Against the old hand pin, the free set and every per-term start logp are bit-identical.
    • Against the old free radius, exactly planet.radius_raw and its prior terms leave, and every other start coordinate and term is bit-identical.

One thing turned up while writing the second test. With the proper-motion starts left at their defaults, the relaxation engine solves them jointly with the other default-tier starts, to a solver tolerance. The old radius was one more seed in that solve: a defaults.yaml value seeds a sampled element and only fills an inactive one. So removing it moved the solved proper motions by ~4e-9 mas/yr and the event-rate prior by 1.5e-8 nats. That is a different start, not a different model. The fixture states the proper-motion starts, so the comparison is exact. None of the shipped examples shows this effect (table above).

tests/test_radius_prior.py built a data-free harness whose free planet radius had only an initval, which is now inactive. That harness now restates the defaults.yaml bounds as a user support, so the radius stays sampled and the density under test is unchanged.

tests/fixtures/mulens/ob170114.json (the acceptance fixture) was re-recorded. Its diff is exactly the removal of planet.radius_raw (start 0.0) and its two terms, and the total goes from 5851.727910976616 to 5857.2620710116635. Every other stored start value and term is unchanged. The hand-pinned fixtures did not move. The re-record is noted in tests/mulens_acceptance_replay.py's docstring, as the earlier ones are.

Docs: new section "Which planets have a radius" in src/exozippy/components/star/star.md, next to the planet radius prior.

🤖 Generated with Claude Code

https://claude.ai/code/session_01AWjnwpYHm56hSpKBzbPhrG

jdeast and others added 2 commits November 18, 2026 10:35
A microlensing planet is read through its mass (the lens's q); nothing in
a 2L1S likelihood reads its radius, which was sampled anyway: one free
dimension refilling its prior, plus R_P, rho_P and log g_P rows that were
pure prior.  Planet.radius_consumers is the readership predicate (transit,
rm, dopptom, the Chen & Kipping relation, an orbit sampling the transit
chord, a user prior on radius/p/density/logg), and the radius is made
INACTIVE on every planet with no reader -- Star._apply_structure_activity's
treatment, with density/logg/p and what derives from them inheriting the
role.  It stays declared (masked) because those name it in their deps.

The user-prior lookup moves from Star to Component
(user_constrained_elements / user_entry_elements) so both predicates
share one definition; Orbit gains chord_planets, a side-effect-free query
for the planets a fitchord orbit reads.

Measured on every shipped config: only the microlensing configs with a
planet and examples/HD114762 change.  All but ob170114 had pinned the
radius by hand and build a bit-identical model (same free set, every
per-term start logp identical); ob170114 loses planet.radius_raw and
exactly its two prior terms (-5.534160035 nats), every other term
bit-identical.  Transit, RV and astrometry examples are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AWjnwpYHm56hSpKBzbPhrG
ob170114 is the one microlensing example whose lens planet's radius was
not pinned by hand, so planet.radius_raw and its two terms leave
(-0.9189 and -4.6152 nats; total 5851.727910976616 -> 5857.2620710116635).
Every stored start value and every other term is bit-identical.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AWjnwpYHm56hSpKBzbPhrG
@jdeast
jdeast merged commit c99bfda into master Nov 18, 2026
36 of 38 checks passed
@jdeast
jdeast deleted the fix/2.8.17-planet-radius-mulens branch November 18, 2026 21:38
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