Skip to content

Commit 9af357a

Browse files
authored
Merge pull request #6 from kesslerlib/docs
docs
2 parents 568dcdc + ba624a5 commit 9af357a

6 files changed

Lines changed: 99 additions & 77 deletions

File tree

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
pip install sphinx-book-theme
3636
pip install myst-nb
3737
cd docs
38-
make html linkcheck
38+
make html linkcheck
3939
- name: Test
4040
run: |
4141
coverage run -m pytest

docs/api.rst

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
11
.. _api:
22

33
API
4-
#########
4+
#######
55

66
Kessler API
77

8-
.. toctree::
9-
:maxdepth: 2
10-
:caption: API Documentation
8+
.. currentmodule:: kessler
119

12-
_autosummary/kessler.cdm
13-
_autosummary/kessler.data
14-
_autosummary/kessler.event
15-
_autosummary/kessler.model
16-
_autosummary/kessler.nn
17-
_autosummary/kessler.observation_model
18-
_autosummary/kessler.plot
19-
_autosummary/kessler.util
10+
.. autosummary::
11+
:toctree: _autosummary
12+
:recursive:
13+
14+
cdm
15+
data
16+
event
17+
model
18+
nn
19+
observation_model
20+
plot
21+
util

docs/conf.py

Lines changed: 15 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,13 @@
1010
# add these directories to sys.path here. If the directory is relative to the
1111
# documentation root, use os.path.abspath to make it absolute, like shown here.
1212
#
13-
project = 'Kessler'
14-
copyright = "2020, 2021, 2022, 2023, 2024, 2025, Kessler contributors"
13+
project = 'kessler'
14+
copyright = "2020-2025, Kessler contributors"
1515
author = 'Giacomo Acciarini, Atılım Güneş Baydin, Francesco Pinto'
1616

1717

1818
# The full version, including alpha/beta/rc tags
1919
import kessler
20-
import sys
21-
import os
22-
sys.path.insert(0, os.path.abspath('../')) # Add the root directory of your repo
2320

2421
release = kessler.__version__
2522

@@ -30,24 +27,12 @@
3027
# Add any Sphinx extension module names here, as strings. They can be
3128
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
3229
# ones.
33-
extensions = ["myst_nb", "sphinx.ext.autodoc", "sphinx.ext.doctest", "sphinx.ext.intersphinx", "sphinx.ext.autosummary","sphinx.ext.napoleon"]
34-
35-
36-
# build the templated autosummary files
37-
autosummary_generate = True
38-
autosummary_imported_members = False
39-
napoleon_google_docstring = True
40-
numpydoc_show_class_members = False
41-
panels_add_bootstrap_css = False
42-
43-
autosectionlabel_prefix_document = True
44-
45-
# katex options
46-
#
47-
#
48-
katex_prerender = True
49-
50-
napoleon_use_ivar = True
30+
extensions = ["myst_nb",
31+
"sphinx.ext.intersphinx",
32+
"sphinx.ext.autodoc",
33+
"sphinx.ext.autosummary",
34+
"sphinx.ext.doctest",
35+
]
5136

5237
# Add any paths that contain templates here, relative to this directory.
5338
templates_path = ["_templates"]
@@ -64,7 +49,7 @@
6449
# List of patterns, relative to source directory, that match files and
6550
# directories to ignore when looking for source files.
6651
# This pattern also affects html_static_path and html_extra_path.
67-
exclude_patterns = ["_build", ".DS_Store",'jupyter_execute/**/*.ipynb','jupyter_execute/*.ipynb']
52+
exclude_patterns = ["_build", ".DS_Store"]
6853

6954

7055
# -- Options for HTML output -------------------------------------------------
@@ -97,7 +82,12 @@
9782
nb_execution_mode = "force"
9883

9984
nb_execution_excludepatterns = ['basics.ipynb','cdms_analysis_and_plotting.ipynb','LSTM_training.ipynb']
100-
#autosummary_ignore_module = ['']
85+
86+
# Force printing traceback to stderr on execution error.
87+
nb_execution_show_tb = True
88+
89+
# Set a longer timeout for notebook execution.
90+
nb_execution_timeout = 120
10191

10292
latex_engine = "xelatex"
10393

docs/index.md

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,23 @@ For more details on the model and results, check out our publications listed in
1111

1212
The authors are [Giacomo Acciarini](https://www.esa.int/gsp/ACT/team/giacomo_acciarini/), [Atılım Güneş Baydin](https://gbaydin.github.io/), [Dario Izzo](https://www.esa.int/gsp/ACT/team/dario_izzo/). The main developer is Giacomo Acciarini (giacomo.acciarini@gmail.com).
1313

14-
:maxdepth: 1
15-
:caption: Getting started
1614

17-
install.rst
18-
capabilities
19-
credits
15+
```{toctree}
16+
:maxdepth: 1
17+
:caption: Getting Started
2018
19+
install
20+
capabilities
21+
credits
22+
```
2123

22-
:maxdepth: 1
23-
:caption: Tutorials
24+
```{toctree}
25+
:maxdepth: 1
26+
:caption: Contents
2427
25-
notebooks/basics
26-
notebooks/cdms_analysis_and_plotting
27-
notebooks/LSTM_training
28-
notebooks/probabilistic_programming_module
29-
30-
31-
:maxdepth: 1
32-
:caption: API documentation
33-
34-
api
28+
tutorials
29+
api
30+
```
3531

3632
Indices and tables
3733
==================

docs/tutorials.rst

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
.. _tutorials:
2+
3+
Tutorials
4+
===============
5+
6+
Basics
7+
^^^^^^^^^^^
8+
These tutorials include some basic examples on how to use kessler
9+
10+
.. toctree::
11+
:maxdepth: 1
12+
13+
notebooks/basics.ipynb
14+
notebooks/cdms_analysis_and_plotting.ipynb
15+
16+
Advanced
17+
^^^^^^^^^^^
18+
These tutorials are more advanced examples on how to leverage kessler framework
19+
for more complex tasks. In particular, we will cover both the deep learning module (where
20+
kessler is used to predict CDMs) and the probabilistic programming one (where kessler is used
21+
as a probabilistic generative model for CDMs)
22+
23+
.. toctree::
24+
:maxdepth: 1
25+
26+
notebooks/LSTM_training.ipynb
27+
notebooks/probabilistic_programming_module.ipynb

kessler/util.py

Lines changed: 29 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -441,30 +441,37 @@ def progress_bar_end(message=None):
441441
print(message)
442442

443443
def get_ccsds_time_format(time_string):
444-
'''
445-
Adapted by Andrew Ng, 18/3/2022.
446-
Original MATLAB source code found at: https://github.com/nasa/CARA_Analysis_Tools/blob/master/two-dimension_Pc/Main/TransformationCode/TimeTransformations/getCcsdsTimeFormat.m
447-
get_ccsds_time_format - process and outputs the format of the time string extracted from the CDM.
448-
The CCSDS time format is required to be of the general form
449-
yyyy-[mm-dd|ddd]THH:MM:SS[.F*][Z]
450-
(1) The date and time fields are separated by a "T".
451-
(2) The date field has a four digit year followed by either a two digit
452-
month and two digit day, or a three digit day-of-year.
453-
(3) The year, month, day, and day-of-year fields are separated by a dash.
454-
(4) The hours, minutes and seconds fields are each two digits separated
455-
by colons.
456-
(5) The fraction of seconds is optional and can have any number of
457-
digits.
458-
(6) If a fraction of seconds is provided, it is separated from the two
459-
digit seconds by a period.
460-
(7) The time string can end with an optional "Z" time zone indicator
444+
"""
445+
Adapted by Andrew Ng, 18/3/2022.
446+
Original MATLAB source code:
447+
`NASA CARA Analysis Tools <https://github.com/nasa/CARA_Analysis_Tools>`_
448+
449+
Processes and outputs the format of the time string extracted from the CDM.
450+
The CCSDS time format is required to be of the general form:
451+
452+
.. code-block:: none
453+
454+
yyyy-[mm-dd|ddd]THH:MM:SS[.F*][Z]
455+
456+
Format Rules:
457+
1. The date and time fields are separated by a **"T"**.
458+
2. The date field consists of a **four-digit year**, followed by either:
459+
- A two-digit month and a two-digit day, or
460+
- A three-digit day-of-year.
461+
3. The year, month, day, and day-of-year fields are separated by a **dash ("-")**.
462+
4. The hours, minutes, and seconds fields are **two-digit values** separated by **colons (":")**.
463+
5. The fraction of seconds is optional and can have **any number of digits**.
464+
6. If a fraction of seconds is provided, it is separated from the two-digit seconds by a **period (".")**.
465+
7. The time string can end with an optional **"Z"** time zone indicator.
461466
462467
Args:
463-
- time_string(``str``): Original time string stored in CDM.
464-
Returns:
465-
- time_format(``str``): Outputs the format of the time string. It must be of the form yyyy-[mm-dd|ddd]THH:MM:SS[.F*][Z], otherwise it is invalid and a RuntimeError is raised.
468+
time_string (str): Original time string stored in CDM.
469+
470+
Returns:
471+
str: Outputs the format of the time string.
472+
Must be of the form **yyyy-[mm-dd|ddd]THH:MM:SS[.F*][Z]**, otherwise a `RuntimeError` is raised.
473+
"""
466474

467-
'''
468475
time_format = []
469476
numT = time_string.count('T')
470477
if numT == -1:
@@ -508,7 +515,7 @@ def get_ccsds_time_format(time_string):
508515
def doy_2_date(value, doy, year, idx):
509516
'''
510517
Written by Andrew Ng, 18/03/2022,
511-
Based on source code @ https://github.com/nasa/CARA_Analysis_Tools/blob/master/two-dimension_Pc/Main/TransformationCode/TimeTransformations/DOY2Date.m
518+
Based on source code @ https://github.com/nasa/CARA_Analysis_Tools
512519
Use the datetime python package.
513520
doy_2_date - Converts Day of Year (DOY) date format to date format.
514521

0 commit comments

Comments
 (0)