From 95c76525d554e9c4ec3fc363d036fd7d25dba059 Mon Sep 17 00:00:00 2001 From: robin Date: Wed, 27 Nov 2024 10:42:34 +0100 Subject: [PATCH 1/4] Add documentation workflow. --- .github/workflows/documentation.yml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .github/workflows/documentation.yml diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml new file mode 100644 index 00000000..7c81ba2d --- /dev/null +++ b/.github/workflows/documentation.yml @@ -0,0 +1,27 @@ +name: documentation + +on: [push, pull_request, workflow_dispatch] + +permissions: + contents: write + +jobs: + docs: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + - name: Install dependencies + run: | + pip install sphinx sphinx_rtd_theme sphinx-tabs sphinx_copybutton myst_parser numpy torch + - name: Sphinx build + run: | + sphinx-build docs/src docs/build + - name: Deploy to GitHub Pages + uses: peaceiris/actions-gh-pages@v3 + if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} + with: + publish_branch: gh-pages + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: docs/build/ + force_orphan: true From 7f6c9bda9bc54122c29c2aec889a0553d9a0fec0 Mon Sep 17 00:00:00 2001 From: robin Date: Wed, 27 Nov 2024 10:45:08 +0100 Subject: [PATCH 2/4] Update the documentation link. --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2452a651..954f169e 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ Then other packages are compatible with this **Core** and a specific **simulatio * Train an artificial neural network with a synthetic dataset; * Use the predictions of a trained network in a numerical simulation. -The full list of features is detailed in the [**documentation**](https://deepphysx.readthedocs.io). +The full list of features is detailed in the [**documentation**](https://mimesis-inria.github.io/DeepPhysX/). ### Quick install @@ -31,7 +31,7 @@ Thus, **DeepPhysX** is mainly designed for these frameworks, but obviously **oth The packages corresponding to these frameworks will therefore be used for the default installation. The easiest way to install is using `pip`, but there are a several way to install and configure a **DeepPhysX** -environment (refer to the [**documentation**](https://deepphysx.readthedocs.io/en/latest/presentation/install.html) +environment (refer to the [**documentation**](https://mimesis-inria.github.io/DeepPhysX/) for further instructions). ``` bash From 09ac93dd3e827bfb593ee70fdbcef7896a191e6d Mon Sep 17 00:00:00 2001 From: robin Date: Wed, 27 Nov 2024 10:53:58 +0100 Subject: [PATCH 3/4] Fix the doc code root. --- docs/source/conf.py | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index ae492141..5f06facc 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -10,17 +10,10 @@ # 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. -from os.path import abspath, join, pardir +import os import sys -# DeepPhysX root -root = abspath(join(abspath(__file__), pardir, pardir, pardir, 'src', 'Core')) -all_modules = ['AsyncSocket', 'Database', 'Environment', 'Manager', 'Network', 'Pipelines', 'Visualization'] - -# Import all modules -sys.path.append(root) -for module in all_modules: - sys.path.append(join(root, module)) +sys.path.insert(0, os.path.abspath('../../src')) # -- Project information ----------------------------------------------------- From abe6a68e8e20b25943ee3c6ff80a7f0c53cc25b9 Mon Sep 17 00:00:00 2001 From: robin Date: Wed, 27 Nov 2024 11:00:59 +0100 Subject: [PATCH 4/4] Rename doc source directory to match new version of SB. --- .readthedocs.yaml | 25 ------------------ README.md | 4 +-- docs/Makefile | 2 +- docs/make.bat | 2 +- .../image/about_classical_pipelines.png | Bin .../_static/image/about_dpx_pipelines.png | Bin .../_static/image/about_tree.png | Bin .../_static/image/armadillo.png | Bin docs/{source => src}/_static/image/beam.png | Bin .../_static/image/database.png | Bin .../_static/image/environment_tcp_ip.png | Bin docs/{source => src}/_static/image/liver.png | Bin docs/{source => src}/_static/image/logo.png | Bin .../_static/image/overview_components.png | Bin .../_static/image/overview_packages.png | Bin docs/{source => src}/_static/theme.css | 0 docs/{source => src}/api/core.rst | 0 docs/{source => src}/api/core/asyncsocket.rst | 0 docs/{source => src}/api/core/dataset.rst | 0 docs/{source => src}/api/core/environment.rst | 0 docs/{source => src}/api/core/manager.rst | 0 docs/{source => src}/api/core/network.rst | 0 docs/{source => src}/api/core/pipeline.rst | 0 docs/{source => src}/api/core/visualizer.rst | 0 docs/{source => src}/api/sofa.rst | 0 docs/{source => src}/api/torch.rst | 0 docs/{source => src}/component/dataset.rst | 0 .../{source => src}/component/environment.rst | 0 docs/{source => src}/component/network.rst | 0 docs/{source => src}/component/pipelines.rst | 0 docs/{source => src}/component/stats.rst | 0 docs/{source => src}/component/visualizer.rst | 0 docs/{source => src}/conf.py | 4 +-- docs/{source => src}/index.rst | 0 docs/{source => src}/presentation/about.rst | 0 docs/{source => src}/presentation/install.rst | 0 .../{source => src}/presentation/overview.rst | 0 docs/{source => src}/requirements.txt | 0 examples/demos/Liver/FC/Environment/utils.py | 8 +++--- .../demos/Liver/UNet/Environment/utils.py | 2 +- .../Utils/Visualizer/barycentric_mapping.py | 6 ++--- src/Core/Utils/path.py | 4 +-- 42 files changed, 16 insertions(+), 41 deletions(-) delete mode 100644 .readthedocs.yaml rename docs/{source => src}/_static/image/about_classical_pipelines.png (100%) rename docs/{source => src}/_static/image/about_dpx_pipelines.png (100%) rename docs/{source => src}/_static/image/about_tree.png (100%) rename docs/{source => src}/_static/image/armadillo.png (100%) rename docs/{source => src}/_static/image/beam.png (100%) rename docs/{source => src}/_static/image/database.png (100%) rename docs/{source => src}/_static/image/environment_tcp_ip.png (100%) rename docs/{source => src}/_static/image/liver.png (100%) rename docs/{source => src}/_static/image/logo.png (100%) rename docs/{source => src}/_static/image/overview_components.png (100%) rename docs/{source => src}/_static/image/overview_packages.png (100%) rename docs/{source => src}/_static/theme.css (100%) rename docs/{source => src}/api/core.rst (100%) rename docs/{source => src}/api/core/asyncsocket.rst (100%) rename docs/{source => src}/api/core/dataset.rst (100%) rename docs/{source => src}/api/core/environment.rst (100%) rename docs/{source => src}/api/core/manager.rst (100%) rename docs/{source => src}/api/core/network.rst (100%) rename docs/{source => src}/api/core/pipeline.rst (100%) rename docs/{source => src}/api/core/visualizer.rst (100%) rename docs/{source => src}/api/sofa.rst (100%) rename docs/{source => src}/api/torch.rst (100%) rename docs/{source => src}/component/dataset.rst (100%) rename docs/{source => src}/component/environment.rst (100%) rename docs/{source => src}/component/network.rst (100%) rename docs/{source => src}/component/pipelines.rst (100%) rename docs/{source => src}/component/stats.rst (100%) rename docs/{source => src}/component/visualizer.rst (100%) rename docs/{source => src}/conf.py (96%) rename docs/{source => src}/index.rst (100%) rename docs/{source => src}/presentation/about.rst (100%) rename docs/{source => src}/presentation/install.rst (100%) rename docs/{source => src}/presentation/overview.rst (100%) rename docs/{source => src}/requirements.txt (100%) diff --git a/.readthedocs.yaml b/.readthedocs.yaml deleted file mode 100644 index 80e958f6..00000000 --- a/.readthedocs.yaml +++ /dev/null @@ -1,25 +0,0 @@ -# .readthedocs.yaml -# Read the Docs configuration file -# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details - -# Required -version: 2 - -# Set the version of Python and other tools you might need -build: - os: ubuntu-20.04 - tools: - python: "3.8" - -# Build documentation in the docs/ directory with Sphinx -sphinx: - configuration: docs/source/conf.py - -# If using Sphinx, optionally build your docs in additional formats such as PDF -formats: - - pdf - -# Optionally declare the Python requirements required to build your docs -python: - install: - - requirements: docs/source/requirements.txt diff --git a/README.md b/README.md index 954f169e..96978e79 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ## DeepPhysX -![logo](docs/source/_static/image/logo.png) +![logo](docs/src/_static/image/logo.png) ### Interfacing AI with simulation @@ -54,7 +54,7 @@ $ DPX --run # Run one of the demo scripts | **Armadillo**
`DPX -r armadillo` | **Beam**
`DPX -r beam` | **Liver**
`DPX -r liver` | |:-----------------------------------------------------:|:-------------------------------------------:|:---------------------------------------------:| -| ![armadillo](docs/source/_static/image/armadillo.png) | ![beam](docs/source/_static/image/beam.png) | ![liver](docs/source/_static/image/liver.png) | +| ![armadillo](docs/src/_static/image/armadillo.png) | ![beam](docs/src/_static/image/beam.png) | ![liver](docs/src/_static/image/liver.png) | ### References diff --git a/docs/Makefile b/docs/Makefile index d0c3cbf1..ee230164 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -5,7 +5,7 @@ # from the environment for the first two. SPHINXOPTS ?= SPHINXBUILD ?= sphinx-build -SOURCEDIR = source +SOURCEDIR = src BUILDDIR = build # Put it first so that "make" without argument is like "make help". diff --git a/docs/make.bat b/docs/make.bat index 061f32f9..c8b182fc 100644 --- a/docs/make.bat +++ b/docs/make.bat @@ -7,7 +7,7 @@ REM Command file for Sphinx documentation if "%SPHINXBUILD%" == "" ( set SPHINXBUILD=sphinx-build ) -set SOURCEDIR=source +set SOURCEDIR=src set BUILDDIR=build if "%1" == "" goto help diff --git a/docs/source/_static/image/about_classical_pipelines.png b/docs/src/_static/image/about_classical_pipelines.png similarity index 100% rename from docs/source/_static/image/about_classical_pipelines.png rename to docs/src/_static/image/about_classical_pipelines.png diff --git a/docs/source/_static/image/about_dpx_pipelines.png b/docs/src/_static/image/about_dpx_pipelines.png similarity index 100% rename from docs/source/_static/image/about_dpx_pipelines.png rename to docs/src/_static/image/about_dpx_pipelines.png diff --git a/docs/source/_static/image/about_tree.png b/docs/src/_static/image/about_tree.png similarity index 100% rename from docs/source/_static/image/about_tree.png rename to docs/src/_static/image/about_tree.png diff --git a/docs/source/_static/image/armadillo.png b/docs/src/_static/image/armadillo.png similarity index 100% rename from docs/source/_static/image/armadillo.png rename to docs/src/_static/image/armadillo.png diff --git a/docs/source/_static/image/beam.png b/docs/src/_static/image/beam.png similarity index 100% rename from docs/source/_static/image/beam.png rename to docs/src/_static/image/beam.png diff --git a/docs/source/_static/image/database.png b/docs/src/_static/image/database.png similarity index 100% rename from docs/source/_static/image/database.png rename to docs/src/_static/image/database.png diff --git a/docs/source/_static/image/environment_tcp_ip.png b/docs/src/_static/image/environment_tcp_ip.png similarity index 100% rename from docs/source/_static/image/environment_tcp_ip.png rename to docs/src/_static/image/environment_tcp_ip.png diff --git a/docs/source/_static/image/liver.png b/docs/src/_static/image/liver.png similarity index 100% rename from docs/source/_static/image/liver.png rename to docs/src/_static/image/liver.png diff --git a/docs/source/_static/image/logo.png b/docs/src/_static/image/logo.png similarity index 100% rename from docs/source/_static/image/logo.png rename to docs/src/_static/image/logo.png diff --git a/docs/source/_static/image/overview_components.png b/docs/src/_static/image/overview_components.png similarity index 100% rename from docs/source/_static/image/overview_components.png rename to docs/src/_static/image/overview_components.png diff --git a/docs/source/_static/image/overview_packages.png b/docs/src/_static/image/overview_packages.png similarity index 100% rename from docs/source/_static/image/overview_packages.png rename to docs/src/_static/image/overview_packages.png diff --git a/docs/source/_static/theme.css b/docs/src/_static/theme.css similarity index 100% rename from docs/source/_static/theme.css rename to docs/src/_static/theme.css diff --git a/docs/source/api/core.rst b/docs/src/api/core.rst similarity index 100% rename from docs/source/api/core.rst rename to docs/src/api/core.rst diff --git a/docs/source/api/core/asyncsocket.rst b/docs/src/api/core/asyncsocket.rst similarity index 100% rename from docs/source/api/core/asyncsocket.rst rename to docs/src/api/core/asyncsocket.rst diff --git a/docs/source/api/core/dataset.rst b/docs/src/api/core/dataset.rst similarity index 100% rename from docs/source/api/core/dataset.rst rename to docs/src/api/core/dataset.rst diff --git a/docs/source/api/core/environment.rst b/docs/src/api/core/environment.rst similarity index 100% rename from docs/source/api/core/environment.rst rename to docs/src/api/core/environment.rst diff --git a/docs/source/api/core/manager.rst b/docs/src/api/core/manager.rst similarity index 100% rename from docs/source/api/core/manager.rst rename to docs/src/api/core/manager.rst diff --git a/docs/source/api/core/network.rst b/docs/src/api/core/network.rst similarity index 100% rename from docs/source/api/core/network.rst rename to docs/src/api/core/network.rst diff --git a/docs/source/api/core/pipeline.rst b/docs/src/api/core/pipeline.rst similarity index 100% rename from docs/source/api/core/pipeline.rst rename to docs/src/api/core/pipeline.rst diff --git a/docs/source/api/core/visualizer.rst b/docs/src/api/core/visualizer.rst similarity index 100% rename from docs/source/api/core/visualizer.rst rename to docs/src/api/core/visualizer.rst diff --git a/docs/source/api/sofa.rst b/docs/src/api/sofa.rst similarity index 100% rename from docs/source/api/sofa.rst rename to docs/src/api/sofa.rst diff --git a/docs/source/api/torch.rst b/docs/src/api/torch.rst similarity index 100% rename from docs/source/api/torch.rst rename to docs/src/api/torch.rst diff --git a/docs/source/component/dataset.rst b/docs/src/component/dataset.rst similarity index 100% rename from docs/source/component/dataset.rst rename to docs/src/component/dataset.rst diff --git a/docs/source/component/environment.rst b/docs/src/component/environment.rst similarity index 100% rename from docs/source/component/environment.rst rename to docs/src/component/environment.rst diff --git a/docs/source/component/network.rst b/docs/src/component/network.rst similarity index 100% rename from docs/source/component/network.rst rename to docs/src/component/network.rst diff --git a/docs/source/component/pipelines.rst b/docs/src/component/pipelines.rst similarity index 100% rename from docs/source/component/pipelines.rst rename to docs/src/component/pipelines.rst diff --git a/docs/source/component/stats.rst b/docs/src/component/stats.rst similarity index 100% rename from docs/source/component/stats.rst rename to docs/src/component/stats.rst diff --git a/docs/source/component/visualizer.rst b/docs/src/component/visualizer.rst similarity index 100% rename from docs/source/component/visualizer.rst rename to docs/src/component/visualizer.rst diff --git a/docs/source/conf.py b/docs/src/conf.py similarity index 96% rename from docs/source/conf.py rename to docs/src/conf.py index 5f06facc..e15c199f 100644 --- a/docs/source/conf.py +++ b/docs/src/conf.py @@ -44,8 +44,8 @@ # Add any paths that contain templates here, relative to this directory. # templates_path = ['_templates'] -# List of patterns, relative to source directory, that match files and -# directories to ignore when looking for source files. +# List of patterns, relative to src directory, that match files and +# directories to ignore when looking for src files. # This pattern also affects html_static_path and html_extra_path. exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] diff --git a/docs/source/index.rst b/docs/src/index.rst similarity index 100% rename from docs/source/index.rst rename to docs/src/index.rst diff --git a/docs/source/presentation/about.rst b/docs/src/presentation/about.rst similarity index 100% rename from docs/source/presentation/about.rst rename to docs/src/presentation/about.rst diff --git a/docs/source/presentation/install.rst b/docs/src/presentation/install.rst similarity index 100% rename from docs/source/presentation/install.rst rename to docs/src/presentation/install.rst diff --git a/docs/source/presentation/overview.rst b/docs/src/presentation/overview.rst similarity index 100% rename from docs/source/presentation/overview.rst rename to docs/src/presentation/overview.rst diff --git a/docs/source/requirements.txt b/docs/src/requirements.txt similarity index 100% rename from docs/source/requirements.txt rename to docs/src/requirements.txt diff --git a/examples/demos/Liver/FC/Environment/utils.py b/examples/demos/Liver/FC/Environment/utils.py index c27fb5db..460e2aa5 100644 --- a/examples/demos/Liver/FC/Environment/utils.py +++ b/examples/demos/Liver/FC/Environment/utils.py @@ -7,7 +7,7 @@ def get_nb_nodes(source_file): """ Get the number of node of the object. - :param source_file: Filename of the source object + :param source_file: Filename of the src object :return: Number of node """ @@ -18,7 +18,7 @@ def find_center(source_file, scale): """ Find the center of mass of the object. - :param source_file: Filename of the source object + :param source_file: Filename of the src object :param scale: Scaling to apply to the objects :return: Center of mass of the object """ @@ -30,8 +30,8 @@ def find_boundaries(source_file, objects_files_list, scale): """ Find the boundary conditions of the liver. - :param source_file: Filename of the source object - :param objects_files_list: List of filenames of objects which intersect the source object + :param source_file: Filename of the src object + :param objects_files_list: List of filenames of objects which intersect the src object :param scale: Scaling to apply to the objects :return: Boundary box defined by [xmin, ymin, zmin, xmax, ymax, zmax] """ diff --git a/examples/demos/Liver/UNet/Environment/utils.py b/examples/demos/Liver/UNet/Environment/utils.py index 84a86cb5..cbec38f7 100644 --- a/examples/demos/Liver/UNet/Environment/utils.py +++ b/examples/demos/Liver/UNet/Environment/utils.py @@ -28,7 +28,7 @@ def find_center(source_file, scale): """ Find the center of mass of the object. - :param source_file: Filename of the source object + :param source_file: Filename of the src object :param scale: Scaling to apply to the objects :return: Center of mass of the object """ diff --git a/src/Core/Utils/Visualizer/barycentric_mapping.py b/src/Core/Utils/Visualizer/barycentric_mapping.py index 202e6bf1..fc167162 100644 --- a/src/Core/Utils/Visualizer/barycentric_mapping.py +++ b/src/Core/Utils/Visualizer/barycentric_mapping.py @@ -8,7 +8,7 @@ class BarycentricMapping: def __init__(self, source: Mesh, target: Mesh): """ - Python implementation of a barycentric mapping between a source mesh and a target mesh. + Python implementation of a barycentric mapping between a src mesh and a target mesh. :param source: Source mesh :param target: Target mesh @@ -23,7 +23,7 @@ def __init__(self, source: Mesh, target: Mesh): def init_mapping(self): """ - Compute barycentric coordinates of target to map source. + Compute barycentric coordinates of target to map src. """ # 1. CONVERT SOURCE TO VTK @@ -84,7 +84,7 @@ def init_mapping(self): def apply(self, source_positions): """ - Apply mapping between new source positions and target with barycentric coordinates. + Apply mapping between new src positions and target with barycentric coordinates. """ ABC = np.array(source_positions)[np.array(self.source.cells())[self.index]] diff --git a/src/Core/Utils/path.py b/src/Core/Utils/path.py index 3a2a8bdc..b69a480f 100644 --- a/src/Core/Utils/path.py +++ b/src/Core/Utils/path.py @@ -80,7 +80,7 @@ def create_dir(session_dir: str, session_name: str) -> str: def copy_dir(src_dir: str, dest_dir: str, dest_name: Optional[str] = None, sub_folders: Optional[str] = None) -> str: """ - Copy the source directory to the destination directory. + Copy the src directory to the destination directory. :param src_dir: Source directory to copy. :param dest_dir: Parent of the destination directory to copy. @@ -103,7 +103,7 @@ def copy_dir(src_dir: str, dest_dir: str, dest_name: Optional[str] = None, sub_f dest_name += f'{max_id + 1}' dest = join(dest_dir, dest_name) if dest_name is not None else dest_dir - print(f"Copying the source directory {src_dir} to {dest} for this session.") + print(f"Copying the src directory {src_dir} to {dest} for this session.") if sub_folders is None: copytree(src_dir, dest) else: