diff --git a/Makefile b/Makefile
index 2681268..989da4f 100644
--- a/Makefile
+++ b/Makefile
@@ -108,7 +108,7 @@ trailing-spaces:
doc-clean:
@make -C docs/ clean
-doc: clean doc-clean inplace
+doc: doc-clean inplace
@make -C docs/ html
check-rst:
diff --git a/docs/_static/css/root_numpy.css b/docs/_static/css/root_numpy.css
new file mode 100644
index 0000000..5ff6fdf
--- /dev/null
+++ b/docs/_static/css/root_numpy.css
@@ -0,0 +1,25 @@
+@import url("theme.css");
+
+#root-numpy h1 {
+ font-size: 250%;
+ margin-bottom: 0;
+}
+
+h2.main-subtitle {
+ font-style: italic;
+ color: #777;
+}
+
+.wy-nav-content {
+ max-width: none;
+}
+
+div.highlight pre {
+ font-family: monospace;
+ font-size: 100%;
+}
+
+#root-numpy-reference code.xref.py.py-obj.docutils.literal {
+ color: #E74C3C;
+ font-size: 100%;
+}
diff --git a/docs/_static/root_numpy.css b/docs/_static/root_numpy.css
deleted file mode 100644
index a49028c..0000000
--- a/docs/_static/root_numpy.css
+++ /dev/null
@@ -1,14 +0,0 @@
-#documentation ul {
- list-style-type: none;
- list-style: none;
-}
-
-#examples ul {
- list-style-type: none;
- list-style: none;
-}
-
-h2.main {
- margin: 0;
- font-style: italic;
-}
diff --git a/docs/conf.py b/docs/conf.py
index 2a63446..34fccdb 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -37,7 +37,6 @@
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = [
'sphinx.ext.autodoc',
- 'sphinx.ext.viewcode',
'sphinx.ext.autosummary',
'numpydoc',
'gen_rst',
@@ -108,16 +107,14 @@
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
-#html_theme = 'default'
-html_theme = 'readthedocs'
+html_theme = 'sphinx_rtd_theme'
+html_style = 'css/root_numpy.css'
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
html_theme_options = {
- 'custom_css': 'root_numpy.css',
- 'show_sphinx': False,
- 'analytics_code': 'UA-39364267-1',
+ 'analytics_id': 'UA-39364267-1',
}
# Add any paths that contain custom themes here, relative to this directory.
@@ -169,10 +166,10 @@
#html_split_index = False
# If true, links to the reST sources are added to the pages.
-#html_show_sourcelink = True
+html_show_sourcelink = False
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
-#html_show_sphinx = True
+html_show_sphinx = False
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
#html_show_copyright = True
@@ -188,80 +185,5 @@
# Output file base name for HTML help builder.
htmlhelp_basename = 'root_numpydoc'
-
-# -- Options for LaTeX output --------------------------------------------------
-
-latex_elements = {
-# The paper size ('letterpaper' or 'a4paper').
-#'papersize': 'letterpaper',
-
-# The font size ('10pt', '11pt' or '12pt').
-#'pointsize': '10pt',
-
-# Additional stuff for the LaTeX preamble.
-#'preamble': '',
-}
-
-# Grouping the document tree into LaTeX files. List of tuples
-# (source start file, target name, title, author, documentclass [howto/manual]).
-latex_documents = [
- ('index', 'root_numpy.tex', u'root\\_numpy Documentation',
- u'Piti Ongmongkolkul', 'manual'),
-]
-
-# The name of an image file (relative to this directory) to place at the top of
-# the title page.
-#latex_logo = None
-
-# For "manual" documents, if this is true, then toplevel headings are parts,
-# not chapters.
-#latex_use_parts = False
-
-# If true, show page references after internal links.
-#latex_show_pagerefs = False
-
-# If true, show URL addresses after external links.
-#latex_show_urls = False
-
-# Documents to append as an appendix to all manuals.
-#latex_appendices = []
-
-# If false, no module index is generated.
-#latex_domain_indices = True
-
-
-# -- Options for manual page output --------------------------------------------
-
-# One entry per manual page. List of tuples
-# (source start file, name, description, authors, manual section).
-man_pages = [
- ('index', 'root_numpy', u'root_numpy Documentation',
- [u'Piti Ongmongkolkul'], 1)
-]
-
-# If true, show URL addresses after external links.
-#man_show_urls = False
-
-
-# -- Options for Texinfo output ------------------------------------------------
-
-# Grouping the document tree into Texinfo files. List of tuples
-# (source start file, target name, title, author,
-# dir menu entry, description, category)
-texinfo_documents = [
- ('index', 'root_numpy', u'root_numpy Documentation',
- u'Piti Ongmongkolkul', 'root_numpy', 'ROOT to numpy fast converter',
- ''),
-]
-
-# Documents to append as an appendix to all manuals.
-#texinfo_appendices = []
-
-# If false, no module index is generated.
-#texinfo_domain_indices = True
-
-# How to display URL addresses: 'footnote', 'no', or 'inline'.
-#texinfo_show_urls = 'footnote'
-
-add_module_names = False
+#add_module_names = False
autosummary_generate = True
diff --git a/docs/examples.rst b/docs/examples.rst
new file mode 100644
index 0000000..fddbddb
--- /dev/null
+++ b/docs/examples.rst
@@ -0,0 +1,8 @@
+Examples
+========
+
+.. toctree::
+ :maxdepth: 2
+
+ auto_examples/index
+
diff --git a/docs/gh-pages-init b/docs/gh-pages-init
deleted file mode 100644
index 6059212..0000000
--- a/docs/gh-pages-init
+++ /dev/null
@@ -1,3 +0,0 @@
-git clone git@github.com:piti118/root_numpy.git _build/html
-cd _build/html
-git checkout gh-pages
diff --git a/docs/index.rst b/docs/index.rst
index 82caeb7..496263b 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -1,30 +1,25 @@
.. raw:: html
-
-
root_numpy
-
An interface between ROOT and NumPy
+
+==========
+root_numpy
+==========
+
+.. raw:: html
+
+
An interface between ROOT and NumPy
.. include:: ../README.rst
:start-line: 20
-Documentation
--------------
-
.. toctree::
:maxdepth: 2
install
start
reference/index
-
-Examples
---------
-
-.. toctree::
- :maxdepth: 2
-
- auto_examples/index
-
+ examples
diff --git a/docs/reference/index.rst b/docs/reference/index.rst
index d066eb7..e538ae4 100644
--- a/docs/reference/index.rst
+++ b/docs/reference/index.rst
@@ -1,8 +1,7 @@
.. _reference:
-####################
root_numpy Reference
-####################
+====================
:Release: |version|
:Date: |today|
@@ -13,7 +12,7 @@ what they are and what they do.
root_numpy
----------
-.. module:: root_numpy
+.. currentmodule:: root_numpy
.. autosummary::
:toctree: generated
@@ -45,7 +44,7 @@ root_numpy
root_numpy.tmva
---------------
-.. module:: root_numpy.tmva
+.. currentmodule:: root_numpy.tmva
.. autosummary::
:toctree: generated
@@ -54,35 +53,3 @@ root_numpy.tmva
add_regression_events
evaluate_reader
evaluate_method
-
-.. _conversion_table:
-
-Type Conversion Table
----------------------
-
-Types are converted according to this table:
-
-================== =========================
-ROOT NumPy
-================== =========================
-Bool_t np.bool
-Char_t np.int8
-UChar_t np.uint8
-Short_t np.int16
-UShort_t np.uint16
-Int_t np.int32
-UInt_t np.uint32
-Float_t np.float32
-Double_t np.float64
-Long64_t np.int64
-ULong64_t np.uint64
-x[10] (np.primitivetype, (10,))
-x[nx] np.object
-string np.object
-vector np.object
-vector > np.object
-================== =========================
-
-Variable length arrays (such as ``particletype[nparticle]``) and vectors
-(such as ``vector``) are converted to NumPy arrays of the corresponding
-types. Fixed length arrays are converted to fixed length NumPy array fields.
diff --git a/docs/sphinxext/numpydoc/__init__.py b/docs/sphinxext/numpydoc/__init__.py
index ae9073b..0fce2cf 100644
--- a/docs/sphinxext/numpydoc/__init__.py
+++ b/docs/sphinxext/numpydoc/__init__.py
@@ -1 +1,3 @@
-from numpydoc import setup
+from __future__ import division, absolute_import, print_function
+
+from .numpydoc import setup
diff --git a/docs/sphinxext/numpydoc/comment_eater.py b/docs/sphinxext/numpydoc/comment_eater.py
index e11eea9..8cddd33 100644
--- a/docs/sphinxext/numpydoc/comment_eater.py
+++ b/docs/sphinxext/numpydoc/comment_eater.py
@@ -1,10 +1,17 @@
-from cStringIO import StringIO
+from __future__ import division, absolute_import, print_function
+
+import sys
+if sys.version_info[0] >= 3:
+ from io import StringIO
+else:
+ from io import StringIO
+
import compiler
import inspect
import textwrap
import tokenize
-from compiler_unparse import unparse
+from .compiler_unparse import unparse
class Comment(object):
@@ -68,7 +75,11 @@ def __init__(self):
def process_file(self, file):
""" Process a file object.
"""
- for token in tokenize.generate_tokens(file.next):
+ if sys.version_info[0] >= 3:
+ nxt = file.__next__
+ else:
+ nxt = file.next
+ for token in tokenize.generate_tokens(nxt):
self.process_token(*token)
self.make_index()
@@ -95,7 +106,7 @@ def new_noncomment(self, start_lineno, end_lineno):
def new_comment(self, string, start, end, line):
""" Possibly add a new comment.
-
+
Only adds a new comment if this comment is the only thing on the line.
Otherwise, it extends the noncomment block.
"""
diff --git a/docs/sphinxext/numpydoc/compiler_unparse.py b/docs/sphinxext/numpydoc/compiler_unparse.py
index ffcf51b..8933a83 100644
--- a/docs/sphinxext/numpydoc/compiler_unparse.py
+++ b/docs/sphinxext/numpydoc/compiler_unparse.py
@@ -10,13 +10,18 @@
fixme: We may want to move to using _ast trees because the compiler for
them is about 6 times faster than compiler.compile.
"""
+from __future__ import division, absolute_import, print_function
import sys
-import cStringIO
from compiler.ast import Const, Name, Tuple, Div, Mul, Sub, Add
+if sys.version_info[0] >= 3:
+ from io import StringIO
+else:
+ from StringIO import StringIO
+
def unparse(ast, single_line_functions=False):
- s = cStringIO.StringIO()
+ s = StringIO()
UnparseCompilerAst(ast, s, single_line_functions)
return s.getvalue().lstrip()
@@ -101,13 +106,13 @@ def _And(self, t):
if i != len(t.nodes)-1:
self._write(") and (")
self._write(")")
-
+
def _AssAttr(self, t):
""" Handle assigning an attribute of an object
"""
self._dispatch(t.expr)
self._write('.'+t.attrname)
-
+
def _Assign(self, t):
""" Expression Assignment such as "a = 1".
@@ -145,36 +150,36 @@ def _AssTuple(self, t):
def _AugAssign(self, t):
""" +=,-=,*=,/=,**=, etc. operations
"""
-
+
self._fill()
self._dispatch(t.node)
self._write(' '+t.op+' ')
self._dispatch(t.expr)
if not self._do_indent:
self._write(';')
-
+
def _Bitand(self, t):
""" Bit and operation.
"""
-
+
for i, node in enumerate(t.nodes):
self._write("(")
self._dispatch(node)
self._write(")")
if i != len(t.nodes)-1:
self._write(" & ")
-
+
def _Bitor(self, t):
""" Bit or operation
"""
-
+
for i, node in enumerate(t.nodes):
self._write("(")
self._dispatch(node)
self._write(")")
if i != len(t.nodes)-1:
self._write(" | ")
-
+
def _CallFunc(self, t):
""" Function call.
"""
@@ -249,7 +254,7 @@ def _From(self, t):
self._write(name)
if asname is not None:
self._write(" as "+asname)
-
+
def _Function(self, t):
""" Handle function definitions
"""
diff --git a/docs/sphinxext/numpydoc/docscrape.py b/docs/sphinxext/numpydoc/docscrape.py
index 615ea11..2b1719d 100644
--- a/docs/sphinxext/numpydoc/docscrape.py
+++ b/docs/sphinxext/numpydoc/docscrape.py
@@ -1,13 +1,16 @@
"""Extract reference documentation from the NumPy source tree.
"""
+from __future__ import division, absolute_import, print_function
import inspect
import textwrap
import re
import pydoc
-from StringIO import StringIO
from warnings import warn
+import collections
+import sys
+
class Reader(object):
"""A line-based string reader.
@@ -113,7 +116,7 @@ def __getitem__(self,key):
return self._parsed_data[key]
def __setitem__(self,key,val):
- if not self._parsed_data.has_key(key):
+ if key not in self._parsed_data:
warn("Unknown section %s" % key)
else:
self._parsed_data[key] = val
@@ -265,13 +268,17 @@ def _parse_summary(self):
if self._is_at_section():
return
- summary = self._doc.read_to_next_empty_line()
- summary_str = " ".join([s.strip() for s in summary]).strip()
- if re.compile('^([\w., ]+=)?\s*[\w\.]+\(.*\)$').match(summary_str):
- self['Signature'] = summary_str
- if not self._is_at_section():
- self['Summary'] = self._doc.read_to_next_empty_line()
- else:
+ # If several signatures present, take the last one
+ while True:
+ summary = self._doc.read_to_next_empty_line()
+ summary_str = " ".join([s.strip() for s in summary]).strip()
+ if re.compile('^([\w., ]+=)?\s*[\w\.]+\(.*\)$').match(summary_str):
+ self['Signature'] = summary_str
+ if not self._is_at_section():
+ continue
+ break
+
+ if summary is not None:
self['Summary'] = summary
if not self._is_at_section():
@@ -328,7 +335,10 @@ def _str_param_list(self, name):
if self[name]:
out += self._str_header(name)
for param,param_type,desc in self[name]:
- out += ['%s : %s' % (param, param_type)]
+ if param_type:
+ out += ['%s : %s' % (param, param_type)]
+ else:
+ out += [param]
out += self._str_indent(desc)
out += ['']
return out
@@ -370,7 +380,7 @@ def _str_index(self):
idx = self['index']
out = []
out += ['.. index:: %s' % idx.get('default','')]
- for section, references in idx.iteritems():
+ for section, references in idx.items():
if section == 'default':
continue
out += [' :%s: %s' % (section, ', '.join(references))]
@@ -424,11 +434,14 @@ def __init__(self, func, role='func', doc=None, config={}):
func, func_name = self.get_func()
try:
# try to read signature
- argspec = inspect.getargspec(func)
+ if sys.version_info[0] >= 3:
+ argspec = inspect.getfullargspec(func)
+ else:
+ argspec = inspect.getargspec(func)
argspec = inspect.formatargspec(*argspec)
argspec = argspec.replace('*','\*')
signature = '%s%s' % (func_name, argspec)
- except TypeError, e:
+ except TypeError as e:
signature = '%s()' % func_name
self['Signature'] = signature
@@ -450,8 +463,8 @@ def __str__(self):
'meth': 'method'}
if self._role:
- if not roles.has_key(self._role):
- print "Warning: invalid role %s" % self._role
+ if self._role not in roles:
+ print("Warning: invalid role %s" % self._role)
out += '.. %s:: %s\n \n\n' % (roles.get(self._role,''),
func_name)
@@ -460,6 +473,9 @@ def __str__(self):
class ClassDoc(NumpyDocString):
+
+ extra_public_methods = ['__call__']
+
def __init__(self, cls, doc=None, modulename='', func_doc=FunctionDoc,
config={}):
if not inspect.isclass(cls) and cls is not None:
@@ -478,23 +494,38 @@ def __init__(self, cls, doc=None, modulename='', func_doc=FunctionDoc,
NumpyDocString.__init__(self, doc)
if config.get('show_class_members', True):
- if not self['Methods']:
- self['Methods'] = [(name, '', '')
- for name in sorted(self.methods)]
- if not self['Attributes']:
- self['Attributes'] = [(name, '', '')
- for name in sorted(self.properties)]
+ def splitlines_x(s):
+ if not s:
+ return []
+ else:
+ return s.splitlines()
+
+ for field, items in [('Methods', self.methods),
+ ('Attributes', self.properties)]:
+ if not self[field]:
+ doc_list = []
+ for name in sorted(items):
+ try:
+ doc_item = pydoc.getdoc(getattr(self._cls, name))
+ doc_list.append((name, '', splitlines_x(doc_item)))
+ except AttributeError:
+ pass # method doesn't exist
+ self[field] = doc_list
@property
def methods(self):
if self._cls is None:
return []
return [name for name,func in inspect.getmembers(self._cls)
- if not name.startswith('_') and callable(func)]
+ if ((not name.startswith('_')
+ or name in self.extra_public_methods)
+ and isinstance(func, collections.Callable))]
@property
def properties(self):
if self._cls is None:
return []
return [name for name,func in inspect.getmembers(self._cls)
- if not name.startswith('_') and func is None]
+ if not name.startswith('_') and
+ (func is None or isinstance(func, property) or
+ inspect.isgetsetdescriptor(func))]
diff --git a/docs/sphinxext/numpydoc/docscrape_sphinx.py b/docs/sphinxext/numpydoc/docscrape_sphinx.py
index e44e770..cdc2a37 100644
--- a/docs/sphinxext/numpydoc/docscrape_sphinx.py
+++ b/docs/sphinxext/numpydoc/docscrape_sphinx.py
@@ -1,11 +1,24 @@
-import re, inspect, textwrap, pydoc
+from __future__ import division, absolute_import, print_function
+
+import sys, re, inspect, textwrap, pydoc
import sphinx
-from docscrape import NumpyDocString, FunctionDoc, ClassDoc
+import collections
+from .docscrape import NumpyDocString, FunctionDoc, ClassDoc
+
+if sys.version_info[0] >= 3:
+ sixu = lambda s: s
+else:
+ sixu = lambda s: unicode(s, 'unicode_escape')
+
class SphinxDocString(NumpyDocString):
def __init__(self, docstring, config={}):
- self.use_plots = config.get('use_plots', False)
NumpyDocString.__init__(self, docstring, config=config)
+ self.load_config(config)
+
+ def load_config(self, config):
+ self.use_plots = config.get('use_plots', False)
+ self.class_members_toctree = config.get('class_members_toctree', True)
# string conversion routines
def _str_header(self, name, symbol='`'):
@@ -33,16 +46,37 @@ def _str_summary(self):
def _str_extended_summary(self):
return self['Extended Summary'] + ['']
+ def _str_returns(self):
+ out = []
+ if self['Returns']:
+ out += self._str_field_list('Returns')
+ out += ['']
+ for param, param_type, desc in self['Returns']:
+ if param_type:
+ out += self._str_indent(['**%s** : %s' % (param.strip(),
+ param_type)])
+ else:
+ out += self._str_indent([param.strip()])
+ if desc:
+ out += ['']
+ out += self._str_indent(desc, 8)
+ out += ['']
+ return out
+
def _str_param_list(self, name):
out = []
if self[name]:
out += self._str_field_list(name)
out += ['']
- for param,param_type,desc in self[name]:
- out += self._str_indent(['**%s** : %s' % (param.strip(),
- param_type)])
- out += ['']
- out += self._str_indent(desc,8)
+ for param, param_type, desc in self[name]:
+ if param_type:
+ out += self._str_indent(['**%s** : %s' % (param.strip(),
+ param_type)])
+ else:
+ out += self._str_indent(['**%s**' % param.strip()])
+ if desc:
+ out += ['']
+ out += self._str_indent(desc, 8)
out += ['']
return out
@@ -72,25 +106,36 @@ def _str_member_list(self, name):
others = []
for param, param_type, desc in self[name]:
param = param.strip()
- if not self._obj or hasattr(self._obj, param):
+
+ # Check if the referenced member can have a docstring or not
+ param_obj = getattr(self._obj, param, None)
+ if not (callable(param_obj)
+ or isinstance(param_obj, property)
+ or inspect.isgetsetdescriptor(param_obj)):
+ param_obj = None
+
+ if param_obj and (pydoc.getdoc(param_obj) or not desc):
+ # Referenced object has a docstring
autosum += [" %s%s" % (prefix, param)]
else:
others.append((param, param_type, desc))
if autosum:
- out += ['.. autosummary::', ' :toctree:', '']
- out += autosum
+ out += ['.. autosummary::']
+ if self.class_members_toctree:
+ out += [' :toctree:']
+ out += [''] + autosum
if others:
- maxlen_0 = max([len(x[0]) for x in others])
- maxlen_1 = max([len(x[1]) for x in others])
- hdr = "="*maxlen_0 + " " + "="*maxlen_1 + " " + "="*10
- fmt = '%%%ds %%%ds ' % (maxlen_0, maxlen_1)
- n_indent = maxlen_0 + maxlen_1 + 4
- out += [hdr]
+ maxlen_0 = max(3, max([len(x[0]) for x in others]))
+ hdr = sixu("=")*maxlen_0 + sixu(" ") + sixu("=")*10
+ fmt = sixu('%%%ds %%s ') % (maxlen_0,)
+ out += ['', hdr]
for param, param_type, desc in others:
- out += [fmt % (param.strip(), param_type)]
- out += self._str_indent(desc, n_indent)
+ desc = sixu(" ").join(x.strip() for x in desc).strip()
+ if param_type:
+ desc = "(%s) %s" % (param_type, desc)
+ out += [fmt % (param.strip(), desc)]
out += [hdr]
out += ['']
return out
@@ -127,7 +172,7 @@ def _str_index(self):
return out
out += ['.. index:: %s' % idx.get('default','')]
- for section, references in idx.iteritems():
+ for section, references in idx.items():
if section == 'default':
continue
elif section == 'refguide':
@@ -178,8 +223,9 @@ def __str__(self, indent=0, func_role="obj"):
out += self._str_index() + ['']
out += self._str_summary()
out += self._str_extended_summary()
- for param_list in ('Parameters', 'Returns', 'Other Parameters',
- 'Raises', 'Warns'):
+ out += self._str_param_list('Parameters')
+ out += self._str_returns()
+ for param_list in ('Other Parameters', 'Raises', 'Warns'):
out += self._str_param_list(param_list)
out += self._str_warnings()
out += self._str_see_also(func_role)
@@ -193,17 +239,18 @@ def __str__(self, indent=0, func_role="obj"):
class SphinxFunctionDoc(SphinxDocString, FunctionDoc):
def __init__(self, obj, doc=None, config={}):
- self.use_plots = config.get('use_plots', False)
+ self.load_config(config)
FunctionDoc.__init__(self, obj, doc=doc, config=config)
class SphinxClassDoc(SphinxDocString, ClassDoc):
def __init__(self, obj, doc=None, func_doc=None, config={}):
- self.use_plots = config.get('use_plots', False)
+ self.load_config(config)
ClassDoc.__init__(self, obj, doc=doc, func_doc=None, config=config)
class SphinxObjDoc(SphinxDocString):
def __init__(self, obj, doc=None, config={}):
self._f = obj
+ self.load_config(config)
SphinxDocString.__init__(self, doc, config=config)
def get_doc_object(obj, what=None, doc=None, config={}):
@@ -212,7 +259,7 @@ def get_doc_object(obj, what=None, doc=None, config={}):
what = 'class'
elif inspect.ismodule(obj):
what = 'module'
- elif callable(obj):
+ elif isinstance(obj, collections.Callable):
what = 'function'
else:
what = 'object'
diff --git a/docs/sphinxext/numpydoc/linkcode.py b/docs/sphinxext/numpydoc/linkcode.py
new file mode 100644
index 0000000..1ad3ab8
--- /dev/null
+++ b/docs/sphinxext/numpydoc/linkcode.py
@@ -0,0 +1,83 @@
+# -*- coding: utf-8 -*-
+"""
+ linkcode
+ ~~~~~~~~
+
+ Add external links to module code in Python object descriptions.
+
+ :copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS.
+ :license: BSD, see LICENSE for details.
+
+"""
+from __future__ import division, absolute_import, print_function
+
+import warnings
+import collections
+
+warnings.warn("This extension has been accepted to Sphinx upstream. "
+ "Use the version from there (Sphinx >= 1.2) "
+ "https://bitbucket.org/birkenfeld/sphinx/pull-request/47/sphinxextlinkcode",
+ FutureWarning, stacklevel=1)
+
+
+from docutils import nodes
+
+from sphinx import addnodes
+from sphinx.locale import _
+from sphinx.errors import SphinxError
+
+class LinkcodeError(SphinxError):
+ category = "linkcode error"
+
+def doctree_read(app, doctree):
+ env = app.builder.env
+
+ resolve_target = getattr(env.config, 'linkcode_resolve', None)
+ if not isinstance(env.config.linkcode_resolve, collections.Callable):
+ raise LinkcodeError(
+ "Function `linkcode_resolve` is not given in conf.py")
+
+ domain_keys = dict(
+ py=['module', 'fullname'],
+ c=['names'],
+ cpp=['names'],
+ js=['object', 'fullname'],
+ )
+
+ for objnode in doctree.traverse(addnodes.desc):
+ domain = objnode.get('domain')
+ uris = set()
+ for signode in objnode:
+ if not isinstance(signode, addnodes.desc_signature):
+ continue
+
+ # Convert signode to a specified format
+ info = {}
+ for key in domain_keys.get(domain, []):
+ value = signode.get(key)
+ if not value:
+ value = ''
+ info[key] = value
+ if not info:
+ continue
+
+ # Call user code to resolve the link
+ uri = resolve_target(domain, info)
+ if not uri:
+ # no source
+ continue
+
+ if uri in uris or not uri:
+ # only one link per name, please
+ continue
+ uris.add(uri)
+
+ onlynode = addnodes.only(expr='html')
+ onlynode += nodes.reference('', '', internal=False, refuri=uri)
+ onlynode[0] += nodes.inline('', _('[source]'),
+ classes=['viewcode-link'])
+ signode += onlynode
+
+def setup(app):
+ app.connect('doctree-read', doctree_read)
+ app.add_config_value('linkcode_resolve', None, '')
diff --git a/docs/sphinxext/numpydoc/numpydoc.py b/docs/sphinxext/numpydoc/numpydoc.py
index 0973141..2bc2d1e 100644
--- a/docs/sphinxext/numpydoc/numpydoc.py
+++ b/docs/sphinxext/numpydoc/numpydoc.py
@@ -12,45 +12,64 @@
- Renumber references.
- Extract the signature from the docstring, if it can't be determined otherwise.
-.. [1] http://projects.scipy.org/numpy/wiki/CodingStyleGuidelines#docstring-standard
+.. [1] https://github.com/numpy/numpy/blob/master/doc/HOWTO_DOCUMENT.rst.txt
"""
+from __future__ import division, absolute_import, print_function
-import os, re, pydoc
-from docscrape_sphinx import get_doc_object, SphinxDocString
-from sphinx.util.compat import Directive
+import os, sys, re, pydoc
+import sphinx
import inspect
+import collections
+
+if sphinx.__version__ < '1.0.1':
+ raise RuntimeError("Sphinx 1.0.1 or newer is required")
+
+from .docscrape_sphinx import get_doc_object, SphinxDocString
+from sphinx.util.compat import Directive
+
+if sys.version_info[0] >= 3:
+ sixu = lambda s: s
+else:
+ sixu = lambda s: unicode(s, 'unicode_escape')
+
def mangle_docstrings(app, what, name, obj, options, lines,
reference_offset=[0]):
cfg = dict(use_plots=app.config.numpydoc_use_plots,
- show_class_members=app.config.numpydoc_show_class_members)
+ show_class_members=app.config.numpydoc_show_class_members,
+ class_members_toctree=app.config.numpydoc_class_members_toctree,
+ )
if what == 'module':
# Strip top title
- title_re = re.compile(ur'^\s*[#*=]{4,}\n[a-z0-9 -]+\n[#*=]{4,}\s*',
+ title_re = re.compile(sixu('^\\s*[#*=]{4,}\\n[a-z0-9 -]+\\n[#*=]{4,}\\s*'),
re.I|re.S)
- lines[:] = title_re.sub(u'', u"\n".join(lines)).split(u"\n")
+ lines[:] = title_re.sub(sixu(''), sixu("\n").join(lines)).split(sixu("\n"))
else:
- doc = get_doc_object(obj, what, u"\n".join(lines), config=cfg)
- lines[:] = unicode(doc).split(u"\n")
+ doc = get_doc_object(obj, what, sixu("\n").join(lines), config=cfg)
+ if sys.version_info[0] >= 3:
+ doc = str(doc)
+ else:
+ doc = unicode(doc)
+ lines[:] = doc.split(sixu("\n"))
if app.config.numpydoc_edit_link and hasattr(obj, '__name__') and \
obj.__name__:
if hasattr(obj, '__module__'):
- v = dict(full_name=u"%s.%s" % (obj.__module__, obj.__name__))
+ v = dict(full_name=sixu("%s.%s") % (obj.__module__, obj.__name__))
else:
v = dict(full_name=obj.__name__)
- lines += [u'', u'.. htmlonly::', '']
- lines += [u' %s' % x for x in
+ lines += [sixu(''), sixu('.. htmlonly::'), sixu('')]
+ lines += [sixu(' %s') % x for x in
(app.config.numpydoc_edit_link % v).split("\n")]
# replace reference numbers so that there are no duplicates
references = []
for line in lines:
line = line.strip()
- m = re.match(ur'^.. \[([a-z0-9_.-])\]', line, re.I)
+ m = re.match(sixu('^.. \\[([a-z0-9_.-])\\]'), line, re.I)
if m:
references.append(m.group(1))
@@ -59,14 +78,14 @@ def mangle_docstrings(app, what, name, obj, options, lines,
if references:
for i, line in enumerate(lines):
for r in references:
- if re.match(ur'^\d+$', r):
- new_r = u"R%d" % (reference_offset[0] + int(r))
+ if re.match(sixu('^\\d+$'), r):
+ new_r = sixu("R%d") % (reference_offset[0] + int(r))
else:
- new_r = u"%s%d" % (r, reference_offset[0])
- lines[i] = lines[i].replace(u'[%s]_' % r,
- u'[%s]_' % new_r)
- lines[i] = lines[i].replace(u'.. [%s]' % r,
- u'.. [%s]' % new_r)
+ new_r = sixu("%s%d") % (r, reference_offset[0])
+ lines[i] = lines[i].replace(sixu('[%s]_') % r,
+ sixu('[%s]_') % new_r)
+ lines[i] = lines[i].replace(sixu('.. [%s]') % r,
+ sixu('.. [%s]') % new_r)
reference_offset[0] += len(references)
@@ -77,15 +96,18 @@ def mangle_signature(app, what, name, obj, options, sig, retann):
'initializes x; see ' in pydoc.getdoc(obj.__init__))):
return '', ''
- if not (callable(obj) or hasattr(obj, '__argspec_is_invalid_')): return
+ if not (isinstance(obj, collections.Callable) or hasattr(obj, '__argspec_is_invalid_')): return
if not hasattr(obj, '__doc__'): return
doc = SphinxDocString(pydoc.getdoc(obj))
if doc['Signature']:
- sig = re.sub(u"^[^(]*", u"", doc['Signature'])
- return sig, u''
+ sig = re.sub(sixu("^[^(]*"), sixu(""), doc['Signature'])
+ return sig, sixu('')
def setup(app, get_doc_object_=get_doc_object):
+ if not hasattr(app, 'add_config_value'):
+ return # probably called by nose, better bail out
+
global get_doc_object
get_doc_object = get_doc_object_
@@ -94,10 +116,11 @@ def setup(app, get_doc_object_=get_doc_object):
app.add_config_value('numpydoc_edit_link', None, False)
app.add_config_value('numpydoc_use_plots', None, False)
app.add_config_value('numpydoc_show_class_members', True, True)
+ app.add_config_value('numpydoc_class_members_toctree', True, True)
# Extra mangling domains
- #app.add_domain(NumpyPythonDomain)
- #app.add_domain(NumpyCDomain)
+ app.add_domain(NumpyPythonDomain)
+ app.add_domain(NumpyCDomain)
#------------------------------------------------------------------------------
# Docstring-mangling domains
@@ -115,7 +138,7 @@ def __init__(self, *a, **kw):
self.wrap_mangling_directives()
def wrap_mangling_directives(self):
- for name, objtype in self.directive_mangling_map.items():
+ for name, objtype in list(self.directive_mangling_map.items()):
self.directives[name] = wrap_mangling_directive(
self.directives[name], objtype)
@@ -130,6 +153,7 @@ class NumpyPythonDomain(ManglingDomainBase, PythonDomain):
'staticmethod': 'function',
'attribute': 'attribute',
}
+ indices = []
class NumpyCDomain(ManglingDomainBase, CDomain):
name = 'np-c'
@@ -161,4 +185,3 @@ def run(self):
return base_directive.run(self)
return directive
-
diff --git a/docs/sphinxext/numpydoc/phantom_import.py b/docs/sphinxext/numpydoc/phantom_import.py
index c77eeb5..9a60b4a 100644
--- a/docs/sphinxext/numpydoc/phantom_import.py
+++ b/docs/sphinxext/numpydoc/phantom_import.py
@@ -14,6 +14,8 @@
.. [1] http://code.google.com/p/pydocweb
"""
+from __future__ import division, absolute_import, print_function
+
import imp, sys, compiler, types, os, inspect, re
def setup(app):
@@ -23,7 +25,7 @@ def setup(app):
def initialize(app):
fn = app.config.phantom_import_file
if (fn and os.path.isfile(fn)):
- print "[numpydoc] Phantom importing modules from", fn, "..."
+ print("[numpydoc] Phantom importing modules from", fn, "...")
import_phantom_module(fn)
#------------------------------------------------------------------------------
@@ -129,7 +131,10 @@ def base_cmp(a, b):
doc = "%s%s\n\n%s" % (funcname, argspec, doc)
obj = lambda: 0
obj.__argspec_is_invalid_ = True
- obj.func_name = funcname
+ if sys.version_info[0] >= 3:
+ obj.__name__ = funcname
+ else:
+ obj.func_name = funcname
obj.__name__ = name
obj.__doc__ = doc
if inspect.isclass(object_cache[parent]):
diff --git a/docs/sphinxext/numpydoc/plot_directive.py b/docs/sphinxext/numpydoc/plot_directive.py
index 545d2e3..2014f85 100644
--- a/docs/sphinxext/numpydoc/plot_directive.py
+++ b/docs/sphinxext/numpydoc/plot_directive.py
@@ -36,7 +36,7 @@
include-source : bool
Whether to display the source code. Default can be changed in conf.py
-
+
and the ``image`` directive options ``alt``, ``height``, ``width``,
``scale``, ``align``, ``class``.
@@ -74,10 +74,16 @@
to make them appear side-by-side, or in floats.
"""
+from __future__ import division, absolute_import, print_function
-import sys, os, glob, shutil, imp, warnings, cStringIO, re, textwrap, traceback
+import sys, os, glob, shutil, imp, warnings, re, textwrap, traceback
import sphinx
+if sys.version_info[0] >= 3:
+ from io import StringIO
+else:
+ from io import StringIO
+
import warnings
warnings.warn("A plot_directive module is also available under "
"matplotlib.sphinxext; expect this numpydoc.plot_directive "
@@ -94,7 +100,7 @@ def setup(app):
setup.app = app
setup.config = app.config
setup.confdir = app.confdir
-
+
app.add_config_value('plot_pre_code', '', True)
app.add_config_value('plot_include_source', False, True)
app.add_config_value('plot_formats', ['png', 'hires.png', 'pdf'], True)
@@ -257,7 +263,7 @@ def run(arguments, content, options, state_machine, state, lineno):
# is it in doctest format?
is_doctest = contains_doctest(code)
- if options.has_key('format'):
+ if 'format' in options:
if options['format'] == 'python':
is_doctest = False
else:
@@ -291,7 +297,7 @@ def run(arguments, content, options, state_machine, state, lineno):
results = makefig(code, source_file_name, build_dir, output_base,
config)
errors = []
- except PlotError, err:
+ except PlotError as err:
reporter = state.memo.reporter
sm = reporter.system_message(
2, "Exception occurred in plotting %s: %s" % (output_base, err),
@@ -314,7 +320,7 @@ def run(arguments, content, options, state_machine, state, lineno):
else:
source_code = ""
- opts = [':%s: %s' % (key, val) for key, val in options.items()
+ opts = [':%s: %s' % (key, val) for key, val in list(options.items())
if key in ('alt', 'height', 'width', 'scale', 'align', 'class')]
only_html = ".. only:: html"
@@ -444,7 +450,7 @@ def run_code(code, code_path, ns=None):
# Redirect stdout
stdout = sys.stdout
- sys.stdout = cStringIO.StringIO()
+ sys.stdout = StringIO()
# Reset sys.argv
old_sys_argv = sys.argv
@@ -456,9 +462,9 @@ def run_code(code, code_path, ns=None):
if ns is None:
ns = {}
if not ns:
- exec setup.config.plot_pre_code in ns
- exec code in ns
- except (Exception, SystemExit), err:
+ exec(setup.config.plot_pre_code, ns)
+ exec(code, ns)
+ except (Exception, SystemExit) as err:
raise PlotError(traceback.format_exc())
finally:
os.chdir(pwd)
@@ -520,7 +526,7 @@ def makefig(code, code_path, output_dir, output_base, config):
all_exists = True
for i, code_piece in enumerate(code_pieces):
images = []
- for j in xrange(1000):
+ for j in range(1000):
img = ImageFile('%s_%02d_%02d' % (output_base, i, j), output_dir)
for format, dpi in formats:
if out_of_date(code_path, img.filename(format)):
@@ -565,7 +571,7 @@ def makefig(code, code_path, output_dir, output_base, config):
for format, dpi in formats:
try:
figman.canvas.figure.savefig(img.filename(format), dpi=dpi)
- except exceptions.BaseException, err:
+ except exceptions.BaseException as err:
raise PlotError(traceback.format_exc())
img.formats.append(format)
@@ -582,38 +588,55 @@ def makefig(code, code_path, output_dir, output_base, config):
try:
from os.path import relpath
except ImportError:
- def relpath(target, base=os.curdir):
- """
- Return a relative path to the target from either the current
- dir or an optional base dir. Base can be a directory
- specified either as absolute or relative to current dir.
- """
-
- if not os.path.exists(target):
- raise OSError, 'Target does not exist: '+target
-
- if not os.path.isdir(base):
- raise OSError, 'Base is not a directory or does not exist: '+base
-
- base_list = (os.path.abspath(base)).split(os.sep)
- target_list = (os.path.abspath(target)).split(os.sep)
-
- # On the windows platform the target may be on a completely
- # different drive from the base.
- if os.name in ['nt','dos','os2'] and base_list[0] <> target_list[0]:
- raise OSError, 'Target is on a different drive to base. Target: '+target_list[0].upper()+', base: '+base_list[0].upper()
-
- # Starting from the filepath root, work out how much of the
- # filepath is shared by base and target.
- for i in range(min(len(base_list), len(target_list))):
- if base_list[i] <> target_list[i]: break
- else:
- # If we broke out of the loop, i is pointing to the first
- # differing path elements. If we didn't break out of the
- # loop, i is pointing to identical path elements.
- # Increment i so that in all cases it points to the first
- # differing path elements.
- i+=1
-
- rel_list = [os.pardir] * (len(base_list)-i) + target_list[i:]
- return os.path.join(*rel_list)
+ # Copied from Python 2.7
+ if 'posix' in sys.builtin_module_names:
+ def relpath(path, start=os.path.curdir):
+ """Return a relative version of a path"""
+ from os.path import sep, curdir, join, abspath, commonprefix, \
+ pardir
+
+ if not path:
+ raise ValueError("no path specified")
+
+ start_list = abspath(start).split(sep)
+ path_list = abspath(path).split(sep)
+
+ # Work out how much of the filepath is shared by start and path.
+ i = len(commonprefix([start_list, path_list]))
+
+ rel_list = [pardir] * (len(start_list)-i) + path_list[i:]
+ if not rel_list:
+ return curdir
+ return join(*rel_list)
+ elif 'nt' in sys.builtin_module_names:
+ def relpath(path, start=os.path.curdir):
+ """Return a relative version of a path"""
+ from os.path import sep, curdir, join, abspath, commonprefix, \
+ pardir, splitunc
+
+ if not path:
+ raise ValueError("no path specified")
+ start_list = abspath(start).split(sep)
+ path_list = abspath(path).split(sep)
+ if start_list[0].lower() != path_list[0].lower():
+ unc_path, rest = splitunc(path)
+ unc_start, rest = splitunc(start)
+ if bool(unc_path) ^ bool(unc_start):
+ raise ValueError("Cannot mix UNC and non-UNC paths (%s and %s)"
+ % (path, start))
+ else:
+ raise ValueError("path is on drive %s, start on drive %s"
+ % (path_list[0], start_list[0]))
+ # Work out how much of the filepath is shared by start and path.
+ for i in range(min(len(start_list), len(path_list))):
+ if start_list[i].lower() != path_list[i].lower():
+ break
+ else:
+ i += 1
+
+ rel_list = [pardir] * (len(start_list)-i) + path_list[i:]
+ if not rel_list:
+ return curdir
+ return join(*rel_list)
+ else:
+ raise RuntimeError("Unsupported platform (no relpath available!)")
diff --git a/docs/sphinxext/numpydoc/tests/test_docscrape.py b/docs/sphinxext/numpydoc/tests/test_docscrape.py
new file mode 100644
index 0000000..b682504
--- /dev/null
+++ b/docs/sphinxext/numpydoc/tests/test_docscrape.py
@@ -0,0 +1,767 @@
+# -*- encoding:utf-8 -*-
+from __future__ import division, absolute_import, print_function
+
+import sys, textwrap
+
+from numpydoc.docscrape import NumpyDocString, FunctionDoc, ClassDoc
+from numpydoc.docscrape_sphinx import SphinxDocString, SphinxClassDoc
+from nose.tools import *
+
+if sys.version_info[0] >= 3:
+ sixu = lambda s: s
+else:
+ sixu = lambda s: unicode(s, 'unicode_escape')
+
+
+doc_txt = '''\
+ numpy.multivariate_normal(mean, cov, shape=None, spam=None)
+
+ Draw values from a multivariate normal distribution with specified
+ mean and covariance.
+
+ The multivariate normal or Gaussian distribution is a generalisation
+ of the one-dimensional normal distribution to higher dimensions.
+
+ Parameters
+ ----------
+ mean : (N,) ndarray
+ Mean of the N-dimensional distribution.
+
+ .. math::
+
+ (1+2+3)/3
+
+ cov : (N, N) ndarray
+ Covariance matrix of the distribution.
+ shape : tuple of ints
+ Given a shape of, for example, (m,n,k), m*n*k samples are
+ generated, and packed in an m-by-n-by-k arrangement. Because
+ each sample is N-dimensional, the output shape is (m,n,k,N).
+
+ Returns
+ -------
+ out : ndarray
+ The drawn samples, arranged according to `shape`. If the
+ shape given is (m,n,...), then the shape of `out` is is
+ (m,n,...,N).
+
+ In other words, each entry ``out[i,j,...,:]`` is an N-dimensional
+ value drawn from the distribution.
+ list of str
+ This is not a real return value. It exists to test
+ anonymous return values.
+
+ Other Parameters
+ ----------------
+ spam : parrot
+ A parrot off its mortal coil.
+
+ Raises
+ ------
+ RuntimeError
+ Some error
+
+ Warns
+ -----
+ RuntimeWarning
+ Some warning
+
+ Warnings
+ --------
+ Certain warnings apply.
+
+ Notes
+ -----
+ Instead of specifying the full covariance matrix, popular
+ approximations include:
+
+ - Spherical covariance (`cov` is a multiple of the identity matrix)
+ - Diagonal covariance (`cov` has non-negative elements only on the diagonal)
+
+ This geometrical property can be seen in two dimensions by plotting
+ generated data-points:
+
+ >>> mean = [0,0]
+ >>> cov = [[1,0],[0,100]] # diagonal covariance, points lie on x or y-axis
+
+ >>> x,y = multivariate_normal(mean,cov,5000).T
+ >>> plt.plot(x,y,'x'); plt.axis('equal'); plt.show()
+
+ Note that the covariance matrix must be symmetric and non-negative
+ definite.
+
+ References
+ ----------
+ .. [1] A. Papoulis, "Probability, Random Variables, and Stochastic
+ Processes," 3rd ed., McGraw-Hill Companies, 1991
+ .. [2] R.O. Duda, P.E. Hart, and D.G. Stork, "Pattern Classification,"
+ 2nd ed., Wiley, 2001.
+
+ See Also
+ --------
+ some, other, funcs
+ otherfunc : relationship
+
+ Examples
+ --------
+ >>> mean = (1,2)
+ >>> cov = [[1,0],[1,0]]
+ >>> x = multivariate_normal(mean,cov,(3,3))
+ >>> print x.shape
+ (3, 3, 2)
+
+ The following is probably true, given that 0.6 is roughly twice the
+ standard deviation:
+
+ >>> print list( (x[0,0,:] - mean) < 0.6 )
+ [True, True]
+
+ .. index:: random
+ :refguide: random;distributions, random;gauss
+
+ '''
+doc = NumpyDocString(doc_txt)
+
+
+def test_signature():
+ assert doc['Signature'].startswith('numpy.multivariate_normal(')
+ assert doc['Signature'].endswith('spam=None)')
+
+def test_summary():
+ assert doc['Summary'][0].startswith('Draw values')
+ assert doc['Summary'][-1].endswith('covariance.')
+
+def test_extended_summary():
+ assert doc['Extended Summary'][0].startswith('The multivariate normal')
+
+def test_parameters():
+ assert_equal(len(doc['Parameters']), 3)
+ assert_equal([n for n,_,_ in doc['Parameters']], ['mean','cov','shape'])
+
+ arg, arg_type, desc = doc['Parameters'][1]
+ assert_equal(arg_type, '(N, N) ndarray')
+ assert desc[0].startswith('Covariance matrix')
+ assert doc['Parameters'][0][-1][-2] == ' (1+2+3)/3'
+
+def test_other_parameters():
+ assert_equal(len(doc['Other Parameters']), 1)
+ assert_equal([n for n,_,_ in doc['Other Parameters']], ['spam'])
+ arg, arg_type, desc = doc['Other Parameters'][0]
+ assert_equal(arg_type, 'parrot')
+ assert desc[0].startswith('A parrot off its mortal coil')
+
+def test_returns():
+ assert_equal(len(doc['Returns']), 2)
+ arg, arg_type, desc = doc['Returns'][0]
+ assert_equal(arg, 'out')
+ assert_equal(arg_type, 'ndarray')
+ assert desc[0].startswith('The drawn samples')
+ assert desc[-1].endswith('distribution.')
+
+ arg, arg_type, desc = doc['Returns'][1]
+ assert_equal(arg, 'list of str')
+ assert_equal(arg_type, '')
+ assert desc[0].startswith('This is not a real')
+ assert desc[-1].endswith('anonymous return values.')
+
+def test_notes():
+ assert doc['Notes'][0].startswith('Instead')
+ assert doc['Notes'][-1].endswith('definite.')
+ assert_equal(len(doc['Notes']), 17)
+
+def test_references():
+ assert doc['References'][0].startswith('..')
+ assert doc['References'][-1].endswith('2001.')
+
+def test_examples():
+ assert doc['Examples'][0].startswith('>>>')
+ assert doc['Examples'][-1].endswith('True]')
+
+def test_index():
+ assert_equal(doc['index']['default'], 'random')
+ assert_equal(len(doc['index']), 2)
+ assert_equal(len(doc['index']['refguide']), 2)
+
+def non_blank_line_by_line_compare(a,b):
+ a = textwrap.dedent(a)
+ b = textwrap.dedent(b)
+ a = [l.rstrip() for l in a.split('\n') if l.strip()]
+ b = [l.rstrip() for l in b.split('\n') if l.strip()]
+ for n,line in enumerate(a):
+ if not line == b[n]:
+ raise AssertionError("Lines %s of a and b differ: "
+ "\n>>> %s\n<<< %s\n" %
+ (n,line,b[n]))
+def test_str():
+ non_blank_line_by_line_compare(str(doc),
+"""numpy.multivariate_normal(mean, cov, shape=None, spam=None)
+
+Draw values from a multivariate normal distribution with specified
+mean and covariance.
+
+The multivariate normal or Gaussian distribution is a generalisation
+of the one-dimensional normal distribution to higher dimensions.
+
+Parameters
+----------
+mean : (N,) ndarray
+ Mean of the N-dimensional distribution.
+
+ .. math::
+
+ (1+2+3)/3
+
+cov : (N, N) ndarray
+ Covariance matrix of the distribution.
+shape : tuple of ints
+ Given a shape of, for example, (m,n,k), m*n*k samples are
+ generated, and packed in an m-by-n-by-k arrangement. Because
+ each sample is N-dimensional, the output shape is (m,n,k,N).
+
+Returns
+-------
+out : ndarray
+ The drawn samples, arranged according to `shape`. If the
+ shape given is (m,n,...), then the shape of `out` is is
+ (m,n,...,N).
+
+ In other words, each entry ``out[i,j,...,:]`` is an N-dimensional
+ value drawn from the distribution.
+list of str
+ This is not a real return value. It exists to test
+ anonymous return values.
+
+Other Parameters
+----------------
+spam : parrot
+ A parrot off its mortal coil.
+
+Raises
+------
+RuntimeError
+ Some error
+
+Warns
+-----
+RuntimeWarning
+ Some warning
+
+Warnings
+--------
+Certain warnings apply.
+
+See Also
+--------
+`some`_, `other`_, `funcs`_
+
+`otherfunc`_
+ relationship
+
+Notes
+-----
+Instead of specifying the full covariance matrix, popular
+approximations include:
+
+ - Spherical covariance (`cov` is a multiple of the identity matrix)
+ - Diagonal covariance (`cov` has non-negative elements only on the diagonal)
+
+This geometrical property can be seen in two dimensions by plotting
+generated data-points:
+
+>>> mean = [0,0]
+>>> cov = [[1,0],[0,100]] # diagonal covariance, points lie on x or y-axis
+
+>>> x,y = multivariate_normal(mean,cov,5000).T
+>>> plt.plot(x,y,'x'); plt.axis('equal'); plt.show()
+
+Note that the covariance matrix must be symmetric and non-negative
+definite.
+
+References
+----------
+.. [1] A. Papoulis, "Probability, Random Variables, and Stochastic
+ Processes," 3rd ed., McGraw-Hill Companies, 1991
+.. [2] R.O. Duda, P.E. Hart, and D.G. Stork, "Pattern Classification,"
+ 2nd ed., Wiley, 2001.
+
+Examples
+--------
+>>> mean = (1,2)
+>>> cov = [[1,0],[1,0]]
+>>> x = multivariate_normal(mean,cov,(3,3))
+>>> print x.shape
+(3, 3, 2)
+
+The following is probably true, given that 0.6 is roughly twice the
+standard deviation:
+
+>>> print list( (x[0,0,:] - mean) < 0.6 )
+[True, True]
+
+.. index:: random
+ :refguide: random;distributions, random;gauss""")
+
+
+def test_sphinx_str():
+ sphinx_doc = SphinxDocString(doc_txt)
+ non_blank_line_by_line_compare(str(sphinx_doc),
+"""
+.. index:: random
+ single: random;distributions, random;gauss
+
+Draw values from a multivariate normal distribution with specified
+mean and covariance.
+
+The multivariate normal or Gaussian distribution is a generalisation
+of the one-dimensional normal distribution to higher dimensions.
+
+:Parameters:
+
+ **mean** : (N,) ndarray
+
+ Mean of the N-dimensional distribution.
+
+ .. math::
+
+ (1+2+3)/3
+
+ **cov** : (N, N) ndarray
+
+ Covariance matrix of the distribution.
+
+ **shape** : tuple of ints
+
+ Given a shape of, for example, (m,n,k), m*n*k samples are
+ generated, and packed in an m-by-n-by-k arrangement. Because
+ each sample is N-dimensional, the output shape is (m,n,k,N).
+
+:Returns:
+
+ **out** : ndarray
+
+ The drawn samples, arranged according to `shape`. If the
+ shape given is (m,n,...), then the shape of `out` is is
+ (m,n,...,N).
+
+ In other words, each entry ``out[i,j,...,:]`` is an N-dimensional
+ value drawn from the distribution.
+
+ list of str
+
+ This is not a real return value. It exists to test
+ anonymous return values.
+
+:Other Parameters:
+
+ **spam** : parrot
+
+ A parrot off its mortal coil.
+
+:Raises:
+
+ **RuntimeError**
+
+ Some error
+
+:Warns:
+
+ **RuntimeWarning**
+
+ Some warning
+
+.. warning::
+
+ Certain warnings apply.
+
+.. seealso::
+
+ :obj:`some`, :obj:`other`, :obj:`funcs`
+
+ :obj:`otherfunc`
+ relationship
+
+.. rubric:: Notes
+
+Instead of specifying the full covariance matrix, popular
+approximations include:
+
+ - Spherical covariance (`cov` is a multiple of the identity matrix)
+ - Diagonal covariance (`cov` has non-negative elements only on the diagonal)
+
+This geometrical property can be seen in two dimensions by plotting
+generated data-points:
+
+>>> mean = [0,0]
+>>> cov = [[1,0],[0,100]] # diagonal covariance, points lie on x or y-axis
+
+>>> x,y = multivariate_normal(mean,cov,5000).T
+>>> plt.plot(x,y,'x'); plt.axis('equal'); plt.show()
+
+Note that the covariance matrix must be symmetric and non-negative
+definite.
+
+.. rubric:: References
+
+.. [1] A. Papoulis, "Probability, Random Variables, and Stochastic
+ Processes," 3rd ed., McGraw-Hill Companies, 1991
+.. [2] R.O. Duda, P.E. Hart, and D.G. Stork, "Pattern Classification,"
+ 2nd ed., Wiley, 2001.
+
+.. only:: latex
+
+ [1]_, [2]_
+
+.. rubric:: Examples
+
+>>> mean = (1,2)
+>>> cov = [[1,0],[1,0]]
+>>> x = multivariate_normal(mean,cov,(3,3))
+>>> print x.shape
+(3, 3, 2)
+
+The following is probably true, given that 0.6 is roughly twice the
+standard deviation:
+
+>>> print list( (x[0,0,:] - mean) < 0.6 )
+[True, True]
+""")
+
+
+doc2 = NumpyDocString("""
+ Returns array of indices of the maximum values of along the given axis.
+
+ Parameters
+ ----------
+ a : {array_like}
+ Array to look in.
+ axis : {None, integer}
+ If None, the index is into the flattened array, otherwise along
+ the specified axis""")
+
+def test_parameters_without_extended_description():
+ assert_equal(len(doc2['Parameters']), 2)
+
+doc3 = NumpyDocString("""
+ my_signature(*params, **kwds)
+
+ Return this and that.
+ """)
+
+def test_escape_stars():
+ signature = str(doc3).split('\n')[0]
+ assert_equal(signature, 'my_signature(\*params, \*\*kwds)')
+
+doc4 = NumpyDocString(
+ """a.conj()
+
+ Return an array with all complex-valued elements conjugated.""")
+
+def test_empty_extended_summary():
+ assert_equal(doc4['Extended Summary'], [])
+
+doc5 = NumpyDocString(
+ """
+ a.something()
+
+ Raises
+ ------
+ LinAlgException
+ If array is singular.
+
+ Warns
+ -----
+ SomeWarning
+ If needed
+ """)
+
+def test_raises():
+ assert_equal(len(doc5['Raises']), 1)
+ name,_,desc = doc5['Raises'][0]
+ assert_equal(name,'LinAlgException')
+ assert_equal(desc,['If array is singular.'])
+
+def test_warns():
+ assert_equal(len(doc5['Warns']), 1)
+ name,_,desc = doc5['Warns'][0]
+ assert_equal(name,'SomeWarning')
+ assert_equal(desc,['If needed'])
+
+def test_see_also():
+ doc6 = NumpyDocString(
+ """
+ z(x,theta)
+
+ See Also
+ --------
+ func_a, func_b, func_c
+ func_d : some equivalent func
+ foo.func_e : some other func over
+ multiple lines
+ func_f, func_g, :meth:`func_h`, func_j,
+ func_k
+ :obj:`baz.obj_q`
+ :class:`class_j`: fubar
+ foobar
+ """)
+
+ assert len(doc6['See Also']) == 12
+ for func, desc, role in doc6['See Also']:
+ if func in ('func_a', 'func_b', 'func_c', 'func_f',
+ 'func_g', 'func_h', 'func_j', 'func_k', 'baz.obj_q'):
+ assert(not desc)
+ else:
+ assert(desc)
+
+ if func == 'func_h':
+ assert role == 'meth'
+ elif func == 'baz.obj_q':
+ assert role == 'obj'
+ elif func == 'class_j':
+ assert role == 'class'
+ else:
+ assert role is None
+
+ if func == 'func_d':
+ assert desc == ['some equivalent func']
+ elif func == 'foo.func_e':
+ assert desc == ['some other func over', 'multiple lines']
+ elif func == 'class_j':
+ assert desc == ['fubar', 'foobar']
+
+def test_see_also_print():
+ class Dummy(object):
+ """
+ See Also
+ --------
+ func_a, func_b
+ func_c : some relationship
+ goes here
+ func_d
+ """
+ pass
+
+ obj = Dummy()
+ s = str(FunctionDoc(obj, role='func'))
+ assert(':func:`func_a`, :func:`func_b`' in s)
+ assert(' some relationship' in s)
+ assert(':func:`func_d`' in s)
+
+doc7 = NumpyDocString("""
+
+ Doc starts on second line.
+
+ """)
+
+def test_empty_first_line():
+ assert doc7['Summary'][0].startswith('Doc starts')
+
+
+def test_no_summary():
+ str(SphinxDocString("""
+ Parameters
+ ----------"""))
+
+
+def test_unicode():
+ doc = SphinxDocString("""
+ öäöäöäöäöåååå
+
+ öäöäöäööäååå
+
+ Parameters
+ ----------
+ ååå : äää
+ ööö
+
+ Returns
+ -------
+ ååå : ööö
+ äää
+
+ """)
+ assert isinstance(doc['Summary'][0], str)
+ assert doc['Summary'][0] == 'öäöäöäöäöåååå'
+
+def test_plot_examples():
+ cfg = dict(use_plots=True)
+
+ doc = SphinxDocString("""
+ Examples
+ --------
+ >>> import matplotlib.pyplot as plt
+ >>> plt.plot([1,2,3],[4,5,6])
+ >>> plt.show()
+ """, config=cfg)
+ assert 'plot::' in str(doc), str(doc)
+
+ doc = SphinxDocString("""
+ Examples
+ --------
+ .. plot::
+
+ import matplotlib.pyplot as plt
+ plt.plot([1,2,3],[4,5,6])
+ plt.show()
+ """, config=cfg)
+ assert str(doc).count('plot::') == 1, str(doc)
+
+def test_class_members():
+
+ class Dummy(object):
+ """
+ Dummy class.
+
+ """
+ def spam(self, a, b):
+ """Spam\n\nSpam spam."""
+ pass
+ def ham(self, c, d):
+ """Cheese\n\nNo cheese."""
+ pass
+ @property
+ def spammity(self):
+ """Spammity index"""
+ return 0.95
+
+ class Ignorable(object):
+ """local class, to be ignored"""
+ pass
+
+ for cls in (ClassDoc, SphinxClassDoc):
+ doc = cls(Dummy, config=dict(show_class_members=False))
+ assert 'Methods' not in str(doc), (cls, str(doc))
+ assert 'spam' not in str(doc), (cls, str(doc))
+ assert 'ham' not in str(doc), (cls, str(doc))
+ assert 'spammity' not in str(doc), (cls, str(doc))
+ assert 'Spammity index' not in str(doc), (cls, str(doc))
+
+ doc = cls(Dummy, config=dict(show_class_members=True))
+ assert 'Methods' in str(doc), (cls, str(doc))
+ assert 'spam' in str(doc), (cls, str(doc))
+ assert 'ham' in str(doc), (cls, str(doc))
+ assert 'spammity' in str(doc), (cls, str(doc))
+
+ if cls is SphinxClassDoc:
+ assert '.. autosummary::' in str(doc), str(doc)
+ else:
+ assert 'Spammity index' in str(doc), str(doc)
+
+def test_duplicate_signature():
+ # Duplicate function signatures occur e.g. in ufuncs, when the
+ # automatic mechanism adds one, and a more detailed comes from the
+ # docstring itself.
+
+ doc = NumpyDocString(
+ """
+ z(x1, x2)
+
+ z(a, theta)
+ """)
+
+ assert doc['Signature'].strip() == 'z(a, theta)'
+
+
+class_doc_txt = """
+ Foo
+
+ Parameters
+ ----------
+ f : callable ``f(t, y, *f_args)``
+ Aaa.
+ jac : callable ``jac(t, y, *jac_args)``
+ Bbb.
+
+ Attributes
+ ----------
+ t : float
+ Current time.
+ y : ndarray
+ Current variable values.
+
+ Methods
+ -------
+ a
+ b
+ c
+
+ Examples
+ --------
+ For usage examples, see `ode`.
+"""
+
+def test_class_members_doc():
+ doc = ClassDoc(None, class_doc_txt)
+ non_blank_line_by_line_compare(str(doc),
+ """
+ Foo
+
+ Parameters
+ ----------
+ f : callable ``f(t, y, *f_args)``
+ Aaa.
+ jac : callable ``jac(t, y, *jac_args)``
+ Bbb.
+
+ Examples
+ --------
+ For usage examples, see `ode`.
+
+ Attributes
+ ----------
+ t : float
+ Current time.
+ y : ndarray
+ Current variable values.
+
+ Methods
+ -------
+ a
+
+ b
+
+ c
+
+ .. index::
+
+ """)
+
+def test_class_members_doc_sphinx():
+ doc = SphinxClassDoc(None, class_doc_txt)
+ non_blank_line_by_line_compare(str(doc),
+ """
+ Foo
+
+ :Parameters:
+
+ **f** : callable ``f(t, y, *f_args)``
+
+ Aaa.
+
+ **jac** : callable ``jac(t, y, *jac_args)``
+
+ Bbb.
+
+ .. rubric:: Examples
+
+ For usage examples, see `ode`.
+
+ .. rubric:: Attributes
+
+ === ==========
+ t (float) Current time.
+ y (ndarray) Current variable values.
+ === ==========
+
+ .. rubric:: Methods
+
+ === ==========
+ a
+ b
+ c
+ === ==========
+
+ """)
+
+if __name__ == "__main__":
+ import nose
+ nose.run()
diff --git a/docs/sphinxext/numpydoc/tests/test_linkcode.py b/docs/sphinxext/numpydoc/tests/test_linkcode.py
new file mode 100644
index 0000000..340166a
--- /dev/null
+++ b/docs/sphinxext/numpydoc/tests/test_linkcode.py
@@ -0,0 +1,5 @@
+from __future__ import division, absolute_import, print_function
+
+import numpydoc.linkcode
+
+# No tests at the moment...
diff --git a/docs/sphinxext/numpydoc/tests/test_phantom_import.py b/docs/sphinxext/numpydoc/tests/test_phantom_import.py
new file mode 100644
index 0000000..80fae08
--- /dev/null
+++ b/docs/sphinxext/numpydoc/tests/test_phantom_import.py
@@ -0,0 +1,12 @@
+from __future__ import division, absolute_import, print_function
+
+import sys
+from nose import SkipTest
+
+def test_import():
+ if sys.version_info[0] >= 3:
+ raise SkipTest("phantom_import not ported to Py3")
+
+ import numpydoc.phantom_import
+
+# No tests at the moment...
diff --git a/docs/sphinxext/numpydoc/tests/test_plot_directive.py b/docs/sphinxext/numpydoc/tests/test_plot_directive.py
new file mode 100644
index 0000000..1ea1076
--- /dev/null
+++ b/docs/sphinxext/numpydoc/tests/test_plot_directive.py
@@ -0,0 +1,11 @@
+from __future__ import division, absolute_import, print_function
+
+import sys
+from nose import SkipTest
+
+def test_import():
+ if sys.version_info[0] >= 3:
+ raise SkipTest("plot_directive not ported to Python 3 (use the one from Matplotlib instead)")
+ import numpydoc.plot_directive
+
+# No tests at the moment...
diff --git a/docs/sphinxext/numpydoc/tests/test_traitsdoc.py b/docs/sphinxext/numpydoc/tests/test_traitsdoc.py
new file mode 100644
index 0000000..fe5078c
--- /dev/null
+++ b/docs/sphinxext/numpydoc/tests/test_traitsdoc.py
@@ -0,0 +1,11 @@
+from __future__ import division, absolute_import, print_function
+
+import sys
+from nose import SkipTest
+
+def test_import():
+ if sys.version_info[0] >= 3:
+ raise SkipTest("traitsdoc not ported to Python3")
+ import numpydoc.traitsdoc
+
+# No tests at the moment...
diff --git a/docs/sphinxext/numpydoc/traitsdoc.py b/docs/sphinxext/numpydoc/traitsdoc.py
index 0fcf2c1..596c54e 100644
--- a/docs/sphinxext/numpydoc/traitsdoc.py
+++ b/docs/sphinxext/numpydoc/traitsdoc.py
@@ -13,18 +13,20 @@
.. [2] http://code.enthought.com/projects/traits/
"""
+from __future__ import division, absolute_import, print_function
import inspect
import os
import pydoc
+import collections
-import docscrape
-import docscrape_sphinx
-from docscrape_sphinx import SphinxClassDoc, SphinxFunctionDoc, SphinxDocString
+from . import docscrape
+from . import docscrape_sphinx
+from .docscrape_sphinx import SphinxClassDoc, SphinxFunctionDoc, SphinxDocString
-import numpydoc
+from . import numpydoc
-import comment_eater
+from . import comment_eater
class SphinxTraitsDoc(SphinxClassDoc):
def __init__(self, cls, modulename='', func_doc=SphinxFunctionDoc):
@@ -117,7 +119,7 @@ def get_doc_object(obj, what=None, config=None):
what = 'class'
elif inspect.ismodule(obj):
what = 'module'
- elif callable(obj):
+ elif isinstance(obj, collections.Callable):
what = 'function'
else:
what = 'object'
diff --git a/docs/start.rst b/docs/start.rst
index 4ee66cc..0f92cec 100644
--- a/docs/start.rst
+++ b/docs/start.rst
@@ -3,8 +3,8 @@
Getting Started
===============
-Try `root_numpy` on `CERN's LXPLUS `_
-========================================================================================================
+Try root_numpy on `CERN's LXPLUS `_
+======================================================================================================
First `set up ROOT `_::
diff --git a/docs/themes/readthedocs/LICENSE b/docs/themes/readthedocs/LICENSE
deleted file mode 100644
index 894aa01..0000000
--- a/docs/themes/readthedocs/LICENSE
+++ /dev/null
@@ -1,26 +0,0 @@
-Copyright (c) 2011 Bay Citizen & Texas Tribune
-
-Original ReadTheDocs.org code
-Copyright (c) 2010 Charles Leifer, Eric Holscher, Bobby Grace
-
-Permission is hereby granted, free of charge, to any person
-obtaining a copy of this software and associated documentation
-files (the "Software"), to deal in the Software without
-restriction, including without limitation the rights to use,
-copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the
-Software is furnished to do so, subject to the following
-conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-OTHER DEALINGS IN THE SOFTWARE.
-
diff --git a/docs/themes/readthedocs/README.rst b/docs/themes/readthedocs/README.rst
deleted file mode 100644
index c548f9d..0000000
--- a/docs/themes/readthedocs/README.rst
+++ /dev/null
@@ -1,70 +0,0 @@
-Armstrong Sphinx Theme
-======================
-Sphinx theme for Armstrong documentation
-
-
-Usage
------
-Symlink this repository into your documentation at ``docs/_themes/armstrong``
-then add the following two settings to your Sphinx ``conf.py`` file::
-
- html_theme = "armstrong"
- html_theme_path = ["_themes", ]
-
-You can also change colors and such by adjusting the ``html_theme_options``
-dictionary. For a list of all settings, see ``theme.conf``.
-
-
-Defaults
---------
-This repository has been customized for Armstrong documentation, but you can
-use the original default color scheme on your project by copying the
-``rtd-theme.conf`` over the existing ``theme.conf``.
-
-
-Contributing
-------------
-
-* Create something awesome -- make the code better, add some functionality,
- whatever (this is the hardest part).
-* `Fork it`_
-* Create a topic branch to house your changes
-* Get all of your commits in the new topic branch
-* Submit a `pull request`_
-
-.. _Fork it: http://help.github.com/forking/
-.. _pull request: http://help.github.com/pull-requests/
-
-
-State of Project
-----------------
-Armstrong is an open-source news platform that is freely available to any
-organization. It is the result of a collaboration between the `Texas Tribune`_
-and `Bay Citizen`_, and a grant from the `John S. and James L. Knight
-Foundation`_. The first stable release is scheduled for September, 2011.
-
-To follow development, be sure to join the `Google Group`_.
-
-``armstrong_sphinx`` is part of the `Armstrong`_ project. Unless you're
-looking for a Sphinx theme, you're probably looking for the main project.
-
-.. _Armstrong: http://www.armstrongcms.org/
-.. _Bay Citizen: http://www.baycitizen.org/
-.. _John S. and James L. Knight Foundation: http://www.knightfoundation.org/
-.. _Texas Tribune: http://www.texastribune.org/
-.. _Google Group: http://groups.google.com/group/armstrongcms
-
-
-Credit
-------
-This theme is based on the the excellent `Read the Docs`_ theme. The original
-can be found in the `readthedocs.org`_ repository on GitHub.
-
-.. _Read the Docs: http://readthedocs.org/
-.. _readthedocs.org: https://github.com/rtfd/readthedocs.org
-
-
-License
--------
-Like the original RTD code, this code is licensed under a BSD. See the
-associated ``LICENSE`` file for more information.
diff --git a/docs/themes/readthedocs/layout.html b/docs/themes/readthedocs/layout.html
deleted file mode 100644
index 3c39fc5..0000000
--- a/docs/themes/readthedocs/layout.html
+++ /dev/null
@@ -1,45 +0,0 @@
-{% extends "basic/layout.html" %}
-
-{% set script_files = script_files + [pathto("_static/searchtools.js", 1)] %}
-
-{% block htmltitle %}
-{{ super() }}
-
-
-
-{% endblock %}
-
-{% block footer %}
-
-
-
-{% if theme_analytics_code %}
-
-
-{% endif %}
-
-{% endblock %}
diff --git a/docs/themes/readthedocs/static/rtd.css_t b/docs/themes/readthedocs/static/rtd.css_t
deleted file mode 100644
index 5ae0039..0000000
--- a/docs/themes/readthedocs/static/rtd.css_t
+++ /dev/null
@@ -1,969 +0,0 @@
-/*
- * rtd.css
- * ~~~~~~~~~~~~~~~
- *
- * Sphinx stylesheet -- sphinxdoc theme. Originally created by
- * Armin Ronacher for Werkzeug.
- *
- * Customized for ReadTheDocs by Eric Pierce & Eric Holscher
- *
- * :copyright: Copyright 2007-2010 by the Sphinx team, see AUTHORS.
- * :license: BSD, see LICENSE for details.
- *
- */
-
-/* RTD colors
- * light blue: {{ theme_light_color }}
- * medium blue: {{ theme_medium_color }}
- * dark blue: {{ theme_dark_color }}
- * dark grey: {{ theme_grey_color }}
- *
- * medium blue hover: {{ theme_medium_color_hover }};
- * green highlight: {{ theme_green_highlight }}
- * light blue (project bar): {{ theme_light_color }}
- */
-
-@import url("basic.css");
-@import url(http://fonts.googleapis.com/css?family=Alegreya:700);
-{% if theme_custom_css %}
-@import url("{{ theme_custom_css }}");
-{% endif %}
-
-/* PAGE LAYOUT -------------------------------------------------------------- */
-
-body {
- font: 100%/1.5 "ff-meta-web-pro-1","ff-meta-web-pro-2",Arial,"Helvetica Neue",sans-serif;
- text-align: center;
- color: black;
- background-color: {{ theme_background }};
- padding: 0;
- margin: 0;
-}
-
-div.document {
- text-align: left;
- background-color: {{ theme_light_color }};
-}
-
-div.bodywrapper {
- background-color: {{ theme_white }};
- border-left: 1px solid {{ theme_lighter_gray }};
- border-bottom: 1px solid {{ theme_lighter_gray }};
- margin: 0 0 0 16em;
-}
-
-div.body {
- margin: 0;
- padding: 0.5em 1.3em;
- /*max-width: 55em;*/
- min-width: 20em;
-}
-
-div.related {
- font-size: 1em;
- background-color: {{ theme_background }};
-}
-
-div.documentwrapper {
- float: left;
- width: 100%;
- background-color: {{ theme_light_color }};
-}
-
-
-/* HEADINGS --------------------------------------------------------------- */
-
-h1 {
- margin: 0;
- padding: 0.7em 0 0.3em 0;
- font-size: 1.5em;
- line-height: 1.15;
- color: {{ theme_h1 }};
- clear: both;
-}
-
-h1.main {
- font-size: 3.0em;
- font-family: 'Alegreya', serif;
-}
-
-h2 {
- margin: 2em 0 0.2em 0;
- font-size: 1.35em;
- padding: 0;
- color: {{ theme_h2 }};
-}
-
-h3 {
- margin: 1em 0 -0.3em 0;
- font-size: 1.2em;
- color: {{ theme_h3 }};
-}
-
-div.body h1 a, div.body h2 a, div.body h3 a, div.body h4 a, div.body h5 a, div.body h6 a {
- color: black;
-}
-
-h1 a.anchor, h2 a.anchor, h3 a.anchor, h4 a.anchor, h5 a.anchor, h6 a.anchor {
- display: none;
- margin: 0 0 0 0.3em;
- padding: 0 0.2em 0 0.2em;
- color: {{ theme_gray_a }} !important;
-}
-
-h1:hover a.anchor, h2:hover a.anchor, h3:hover a.anchor, h4:hover a.anchor,
-h5:hover a.anchor, h6:hover a.anchor {
- display: inline;
-}
-
-h1 a.anchor:hover, h2 a.anchor:hover, h3 a.anchor:hover, h4 a.anchor:hover,
-h5 a.anchor:hover, h6 a.anchor:hover {
- color: {{ theme_gray_7 }};
- background-color: {{ theme_dirty_white }};
-}
-
-
-/* LINKS ------------------------------------------------------------------ */
-
-/* Normal links get a pseudo-underline */
-a {
- color: {{ theme_link_color }};
- text-decoration: none;
- border-bottom: 1px solid {{ theme_link_color_decoration }};
-}
-
-/* Links in sidebar, TOC, index trees and tables have no underline */
-.sphinxsidebar a,
-.toctree-wrapper a,
-.indextable a,
-#indices-and-tables a {
- color: {{ theme_dark_gray }};
- text-decoration: none;
- border-bottom: none;
-}
-
-/* Most links get an underline-effect when hovered */
-a:hover,
-div.toctree-wrapper a:hover,
-.indextable a:hover,
-#indices-and-tables a:hover {
- color: {{ theme_black }};
- text-decoration: none;
- border-bottom: 1px solid {{ theme_black }};
-}
-
-/* Footer links */
-div.footer a {
- color: {{ theme_background_text_link }};
- text-decoration: none;
- border: none;
-}
-div.footer a:hover {
- color: {{ theme_medium_color_link_hover }};
- text-decoration: underline;
- border: none;
-}
-
-/* Permalink anchor (subtle grey with a red hover) */
-div.body a.headerlink {
- color: {{ theme_lighter_gray }};
- font-size: 1em;
- margin-left: 6px;
- padding: 0 4px 0 4px;
- text-decoration: none;
- border: none;
-}
-div.body a.headerlink:hover {
- color: {{ theme_negative_text }};
- border: none;
-}
-
-a.image-reference {
- border-bottom: none;
-}
-
-a.image-reference:hover {
- border-bottom: none;
-}
-
-
-/* NAVIGATION BAR --------------------------------------------------------- */
-
-div.related ul {
- height: 2.5em;
-}
-
-div.related ul li {
- margin: 0;
- padding: 0.65em 0;
- float: left;
- display: block;
- color: {{ theme_background_link_half }}; /* For the >> separators */
- font-size: 0.8em;
-}
-
-div.related ul li.right {
- float: right;
- margin-right: 5px;
- color: transparent; /* Hide the | separators */
-}
-
-/* "Breadcrumb" links in nav bar */
-div.related ul li a {
- order: none;
- background-color: inherit;
- font-weight: bold;
- margin: 6px 0 6px 4px;
- line-height: 1.75em;
- color: {{ theme_background_link }};
- text-shadow: 0 1px rgba(0, 0, 0, 0.5);
- padding: 0.4em 0.8em;
- border: none;
- border-radius: 3px;
-}
-/* previous / next / modules / index links look more like buttons */
-div.related ul li.right a {
- margin: 0.375em 0;
- background-color: {{ theme_medium_color_hover }};
- text-shadow: 0 1px rgba(0, 0, 0, 0.5);
- border-radius: 3px;
- -webkit-border-radius: 3px;
- -moz-border-radius: 3px;
-}
-/* All navbar links light up as buttons when hovered */
-div.related ul li a:hover {
- background-color: {{ theme_medium_color }};
- color: {{ theme_white }};
- text-decoration: none;
- border-radius: 3px;
- -webkit-border-radius: 3px;
- -moz-border-radius: 3px;
-}
-/* Take extra precautions for tt within links */
-a tt,
-div.related ul li a tt {
- background: inherit !important;
- color: inherit !important;
-}
-
-
-/* SIDEBAR ---------------------------------------------------------------- */
-
-div.sphinxsidebarwrapper {
- padding: 0 0 0 0;
-}
-
-div.sphinxsidebar {
- margin: 0;
- margin-left: -100%;
- float: left;
- top: 3em;
- left: 0;
- padding: 0 1em;
- width: 14em;
- font-size: 1em;
- text-align: left;
- background-color: {{ theme_light_color }};
-}
-
-div.sphinxsidebar img {
- max-width: 12em;
-}
-
-div.sphinxsidebar h3, div.sphinxsidebar h4 {
- margin: 1.2em 0 0.3em 0;
- font-size: 1em;
- padding: 0;
- color: {{ theme_gray_2 }};
- font-family: "ff-meta-web-pro-1", "ff-meta-web-pro-2", "Arial", "Helvetica Neue", sans-serif;
-}
-
-div.sphinxsidebar h3 a {
- color: {{ theme_grey_color }};
-}
-
-div.sphinxsidebar ul,
-div.sphinxsidebar p {
- margin-top: 0;
- padding-left: 0;
- line-height: 130%;
- background-color: {{ theme_light_color }};
-}
-
-/* No bullets for nested lists, but a little extra indentation */
-div.sphinxsidebar ul ul {
- list-style-type: none;
- margin-left: 1.5em;
- padding: 0;
-}
-
-/* A little top/bottom padding to prevent adjacent links' borders
- * from overlapping each other */
-div.sphinxsidebar ul li {
- padding: 1px 0;
-}
-
-/* A little left-padding to make these align with the ULs */
-div.sphinxsidebar p.topless {
- padding-left: 0 0 0 1em;
-}
-
-/* Make these into hidden one-liners */
-div.sphinxsidebar ul li,
-div.sphinxsidebar p.topless {
- white-space: nowrap;
- overflow: hidden;
-}
-/* ...which become visible when hovered */
-div.sphinxsidebar ul li:hover,
-div.sphinxsidebar p.topless:hover {
- overflow: visible;
-}
-
-/* Search text box and "Go" button */
-#searchbox {
- margin-top: 2em;
- margin-bottom: 1em;
- background: {{ theme_dirtier_white }};
- padding: 0.5em;
- border-radius: 6px;
- -moz-border-radius: 6px;
- -webkit-border-radius: 6px;
-}
-#searchbox h3 {
- margin-top: 0;
-}
-
-/* Make search box and button abut and have a border */
-input,
-div.sphinxsidebar input {
- border: 1px solid {{ theme_gray_9 }};
- float: left;
-}
-
-/* Search textbox */
-input[type="text"] {
- margin: 0;
- padding: 0 3px;
- height: 20px;
- width: 144px;
- border-top-left-radius: 3px;
- border-bottom-left-radius: 3px;
- -moz-border-radius-topleft: 3px;
- -moz-border-radius-bottomleft: 3px;
- -webkit-border-top-left-radius: 3px;
- -webkit-border-bottom-left-radius: 3px;
-}
-/* Search button */
-input[type="submit"] {
- margin: 0 0 0 -1px; /* -1px prevents a double-border with textbox */
- height: 22px;
- color: {{ theme_dark_gray }};
- background-color: {{ theme_light_color }};
- padding: 1px 4px;
- font-weight: bold;
- border-top-right-radius: 3px;
- border-bottom-right-radius: 3px;
- -moz-border-radius-topright: 3px;
- -moz-border-radius-bottomright: 3px;
- -webkit-border-top-right-radius: 3px;
- -webkit-border-bottom-right-radius: 3px;
-}
-input[type="submit"]:hover {
- color: {{ theme_white }};
- background-color: {{ theme_green_highlight }};
-}
-
-div.sphinxsidebar p.searchtip {
- clear: both;
- padding: 0.5em 0 0 0;
- background: {{ theme_dirtier_white }};
- color: {{ theme_gray }};
- font-size: 0.9em;
-}
-
-/* Sidebar links are unusual */
-div.sphinxsidebar li a,
-div.sphinxsidebar p a {
- background: {{ theme_light_color }}; /* In case links overlap main content */
- border-radius: 3px;
- -moz-border-radius: 3px;
- -webkit-border-radius: 3px;
- border: 1px solid transparent; /* To prevent things jumping around on hover */
- padding: 0 5px 0 5px;
-}
-div.sphinxsidebar li a:hover,
-div.sphinxsidebar p a:hover {
- color: {{ theme_black }};
- text-decoration: none;
- border: 1px solid {{ theme_light_gray }};
-}
-
-/* Tweak any link appearing in a heading */
-div.sphinxsidebar h3 a {
-}
-
-
-
-
-/* OTHER STUFF ------------------------------------------------------------ */
-
-cite, code, tt {
- font-family: 'Consolas', 'Deja Vu Sans Mono',
- 'Bitstream Vera Sans Mono', monospace;
- font-size: 0.95em;
- letter-spacing: 0.01em;
-}
-
-tt {
- background-color: {{ theme_code_background }};
- color: {{ theme_dark_gray }};
-}
-
-tt.descname, tt.descclassname, tt.xref {
- border: 0;
-}
-
-hr {
- border: 1px solid {{ theme_ruler }};
- margin: 2em;
-}
-
-pre, #_fontwidthtest {
- font-family: 'Consolas', 'Deja Vu Sans Mono',
- 'Bitstream Vera Sans Mono', monospace;
- margin: 1em 2em;
- font-size: 14px;
- letter-spacing: 0.015em;
- line-height: 120%;
- padding: 0.5em;
- border: 1px solid {{ theme_lighter_gray }};
- background-color: {{ theme_code_background }};
- border-radius: 6px;
- -moz-border-radius: 6px;
- -webkit-border-radius: 6px;
-}
-
-pre a {
- color: inherit;
- text-decoration: underline;
-}
-
-td.linenos pre {
- padding: 0.5em 0;
-}
-
-div.quotebar {
- background-color: {{ theme_almost_white }};
- max-width: 250px;
- float: right;
- padding: 2px 7px;
- border: 1px solid {{ theme_lighter_gray }};
-}
-
-div.topic {
- background-color: {{ theme_almost_white }};
-}
-
-table {
- border-collapse: collapse;
- margin: 0 -0.5em 0 -0.5em;
-}
-
-table td, table th {
- padding: 0.2em 0.5em 0.2em 0.5em;
-}
-
-
-/* ADMONITIONS AND WARNINGS ------------------------------------------------- */
-
-/* Shared by admonitions, warnings and sidebars */
-div.admonition,
-div.warning,
-div.sidebar {
- font-size: 0.9em;
- margin: 2em;
- padding: 0;
- /*
- border-radius: 6px;
- -moz-border-radius: 6px;
- -webkit-border-radius: 6px;
- */
-}
-div.admonition p,
-div.warning p,
-div.sidebar p {
- margin: 0.5em 1em 0.5em 1em;
- padding: 0;
-}
-div.admonition pre,
-div.warning pre,
-div.sidebar pre {
- margin: 0.4em 1em 0.4em 1em;
-}
-div.admonition p.admonition-title,
-div.warning p.admonition-title,
-div.sidebar p.sidebar-title {
- margin: 0;
- padding: 0.1em 0.5em 0.1em 0.5em;
- color: white;
- font-weight: bold;
- font-size: 1.1em;
- text-shadow: 0 1px rgba(0, 0, 0, 0.5);
-}
-div.admonition ul, div.admonition ol,
-div.warning ul, div.warning ol,
-div.sidebar ul, div.sidebar ol {
- margin: 0.1em 0.5em 0.5em 3em;
- padding: 0;
-}
-
-
-/* Admonitions and sidebars only */
-div.admonition, div.sidebar {
- border: 1px solid {{ theme_positive_dark }};
- background-color: {{ theme_positive_light }};
-}
-div.admonition p.admonition-title,
-div.sidebar p.sidebar-title {
- background-color: {{ theme_positive_medium }};
- border-bottom: 1px solid {{ theme_positive_dark }};
-}
-
-
-/* Warnings only */
-div.warning {
- border: 1px solid {{ theme_negative_dark }};
- background-color: {{ theme_negative_light }};
-}
-div.warning p.admonition-title {
- background-color: {{ theme_negative_medium }};
- border-bottom: 1px solid {{ theme_negative_dark }};
-}
-
-
-/* Sidebars only */
-div.sidebar {
- max-width: 200px;
-}
-
-
-
-div.versioninfo {
- margin: 1em 0 0 0;
- border: 1px solid {{ theme_lighter_gray }};
- background-color: {{ theme_light_medium_color }};
- padding: 8px;
- line-height: 1.3em;
- font-size: 0.9em;
-}
-
-.viewcode-back {
- font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'Geneva',
- 'Verdana', sans-serif;
-}
-
-div.viewcode-block:target {
- background-color: {{ theme_viewcode_bg }};
- border-top: 1px solid {{ theme_viewcode_border }};
- border-bottom: 1px solid {{ theme_viewcode_border }};
-}
-
-dl {
- margin: 1em 0 2.5em 0;
-}
-
-/* Highlight target when you click an internal link */
-dt:target {
- background: {{ theme_highlight }};
-}
-/* Don't highlight whole divs */
-div.highlight {
- background: transparent;
-}
-/* But do highlight spans (so search results can be highlighted) */
-span.highlight {
- background: {{ theme_highlight }};
-}
-
-div.footer {
- background-color: {{ theme_background }};
- color: {{ theme_background_text }};
- padding: 0 2em 2em 2em;
- clear: both;
- font-size: 0.8em;
- text-align: center;
-}
-
-p {
- margin: 0.8em 0 0.5em 0;
-}
-
-.section p img {
- margin: 1em 2em;
-}
-
-/* TWEAKS ----------------------------------------------------------------------*/
-
-tt {
- color: inherit;
- font: inherit;
-}
-
-tt.literal {
- font-family: monospace;
- padding-left: 2px;
- background-color: rgb(242, 242, 242);
-}
-
-a tt.literal {
- border-bottom: none;
- background-color: inherit;
-}
-
-tt.xref {
- font-family: inherit;
- border-bottom: none;
- background-color: inherit;
- font-weight: normal;
- padding-left: 0px;
-}
-
-tt.descname {
- font-size: 16px;
-}
-
-dl.class > dt > em {
- font-weight: normal;
-}
-
-dl.function > dt > em {
- font-weight: normal;
-}
-
-dl.method > dt > em {
- font-weight: normal;
-}
-
-/*
- * Field lists
- */
-
-table.field-list {
- border-collapse: collapse;
- border-spacing: 5px;
- margin-left: 1px;
- border-left: 5px solid rgb(238, 238, 238) !important;
-}
-
-table.field-list th.field-name {
- display: inline-block;
- padding: 1px 8px 1px 5px;
- white-space: nowrap;
- background-color: rgb(238, 238, 238);
-}
-
-table.field-list td.field-body {
- border-left: none !important;
-}
-
-table.field-list td.field-body > p {
- font-style: italic;
-}
-
-table.field-list td.field-body > p > strong {
- font-style: normal;
-}
-
-td.field-body blockquote {
- border-left: none;
- margin: 0;
- padding-left: 30px;
-}
-
-td.field-body blockquote p,
-dl.class blockquote p,
-dl.function blockquote p,
-dl.method blockquote p
-{
- font-family: inherit;
- font-size: inherit;
- font-weight: inherit;
- line-height: inherit;
-}
-
-/*
- * Headers
- */
-
-h1 a { color: rgb(85, 85, 85); }
-h2 a { color: rgb(85, 85, 85); }
-h3 a { color: rgb(85, 85, 85); }
-h4 a { color: rgb(85, 85, 85); }
-h5 a { color: rgb(85, 85, 85); }
-h6 a { color: rgb(85, 85, 85); }
-
-h1 tt { font: inherit; border-bottom: none; }
-h2 tt { font: inherit; border-bottom: none; }
-h3 tt { font: inherit; border-bottom: none; }
-h4 tt { font: inherit; border-bottom: none; }
-h5 tt { font: inherit; border-bottom: none; }
-h6 tt { font: inherit; border-bottom: none; }
-
-p.rubric {
- color: rgb(85, 85, 85);
- font-size: 120%;
- font-weight: normal;
- border-bottom: 1px solid rgb(204, 204, 204);
-}
-
-
-/*
- * Tables
- */
-
-table.citation {
- border: none;
-}
-
-table.docutils td, table.docutils th {
- border: none;
-}
-
-table.docutils {
- margin-bottom: 9.5px;
-}
-
-
-/*
- * Admonitions
- */
-
-p.admonition-title {
- display: inline;
-}
-
-p.admonition-title:after {
- content: ":";
-}
-
-div.seealso {
- background-color: #ffc;
- border: 1px solid #ff6;
-}
-
-div.seealso dt {
- float: left;
- clear: left;
- min-width: 4em;
- padding-right: 1em;
-}
-
-div.seealso dd {
- margin-top: 0;
- margin-bottom: 0;
-}
-
-div.warning {
- background-color: #ffe4e4;
- border: 1px solid #f66;
-}
-
-div.note {
- background-color: #eee;
- border: 1px solid #ccc;
-}
-
-
-/* MOBILE LAYOUT -------------------------------------------------------------- */
-
-@media screen and (max-width: 600px) {
-
- h1, h2, h3, h4, h5 {
- position: relative;
- }
-
- ul {
- padding-left: 1.75em;
- }
-
- div.bodywrapper a.headerlink, #indices-and-tables h1 a {
- color: {{ theme_almost_dirty_white }};
- font-size: 80%;
- float: right;
- line-height: 1.8;
- position: absolute;
- right: -0.7em;
- visibility: inherit;
- }
-
- div.bodywrapper h1 a.headerlink, #indices-and-tables h1 a {
- line-height: 1.5;
- }
-
- pre {
- font-size: 0.7em;
- overflow: auto;
- word-wrap: break-word;
- white-space: pre-wrap;
- }
-
- div.related ul {
- height: 2.5em;
- padding: 0;
- text-align: left;
- }
-
- div.related ul li {
- clear: both;
- color: {{ theme_dark_color }};
- padding: 0.2em 0;
- }
-
- div.related ul li:last-child {
- border-bottom: 1px dotted {{ theme_medium_color }};
- padding-bottom: 0.4em;
- margin-bottom: 1em;
- width: 100%;
- }
-
- div.related ul li a {
- color: {{ theme_dark_color }};
- padding-right: 0;
- }
-
- div.related ul li a:hover {
- background: inherit;
- color: inherit;
- }
-
- div.related ul li.right {
- clear: none;
- padding: 0.65em 0;
- margin-bottom: 0.5em;
- }
-
- div.related ul li.right a {
- color: {{ theme_white }};
- padding-right: 0.8em;
- }
-
- div.related ul li.right a:hover {
- background-color: {{ theme_medium_color }};
- }
-
- div.body {
- clear: both;
- min-width: 0;
- word-wrap: break-word;
- }
-
- div.bodywrapper {
- margin: 0 0 0 0;
- }
-
- div.sphinxsidebar {
- float: none;
- margin: 0;
- width: auto;
- }
-
- div.sphinxsidebar input[type="text"] {
- height: 2em;
- line-height: 2em;
- width: 70%;
- }
-
- div.sphinxsidebar input[type="submit"] {
- height: 2em;
- margin-left: 0.5em;
- width: 20%;
- }
-
- div.sphinxsidebar p.searchtip {
- background: inherit;
- margin-bottom: 1em;
- }
-
- div.sphinxsidebar ul li, div.sphinxsidebar p.topless {
- white-space: normal;
- }
-
- .bodywrapper img {
- display: block;
- margin-left: auto;
- margin-right: auto;
- max-width: 100%;
- }
-
- div.documentwrapper {
- float: none;
- }
-
- div.admonition, div.warning, pre, blockquote {
- margin-left: 0em;
- margin-right: 0em;
- }
-
- .body p img {
- margin: 0;
- }
-
- #searchbox {
- background: transparent;
- }
-
- .related:not(:first-child) li {
- display: none;
- }
-
- .related:not(:first-child) li.right {
- display: block;
- }
-
- div.footer {
- padding: 1em;
- }
-
- .rtd_doc_footer .badge {
- float: none;
- margin: 1em auto;
- position: static;
- }
-
- .rtd_doc_footer .badge.revsys-inline {
- margin-right: auto;
- margin-bottom: 2em;
- }
-
- table.indextable {
- display: block;
- width: auto;
- }
-
- .indextable tr {
- display: block;
- }
-
- .indextable td {
- display: block;
- padding: 0;
- width: auto !important;
- }
-
- .indextable td dt {
- margin: 1em 0;
- }
-
- ul.search {
- margin-left: 0.25em;
- }
-
- ul.search li div.context {
- font-size: 90%;
- line-height: 1.1;
- margin-bottom: 1;
- margin-left: 0;
- }
-
-}
diff --git a/docs/themes/readthedocs/theme.conf b/docs/themes/readthedocs/theme.conf
deleted file mode 100644
index 96de415..0000000
--- a/docs/themes/readthedocs/theme.conf
+++ /dev/null
@@ -1,67 +0,0 @@
-[theme]
-inherit = default
-stylesheet = rtd.css
-pygment_style = default
-
-[options]
-analytics_code =
-show_copyright = True
-show_sphinx = False
-custom_css =
-
-white = #ffffff
-almost_white = #f8f8f8
-barely_white = #f2f2f2
-dirty_white = #eeeeee
-almost_dirty_white = #e6e6e6
-dirtier_white = #dddddd
-lighter_gray = #cccccc
-gray_a = #aaaaaa
-gray_9 = #999999
-light_gray = #888888
-gray_7 = #777777
-gray = #666666
-dark_gray = #444444
-gray_2 = #222222
-black = #111111
-light_color = #e8ecef
-light_medium_color = #DDEAF0
-medium_color = #8ca1af
-medium_color_link = #86989b
-medium_color_link_hover = #a6b8bb
-dark_color = #465158
-
-h1 = #000000
-h2 = #465158
-h3 = #6c818f
-
-link_color = #444444
-link_color_decoration = #CCCCCC
-
-medium_color_hover = #697983
-green_highlight = #8ecc4c
-
-
-positive_dark = #609060
-positive_medium = #70a070
-positive_light = #e9ffe9
-
-negative_dark = #900000
-negative_medium = #b04040
-negative_light = #ffe9e9
-negative_text = #c60f0f
-
-ruler = #abc
-
-viewcode_bg = #f4debf
-viewcode_border = #ac9
-
-highlight = #ffe080
-
-code_background = #eeeeee
-
-background = #465158
-background_link = #ffffff
-background_link_half = #ffffff
-background_text = #eeeeee
-background_text_link = #86989b
diff --git a/docs/themes/sphinx_rtd_theme/Apache-License-2.0.txt b/docs/themes/sphinx_rtd_theme/Apache-License-2.0.txt
new file mode 100644
index 0000000..a2e633f
--- /dev/null
+++ b/docs/themes/sphinx_rtd_theme/Apache-License-2.0.txt
@@ -0,0 +1,205 @@
+sphinx_rtd_theme/static/fonts/RobotoSlab-Bold.ttf
+sphinx_rtd_theme/static/fonts/RobotoSlab-Regular.tt/
+
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/docs/themes/sphinx_rtd_theme/LICENSE b/docs/themes/sphinx_rtd_theme/LICENSE
new file mode 100644
index 0000000..921f073
--- /dev/null
+++ b/docs/themes/sphinx_rtd_theme/LICENSE
@@ -0,0 +1,20 @@
+The MIT License (MIT)
+
+Copyright (c) 2013 Dave Snider
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/docs/themes/sphinx_rtd_theme/__init__.py b/docs/themes/sphinx_rtd_theme/__init__.py
new file mode 100644
index 0000000..95ddc52
--- /dev/null
+++ b/docs/themes/sphinx_rtd_theme/__init__.py
@@ -0,0 +1,17 @@
+"""Sphinx ReadTheDocs theme.
+
+From https://github.com/ryan-roemer/sphinx-bootstrap-theme.
+
+"""
+import os
+
+VERSION = (0, 1, 8)
+
+__version__ = ".".join(str(v) for v in VERSION)
+__version_full__ = __version__
+
+
+def get_html_theme_path():
+ """Return list of HTML theme paths."""
+ cur_dir = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
+ return cur_dir
diff --git a/docs/themes/sphinx_rtd_theme/breadcrumbs.html b/docs/themes/sphinx_rtd_theme/breadcrumbs.html
new file mode 100644
index 0000000..131d497
--- /dev/null
+++ b/docs/themes/sphinx_rtd_theme/breadcrumbs.html
@@ -0,0 +1,31 @@
+{# Support for Sphinx 1.3+ page_source_suffix, but don't break old builds. #}
+
+{% if page_source_suffix %}
+{% set suffix = page_source_suffix %}
+{% else %}
+{% set suffix = source_suffix %}
+{% endif %}
+
+
+{%- endblock %}
+
+
+
diff --git a/docs/themes/sphinx_rtd_theme/search.html b/docs/themes/sphinx_rtd_theme/search.html
new file mode 100644
index 0000000..e3aa9b5
--- /dev/null
+++ b/docs/themes/sphinx_rtd_theme/search.html
@@ -0,0 +1,50 @@
+{#
+ basic/search.html
+ ~~~~~~~~~~~~~~~~~
+
+ Template for the search page.
+
+ :copyright: Copyright 2007-2013 by the Sphinx team, see AUTHORS.
+ :license: BSD, see LICENSE for details.
+#}
+{%- extends "layout.html" %}
+{% set title = _('Search') %}
+{% set script_files = script_files + ['_static/searchtools.js'] %}
+{% block footer %}
+
+ {# this is used when loading the search index using $.ajax fails,
+ such as on Chrome for documents on localhost #}
+
+ {{ super() }}
+{% endblock %}
+{% block body %}
+
+
+ {% if search_performed %}
+
{{ _('Search Results') }}
+ {% if not search_results %}
+
{{ _('Your search did not match any documents. Please make sure that all words are spelled correctly and that you\'ve selected enough categories.') }}
+ {% endif %}
+ {% endif %}
+
+ {% if search_results %}
+
+ {% for href, caption, context in search_results %}
+
+
+ Free document hosting provided by Read the Docs.
+
+
+
+{% endif %}
+
diff --git a/root_numpy/_tree.py b/root_numpy/_tree.py
index 604f628..f597262 100644
--- a/root_numpy/_tree.py
+++ b/root_numpy/_tree.py
@@ -105,8 +105,6 @@ def root2array(filenames,
cache_size=-1):
"""Convert trees in ROOT files into a numpy structured array.
- Refer to the type conversion table :ref:`here `.
-
Parameters
----------
filenames : str or list
@@ -136,47 +134,13 @@ def root2array(filenames,
value of -1 uses ROOT's default cache size. A value of 0 disables the
cache.
- Examples
- --------
-
- Read all branches from the tree named ``mytree`` in ``a.root``
- Remember that ``mytree`` is optional if ``a.root`` has one tree::
-
- root2array('a.root', 'mytree')
-
- Read all branches starting from entry 5 and include 10 entries or up to the
- end of the file::
-
- root2array('a.root', 'mytree', start=5, stop=11)
-
- Read all branches in reverse order::
-
- root2array('a.root', 'mytree', step=-1)
-
- Read every second entry::
-
- root2array('a.root', 'mytree', step=2)
-
- Read all branches from the tree named ``mytree`` in ``a*.root``::
-
- root2array('a*.root', 'mytree')
-
- Read all branches from the tree named ``mytree`` in ``a*.root`` and
- ``b*.root``::
-
- root2array(['a*.root', 'b*.root'], 'mytree')
-
- Read branch ``x`` and ``y`` from the tree named ``mytree`` in ``a.root``::
-
- root2array('a.root', 'mytree', ['x', 'y'])
-
Notes
-----
+ * Refer to the :ref:`type conversion table `.
- Due to the way TChain works, if the trees specified in the input files have
- different structures, only the branch in the first tree will be
- automatically extracted. You can work around this by either reordering the
- input file or specifying the branches manually.
+ See Also
+ --------
+ tree2array
"""
filenames = _glob(filenames)
@@ -230,10 +194,12 @@ def root2rec(filenames,
Notes
-----
- This is equivalent to::
+ * This is equivalent to::
root2array(filenames, treename, branches).view(np.recarray)
+ * Refer to the :ref:`type conversion table `.
+
See Also
--------
root2array
@@ -258,8 +224,6 @@ def tree2array(tree,
cache_size=-1):
"""Convert a tree into a numpy structured array.
- Refer to the type conversion table :ref:`here `.
-
Parameters
----------
tree : ROOT TTree instance
@@ -285,6 +249,39 @@ def tree2array(tree,
value of -1 uses ROOT's default cache size. A value of 0 disables the
cache.
+ Notes
+ -----
+ Types are converted according to:
+
+ .. _conversion_table:
+
+ ======================== ===============================
+ ROOT NumPy
+ ======================== ===============================
+ ``Bool_t`` ``np.bool``
+ ``Char_t`` ``np.int8``
+ ``UChar_t`` ``np.uint8``
+ ``Short_t`` ``np.int16``
+ ``UShort_t`` ``np.uint16``
+ ``Int_t`` ``np.int32``
+ ``UInt_t`` ``np.uint32``
+ ``Float_t`` ``np.float32``
+ ``Double_t`` ``np.float64``
+ ``Long64_t`` ``np.int64``
+ ``ULong64_t`` ``np.uint64``
+ ``[2][3]...`` ``(, (2, 3, ...))``
+ ``[nx][2]...`` ``np.object``
+ ``string`` ``np.object``
+ ``vector`` ``np.object``
+ ``vector >`` ``np.object``
+ ======================== ===============================
+
+ * Variable-length arrays (such as ``x[nx][2]``) and vectors (such as
+ ``vector``) are converted to NumPy arrays of the corresponding
+ types.
+
+ * Fixed-length arrays are converted to fixed-length NumPy array fields.
+
See Also
--------
root2array
@@ -328,10 +325,12 @@ def tree2rec(tree,
Notes
-----
- This is equivalent to::
+ * This is equivalent to::
tree2array(treename, branches).view(np.recarray)
+ * Refer to the :ref:`type conversion table `.
+
See Also
--------
tree2array