Skip to main content

Fast and flexible orbit fitting

Project description

octofitterpy

octofitterpy is a python package for performing Bayesian inference against a wide variety of exoplanet / binary star data. It uses the Octofitter.jl julia package under the hood (just like eg numpy uses C).

octofitterpy can access almost all functionality of Octofitter.jl. Currently a subset of this functionality including relative astrometry fitting, absolute astrometry fitting, and various plotting functions have been wrapped with convenient python functions. Remaining functionality can be accessed via the octofitterpy.Octofitter submodule.

The examples directory and demo notebook provide an introduction to using octofitter in Python. Extensive documentation and tutorials are available here for the Julia version, and for the most part are directly translatable to Python.

Installation

In python 3.8 to 3.11 based environment, run:

pip install -U octofitterpy

Example

import octofitterpy as octo

# See demo.ipynb for more details
astrom_like = octo.PlanetRelAstromLikelihood(
    epoch = [50000,50120],
    sep = [505.7,600.1],
    pa = [0.0,0.4,],
    σ_sep = [10,10],
    σ_pa = [0.01,0.01],
    cor= [0,0.2]
)
planet_b = octo.Planet(
    name="b",
    basis="Visual{KepOrbit}",
    priors=
    """            
        a ~ LogUniform(0.1, 500)
        e ~ Uniform(0.0, 0.99)
        i ~ Sine()
        ω ~ UniformCircular()
        Ω ~ UniformCircular()
        θ ~ UniformCircular()
        tp = θ_at_epoch_to_tperi(system,b,50000) # use MJD epoch of your data here!!
    """,
    likelihoods=[astrom_like]
)
sys = octo.System(
    name="HIP100123",
    priors = 
    """
        M ~ truncated(Normal(1.2, 0.1), lower=0)
        plx ~ truncated(Normal(50.0, 0.02), lower=0)
    """,
    likelihoods=[],
    companions=[planet_b]
)
model = octo.LogDensityModel(sys) # Compile model
chain = octo.octofit(model) # Sample model
octo.octoplot(model,chain) # Plot orbits
octo.octocorner(model,chain,small=True) # Make corner plot
octo.savechain("table.fits", chain)

Read the paper

In addition to these documentation and tutorial pages, you can read the paper published in the Astronomical Journal (open-access).

Attribution

@article{Thompson_2023,
    doi = {10.3847/1538-3881/acf5cc},
    url = {https://dx.doi.org/10.3847/1538-3881/acf5cc},
    year = {2023},
    month = {sep},
    publisher = {The American Astronomical Society},
    volume = {166},
    number = {4},
    pages = {164},
    author = {William Thompson and Jensen Lawrence and Dori Blakely and Christian Marois and Jason Wang and Mosé Giordano and Timothy Brandt and Doug Johnstone and Jean-Baptiste Ruffio and S. Mark Ammons and Katie A. Crotts and Clarissa R. Do Ó and Eileen C. Gonzales and Malena Rice},
    title = {Octofitter: Fast, Flexible, and Accurate Orbit Modeling to Detect Exoplanets},
    journal = {The Astronomical Journal},
}
  • If you use the pairplot functionality, please cite:
@misc{Thompson2023,
    author = {William Thompson},
    title = {{PairPlots.jl} Beautiful and flexible visualizations of high dimensional data},
    year = {2023},
    howpublished = {\url{https://sefffal.github.io/PairPlots.jl/dev}},
}
  • The python wrapper octofitterpy is based on the excellent PySR by Miles Cranmer.

  • See the documentation for a list of additional papers to consider citing.

Ready?

Start by following this tutorial.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

octofitterpy-3.1.0.tar.gz (6.3 MB view details)

Uploaded Source

Built Distribution

octofitterpy-3.1.0-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

Details for the file octofitterpy-3.1.0.tar.gz.

File metadata

  • Download URL: octofitterpy-3.1.0.tar.gz
  • Upload date:
  • Size: 6.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.5

File hashes

Hashes for octofitterpy-3.1.0.tar.gz
Algorithm Hash digest
SHA256 d50238fff80f35e4acce6260fb926d7e356e2d3981772e61f915d37bbf7d65d8
MD5 9dbd5040e5e84535d4666b7273bd36a6
BLAKE2b-256 446323db35fd3cb89f388856f6e5e4396e292fda34a24ea2fc868661328dc462

See more details on using hashes here.

File details

Details for the file octofitterpy-3.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for octofitterpy-3.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 238afbc6629b61fcd354d4c188afa1db38a0e569ac34a2618b879ae97775473d
MD5 c2b3a73de9f241754dfd1fedb2f10abe
BLAKE2b-256 705b4e6ae490bc0f069cd514361e7e1165c6979e24550bbbaef51a94265ac5cb

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page