Repository navigation
mulensing: force a second limb-darkening annulus in VBM (workaround for a false convergence) - #504
Merged
Merged
Conversation
VBMicrolensing's limb-darkened Mag2 calls (ESPLMagDark, BinaryMagDark, MultiMagDark) can accept the first annulus as converged when the uniform-disk magnification happens to equal the center point-source magnification, returning the UNIFORM-source value with no warning: 2.55% low on a triple-lens point of OGLE-2013-BLG-0341 at the default Tol = 1e-3 (170.1815 against 174.6366). Set vbm.minannuli = 2 on every VBMDirectMagOp that carries limb darkening; a uniform-source Op keeps VBM's default, since one annulus is exact there and a second nearly doubles its cost. Workaround pending upstream; mulensing.md says when to remove it. Tol/RelTol unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01S5pG2s9aJEo6Xqk6hWvnkW
…efault annuli The forced second limb-darkening annulus moves only RV:mulensinstrument.model at each stored start (starts bit-identical): ob09020 +0.2534 nats, OGLE_0383LD -0.0526, ob07224 -0.0155, ob161003 -0.0061, ob170114 +0.0051, KMT-2019-BLG-1806 x3 +0.0003 -- ordinary Tol-level moves toward a Tol = 1e-5 reference, no false convergence among them. Explained in mulens_acceptance_replay.py. The MulensModel A/B parity tests and the ob161003 pre-split reconciliation compare against a kernel that runs VBM's default minannuli = 1 (MulensModel's own instance; the stage-0 recording), so they set the direct Op back to 1 for the comparison. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01S5pG2s9aJEo6Xqk6hWvnkW
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 workaround for a VBMicrolensing false convergence, pending an upstream fix. Every
VBMDirectMagOpthat carries limb darkening now setsvbm.minannuli = 2. A uniform-source Op keeps VBM's default of 1.The bug (VBM 5.6.1 and current
dev)VBM integrates a limb-darkened source in annuli (
ESPLMagDark,BinaryMagDark,MultiMagDark). After the first annulus its only error estimate is|(A_uniform(rho) - A_point(center)) (f(0) - f(1)) / 4|. When the uniform-disk and center point-source magnifications happen to agree, which is common near a caustic, the estimate is ~0 and the refinement loop never starts. With the defaultminannuli = 1, the call then returns the uniform-source magnification withtherr < Toland no warning.Reproducer: a three-lens geometry from a fit of OGLE-2013-BLG-0341 (Gould et al. 2014) near the central caustic, linear LD
a1 = 0.754,Tol = 1e-3,RelTol = 0.MultiMag2returns 170.1815, which is the uniform value. The correct value is 174.6366 withminannuli = 2(174.6367 atTol = 1e-5), so the default answer is 2.55% low. On an ~8900-epoch light curve of that event, one such epoch moved chi2 by 28.Changes
op.py_build_vbm:if self.bandpass is not None: vbm.minannuli = 2. A uniform source is exact in one annulus, andBinaryMag2/MultiMag2send uniform sources through the same integrator, so forcing a second annulus there would cost ~1.9x for a change below 1e-5.mulensing.md: a new section explaining why the setting is there and when to remove it (once VBM's own default guards it; name that version there).tests/test_vbm_minannuli.py(~1 s): runs the reproducer geometry through the Op's own_magnifyand checks it returns 174.6366, not 170.1815. A precondition check asserts that a raw default VBM still returns the uniform value. Once upstream fixes the bug that check fails, and its message says the workaround can come out.Tol/RelToland the VBM pin are unchanged.What moved
Acceptance fixtures were re-replayed at each stored start with minannuli 1 and 2 on one machine. Every start is bit-identical, and the only term that moves is
RV:mulensinstrument.model:None of these fixtures contains a falsely converged epoch. The moves are ordinary Tol-level changes toward the reference. ob09020 and OGLE_0383LD exceeded the physics tolerance. All eight moved fixtures were re-recorded so the strict tier stays bit-exact. The re-record also absorbed two drifts that master already had (identical at minannuli 1), both itemized in
tests/mulens_acceptance_replay.py.Three kinds of test compare against a kernel that runs VBM's default
minannuli = 1. They now set the direct Op back to 1 for the comparison:test_vbm_direct_vs_mulensmodel.py, two intest_lens_orbital_motion.py). MulensModel's own VBM instance runs the default, and these tests check the plumbing against an identical kernel at rtol 1e-8; the second annulus moves A by ~2e-5 there.test_ob161003_collapse_reconciles_against_the_presplit_recording. The stage-0 recording ran the default, and the test already switches later physics off the same way (1.10.13).Remove these together with the workaround.
Tests
tests/test_vbm_minannuli.pypasses.🤖 Generated with Claude Code
https://claude.ai/code/session_01S5pG2s9aJEo6Xqk6hWvnkW