Metadata-Version: 2.5
Name: harv
Version: 0.2.0
Summary: Tools for modeling Keplerian systems in astrometric and/or radial velocity data.
Project-URL: Homepage, https://github.com/adrn/harv
Project-URL: Source Code, https://github.com/adrn/harv
Project-URL: Bug Tracker, https://github.com/adrn/harv/issues
Project-URL: Documentation, https://harvey.readthedocs.io
Project-URL: Download, https://pypi.org/project/harv/#files
Author-email: adrn <583379+adrn@users.noreply.github.com>
License-Expression: MIT
License-File: LICENSE
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Scientific/Engineering
Classifier: Typing :: Typed
Requires-Python: >=3.12
Requires-Dist: equinox>=0.13.2
Requires-Dist: h5py>=3.15.1
Requires-Dist: jax<0.12,>=0.11
Requires-Dist: jaxtyping>=0.3.3
Requires-Dist: numpy>=2.0
Requires-Dist: numpyro>=0.22
Requires-Dist: quaxed>=0.10.4
Requires-Dist: unxt>=1.7.2
Provides-Extra: cuda12
Requires-Dist: jax[cuda12]<0.12,>=0.11; (sys_platform == 'linux') and extra == 'cuda12'
Provides-Extra: cuda13
Requires-Dist: jax[cuda13]<0.12,>=0.11; (sys_platform == 'linux') and extra == 'cuda13'
Provides-Extra: extra
Requires-Dist: arviz>=1.0.0; extra == 'extra'
Requires-Dist: gaiaunlimited>=0.3.2; extra == 'extra'
Requires-Dist: healpy>=1.18.1; extra == 'extra'
Requires-Dist: matplotlib>=3.10.7; extra == 'extra'
Requires-Dist: pooch>=1.8.2; extra == 'extra'
Requires-Dist: scikit-learn>=1.5; extra == 'extra'
Requires-Dist: setuptools; extra == 'extra'
Requires-Dist: tinygp>=0.3.1; extra == 'extra'
Description-Content-Type: text/markdown

# harv

[![Tests](https://github.com/adrn/harv/actions/workflows/test.yml/badge.svg)](https://github.com/adrn/harv/actions/workflows/test.yml)
[![Docs](https://readthedocs.org/projects/harvey/badge/?version=latest)](https://harvey.readthedocs.io/en/latest/)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
[![Python 3.12+](https://img.shields.io/badge/python-3.12%2B-blue.svg)](https://python.org)
[![arXiv](https://img.shields.io/badge/arXiv-2611.35085-b31b1b.svg)](https://arxiv.org/abs/2611.35085)

<br/>
<div align="center">
<img
    src="https://raw.githubusercontent.com/adrn/harv/refs/heads/main/docs/_static/logo-text-only.png"
    alt="harv logo"
    width="300"
>
</div>
<br/>

**harv** is a Python package for inferring Keplerian orbital parameters of binary-star
and star–exoplanet systems from time series data. Built on
[JAX](https://github.com/google/jax), [NumPyro](https://github.com/pyro-ppl/numpyro),
and [unxt](https://github.com/GalacticDynamics/unxt) for units-aware computation.

It's pronounced _harvey_.

The methods are described in the harv paper
([arXiv:2611.35085](https://arxiv.org/abs/2611.35085)); please cite it if you use harv.

<!-- ### Key features

- **JAX-native** — JIT-compiled likelihoods and samplers; runs on CPU or GPU.
- **Units throughout** — all physical quantities carry explicit units via
  [unxt](https://github.com/GalacticDynamics/unxt), reducing unit-conversion errors
- **Analytical marginalization** — linear parameters (semi-amplitude, systemic velocity,
  astrometric offsets) are marginalized analytically for fast rejection sampling
- **Multi-instrument support** — fit RV data from multiple spectrographs with
  per-instrument offsets
- **Gaia DR4 ready** — native support for Gaia epoch astrometry (along-scan
  measurements) using the local plane coordinate convention
- **SB1 and SB2** — supports single- and double-lined spectroscopic binaries
- **Polynomial trends** — optional polynomial velocity trends for long-period companions -->

## Installation

Requires Python 3.12+. Install from GitHub:

```bash
pip install git+https://github.com/adrn/harv
```

Or, if using [uv](https://docs.astral.sh/uv/):

```bash
uv add git+https://github.com/adrn/harv
```

## Quickstart

Here are a few entry points to the documentation:

- [Documentation](https://harvey.readthedocs.io/en/latest)
- [Getting started with harv](https://harvey.readthedocs.io/en/latest/tutorials/getting-started.html)
- [Tutorials](https://harvey.readthedocs.io/en/latest/tutorials/index.html)

## How it works

**harv** is built on the same tricks as [The Joker](https://github.com/adrn/thejoker)
(Price-Whelan et al. 2017) to make rejection sampling practical for Keplerian orbit
inference. It uses a two-level parameterization that separates orbital parameters into:

1. **Nonlinear parameters** (period, eccentricity, argument of pericenter, phase) —
   sampled directly from the prior via rejection sampling, and
1. **Linear parameters** (RV semi-amplitude, systemic velocity, astrometric offsets) —
   these can be analytically marginalized given each set of nonlinear parameters.

This approach makes rejection sampling possible for high-dimensional parameter spaces by
reducing the effective dimensionality of the sampling problem. The main utility of the
rejection sampler is to map out the multi-modal posterior distribution of orbital
parameters in the low signal-to-noise or low number of observations regime, which is
challenging or impossible for MCMC methods. The samples returned by the rejection
sampler are exact draws from the posterior distribution, and can be used to initialize
MCMC samplers for further refinement, if necessary.

All objects are [Equinox](https://github.com/patrick-kidger/equinox) modules (valid JAX
pytrees), so they work seamlessly with `jax.jit`, `jax.vmap`, and `jax.grad`.

## Documentation

The full documentation is available at:
[harvey.readthedocs.io](https://harvey.readthedocs.io).

## License

**harv** is free software released under the MIT License. See [LICENSE](LICENSE) for
details.
