Skip to content

Commit 49a17f8

Browse files
committed
[feat] add sphinx autogenerated documentation
1 parent cef53a1 commit 49a17f8

File tree

6 files changed

+181
-47
lines changed

6 files changed

+181
-47
lines changed

docs/Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Minimal makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line, and also
5+
# from the environment for the first two.
6+
SPHINXOPTS ?=
7+
SPHINXBUILD ?= sphinx-build
8+
SOURCEDIR = source
9+
BUILDDIR = build
10+
11+
# Put it first so that "make" without argument is like "make help".
12+
help:
13+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14+
15+
.PHONY: help Makefile
16+
17+
# Catch-all target: route all unknown targets to Sphinx using the new
18+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19+
%: Makefile
20+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

docs/make.bat

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
@ECHO OFF
2+
3+
pushd %~dp0
4+
5+
REM Command file for Sphinx documentation
6+
7+
if "%SPHINXBUILD%" == "" (
8+
set SPHINXBUILD=sphinx-build
9+
)
10+
set SOURCEDIR=source
11+
set BUILDDIR=build
12+
13+
if "%1" == "" goto help
14+
15+
%SPHINXBUILD% >NUL 2>NUL
16+
if errorlevel 9009 (
17+
echo.
18+
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
19+
echo.installed, then set the SPHINXBUILD environment variable to point
20+
echo.to the full path of the 'sphinx-build' executable. Alternatively you
21+
echo.may add the Sphinx directory to PATH.
22+
echo.
23+
echo.If you don't have Sphinx installed, grab it from
24+
echo.http://sphinx-doc.org/
25+
exit /b 1
26+
)
27+
28+
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
29+
goto end
30+
31+
:help
32+
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
33+
34+
:end
35+
popd

docs/source/conf.py

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Configuration file for the Sphinx documentation builder.
2+
#
3+
# This file only contains a selection of the most common options. For a full
4+
# list see the documentation:
5+
# https://www.sphinx-doc.org/en/master/usage/configuration.html
6+
7+
# -- Path setup --------------------------------------------------------------
8+
9+
# If extensions (or modules to document with autodoc) are in another directory,
10+
# add these directories to sys.path here. If the directory is relative to the
11+
# documentation root, use os.path.abspath to make it absolute, like shown here.
12+
#
13+
import os
14+
import sys
15+
sys.path.insert(0, os.path.abspath('../../'))
16+
17+
18+
# -- Project information -----------------------------------------------------
19+
20+
project = 'FastAnalysis'
21+
copyright = '2020, Benjamin Gallois'
22+
author = 'Benjamin Gallois'
23+
24+
25+
# -- General configuration ---------------------------------------------------
26+
27+
# Add any Sphinx extension module names here, as strings. They can be
28+
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
29+
# ones.
30+
extensions = ['sphinx.ext.autodoc']
31+
32+
# Add any paths that contain templates here, relative to this directory.
33+
templates_path = ['_templates']
34+
master_doc = 'index'
35+
36+
# List of patterns, relative to source directory, that match files and
37+
# directories to ignore when looking for source files.
38+
# This pattern also affects html_static_path and html_extra_path.
39+
exclude_patterns = []
40+
41+
42+
# -- Options for HTML output -------------------------------------------------
43+
44+
# The theme to use for HTML and HTML Help pages. See the documentation for
45+
# a list of builtin themes.
46+
#
47+
html_theme = 'alabaster'
48+
49+
# Add any paths that contain custom static files (such as style sheets) here,
50+
# relative to this directory. They are copied after the builtin static files,
51+
# so a file named "default.css" will overwrite the builtin "default.css".
52+
html_static_path = ['_static']

docs/source/fastanalysis.rst

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
fastanalysis package
2+
=====================
3+
4+
Submodules
5+
----------
6+
7+
fastanalysis module
8+
-----------------------------
9+
10+
.. automodule:: fastanalysis.load
11+
:members:
12+
:undoc-members:
13+
:show-inheritance:
14+
15+
16+
Module contents
17+
---------------
18+
19+
.. automodule:: fastanalysis
20+
:members:
21+
:undoc-members:
22+
:show-inheritance:

docs/source/index.rst

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
.. FastAnalysis documentation master file, created by
2+
sphinx-quickstart on Sun Jun 28 08:58:55 2020.
3+
You can adapt this file completely to your liking, but it should at least
4+
contain the root `toctree` directive.
5+
6+
Welcome to FastAnalysis's documentation!
7+
========================================
8+
9+
.. toctree::
10+
:maxdepth: 2
11+
:caption: Contents:
12+
13+
14+
Indices and tables
15+
==================
16+
17+
* :ref:`genindex`
18+
* :ref:`modindex`
19+
* :ref:`search`

fastanalysis/load.py

Lines changed: 33 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,11 @@ class Load:
55
"""Base class to load tracking.txt files"""
66

77
def __init__(self, path):
8-
"""
9-
Constructor for Load.
8+
"""Constructor for Load class.
109
11-
:param [path]: [Path to the tracking.txt file.]
12-
:type [path]: [str]
13-
...
14-
:raises [Exception]: []
10+
:param path: Path to the tracking.txt file.
11+
:type path: str
12+
:raises Exception
1513
"""
1614
self.path = os.path.abspath(path)
1715
try:
@@ -20,82 +18,70 @@ def __init__(self, path):
2018
raise e
2119

2220
def getDataframe(self):
23-
"""
24-
Get the tracking data in a DataFrame.
21+
"""Get the tracking data in a DataFrame.
2522
26-
:raises [Exception]: [The selected file is empty]
27-
...
28-
:return: [Tracking data]
29-
:rtype: [DataFrame]
23+
:raises Exception: The selected file is empty
24+
:return: Tracking data
25+
:rtype: DataFrame
3026
"""
3127
if self.tracking.empty:
3228
raise Exception("The selected file is empty")
3329
else:
3430
return self.tracking
3531

3632
def getObjectNumber(self):
37-
"""
38-
Get the total number of objects.
33+
"""Get the total number of objects.
3934
40-
...
4135
:return: [Total number of objects]
4236
:rtype: [int]
4337
"""
4438
maxObj = len(set(self.tracking.id.values))
4539
return maxObj
4640

4741
def getObject(self, iD):
48-
"""
49-
Get the data for the object with id.
42+
"""Get the data for the object with id.
5043
51-
:param [iD]: [Id of the object.]
52-
:type [index]: [int]
53-
...
54-
:return: [Data for the object id.]
55-
:rtype: [DataFrame]
44+
:param iD: Id of the object.
45+
:type index: int
46+
:return: Data for the object id.
47+
:rtype: DataFrame
5648
"""
5749
objectData = self.tracking[self.tracking.id == iD]
5850
return objectData
5951

6052
def getFrame(self, index):
61-
"""
62-
Get the data for the image number index.
53+
"""Get the data for the image number index.
6354
64-
:param [index]: [Index of the image.]
65-
:type [index]: [int]
66-
...
67-
:return: [Data for the image index.]
68-
:rtype: [DataFrame]
55+
:param index: Index of the image.
56+
:type index: int
57+
:return: Data for the image index.
58+
:rtype: DataFrame
6959
"""
7060
objectData = self.tracking[self.tracking.imageNumber == index]
7161
return objectData
7262

7363
def getObjectInFrame(self, iD, index):
74-
"""
75-
Get the data for an object id is in a frame index.
64+
"""Get the data for an object id is in a frame index.
7665
77-
:param [iD]: [Id of the object.]
78-
:type [index]: [int]
79-
:param [index]: [Index of the image.]
80-
:type [index]: [int]
81-
...
82-
:return: [True if object id in frame index.]
83-
:rtype: [bool]
66+
:param iD: [Id of the object.]
67+
:type iD: int
68+
:param index: Index of the image.
69+
:type index: int
70+
:return: True if object id in frame index.
71+
:rtype: bool
8472
"""
8573
data = self.tracking[(self.tracking.imageNumber == index)&(self.tracking.id == iD)]
8674
return data
8775

8876
def isObjectInFrame(self, iD, index):
89-
"""
90-
Check if an object id is in a frame index.
77+
"""Check if an object id is in a frame index.
9178
92-
:param [iD]: [Id of the object.]
93-
:type [index]: [int]
94-
:param [index]: [Index of the image.]
95-
:type [index]: [int]
96-
...
97-
:return: [True if object id in frame index.]
98-
:rtype: [bool]
79+
:param iD: Id of the object.
80+
:type index: int
81+
:param index: Index of the image.
82+
:type index: int
83+
:return: True if object id in frame index.
84+
:rtype: bool
9985
"""
10086
data = self.tracking[(self.tracking.imageNumber == index)&(self.tracking.id == iD)]
10187
if data.empty:

0 commit comments

Comments
 (0)