Skip to content

Commit

Permalink
Restructure API docs for integrations (#103)
Browse files Browse the repository at this point in the history
  • Loading branch information
stes authored Oct 29, 2023
1 parent f0fe607 commit 4e594a4
Show file tree
Hide file tree
Showing 11 changed files with 64 additions and 20 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,13 @@ jobs:
- name: Install package
run: |
python -m pip install --upgrade pip setuptools wheel
sudo apt-get install -y pandoc
# NOTE(stes) Pandoc version must be at least (2.14.2) but less than (4.0.0).
# as of 29/10/23. Ubuntu 22.04 which is used for ubuntu-latest only has an
# old pandoc version (2.9.). We will hence install the latest version manually.
# previou: sudo apt-get install -y pandoc
wget https://github.com/jgm/pandoc/releases/download/3.1.9/pandoc-3.1.9-1-amd64.deb
sudo dpkg -i pandoc-3.1.9-1-amd64.deb
rm pandoc-3.1.9-1-amd64.deb
pip install torch --extra-index-url https://download.pytorch.org/whl/cpu
pip install '.[docs]'
Expand Down
17 changes: 16 additions & 1 deletion cebra/data/load.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,22 @@
# Please see LICENSE.md for the full license document:
# https://github.com/AdaptiveMotorControlLab/CEBRA/LICENSE.md
#
"""A simple API for loading various data formats used with CEBRA."""
"""A simple API for loading various data formats used with CEBRA.
Availability of different data formats depends on the installed
dependencies. If a dependency is not installed, an attempt to load
a file of that format will throw an error with further installation
instructions.
Currently available formats:
- HDF5 via ``h5py``
- Pickle files via ``pickle``
- Joblib files via ``joblib``
- Various dataframe formats via ``pandas``.
- Matlab files via ``scipy.io.loadmat``
- DeepLabCut (single animal) files via ``deeplabcut``
"""

import abc
import pathlib
Expand Down
4 changes: 2 additions & 2 deletions cebra/integrations/plotly.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def plot_embedding_interactive(
This is supposing that the dimensions provided to ``idx_order`` are in the range of the number of
dimensions of the embedding (i.e., between 0 and :py:attr:`cebra.CEBRA.output_dimension` -1).
The function makes use of :py:func:`plotly.graph_objs._scatter.Scatter` and parameters from that function can be provided
The function makes use of :py:class:`plotly.graph_objects.Scatter` and parameters from that function can be provided
as part of ``kwargs``.
Expand All @@ -156,7 +156,7 @@ def plot_embedding_interactive(
title: The title on top of the embedding.
figsize: Figure width and height in inches.
dpi: Figure resolution.
kwargs: Optional arguments to customize the plots. See :py:func:`plotly.graph_objs._scatter.Scatter` documentation for more
kwargs: Optional arguments to customize the plots. See :py:class:`plotly.graph_objects.Scatter` documentation for more
details on which arguments to use.
Returns:
Expand Down
10 changes: 9 additions & 1 deletion docs/source/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,16 @@ these components in other contexts and research code bases.
api/pytorch/datasets
api/pytorch/distributions
api/pytorch/models
api/pytorch/integrations
api/pytorch/helpers

.. toctree::
:hidden:
:caption: Integrations

api/integrations/data
api/integrations/matplotlib
api/integrations/plotly
api/integrations/deeplabcut


.. _Scikit-learn estimators: https://scikit-learn.org/stable/developers/develop.html
6 changes: 6 additions & 0 deletions docs/source/api/integrations/data.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Data Loading
------------

.. automodule:: cebra.data.load
:show-inheritance:
:members:
8 changes: 8 additions & 0 deletions docs/source/api/integrations/deeplabcut.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
DeepLabCut
----------

.. automodule:: cebra.integrations.deeplabcut
:show-inheritance:
:members:


7 changes: 7 additions & 0 deletions docs/source/api/integrations/matplotlib.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Plotting with ``matplotlib``
----------------------------

.. automodule:: cebra.integrations.matplotlib
:show-inheritance:
:members:

7 changes: 7 additions & 0 deletions docs/source/api/integrations/plotly.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Plotting with ``plotly``
----------------------------

.. automodule:: cebra.integrations.plotly
:show-inheritance:
:members:

8 changes: 0 additions & 8 deletions docs/source/api/pytorch/helpers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,6 @@ Registry
:show-inheritance:


Plots
-----

.. automodule:: cebra.integrations.matplotlib
:show-inheritance:
:members:


Grid-Search
-----------

Expand Down
7 changes: 0 additions & 7 deletions docs/source/api/pytorch/integrations.rst

This file was deleted.

2 changes: 2 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ def get_years(start_year=2021):
"pandas": ("http://pandas.pydata.org/pandas-docs/dev", None),
"scipy": ("http://docs.scipy.org/doc/scipy/reference/", None),
"joblib": ("https://joblib.readthedocs.io/en/latest/", None),
"plotly": ("https://plotly.com/python-api-reference/", None)
}

# Config is documented here: https://sphinx-copybutton.readthedocs.io/en/latest/
Expand All @@ -116,6 +117,7 @@ def get_years(start_year=2021):
"h5py",
"pandas",
"matplotlib",
"plotly"
]
# autodoc_typehints = "none"

Expand Down

0 comments on commit 4e594a4

Please sign in to comment.