Skip to content

Commit

Permalink
Reorg docs (isl-org#2381)
Browse files Browse the repository at this point in the history
* restructure docs

* more protection against disabled modules

* core->tensor
  • Loading branch information
yxlao authored Oct 1, 2020
1 parent 664eff5 commit 1860e75
Show file tree
Hide file tree
Showing 235 changed files with 551 additions and 398 deletions.
26 changes: 13 additions & 13 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -51,30 +51,30 @@ static/
compile_commands.json

# Example resources
examples/python/ReconstructionSystem/dataset/
examples/python/reconstruction_system/dataset/
examples/test_data/fountain_small
examples/test_data/Armadillo.ply
examples/test_data/Bunny.ply
examples/test_data/eagle.ply
examples/test_data/voxelized.ply
examples/python/Basic/voxel_grid_test.ply
examples/python/Benchmark/testdata/
examples/python/Misc/test.jpg
examples/python/geometry/voxel_grid_test.ply
examples/python/benchmark/testdata/
examples/python/misc/test.jpg
examples/test_data/GraphOptimization/pose_graph_example_fragment_optimized.json
examples/test_data/GraphOptimization/pose_graph_example_global_optimized.json
examples/test_data/depth/
examples/test_data/image/
examples/test_data/sync.ply
examples/test_data/sync.png
examples/python/Advanced/multiway_registration.pcd
examples/python/Advanced/test.json
examples/python/Advanced/viewpoint.json
examples/python/Basic/copy_of_fragment.pcd
examples/python/Basic/copy_of_knot.ply
examples/python/Basic/copy_of_lena_color.jpg
examples/python/Basic/copy_of_crate.mtl
examples/python/Basic/copy_of_crate.png
examples/python/Basic/copy_of_crate.obj
examples/python/pipelines/multiway_registration.pcd
examples/python/geometry/test.json
examples/python/visualization/viewpoint.json
examples/python/geometry/copy_of_fragment.pcd
examples/python/geometry/copy_of_knot.ply
examples/python/geometry/copy_of_lena_color.jpg
examples/python/geometry/copy_of_crate.mtl
examples/python/geometry/copy_of_crate.png
examples/python/geometry/copy_of_crate.obj

# doc
docs/test_data
Expand Down
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,7 @@ Test your installation with:
$ python -c "import open3d as o3d"
```

and follow the [basic tutorials](http://www.open3d.org/docs/release/tutorial/Basic/index.html)
or [Python examples](https://github.com/intel-isl/Open3D/tree/master/examples/python) to get
started.
and follow the tutorials to get started.

## C++ quick start

Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed docs/_static/Advanced/global_registration/icp.png
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed docs/_static/Basic/icp/initial.png
Diff not rendered.
Binary file removed docs/_static/Basic/icp/point_to_plane.png
Diff not rendered.
Binary file removed docs/_static/Basic/icp/point_to_point.png
Diff not rendered.
Binary file removed docs/_static/Basic/icp/point_to_point_2000.png
Diff not rendered.
Binary file removed docs/_static/Basic/kdtree/kdtree.png
Diff not rendered.
Binary file removed docs/_static/Basic/mesh/half.png
Diff not rendered.
Binary file removed docs/_static/Basic/mesh/half_color.png
Diff not rendered.
Binary file removed docs/_static/Basic/mesh/with_shading.png
Diff not rendered.
Binary file removed docs/_static/Basic/mesh/without_shading.png
Diff not rendered.
Binary file removed docs/_static/Basic/pointcloud/crop.png
Diff not rendered.
Binary file removed docs/_static/Basic/pointcloud/crop_color.png
Diff not rendered.
Binary file removed docs/_static/Basic/pointcloud/downsampled.png
Diff not rendered.
Diff not rendered.
Binary file removed docs/_static/Basic/pointcloud/scene.png
Diff not rendered.
Binary file removed docs/_static/Basic/pointcloud/scene_small.png
Diff not rendered.
Binary file removed docs/_static/Basic/rgbd_images/nyu_pcd.png
Diff not rendered.
Binary file removed docs/_static/Basic/rgbd_images/nyu_rgbd.png
Diff not rendered.
Binary file removed docs/_static/Basic/rgbd_images/redwood_pcd.png
Diff not rendered.
Binary file removed docs/_static/Basic/rgbd_images/redwood_rgbd.png
Diff not rendered.
Binary file removed docs/_static/Basic/rgbd_images/sun_pcd.png
Diff not rendered.
Binary file removed docs/_static/Basic/rgbd_images/sun_rgbd.png
Diff not rendered.
Binary file removed docs/_static/Basic/rgbd_images/tum_pcd.png
Diff not rendered.
Binary file removed docs/_static/Basic/rgbd_images/tum_rgbd.png
Diff not rendered.
Binary file removed docs/_static/Basic/rgbd_odometry/color_term.png
Diff not rendered.
Binary file removed docs/_static/Basic/rgbd_odometry/hybrid_term.png
Diff not rendered.
Binary file removed docs/_static/Basic/working_with_numpy/sync_3d.png
Diff not rendered.
Binary file removed docs/_static/Basic/working_with_numpy/sync_image.png
Diff not rendered.
File renamed without changes
2 changes: 1 addition & 1 deletion docs/builddocs.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.. _builddocs:

Building documentation
Build documentation
======================

The main documentation and Python documentation is written in
Expand Down
2 changes: 1 addition & 1 deletion docs/compilation.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.. _compilation:

Compiling from source
Build from source
=====================

You may want to build Open3D from source if you are developing Open3D, want to
Expand Down
2 changes: 1 addition & 1 deletion docs/contribute/contribution_recipes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ Case 3: When documenting pure Python code (no bindings)
Case 4: When adding a Python tutorial
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

* Place your tutorial within Open3D/docs/tutorial/{Basic, Advanced}/
* Place your tutorial within Open3D/docs/tutorial
* There, create a new nblink file pointing to your ipynb notebook

* e.g.: TutorialPointcloud.nblink
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.. _cplusplus_example_project:

Building C++ projects with Open3D
Build C++ projects with Open3D
---------------------------------

This page explains how to create a CMake based C++ project using the Open3D C++ interface.
Expand Down
34 changes: 17 additions & 17 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,44 +18,44 @@ Open3D: A Modern Library for 3D Data Processing
Contents:
.. toctree::
:maxdepth: 1
:caption: Getting Started

introduction
getting_started
compilation
cpp_project
builddocs

.. _contribute_guide:

.. toctree::
:maxdepth: 1
:caption: Contribute

contribute/contribute
contribute/contribution_recipes
contribute/styleguide
:maxdepth: 2
:caption: Tutorial

tutorial/geometry/index
tutorial/pipelines/index
tutorial/visualization/index
tutorial/core/index
tutorial/reconstruction_system/index
tutorial/sensor/index
tutorial/reference

.. _tutorial_index:

.. toctree::
:maxdepth: 1
:caption: Tutorial
:caption: Contribute

tutorial/Basic/index
tutorial/Advanced/index
tutorial/ReconstructionSystem/index
tutorial/C++/cplusplus_interface
tutorial/reference
contribute/contribute
contribute/contribution_recipes
contribute/styleguide

.. _cpp_api_index:

.. toctree::
:maxdepth: 1
:caption: C++ API

cpp
cpp_api

.. _python_api_index:

.. Note: when adding new modules, please also update documented_modules.txt.
Expand Down
3 changes: 3 additions & 0 deletions docs/introduction.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
.. _introduction:

Introduction
~~~~~~~~~~~~

.. mdinclude:: ../README.md
83 changes: 46 additions & 37 deletions docs/make_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,21 +65,44 @@ class PyAPIDocsBuilder:
...
"""

def __init__(self, output_dir, input_dir, module_names):
def __init__(self, output_dir="python_api", input_dir="python_api_in"):
"""
input_dir: The input dir for custom rst files that override the
generated files.
"""
self.output_dir = output_dir
self.input_dir = input_dir
self.module_names = module_names
self.module_names = PyAPIDocsBuilder._get_documented_module_names()
print("Generating *.rst Python API docs in directory: %s" %
self.output_dir)

def generate_rst(self):
_create_or_clear_dir(self.output_dir)

for module_name in self.module_names:
module = self._get_open3d_module(module_name)
self._generate_module_class_function_docs(module_name, module)
try:
module = self._try_import_module(module_name)
self._generate_module_class_function_docs(module_name, module)
except:
print("[Warning] Module {} cannot be imported.".format(
module_name))

def _get_open3d_module(self, full_module_name):
@staticmethod
def _get_documented_module_names():
"""Reads the modules of the python api from the index.rst"""
module_names = []
with open("documented_modules.txt", "r") as f:
for line in f:
print(line, end="")
m = re.match("^(open3d\..*)\s*$", line)
if m:
module_names.append(m.group(1))
print("Documented modules:")
for module_name in module_names:
print("-", module_name)
return module_names

def _try_import_module(self, full_module_name):
"""Returns the module object for the given module path"""
import open3d # make sure the root module is loaded
if open3d._build_config['BUILD_TENSORFLOW_OPS']:
Expand All @@ -88,11 +111,11 @@ def _get_open3d_module(self, full_module_name):
import open3d.ml.torch

try:
# try to import directly. This will work for pure python submodules
# Try to import directly. This will work for pure python submodules
module = importlib.import_module(full_module_name)
return module
except ImportError:
# traverse the module hierarchy of the root module.
# Traverse the module hierarchy of the root module.
# This code path is necessary for modules for which we manually
# define a specific module path (e.g. the modules defined with
# pybind).
Expand Down Expand Up @@ -253,32 +276,10 @@ class SphinxDocsBuilder:
"""

def __init__(self, html_output_dir, is_release, skip_notebooks):
# Get the modules for which we want to build the documentation.
# We use the modules listed in the index.rst file here.
self.documented_modules = self._get_documented_module_names()

self.python_api_output_dir = "python_api"
# The input dir for custom rst files that override the generated files
self.python_api_input_dir = "python_api_in"
self.html_output_dir = html_output_dir
self.is_release = is_release
self.skip_notebooks = skip_notebooks

@staticmethod
def _get_documented_module_names():
"""Reads the modules of the python api from the index.rst"""
module_names = []
with open("documented_modules.txt", "r") as f:
for line in f:
print(line)
m = re.match("^(open3d\..*)\s*$", line)
if m:
module_names.append(m.group(1))
print("Documented modules:")
for module_name in module_names:
print("-", module_name)
return module_names

def run(self):
self._gen_python_api_docs()
self._run_sphinx()
Expand All @@ -290,9 +291,7 @@ def _gen_python_api_docs(self):
"""
# self.python_api_output_dir cannot be a temp dir, since other
# "*.rst" files reference it
pd = PyAPIDocsBuilder(self.python_api_output_dir,
self.python_api_input_dir,
self.documented_modules)
pd = PyAPIDocsBuilder()
pd.generate_rst()

def _run_sphinx(self):
Expand Down Expand Up @@ -388,22 +387,27 @@ def run(self):

# Copy and execute notebooks in the tutorial folder
nb_paths = []
nb_ignored = ['tensor.ipynb']
example_dirs = ["Basic", "Advanced"]
nb_direct_copy = ['tensor.ipynb']
example_dirs = [
"geometry",
"core",
"pipelines",
"visualization",
]
for example_dir in example_dirs:
in_dir = (Path(self.current_file_dir).parent / "examples" /
"python" / example_dir)
out_dir = Path(self.current_file_dir) / "tutorial" / example_dir
out_dir.mkdir(parents=True, exist_ok=True)
shutil.copy(
in_dir.parent / "open3d_tutorial.py",
out_dir.parent / "open3d_tutorial.py",
)

if self.clean_notebooks:
for nb_out_path in out_dir.glob("*.ipynb"):
if (nb_out_path.name not in nb_ignored):
print("Delete: {}".format(nb_out_path))
nb_out_path.unlink()
print("Delete: {}".format(nb_out_path))
nb_out_path.unlink()

for nb_in_path in in_dir.glob("*.ipynb"):
nb_out_path = out_dir / nb_in_path.name
Expand All @@ -416,6 +420,11 @@ def run(self):

# Execute Jupyter notebooks
for nb_path in nb_paths:
if nb_out_path.name in nb_direct_copy:
print("[Processing notebook {}, directly copied]".format(
nb_path.name))
continue

print("[Processing notebook {}]".format(nb_path.name))
with open(nb_path, encoding="utf-8") as f:
nb = nbformat.read(f, as_version=4)
Expand Down
11 changes: 0 additions & 11 deletions docs/tutorial/Advanced/example_projects.rst

This file was deleted.

20 changes: 0 additions & 20 deletions docs/tutorial/Advanced/index.rst

This file was deleted.

23 changes: 0 additions & 23 deletions docs/tutorial/Basic/index.rst

This file was deleted.

Loading

0 comments on commit 1860e75

Please sign in to comment.