Skip to content

Commit

Permalink
packaging and autodocs for kernels
Browse files Browse the repository at this point in the history
  • Loading branch information
dfm committed Jul 12, 2017
1 parent 663b479 commit 053b26a
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 13 deletions.
1 change: 1 addition & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
_build
!*.png
user/kernels.rst
28 changes: 28 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,36 @@
# -*- coding: utf-8 -*-

import os
import glob
import yaml
import george

d = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
with open(os.path.join(d, "docs", "user", "kernels.rst.template"), "r") as f:
TEMPLATE = f.read()

fns = glob.glob(os.path.join(d, "kernels", "*.yml"))
if len(fns):
specs = []
for i, fn in enumerate(fns):
with open(fn, "r") as f:
specs.append(yaml.load(f.read()))
tokens = []
for spec in specs:
if spec["stationary"]:
tokens += [".. autoclass:: george.kernels.{0}"
.format(spec["name"])]
TEMPLATE = TEMPLATE.replace("STATIONARYKERNELS", "\n".join(tokens))
tokens = []
for spec in specs:
if not spec["stationary"]:
tokens += [".. autoclass:: george.kernels.{0}"
.format(spec["name"])]
TEMPLATE = TEMPLATE.replace("OTHERKERNELS", "\n".join(tokens))

with open(os.path.join(d, "docs", "user", "kernels.rst"), "w") as f:
f.write(TEMPLATE)

extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.mathjax",
Expand Down
15 changes: 2 additions & 13 deletions docs/user/kernels.rst → docs/user/kernels.rst.template
Original file line number Diff line number Diff line change
Expand Up @@ -217,11 +217,7 @@ argument:

The currently available stationary kernels are:

.. autoclass:: george.kernels.ExpSquaredKernel
.. autoclass:: george.kernels.Matern32Kernel
.. autoclass:: george.kernels.Matern52Kernel
.. autoclass:: george.kernels.ExpKernel
.. autoclass:: george.kernels.RationalQuadraticKernel
STATIONARYKERNELS


.. _non-stationary-kernels:
Expand All @@ -246,14 +242,7 @@ input space where you only want to apply the periodicity along the first

The currently available non-stationary kernels are:

.. autoclass:: george.kernels.ConstantKernel
.. autoclass:: george.kernels.DotProductKernel
.. autoclass:: george.kernels.LinearKernel
.. autoclass:: george.kernels.PolynomialKernel
.. autoclass:: george.kernels.CosineKernel
.. autoclass:: george.kernels.ExpSine2Kernel
.. autoclass:: george.kernels.LocalGaussianKernel

OTHERKERNELS

.. _combining-kernels:

Expand Down

0 comments on commit 053b26a

Please sign in to comment.