Skip to content

Latest commit

 

History

50 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gapmoe

gapmoe constructs Galactic microlensing priors from event-local histogram products generated by genulens pre_gapmoe. The public inference API is built around a prepared histogram, an isochrone source model, and a light-curve parameterization.

The current stable backend is histogram based. Normalizing-flow work is kept on the separate codex/flow-experimental branch and is not a dependency of the main package.

Install

pip install gapmoe

For development, examples, and documentation:

pip install -e ".[dev,docs]"

Quick start

First prepare histogram products for the event sightline. PreRunner uses the installed genulens.pre_gapmoe Python API by default.

from gapmoe.pre_runner import PreRunner

pre_run = PreRunner(output_dir="runs").run(
    ra_deg=270.0,
    dec_deg=-30.0,
    run_name="event-001",
)

Open that prepared directory and construct a sampler-independent prior:

import gapmoe

backend = gapmoe.Histogram.open(pre_run.output_dir)
source = gapmoe.Isochrone(
    reference_band="Imag",
    color_bands=("Vmag", "Imag"),
    magnitude_range=(15.0, 21.0),
    color_range=(0.5, 3.0),
)
model = gapmoe.Model(
    gapmoe.ParamType(parallax=True, distance="sample"),
    l=pre_run.l_deg,
    b=pre_run.b_deg,
    source=source,
    extinction={"Imag": 0.0, "Vmag": 0.0},
    backend=backend,
)

print(model.names)

model.log_density(theta, context=...) includes the coordinate transform, Galactic density, and event-rate factor. See the documentation for the required parameterization context and complete examples.

Development

pytest -q
sphinx-build -W -b html docs docs/_build/html

The two notebooks under example/ demonstrate preprocessing and a physical density sampling workflow. Generated preprocessing products are ignored by git.

License

MIT. See LICENSE.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages