Inverse-Ray Lightcurve

Configuration

class microjax.inverse_ray.BinaryMagConfig(n_limb: int = 500, source_tile_size: int = 100, radial_chunk_size: int = 64)

Bases: _BoundaryMagConfig

Static configuration for mag_binary.

radial_chunk_size: int = 64
class microjax.inverse_ray.TripleMagConfig(n_limb: int = 500, source_tile_size: int = 100, radial_chunk_size: int = 8)

Bases: _BoundaryMagConfig

Static configuration for mag_triple.

Light-curve functions

Finite-source binary- and triple-lens light curves.

Use mag_binary() and mag_triple() with a complex source trajectory. For source positions sufficiently far from caustics, microJAX uses a fast finite-source approximation. Where a full calculation is needed, it traces the lensed images of the circular source boundary and integrates the enclosed brightness.

Both functions support a uniform source (u1=0) and linear limb darkening (u1>0). They are designed for JAX compilation, vectorization, and forward-mode automatic differentiation.

The returned values are numerical estimates without a guaranteed error bound. If a valid image boundary or integration region cannot be constructed, the corresponding result is NaN.

microjax.inverse_ray.lightcurve.mag_binary(w_points: Array, rho: float, *, s: float, q: float, u1: float = 0.0, config: BinaryMagConfig = BinaryMagConfig(n_limb=500, source_tile_size=100, radial_chunk_size=64), backend: str = 'accelerator', return_info: bool = False) Array

Calculate a binary-lens finite-source light curve.

backend="accelerator" preserves the established one-pass GPU-oriented scheduler. backend="cpu" selects the differentiable one-shot CPU scheduler: after the multipole prefilter, it traces the source limb once, selects one fixed high-order Cartesian or polar rule from the traced image state, and never retries. cpu-one-shot is a compatibility alias for the same default CPU path. The former adaptive CPU scheduler remains available explicitly as backend="cpu-adaptive". Exact radial tangencies stabilize the polar chart without treating n_limb as an accuracy order. The production CPU uses one fixed, calibrated multipole shortcut gate; it is not a full-solve error guarantee. For full one-shot solves, estimated_error is NaN and non-zero status denotes only a detected structural failure. CPU diagnostics are returned when return_info=True; otherwise structurally invalid points are mapped to NaN.

microjax.inverse_ray.lightcurve.mag_triple(w_points: Array, rho: float, *, s: float, q: float, q3: float, r3: float, psi: float, u1: float = 0.0, config: TripleMagConfig = TripleMagConfig(n_limb=500, source_tile_size=100, radial_chunk_size=8)) Array

Compute finite-source magnification for a triple lens.

Parameters:
  • w_points – Complex source positions in Einstein-radius units.

  • rho – Angular source radius in Einstein-radius units.

  • s – Separation and mass ratio of the first two lenses.

  • q – Separation and mass ratio of the first two lenses.

  • q3 – Mass of the third lens relative to the first.

  • r3 – Distance and position angle of the third lens.

  • psi – Distance and position angle of the third lens.

  • u1 – Linear limb-darkening coefficient. Use zero for a uniform source.

  • config – Source-boundary sampling and accelerator scheduling configuration. The default is recommended for normal use. Scheduler settings change static JAX shapes and therefore trigger separate compilation.

Returns:

Magnification at each input source position. A value is NaN when microJAX cannot construct a valid image boundary or integration region.

Return type:

Array

Notes

The function uses a fast approximation away from caustics and a full image-boundary integration where needed. Small isolated images are handled in coordinates centred near those images to avoid loss of angular resolution. Returned finite values do not carry a guaranteed error bound.

Advanced CPU diagnostics

class microjax.inverse_ray.cpu.CpuMagnificationResult(magnification: Array, estimated_error: Array, tier: Array, n_limb: Array, n_radial_nodes: Array, status: Array)

Bases: NamedTuple

Magnification and diagnostics from one fixed CPU tier.

For the production one-shot backend, status == 0 means only that no finite-value, root, support, topology, or capacity failure was detected. It makes no accuracy claim; full solves report estimated_error as NaN. The multipole tier and legacy adaptive backend retain their own numerical error diagnostics.

estimated_error: Array

Alias for field number 1

magnification: Array

Alias for field number 0

n_limb: Array

Alias for field number 3

n_radial_nodes: Array

Alias for field number 4

status: Array

Alias for field number 5

tier: Array

Alias for field number 2

Routine modeling does not require this result type. See CPU Binary-Lens Backend for the CPU backend contract and debugging guidance.