Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,9 @@ build/
source/.buildinfo
source/*.inv
source/_outputs/

# direnv
.envrc

# autogenerated documentation
source/reference/python/RATapi.*
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ pydata-sphinx-theme==0.15.2
sphinx_design==0.6.0
sphinx-copybutton==0.5.2
RATapi==0.0.0.dev4
autodoc_pydantic==2.2.0
enum-tools[sphinx]==0.12.0
27 changes: 25 additions & 2 deletions source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
# add extensions path for snippets
sys.path.append(os.path.abspath("./_ext"))

extensions = ['sphinxcontrib.matlab', 'sphinx.ext.autodoc', 'sphinx.ext.autosummary', 'sphinx_design', 'sphinx_copybutton', 'snippets']
extensions = ['sphinxcontrib.matlab', 'sphinx.ext.napoleon', 'sphinx.ext.autodoc', 'sphinx.ext.autosummary', 'sphinxcontrib.autodoc_pydantic', 'sphinx_design', 'sphinx_copybutton', 'snippets', 'enum_tools.autoenum']

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
Expand Down Expand Up @@ -78,4 +78,27 @@
}

copybutton_prompt_text = r">>> |>> "
copybutton_prompt_is_regexp = True
copybutton_prompt_is_regexp = True

autodoc_typehints = "description"

### autodoc_pydantic settings
# hide JSON schemas by default
autodoc_pydantic_model_show_json = False
autodoc_pydantic_settings_show_json = False

# don't show validators or config
autodoc_pydantic_field_list_validators = False
autodoc_pydantic_model_show_config_summary = False
autodoc_pydantic_model_show_validator_summary = False
autodoc_pydantic_model_show_validator_members = False

# hide parameter list in class signature
autodoc_pydantic_settings_hide_paramlist = True

# do not show list of fields if they do not have docstrings
# (e.g. for models we use the main docstring)
autodoc_pydantic_model_undoc_members = False

# get field documentation from field docstrings
autodoc_pydantic_field_doc_policy = "docstring"
2 changes: 2 additions & 0 deletions source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ RAT contains a number of improvements over legacy RasCAL, including:
Learn more by diving into the RAT reference:

* :ref:`matlab_api`: Detailed information about all of RAT's MATLAB API.
* :ref:`python_api`: Detailed information about the RAT Python API.


.. grid-item-card::
Expand All @@ -77,4 +78,5 @@ RAT contains a number of improvements over legacy RasCAL, including:
install
guide
reference/matlab/index
reference/python/index

4 changes: 4 additions & 0 deletions source/reference/python/classlist.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
ClassList
---------

.. autoclass:: RATapi.ClassList
9 changes: 9 additions & 0 deletions source/reference/python/controls.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Controls
--------

The ``Controls`` class details control parameters for the RAT run. Note that many of these are
specific to certain procedures: the relevant procedure is listed in square brackets before the
field description.

.. autopydantic_model:: RATapi.Controls
:members:
8 changes: 8 additions & 0 deletions source/reference/python/core.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
RAT Core
--------

This module contains the `Pybind11 <https://pybind11.readthedocs.io/en/stable/index.html>`_ objects
which are used to interface with RAT's C++ code.

.. automodule:: RATapi.rat_core
:members:
9 changes: 9 additions & 0 deletions source/reference/python/enums.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Enums
-----

This utility module (found in ``RATapi.utils.enums``) contains the Enum objects
which are used under the hood to represent arguments given as string options,
such as those for control parameters or background types.

.. automodule:: RATapi.utils.enums
:members:
5 changes: 5 additions & 0 deletions source/reference/python/events.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Events
------

.. automodule:: RATapi.events
:members:
5 changes: 5 additions & 0 deletions source/reference/python/examples.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Examples
--------

.. automodule:: RATapi.examples
:members:
32 changes: 32 additions & 0 deletions source/reference/python/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
.. _python_api:

Python API Reference
--------------------

User API
^^^^^^^^

.. toctree::
:maxdepth: 2

run
project
controls
classlist
models
events
examples
plotting
enums


Developer API
^^^^^^^^^^^^^

.. toctree::
:maxdepth: 2

core
inputs
outputs
wrappers
8 changes: 8 additions & 0 deletions source/reference/python/inputs.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Inputs
------

This module contains the objects used to organise input data to RAT to be fed
into the C++ module.

.. automodule:: RATapi.inputs
:members:
7 changes: 7 additions & 0 deletions source/reference/python/models.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Models
------

.. automodule:: RATapi.models
:members:
:inherited-members: RATModel
:exclude-members: RATModel, Signal
8 changes: 8 additions & 0 deletions source/reference/python/outputs.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Outputs
-------

This module contains the Results objects and the relevant objects to retrieve
results data from the C++ module.

.. automodule:: RATapi.outputs
:members:
10 changes: 10 additions & 0 deletions source/reference/python/plotting.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Plotting
--------

Plotting functionality for RAT results objects is available through the ``RATapi.utils.plotting`` module.

.. note: plot_bayes is currently excluded because its docstring is not valid RST!

.. automodule:: RATapi.utils.plotting
:members:
:exclude-members: plot_errorbars, plot_ref_sld_helper, assert_bayesian, name_to_index, panel_plot_helper, plot_bayes
6 changes: 6 additions & 0 deletions source/reference/python/project.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Project
-------

.. autopydantic_model:: RATapi.Project
:members:

6 changes: 6 additions & 0 deletions source/reference/python/run.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Run
---

The core function to run RAT.

.. autofunction:: RATapi.run
8 changes: 8 additions & 0 deletions source/reference/python/wrappers.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Wrappers
--------

This module contains the wrappers for interfacing with MATLAB custom functions,
such as those for custom layers models or function backgrounds.

.. automodule:: RATapi.wrappers
:members: