Skip to content

Commit c9b18bb

Browse files
authored
Merge branch 'main' into MMathisLab-setup
2 parents 82bce28 + 09b8974 commit c9b18bb

File tree

6 files changed

+54
-7
lines changed

6 files changed

+54
-7
lines changed

.github/workflows/docs.yml

+7
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ on:
99
- main
1010
- public
1111
- dev
12+
paths:
13+
- '**.py'
14+
- '**.ipynb'
15+
- '**.js'
16+
- '**.rst'
17+
- '**.md'
1218

1319
jobs:
1420
build:
@@ -69,6 +75,7 @@ jobs:
6975
pip install torch --extra-index-url https://download.pytorch.org/whl/cpu
7076
pip install '.[docs]'
7177
78+
7279
- name: Build docs
7380
run: |
7481
ls docs/source/cebra-figures

cebra/integrations/plotly.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import numpy.typing as npt
2929
import plotly.graph_objects
3030
import torch
31+
import plotly.graph_objects as go
3132

3233
from cebra.integrations.matplotlib import _EmbeddingPlot
3334

@@ -154,7 +155,7 @@ def _plot_3d(self, **kwargs) -> plotly.graph_objects.Figure:
154155
def plot_embedding_interactive(
155156
embedding: Union[npt.NDArray, torch.Tensor],
156157
embedding_labels: Optional[Union[npt.NDArray, torch.Tensor, str]] = "grey",
157-
axis: Optional[plotly.graph_objects.Figure] = None,
158+
axis: Optional["go.Figure"] = None,
158159
markersize: float = 1,
159160
idx_order: Optional[Tuple[int]] = None,
160161
alpha: float = 0.4,
@@ -163,7 +164,7 @@ def plot_embedding_interactive(
163164
figsize: Tuple[int] = (5, 5),
164165
dpi: int = 100,
165166
**kwargs,
166-
) -> plotly.graph_objects.Figure:
167+
) -> "go.Figure":
167168
"""Plot embedding in a 3D dimensional space.
168169
169170
This is supposing that the dimensions provided to ``idx_order`` are in the range of the number of

docs/Makefile

+5
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ help:
1818
html:
1919
PYTHONPATH=.. $(SPHINXBUILD) -M html "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
2020

21+
# Build multiple versions
22+
html_versions:
23+
for v in latest v0.2.0 v0.3.0 v0.4.0; do \
24+
PYTHONPATH=.. $(SPHINXBUILD) -b html "$(SOURCEDIR)" "$(BUILDDIR)/$$v"; \
25+
done
2126
# Remove the current temp folder and page build
2227
clean:
2328
rm -rf build

docs/source/_static/css/custom.js

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
requirejs.config({
2+
paths: {
3+
base: '/static/base',
4+
plotly: 'https://cdn.plot.ly/plotly-2.12.1.min.js?noext',
5+
},
6+
});

docs/source/_templates/layout.html

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
{% extends "pydata_sphinx_theme/layout.html" %}
22

3-
{% block fonts %}
3+
{% block extrahead %}
4+
<!-- Load require.js locally from _static -->
5+
<script src="{{ pathto('_static/css/custom.js', 1) }}"></script>
6+
7+
{% endblock %}
48

9+
{% block fonts %}
510
<link rel="preconnect" href="https://fonts.googleapis.com">
611
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
712
<link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@300&display=swap" rel="stylesheet">
8-
913
{% endblock %}
1014

1115
{% block docs_sidebar %}

docs/source/conf.py

+27-3
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ def get_years(start_year=2021):
4747

4848
# -- Project information -----------------------------------------------------
4949
project = "cebra"
50-
copyright = f"""{get_years(2021)}, Steffen Schneider, Jin H Lee, Mackenzie Mathis"""
51-
author = "Steffen Schneider, Jin H Lee, Mackenzie Mathis"
50+
copyright = f"""{get_years(2021)}"""
51+
author = "See AUTHORS.md"
5252
# The full version, including alpha/beta/rc tags
5353
release = cebra.__version__
5454

@@ -57,6 +57,13 @@ def get_years(start_year=2021):
5757
# Add any Sphinx extension module names here, as strings. They can be
5858
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
5959
# ones.
60+
61+
#https://github.com/spatialaudio/nbsphinx/issues/128#issuecomment-1158712159
62+
html_js_files = [
63+
"require.min.js", # Add to your _static
64+
"custom.js",
65+
]
66+
6067
extensions = [
6168
"sphinx.ext.autodoc",
6269
"sphinx.ext.napoleon",
@@ -68,13 +75,13 @@ def get_years(start_year=2021):
6875
"sphinx_tabs.tabs",
6976
"sphinx.ext.mathjax",
7077
"IPython.sphinxext.ipython_console_highlighting",
71-
# "sphinx_panels", # Note: package to avoid: no longer maintained.
7278
"sphinx_design",
7379
"sphinx_togglebutton",
7480
"sphinx.ext.doctest",
7581
"sphinx_gallery.load_style",
7682
]
7783

84+
7885
coverage_show_missing_items = True
7986
panels_add_bootstrap_css = False
8087

@@ -137,6 +144,21 @@ def get_years(start_year=2021):
137144
# a list of builtin themes.
138145
html_theme = "pydata_sphinx_theme"
139146

147+
html_context = {
148+
"default_mode": "light",
149+
"switcher": {
150+
"version_match": "latest", # Adjust this dynamically per version
151+
"versions": [
152+
("latest", "/latest/"),
153+
("v0.2.0", "/v0.2.0/"),
154+
("v0.3.0", "/v0.3.0/"),
155+
("v0.4.0", "/v0.4.0/"),
156+
("v0.5.0rc1", "/v0.5.0rc1/"),
157+
],
158+
},
159+
"navbar_start": ["version-switcher", "navbar-logo"], # Place the dropdown above the logo
160+
}
161+
140162
# More info on theme options:
141163
# https://pydata-sphinx-theme.readthedocs.io/en/latest/user_guide/configuring.html
142164
html_theme_options = {
@@ -197,6 +219,8 @@ def get_years(start_year=2021):
197219
]
198220

199221
nbsphinx_thumbnails = {
222+
"demo_notebooks/CEBRA_best_practices":
223+
"_static/thumbnails/cebra-best.png",
200224
"demo_notebooks/Demo_primate_reaching":
201225
"_static/thumbnails/ForelimbS1.png",
202226
"demo_notebooks/Demo_hippocampus":

0 commit comments

Comments
 (0)