Repository navigation
planet: radius is inactive where nothing reads it (review 2.8.17) - #608
Merged
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
A microlensing planet is read through its mass (the lens's
q). Nothing in a 2L1S likelihood reads its radius, butPlanet.register_parametersdeclaredplanet.radiusas a sampled leaf on every planet anyway. The result was one dead, prior-only dimension per lens planet, plusR_P,rho_Pandlog g_Ptable 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.radiusis 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:transitblock, an rvinstrumentrm:key, ordopptom. All three readp = R_P/R_*, and each marks every planet.fitchord). That orbit derives cos i fromp. The planet asks through the new side-effect-freeOrbit.chord_planets, because stage 3 follows config key order.mu/sigma/lower/upperonradius,p,densityorlogg. As for stars,sigma: 0counts as a pin that the inactive role already covers, and aninitvalalone does not count as a reader.Planet._apply_radius_activitymasks the radius on planets with no reader.density,loggand, with an orbit,p, along with everything derived from them, inherit the inactive role throughComponent._inherit_inactivity.StartoComponent(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_activitygives the same treatment to a star radius, teff or feh that nothing reads, for the same reason:planet.densityandplanet.logg(always), andplanet.p(with an orbit), nameradiusin theirdeps. Dropping the key would be a build-graph error unless those were dropped too. With an orbit, the cascade continues throughpintob, the transit durations,deltaand the transit probabilities. The inactive role prunes all of them automatically through_inherit_inactivity.chen: trueon 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:DC2018/configsvariants, KMT-2019-BLG-1806, kb180087_obj3, MOA-2008-BLG-379, ob170114 and OGLE_0383LD;examples/HD114762, an astrometric stellar companion withchen: 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:
planet.radius_rawandlogit_uniform_prior.planet.radiusgone (sum -5.534160035047); every other term bit-identicalAll 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:density), orchen: truekeeps it active.sigma: 0pin leaves it inactive.planet.radius_rawand 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.pybuilt a data-free harness whose free planet radius had only aninitval, 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 ofplanet.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 intests/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