Skip to content

Commit

Permalink
docs: add POC table to docs
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmueller committed Aug 16, 2021
1 parent 94885fd commit e90038f
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
3.1.2
- docs: add POC table to docs
3.1.1
- fix: do not modify preprocessing options when applying them (create
a copy of the dictionary)
Expand Down
36 changes: 32 additions & 4 deletions docs/extensions/nanite_preprocs.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,17 @@
.. nanite_preproc_table::
Table of all POC methods in nanite
.. nanite_preproc_poc_table::
"""
from docutils.statemachine import ViewList
from docutils.parsers.rst import Directive
from sphinx.util.nodes import nested_parse_with_titles
from docutils import nodes

from nanite import preproc
from nanite import poc, preproc


class Base(Directive):
Expand Down Expand Up @@ -48,11 +52,34 @@ def generate_rst(self):
rst.append("")

for kk in keys:
ref = "nanite.preproc.IndentationPreprocessor.{}".format(kk)
ref = f"nanite.preproc.IndentationPreprocessor.{kk}"
details = ":func:`code reference <{}>`".format(ref)
method = getattr(preproc.IndentationPreprocessor, kk)
name = method.__doc__.split("\n\n")[0].strip()
rst.append(" {}\t {}\t {}".format(kk, name, details))
rst.append(f" {kk}\t {name}\t {details}")

rst.append("")

return rst


class PreprocPOCTable(Base):
def generate_rst(self):
rst = []

pocs = poc.POC_METHODS

rst.append(".. csv-table::")
rst.append(" :header: method, description, details")
rst.append(" :delim: tab")
rst.append("")

for pp in pocs:
ref = f"nanite.poc.{pp.__name__}"
details = ":func:`code reference <{}>`".format(ref)
method = pp.identifier
name = pp.name
rst.append(f" {method}\t {name}\t {details}")

rst.append("")

Expand All @@ -61,4 +88,5 @@ def generate_rst(self):

def setup(app):
app.add_directive('nanite_preproc_table', PreprocTable)
return {'version': '0.1'} # identifies the version of our extension
app.add_directive('nanite_preproc_poc_table', PreprocPOCTable)
return {'version': '0.2'} # identifies the version of our extension
8 changes: 8 additions & 0 deletions docs/sec_fitting_guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ This is a summary of the methods used by nanite for fitting
force-distance data. Examples are given below.


.. _sec_fitting_preproc:

Preprocessors
=============
Prior to data analysis, a force-distance curve has to be preprocessed.
Expand All @@ -19,6 +21,12 @@ steps correct for offsets or smoothen the data:
.. nanite_preproc_table::


Several methods for estimating the point of contact are implemented in
nanite:

.. nanite_preproc_poc_table::


Models
======
Nanite comes with a predefined set of model functions that are
Expand Down

0 comments on commit e90038f

Please sign in to comment.