Skip to content

Commit

Permalink
Updating API docs and some links (#151)
Browse files Browse the repository at this point in the history
* updating api docs and some links

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
dfm and pre-commit-ci[bot] committed Mar 11, 2021
1 parent dadf549 commit 99f9ce1
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 137 deletions.
18 changes: 6 additions & 12 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,11 @@ jobs:
fail-fast: false
matrix:
python-version: ["3.9"]
arviz-version: ["arviz"]
pymc-version:
- "pymc3~=3.11.0"
- "https://github.com/pymc-devs/pymc3/archive/master.zip"
include:
- python-version: "3.9"
arviz-version: "arviz<0.11"
pymc-version: "pymc3~=3.9.0"
- python-version: "3.9"
arviz-version: "arviz<0.11"
pymc-version: "pymc3~=3.10.0"
pymc-arviz:
- '"pymc3~=3.9.0" "arviz<0.11"'
- '"pymc3~=3.10.0" "arviz<0.11"'
- '"pymc3~=3.11.0"'
- '"https://github.com/pymc-devs/pymc3/archive/master.zip"'

steps:
- uses: actions/checkout@v2
Expand All @@ -45,7 +39,7 @@ jobs:
shell: bash -l {0}
run: |
python -m pip install -U pip
python -m pip install "${{ matrix.pymc-version }}" "${{ matrix.arviz-version }}"
python -m pip install ${{ matrix.pymc-arviz }}
python -m pip install rebound
python -m pip install "reboundx>=3.2.0"
python -m pip install -e .[test]
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2018, 2019, 2020 Dan Foreman-Mackey
Copyright (c) 2018, 2019, 2020, 2021 Dan Foreman-Mackey

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
3 changes: 2 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ def markdown2rst(text):
"astropy",
"pymc3",
"theano",
"aesara_theano_fallback",
"tqdm",
"rebound_pymc3",
]
Expand Down Expand Up @@ -81,7 +82,7 @@ def markdown2rst(text):
# General information about the project.
project = "exoplanet"
author = "Dan Foreman-Mackey"
copyright = "2018, 2019, 2020, " + author
copyright = "2018, 2019, 2020, 2021, " + author

version = __version__
release = __version__
Expand Down
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ page <httsp://celerite2.readthedocs.io>`_.
License & attribution
---------------------

Copyright 2018, 2019, 2020 Daniel Foreman-Mackey.
Copyright 2018, 2019, 2020, 2021 Daniel Foreman-Mackey.

The source code is made available under the terms of the MIT license.

Expand Down
2 changes: 1 addition & 1 deletion docs/tutorials/citation.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
# The :func:`exoplanet.citations.get_citations_for_model` function would generate an acknowledgement that cites:
#
# * [PyMC3](https://docs.pymc.io/#citing-pymc3): for the inference engine and modeling framework,
# * [Theano](http://deeplearning.net/software/theano/citation.html): for the numerical infrastructure,
# * [Theano/Aesara](https://aesara.readthedocs.io/en/latest/citation.html): for the numerical infrastructure,
# * [AstroPy](http://www.astropy.org/acknowledging.html): for units and constants,
# * [Kipping (2013)](https://arxiv.org/abs/1308.0009): for the reparameterization of the limb darkening parameters for a quadratic law, and
# * [Luger, et al. (2018)](https://arxiv.org/abs/1810.06559): for the light curve calculation.
Expand Down
6 changes: 3 additions & 3 deletions docs/tutorials/intro-to-pymc3.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,16 +174,16 @@
# While the above example was cute, it doesn't really fully exploit the power of PyMC3 and it doesn't really show some of the real issues that you will face when you use PyMC3 as an astronomer.
# To get a better sense of how you might use PyMC3 in Real Life™, let's take a look at a more realistic example: fitting a Keplerian orbit to radial velocity observations.
#
# One of the key aspects of this problem that I want to highlight is the fact that PyMC3 (and the underlying model building framework [Theano](http://deeplearning.net/software/theano/)) don't have out-of-the-box support for the root-finding that is required to solve Kepler's equation.
# One of the key aspects of this problem that I want to highlight is the fact that PyMC3 (and the underlying model building framework [Theano (recently renamed to Aesara)](https://aesara.readthedocs.io/)) don't have out-of-the-box support for the root-finding that is required to solve Kepler's equation.
# As part of the process of computing a Keplerian RV model, we must solve the equation:
#
# $$
# M = E - e\,\sin E
# $$
#
# for the eccentric anomaly $E$ given some mean anomaly $M$ and eccentricity $e$.
# There are commonly accepted methods of solving this equation using [Newton's method](https://en.wikipedia.org/wiki/Newton%27s_method), but if we want to expose that to PyMC3, we have to define a [custom Theano operation](http://deeplearning.net/software/theano/extending/extending_theano.html) with a custom gradient.
# I won't go into the details of the math (because [I blogged about it](https://dfm.io/posts/stan-c++/)) and I won't go into the details of the implementation (because [you can take a look at it on GitHub](https://github.com/exoplanet-dev/exoplanet/tree/master/exoplanet/theano_ops/kepler)).
# There are commonly accepted methods of solving this equation using [Newton's method](https://en.wikipedia.org/wiki/Newton%27s_method), but if we want to expose that to PyMC3, we have to define a [custom Theano operation](https://aesara.readthedocs.io/en/latest/extending/index.html) with a custom gradient.
# I won't go into the details of the math (because [I blogged about it](https://dfm.io/posts/stan-c++/)) and I won't go into the details of the implementation (because [you can take a look at it on GitHub](https://github.com/exoplanet-dev/exoplanet/tree/main/exoplanet/theano_ops/kepler.py)).
# So, for this tutorial, we'll use the custom Kepler solver that is implemented as part of *exoplanet* and fit the publicly available radial velocity observations of the famous exoplanetary system 51 Peg using PyMC3.
#
# First, we need to download the data from the exoplanet archive:
Expand Down
2 changes: 1 addition & 1 deletion docs/tutorials/transit.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
_ = plt.xlim(t.min(), t.max())
# -

# But the real power comes from the fact that this is defined as a [Theano operation](http://deeplearning.net/software/theano/extending/extending_theano.html) so it can be combined with PyMC3 to do transit inference using Hamiltonian Monte Carlo.
# But the real power comes from the fact that this is defined as a [Theano operation](https://aesara.readthedocs.io/en/latest/extending/index.html) so it can be combined with PyMC3 to do transit inference using Hamiltonian Monte Carlo.
#
# ## The transit model in PyMC3
#
Expand Down
30 changes: 4 additions & 26 deletions docs/user/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,11 @@ Estimators
Distributions
-------------

.. autofunction:: exoplanet.distributions.get_log_abs_det_jacobian
.. autofunction:: exoplanet.distributions.estimate_inverse_gamma_parameters


Base distributions
~~~~~~~~~~~~~~~~~~

.. autoclass:: exoplanet.distributions.UnitUniform
.. autoclass:: exoplanet.distributions.UnitVector
.. autoclass:: exoplanet.distributions.UnitDisk
.. autoclass:: exoplanet.distributions.Angle
.. autoclass:: exoplanet.distributions.Periodic
These distributions have been moved to the `pymc3-ext project
<https://github.com/exoplanet-dev/pymc3-ext>`_.

Physical distributions
~~~~~~~~~~~~~~~~~~~~~~
Expand All @@ -70,28 +63,13 @@ Eccentricity distributions
.. autofunction:: exoplanet.distributions.eccentricity.vaneylen19


Utilities
---------

.. autofunction:: exoplanet.optimize
.. autofunction:: exoplanet.eval_in_model
.. autofunction:: exoplanet.get_theano_function_for_var
.. autofunction:: exoplanet.get_args_for_theano_function
.. autofunction:: exoplanet.get_samples_from_trace
.. autofunction:: exoplanet.get_dense_nuts_step
Miscellaneous
-------------

.. autofunction:: exoplanet.orbits.ttv.compute_expected_transit_times


Units
-----

.. autofunction:: exoplanet.units.with_unit
.. autofunction:: exoplanet.units.has_unit
.. autofunction:: exoplanet.units.to_unit


Citations
---------

.. autofunction:: exoplanet.citations.get_citations_for_model
89 changes: 6 additions & 83 deletions docs/user/dev.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ local machine:

.. code-block:: bash
git clone https://github.com/YOURUSERNAME/exoplanet.git
git clone --recursive https://github.com/YOURUSERNAME/exoplanet.git
cd exoplanet
git checkout -b BRANCHNAME
Expand All @@ -47,36 +47,15 @@ Then you should set up an isolated environment for development using a `Conda
environment
<https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html>`_,
`virtualenv <https://virtualenv.pypa.io/>`_, `venv
<https://docs.python.org/3/library/venv.html>`_, or similar. If using ``conda``,
you can get the current development environment from the ``environment.yml``
file:

.. code-block:: bash
conda env create --prefix env -f environment.yml
conda activate ./env
If you have an existing ``conda`` environment for ``exoplanet``, you can update
it using:

.. code-block:: bash
conda env update --prefix ./env -f environment.yml --prune
<https://docs.python.org/3/library/venv.html>`_, or similar.

If you're using a ``pip`` based environment, you can install the developer
dependencies as follows:

.. code-block:: bash
python -m pip install -U pip
python -m pip install -U .[dev]
After your environment is set up, you can install the current development
version of ``exoplanet``:

.. code-block:: bash
python -m pip install -e .
python -m pip install -U -e ".[dev]"
Finding your way around the codebase
Expand Down Expand Up @@ -105,25 +84,11 @@ computational run time. These can be found in the `case studies
<https://github.com/exoplanet-dev/case-studies>`_ repo and there is more
information there about how to contribute.

3. **Theano ops**: ``exoplanet`` comes bundled with a set of custom Theano ops
3. **Theano/Aesara ops**: ``exoplanet`` comes bundled with a set of custom ops
that are implemented in ``src/exoplanet/theano_ops``. As a user, you'll rarely
interact with these directly and we haven't put a lot of work into making them
user friendly, but if you are interested in diving in, here are some tips.
First, you should check out the Theano docs that describe how to develop new ops
in `Python
<http://deeplearning.net/software/theano/extending/extending_theano.html>`_ and
`C/C++
<http://deeplearning.net/software/theano/extending/extending_theano_c.html>`_.
Most of the ``exoplanet`` ops are implemented in C++ for speed and we've made
the design decision to separate the "science" code (which implements the actual
operation without any dependency on Theano) and "wrapper" code (which sets up
the interface). The science code is implemented as a header-only C++ library in
``src/exoplanet/theano_ops/lib/include/exoplanet`` and then, in most cases,
these functions are accessed via the `pybind11
<https://github.com/pybind/pybind11>`_ interface implemented in
``src/exoplanet/theano_ops/driver.cpp``. Then the wrappers are implemented as
submodules in ``src/exoplanet/theano_ops``. A good place to start is the
``KeplerOp`` implemented in ``src/exoplanet/theano_ops/kepler.py``.
user friendly, but if you are interested in diving in, feel free to ask
questions on GitHub or via email.


Testing your contribution
Expand All @@ -137,45 +102,3 @@ request using the following command:
.. code-block:: bash
python -m pytest -v tests
Code style
----------

We have a pretty strict (but easy to implement!) set of style guidelines for the
codebase. For Python code, we use `isort
<https://github.com/timothycrosley/isort>`_ and `black
<https://github.com/psf/black>`_. The custom settings for these projects can be
found in ``pyproject.toml``. Before opening a pull request, you can run the
formatters as follows:

.. code-block:: bash
isort -rc src
black src
Or, you can use `pre-commit <https://pre-commit.com>`_ to automatically apply the formatting whenever you commit:

.. code-block:: bash
python -m pip install -U pre-commit
pre-commit install
Release management
------------------

.. note:: Most of this build process is based on the October 2019 update to
`this blog post
<https://hynek.me/articles/sharing-your-labor-of-love-pypi-quick-and-dirty/>`_
so you should check that out if you want more info.

This section is mainly internal, but these are the steps that should be executed to produce a new release.

1. Update citation date and version in ``src/exoplanet/citations.py``.

2. Update changelog date in ``HISTORY.rst``.

3. Tag a GitHub release on both the `exoplanet repository
<https://github.com/exoplanet-dev/exoplanet>`_ and the `case studies repository
<https://github.com/exoplanet-dev/case-studies>`_
15 changes: 7 additions & 8 deletions docs/user/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,15 @@ Note: if you clone the repo without the ``--recursive`` flag, you will need to r
Notes about running on Windows
------------------------------

Running exoplanet on Windows can be a little tricky because of the dependence on Theano and runtime compilation,
but it is currently tested on Windows with Python 3.7 and 3.8.
The following (based on the tips from `the Theano docs <http://deeplearning.net/software/theano_versions/dev/install_windows.html>`_) seem to work:
Running exoplanet on Windows can be a little tricky because of the dependence on
runtime compilation, but it has been used on Windows successfully. The following
conda installation steps seem to work:

.. code-block:: bash
conda create --name exoplanetTest python=3.8 pip
conda install --name exoplanetTest numpy scipy mkl-service libpython m2w64-toolchain astropy matplotlib theano
conda install --name exoplanetTest -c conda-forge pybind11 celerite
python -m pip install -e .[test]
conda create --name exoplanetTest python pip
conda install --name exoplanetTest numpy scipy mkl-service libpython m2w64-toolchain astropy
python -m pip install -e ".[test]"
Testing
Expand All @@ -71,7 +70,7 @@ To run the unit tests, install the development dependencies using pip:

.. code-block:: bash
python -m pip install .[test]
python -m pip install ".[test]"
and then execute:

Expand Down

0 comments on commit 99f9ce1

Please sign in to comment.