Skip to content

Commit

Permalink
add rudimentary documentation
Browse files Browse the repository at this point in the history
add rudimentary documentation

cleanup .readthedocs.yaml

add docs requirements

fix requirements

fix requirements

update
  • Loading branch information
axsk committed Jun 9, 2020
1 parent 7005683 commit 8000d7a
Show file tree
Hide file tree
Showing 10 changed files with 198 additions and 10 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@
.coverage

*.egg-info

docs/_build
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[![Documentation Status](https://readthedocs.org/projects/cmdtools/badge/?version=latest)](https://cmdtools.readthedocs.io/en/latest/?badge=latest)

# cmdtools

This Python library implements a suite of tools used and/or developed in the [Computational Molecular Design](https://www.zib.de/numeric/cmd) group of the Zuse Institute Berlin.
Expand All @@ -11,5 +13,5 @@ This Python library implements a suite of tools used and/or developed in the [Co

## Contents
* `cmdtools.analysis.pcca`: An implementation of (generalized) PCCA⁺ using the Schur decomposition
* `cmdtools.estimation.galerkin`: Estimation of the transfer operator using a Galerkin projection onto Gaussian RBFs
* `cmdtools.estimation.galerkin`: Estimation of the transfer operator using a Galerkin projection onto Gaussian RBFs
* `cmdtools.systems`: A collection of dynamical systems
20 changes: 20 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = .
BUILDDIR = _build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
26 changes: 26 additions & 0 deletions docs/api.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
API
================

.. automodule:: cmdtools

analysis
--------
.. automodule:: cmdtools.analysis
.. automodule:: cmdtools.analysis.pcca
.. automodule:: cmdtools.analysis.optimization

estimation
----------
.. automodule:: cmdtools.estimation
.. automodule:: cmdtools.estimation.galerkin
.. automodule:: cmdtools.estimation.sqra

systems
-------
.. automodule:: cmdtools.systems
.. automodule:: cmdtools.systems.diffusion


utils
---------------
.. automodule:: cmdtools.utils
76 changes: 76 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

# -- Path setup --------------------------------------------------------------

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
# import os
# import sys
# sys.path.insert(0, '/Users/alex/Documents/code/cmdtools/src/cmdtools')


# -- Project information -----------------------------------------------------

project = 'cmdtools'
copyright = '2020, Author'
author = 'Author'


# -- General configuration ---------------------------------------------------

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.viewcode',
'sphinx.ext.napoleon',
'sphinx.ext.todo',
]

autodoc_default_options = {
'members': True,
'undoc-members': True,
}

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = 'en'

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']


# -- Options for HTML output -------------------------------------------------

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'pyramid'

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']


# -- Extension configuration -------------------------------------------------

# -- Options for todo extension ----------------------------------------------

# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = True
20 changes: 20 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
.. cmdtools documentation master file, created by
sphinx-quickstart on Mon Jun 8 16:16:30 2020.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Welcome to cmdtools's documentation!
====================================

.. toctree::

introduction
api


Indices and tables
==================

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
4 changes: 4 additions & 0 deletions docs/introduction.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Introduction
============

Work in progress
35 changes: 35 additions & 0 deletions docs/make.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@ECHO OFF

pushd %~dp0

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=.
set BUILDDIR=_build

if "%1" == "" goto help

%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.http://sphinx-doc.org/
exit /b 1
)

%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end

:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%

:end
popd
1 change: 1 addition & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Sphinx >= 3.0
20 changes: 11 additions & 9 deletions src/cmdtools/estimation/galerkin.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,26 @@ def get_membership(timeseries, centers, sigma):


def find_bandwidth(timeseries, centers, percentile=50):
"""Find the bandwidth of the Gaussian based on:
"""
Find the bandwidth of the Gaussian based on:
"Stein Variational Gradient Descent:
A General Purpose Bayesian Inference Algorithm",
Qiang Liu and Dilin Wang (2016).
Based on the value of the percentile is possible to decide the points to
take into consideration for the determination of the bandwidth.
Based on the value of the percentile is possible to decide the points to
take into consideration for the determination of the bandwidth.
Input:
timeseries: arr, trajectory, each row is a collection of
coordinates at a different timestep
centers: arr, centers of the Gaussians, each row has the coordinates
of a different center
timeseries: arr, trajectory, each row is a collection of \
coordinates at a different timestep
centers: arr, centers of the Gaussians, each row has the \
coordinates of a different center
percentile: int [0,100], default value = 50
Output:
sigma: float, the variance of the Gaussian"""
Output:
sigma: float, the variance of the Gaussian
"""

no_centers = np.shape(centers)[0]
sqdist = distance.cdist(timeseries, centers, distance.sqeuclidean)
Expand Down

0 comments on commit 8000d7a

Please sign in to comment.