Skip to content

Commit

Permalink
moving rebound to optional dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
dfm committed Dec 28, 2019
1 parent 2171caa commit c8e48e1
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 5 deletions.
5 changes: 3 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ env:
- THEANO_FLAGS=floatX=float64,compute_test_value=off
cache:
directories:
- "$HOME/.cache/pip"
- "$HOME/.theano"
- "$HOME/.cache/pip"

stages:
- name: Housekeeping
Expand All @@ -23,7 +24,7 @@ jobs:
install: skip
script: ./.ci/travis/update_docs.sh
after_success: skip
if: type != pull_request
if: (branch = master) AND (type != pull_request)
- name: "Style"
install:
- python -m pip install -U pip
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ multi_line_output = 3
include_trailing_comma = true
force_grid_wrap = 0
use_parentheses = true
known_third_party = ["astropy", "matplotlib", "nbconvert", "nbformat", "numpy", "packaging", "pkg_resources", "pymc3", "pytest", "rebound_pymc3", "scipy", "setuptools", "theano", "tqdm"]
known_third_party = ["astropy", "matplotlib", "nbconvert", "nbformat", "numpy", "packaging", "pkg_resources", "pymc3", "pytest", "scipy", "setuptools", "theano", "tqdm"]
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
"numpy>=1.13.0",
"pymc3>=3.5",
"astropy>=3.1",
"rebound_pymc3>=0.0.3",
]
EXTRA_REQUIRE = {"nbody": ["rebound_pymc3>=0.0.3"]}

# END PROJECT SPECIFIC

Expand Down Expand Up @@ -73,6 +73,7 @@ def find_meta(meta, meta_file=read(META_PATH)):
package_dir={"": "src"},
include_package_data=True,
install_requires=INSTALL_REQUIRES,
extras_require=EXTRA_REQUIRE,
classifiers=CLASSIFIERS,
zip_safe=False,
options={"bdist_wheel": {"universal": "1"}},
Expand Down
6 changes: 5 additions & 1 deletion src/exoplanet/orbits/rebound.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,15 @@
__all__ = ["ReboundOrbit"]

import theano.tensor as tt
from rebound_pymc3.integrate import IntegrateOp as ReboundOp

from .constants import au_per_R_sun, day_per_yr_over_2pi
from .keplerian import KeplerianOrbit

try:
from rebound_pymc3.integrate import IntegrateOp as ReboundOp
except ImportError:
from ..theano_ops.rebound import ReboundOp


class ReboundOrbit(KeplerianOrbit):
"""An N-body system powered by the rebound integrator
Expand Down
3 changes: 3 additions & 0 deletions src/exoplanet/theano_ops/rebound/rebound.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

__all__ = ["ReboundOp"]

import warnings

import numpy as np
import theano
import theano.tensor as tt
Expand All @@ -13,6 +15,7 @@ class ReboundOp(gof.Op):
__props__ = ()

def __init__(self, **rebound_args):
warnings.warn("For better performance, install 'rebound_pymc3'")
self.rebound_args = rebound_args
super(ReboundOp, self).__init__()

Expand Down

0 comments on commit c8e48e1

Please sign in to comment.