From 65702c37b3c96897f4d86972cb5f53014eb25f36 Mon Sep 17 00:00:00 2001
From: Christine Kim <chkim@usgs.gov>
Date: Tue, 7 May 2024 16:14:58 -0500
Subject: [PATCH] Add docs structure

---
 README.md                   |  6 +++---
 docs/_static/css/custom.css |  7 +++++++
 docs/conf.py                | 20 ++++++++++++--------
 docs/index.rst              | 11 +++++++++++
 docs/library/bundle.rst     |  9 +++++++++
 docs/library/csm.rst        |  9 +++++++++
 docs/library/index.rst      | 18 ++++++++++++++++++
 docs/library/surface.rst    |  9 +++++++++
 docs/library/utils.rst      |  9 +++++++++
 docs/library/vis.rst        |  9 +++++++++
 knoten/csm.py               | 24 ++++++++++++++----------
 11 files changed, 110 insertions(+), 21 deletions(-)
 create mode 100644 docs/_static/css/custom.css
 create mode 100644 docs/library/bundle.rst
 create mode 100644 docs/library/csm.rst
 create mode 100644 docs/library/index.rst
 create mode 100644 docs/library/surface.rst
 create mode 100644 docs/library/utils.rst
 create mode 100644 docs/library/vis.rst

diff --git a/README.md b/README.md
index 8d7e466..b4642bb 100644
--- a/README.md
+++ b/README.md
@@ -8,13 +8,13 @@ A library to leverage python wrapped Community Sensor Models (CSMs) for common s
 
 ## References:
 
-- CSM (usgscsm): https://github.com/USGS-Astrogeology/usgscsm
-- Abstraction Layer for Ephemerides (ALE): https://github.com/USGS-Astrogeology/ale
+- CSM (usgscsm): https://github.com/DOI_USGS/usgscsm
+- Abstraction Layer for Ephemerides (ALE): https://github.com/DOI_USGS/ale
 <hr>
 
 ## Overview
 
-We currently use Knoten to help test our supported CSM implementations against well established [ISIS3 camera models](https://github.com/USGS-Astrogeology/ISIS3). In short, The CSM standard, now at version 3.0.3, is a framework that provides a well-defined application program interface (API) for multiple types of sensors and has been widely adopted by remote sensing software systems (e.g. BAE's Socet GXP, Harris Corp.'s ENVI, Hexagon's ERDAS Imagine, and recently added to the NASA AMES Stereo Pipeline [ASP]). Our support for CSM is explained in this [abstract](https://www.hou.usra.edu/meetings/informatics2018/pdf/6040.pdf) and a recently submitted paper (not yet available). Currently, we support **Framing** and **Pushbroom** (line scanner) types of sensor models in the [usgscsm](https://github.com/USGS-Astrogeology/usgscsm) library. 
+We currently use Knoten to help test our supported CSM implementations against well established [ISIS3 camera models](https://github.com/DOI_USGS/ISIS3). In short, The CSM standard, now at version 3.0.3, is a framework that provides a well-defined application program interface (API) for multiple types of sensors and has been widely adopted by remote sensing software systems (e.g. BAE's Socet GXP, Harris Corp.'s ENVI, Hexagon's ERDAS Imagine, and recently added to the NASA AMES Stereo Pipeline [ASP]). Our support for CSM is explained in this [abstract](https://www.hou.usra.edu/meetings/informatics2018/pdf/6040.pdf) and a recently submitted paper (not yet available). Currently, we support **Framing** and **Pushbroom** (line scanner) types of sensor models in the [usgscsm](https://github.com/DOI_USGS/usgscsm) library. 
 
 A secondary requirement for our CSM implementation requires an ALE-generated Image Support Data (ISD). ISDs contain the [SPICE-derived](https://naif.jpl.nasa.gov/naif/toolkit.html) positional (and when needed velocity) description for each image. You can find several generated JSON-formatted examples [here](examples/data/)
 
diff --git a/docs/_static/css/custom.css b/docs/_static/css/custom.css
new file mode 100644
index 0000000..abb4622
--- /dev/null
+++ b/docs/_static/css/custom.css
@@ -0,0 +1,7 @@
+@import 'material_sphinx.css';
+
+.sig.sig-object.py{
+    font-feature-settings: "kern";
+    font-family: "Roboto Mono", "Courier New", Courier, monospace;
+    background: #f8f8f8;
+}
\ No newline at end of file
diff --git a/docs/conf.py b/docs/conf.py
index 015b119..83fd2a0 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -10,9 +10,9 @@
 # add these directories to sys.path here. If the directory is relative to the
 # documentation root, use os.path.abspath to make it absolute, like shown here.
 #
-# import os
-# import sys
-# sys.path.insert(0, os.path.abspath('.'))
+import os
+import sys
+sys.path.insert(0, os.path.abspath('..'))
 
 
 # -- Project information -----------------------------------------------------
@@ -27,8 +27,7 @@ author = 'USGS Astrogeology Software Team'
 # Add any Sphinx extension module names here, as strings. They can be
 # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
 # ones.
-extensions = [
-]
+extensions = ['sphinx.ext.autodoc', 'sphinx.ext.napoleon']
 
 # Add any paths that contain templates here, relative to this directory.
 templates_path = ['_templates']
@@ -38,6 +37,8 @@ templates_path = ['_templates']
 # This pattern also affects html_static_path and html_extra_path.
 exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
 
+autosummary_generate = False
+autoclass_content = "class"
 
 # -- Options for HTML output -------------------------------------------------
 
@@ -46,6 +47,9 @@ exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
 #
 html_theme = 'sphinx_material'
 
+html_static_path = ['_static']
+html_css_files = ['css/custom.css']
+
 # Add any paths that contain custom static files (such as style sheets) here,
 # relative to this directory. They are copied after the builtin static files,
 # so a file named "default.css" will overwrite the builtin "default.css".
@@ -81,9 +85,9 @@ html_theme_options = {
     'repo_name': 'Project',
 
     # Visible levels of the global TOC; -1 means unlimited
-    'globaltoc_depth': 3,
+    'globaltoc_depth': 2,
     # If False, expand all TOC entries
-    'globaltoc_collapse': False,
+    'globaltoc_collapse': True,
     # If True, show hidden TOC entries
     'globaltoc_includehidden': False,
-}
\ No newline at end of file
+}
diff --git a/docs/index.rst b/docs/index.rst
index fabb6d1..1899abc 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -4,6 +4,17 @@ Knoten
 A library to leverage python wrapped Community Sensor Models (CSMs) for common spatial/sensor operations and testing.
 
 
+Table of Contents
+-----------------
+
+:Date: |today|
+
+.. toctree::
+   :maxdepth: 2
+
+   library/index
+   
+
 References
 ----------
 
diff --git a/docs/library/bundle.rst b/docs/library/bundle.rst
new file mode 100644
index 0000000..03fa529
--- /dev/null
+++ b/docs/library/bundle.rst
@@ -0,0 +1,9 @@
+:mod:`bundle` --- Bundle Adjustment
+======================================
+
+The :mod:`knoten.bundle` module
+
+.. automodule:: knoten.bundle
+  :synopsis:
+  :members:
+  :show-inheritance:
\ No newline at end of file
diff --git a/docs/library/csm.rst b/docs/library/csm.rst
new file mode 100644
index 0000000..4ad6a77
--- /dev/null
+++ b/docs/library/csm.rst
@@ -0,0 +1,9 @@
+:mod:`csm` --- CSM Tools
+=========================
+
+The :mod:`knoten.csm` module
+
+.. automodule:: knoten.csm
+  :synopsis:
+  :members:
+  :show-inheritance:
\ No newline at end of file
diff --git a/docs/library/index.rst b/docs/library/index.rst
new file mode 100644
index 0000000..8907353
--- /dev/null
+++ b/docs/library/index.rst
@@ -0,0 +1,18 @@
+.. _index:
+
+#################
+Library Reference
+#################
+
+:Date: |today|
+
+-----------------------------------------
+
+.. toctree::
+   :maxdepth: 2
+
+   bundle
+   csm
+   surface
+   utils
+   vis
\ No newline at end of file
diff --git a/docs/library/surface.rst b/docs/library/surface.rst
new file mode 100644
index 0000000..3095162
--- /dev/null
+++ b/docs/library/surface.rst
@@ -0,0 +1,9 @@
+:mod:`surface` --- Target Surface
+======================================
+
+The :mod:`knoten.surface` module
+
+.. automodule:: knoten.surface
+  :synopsis:
+  :members:
+  :show-inheritance:
\ No newline at end of file
diff --git a/docs/library/utils.rst b/docs/library/utils.rst
new file mode 100644
index 0000000..2c42e05
--- /dev/null
+++ b/docs/library/utils.rst
@@ -0,0 +1,9 @@
+:mod:`utils` --- Utilities
+======================================
+
+The :mod:`knoten.utils` module
+
+.. automodule:: knoten.utils
+  :synopsis:
+  :members:
+  :show-inheritance:
\ No newline at end of file
diff --git a/docs/library/vis.rst b/docs/library/vis.rst
new file mode 100644
index 0000000..2bec855
--- /dev/null
+++ b/docs/library/vis.rst
@@ -0,0 +1,9 @@
+:mod:`vis` --- Visualization
+======================================
+
+The :mod:`knoten.vis` module
+
+.. automodule:: knoten.vis
+  :synopsis:
+  :members:
+  :show-inheritance:
\ No newline at end of file
diff --git a/knoten/csm.py b/knoten/csm.py
index 9912283..a60a854 100644
--- a/knoten/csm.py
+++ b/knoten/csm.py
@@ -239,8 +239,9 @@ def _compute_intersection_distance(intersection, next_intersection):
             abs(intersection.z - next_intersection.z))
 
 def generate_boundary(isize, npoints=10):
-    '''
+    """
     Generates a bounding box given a camera model
+
     Parameters
     ----------
     isize : list
@@ -252,7 +253,7 @@ def generate_boundary(isize, npoints=10):
     -------
     boundary : list
                List of full bounding box
-    '''
+    """
     x = np.linspace(0, isize[0], npoints)
     y = np.linspace(0, isize[1], npoints)
     boundary = [(i,0.) for i in x] + [(isize[0], i) for i in y[1:]] +\
@@ -261,7 +262,7 @@ def generate_boundary(isize, npoints=10):
     return boundary
 
 def generate_latlon_boundary(camera, boundary, dem=0.0, radii=None, **kwargs):
-    '''
+    """
     Generates a latlon bounding box given a camera model
 
     Parameters
@@ -286,7 +287,7 @@ def generate_latlon_boundary(camera, boundary, dem=0.0, radii=None, **kwargs):
            List of latitude values
     alts : list
            List of altitude values
-    '''
+    """
 
     if radii is None:
         semi_major, semi_minor = get_radii(camera)
@@ -312,9 +313,10 @@ def generate_latlon_boundary(camera, boundary, dem=0.0, radii=None, **kwargs):
     return lons, lats, alts
 
 def generate_gcps(camera, boundary, radii=None):
-    '''
+    """
     Generates an area of ground control points formated as:
     <GCP Id="" Info="" Pixel="" Line="" X="" Y="" Z="" /> per record
+
     Parameters
     ----------
     camera : object
@@ -329,7 +331,7 @@ def generate_gcps(camera, boundary, radii=None):
     -------
     gcps : list
            List of all gcp records generated
-    '''
+    """
     if radii is None:
         semi_major, semi_minor = get_radii(camera)
     else:
@@ -349,8 +351,9 @@ def generate_gcps(camera, boundary, radii=None):
     return gcps
 
 def generate_latlon_footprint(camera, boundary, dem=0.0, radii=None, **kwargs):
-    '''
+    """
     Generates a latlon footprint from a csmapi generated camera model
+
     Parameters
     ----------
     camera : object
@@ -369,7 +372,7 @@ def generate_latlon_footprint(camera, boundary, dem=0.0, radii=None, **kwargs):
     -------
     : object
       ogr multipolygon containing between one and two polygons
-    '''
+    """
     if radii is None:
         semi_major, semi_minor = get_radii(camera)
     else:
@@ -431,8 +434,9 @@ def generate_latlon_footprint(camera, boundary, dem=0.0, radii=None, **kwargs):
     return multipoly
 
 def generate_bodyfixed_footprint(camera, boundary, radii=None):
-    '''
+    """
     Generates a bodyfixed footprint from a csmapi generated camera model
+    
     Parameters
     ----------
     camera : object
@@ -447,7 +451,7 @@ def generate_bodyfixed_footprint(camera, boundary, radii=None):
     -------
     : object
       ogr polygon
-    '''
+    """
     if radii is None:
         semi_major, semi_minor = get_radii(camera)
     else:
-- 
GitLab