API reference

Public API

gapmoe public API.

Preprocessing

class gapmoe.pre_runner.GenulensEnvironment(genulens_root, pre_gapmoe_dir, available_tools, missing_tools, backend='cli')

Resolved genulens pre_gapmoe environment status.

Parameters:
  • genulens_root (Path)

  • pre_gapmoe_dir (Path)

  • available_tools (Tuple[str, ...])

  • missing_tools (Tuple[str, ...])

  • backend (str)

class gapmoe.pre_runner.PreRunResult(ra_deg: 'Optional[float]', dec_deg: 'Optional[float]', l_deg: 'float', b_deg: 'float', output_dir: 'Path', mass_path: 'Path', rho_path: 'Path', murel_path: 'Path', manifest_path: 'Path', source_evidence_path: 'Path | None' = None, cmd_prior_path: 'Path | None' = None, commands: 'Dict[str, Sequence[str]]'=<factory>)
Parameters:
  • ra_deg (float | None)

  • dec_deg (float | None)

  • l_deg (float)

  • b_deg (float)

  • output_dir (Path)

  • mass_path (Path)

  • rho_path (Path)

  • murel_path (Path)

  • manifest_path (Path)

  • source_evidence_path (Path | None)

  • cmd_prior_path (Path | None)

  • commands (Dict[str, Sequence[str]])

class gapmoe.pre_runner.PreRunner(genulens_root=None, output_dir='.', *, auto_build=False, backend='auto')

Run genulens pre_gapmoe tools and write per-event gapmoe inputs.

Parameters:
  • genulens_root (Optional[Union[str, Path]])

  • output_dir (str | Path)

  • auto_build (bool)

  • backend (Literal['auto', 'python', 'cli'])

check_environment()

Return the resolved genulens pre_gapmoe executable status.

Return type:

GenulensEnvironment

run(ra_deg=None, dec_deg=None, *, ra=None, dec=None, l_deg=None, b_deg=None, l=None, b=None, glon=None, glat=None, gal_l=None, gal_b=None, galactic_l=None, galactic_b=None, source_model=None, cmd_prior=None, run_name=None, distance_max_pc=16000.0, rho_step_pc=1.0, murel_distance_step_pc=250.0, d_min_pc=100.0, d_max_pc=None, d_step_pc=None, dl_min_pc=0.0, dl_max_pc=None, dl_step_pc=None, ds_min_pc=0.0, ds_max_pc=None, ds_step_pc=None, n_simu=10000000, mu_max_masyr=300.0, dmu_masyr=0.5, autoerr=True, err_target=None, seed=None, mass_options=None, rho_options=None, murel_options=None, model_options=None)

Run mass, rho, and murel preprocessing for one sky position.

The normal user-facing inputs are the sky coordinates and optional source-selection settings. By default, rho and murel preprocessing use the same maximum distance. Rho uses a 1 pc distance step to preserve the genulens density precision; murel uses a coarser 250 pc distance grid. The separate d/DL/DS options are advanced overrides.

calc_murel_dist has no t0 or Earth-velocity option. Its output is the heliocentric relative proper-motion distribution from the Galactic lens/source kinematics.

Parameters:
  • ra_deg (str | int | float | None)

  • dec_deg (str | int | float | None)

  • ra (str | int | float | None)

  • dec (str | int | float | None)

  • l_deg (str | int | float | None)

  • b_deg (str | int | float | None)

  • l (str | int | float | None)

  • b (str | int | float | None)

  • glon (str | int | float | None)

  • glat (str | int | float | None)

  • gal_l (str | int | float | None)

  • gal_b (str | int | float | None)

  • galactic_l (str | int | float | None)

  • galactic_b (str | int | float | None)

  • source_model (GenulensSourceModel | None)

  • cmd_prior (CmdPriorTable | None)

  • run_name (str | None)

  • distance_max_pc (float)

  • rho_step_pc (float)

  • murel_distance_step_pc (float)

  • d_min_pc (float)

  • d_max_pc (float | None)

  • d_step_pc (float | None)

  • dl_min_pc (float)

  • dl_max_pc (float | None)

  • dl_step_pc (float | None)

  • ds_min_pc (float)

  • ds_max_pc (float | None)

  • ds_step_pc (float | None)

  • n_simu (int)

  • mu_max_masyr (float)

  • dmu_masyr (float)

  • autoerr (bool)

  • err_target (float | None)

  • seed (int | None)

  • mass_options (Mapping[str, str | int | float | bool] | None)

  • rho_options (Mapping[str, str | int | float | bool | Sequence[str | int | float | bool]] | None)

  • murel_options (Mapping[str, str | int | float | bool] | None)

  • model_options (Mapping[str, str | int | float | bool] | None)

Return type:

PreRunResult

Inference model

Complete, sampler-independent Galactic inference models.

class gapmoe.model.Histogram(pre_run)

A precomputed event-local histogram backend.

Parameters:

pre_run (PreRunResult)

gapmoe.model.Isochrone

alias of IsochroneModel

class gapmoe.model.Model(param_type, *, l, b, source, extinction=None, backend, dm_rc=None, dust_scale_height_pc=164.0, include_event_rate=True, remnant=0, binary=0, integration_samples=512, direction_samples=32, seed=0)

A complete Galactic prior expressed in user-selected coordinates.

The model is independent of any sampler or light-curve package. It owns the physical density, parameter transform, Jacobian, and any hidden-variable integration required by param_type.

Parameters:
  • param_type (Any)

  • l (float)

  • b (float)

  • source (Isochrone)

  • extinction (Mapping[str, float] | None)

  • backend (Histogram)

  • dm_rc (float | None)

  • dust_scale_height_pc (float)

  • include_event_rate (bool)

  • remnant (int)

  • binary (int)

  • integration_samples (int)

  • direction_samples (int)

  • seed (int)

prior(fn)

Add a JAX-compatible prior over physical or derived quantities.

Parameterization selector

class gapmoe.param_types.param_type.ParamType(lens='binary', source='single', orbital_motion='static', xallarap='none', parallax=False, distance='auto')

Standard gapmoe light-curve-to-physical param_type selector.

ParamType is itself a parameterization object and is passed directly to gapmoe.Model. The selected concrete mapping stays internal so users do not need to choose class names for parallax/static/orbital cases.

Examples

ParamType(lens="binary", parallax=True) expects (t0, tE, u0, rho, piEN, piEE, DS).

ParamType(lens="binary", parallax=False) expects (t0, tE, u0, rho) and marginalizes lens/source distances and the proper-motion direction.

ParamType(lens="binary", parallax=True, orbital_motion="circular") uses the binary circular-orbit mapping.

Parameters:
  • lens (str)

  • source (str)

  • orbital_motion (str)

  • xallarap (str)

  • parallax (bool)

  • distance (str)

gapmoe.param_types.param_type.from_model_spec(spec)

Build a gapmoe ParamType from an external spec-like object.

This is primarily a bridge for external tools. Normal gapmoe code should instantiate ParamType directly.

Parameters:

spec (Any)

Return type:

ParamType

Source selection

The source-selection API is configured through gapmoe.Isochrone. Its lower-level tables and population objects remain importable from gapmoe.source_selection for scientific extensions.