Skip to content

Commit

Permalink
Integrate example gallery (#55)
Browse files Browse the repository at this point in the history
* Created examples gallery
* Enabled collapsible subcategories in sidebar
* ran nbstripout on example notebooks
* added nbstripout to pre-commit

---------

Co-authored-by: Josef Cutler <josefcutler@gmail.com>
  • Loading branch information
emiddell and jccutler authored Oct 18, 2024
1 parent ffaefa6 commit 8eeec4a
Show file tree
Hide file tree
Showing 41 changed files with 3,604 additions and 40,305 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ src/cedalion/_version.py

# rendered example notebooks
docs/examples/*.ipynb
docs/examples/*/*.ipynb

# API documentation from sphinx-apidoc
docs/api/*
Expand Down
12 changes: 7 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ repos:
# Ruff
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.5.4
rev: v0.7.0
hooks:
# Run the linter.
- id: ruff
files: ^src/cedalion/
# Run the formatter.
#- id: ruff-format
# files: ^src/cedalion/
- repo: https://github.com/kynan/nbstripout
rev: 0.7.1
hooks:
- id: nbstripout
files: ^examples/

Binary file added docs/_static/IBS_Logo_sm.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,8 @@

# -- sphinx_autodoc_typehints -------------------------------------------------
always_use_bars_union = True

# -- Nbsphinx gallery ----------------------------------------------------------------
nbsphinx_thumbnails = {
'examples/*/*': '_static/IBS_Logo_sm.png',
}
62 changes: 62 additions & 0 deletions docs/examples.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
Examples
========

.. contents::
:local:

Getting Started and IO
----------------------

.. nbgallery::
:glob:

examples/getting_started_io/*

Signal Quality
-----------------------

.. nbgallery::
:glob:

examples/signal_quality/*

Modeling
-----------------------

.. nbgallery::
:glob:

examples/modeling/*

Head Models and Image Reconstruction
-------------------------------------

.. nbgallery::
:glob:

examples/head_models/*

Machine Learning and Data Driven Methods
----------------------------------------

.. nbgallery::
:glob:

examples/machine_learning/*

Data Augmentation
-----------------------

.. nbgallery::
:caption: Coming soon
:glob:

examples/data_augmentation/*

Plots & Visualization
-----------------------

.. nbgallery::
:glob:

examples/plots_visualization/*
44 changes: 19 additions & 25 deletions docs/examples/Makefile
Original file line number Diff line number Diff line change
@@ -1,31 +1,25 @@
EXAMPLE_NOTEBOOKS = 00_test_installation.ipynb \
10_xarray_datastructs_fnirs.ipynb \
11_recording_container.ipynb \
12_plots_example.ipynb \
13_data_structures_intro.ipynb \
20_scalp_coupling_index.ipynb \
21_data_quality_and_pruning.ipynb \
22_motion_artefacts_and_correction.ipynb \
31_glm_basis_functions.ipynb \
32_glm_fingertapping_example.ipynb \
33_glm_illustrative_example.ipynb \
34_store_hrfs_in_snirf_file.ipynb \
40_image_reconstruction.ipynb \
41_photogrammetric_optode_coregistration.ipynb \
42_1010_system.ipynb \
43_crs_and_headmodel.ipynb \
50_finger_tapping_lda_classification.ipynb



EXAMPLE_NOTEBOOKS = getting_started_io/00_test_installation.ipynb \
getting_started_io/10_xarray_datastructs_fnirs.ipynb \
getting_started_io/11_recording_container.ipynb \
getting_started_io/13_data_structures_intro.ipynb \
getting_started_io/34_store_hrfs_in_snirf_file.ipynb \
plots_visualization/12_plots_example.ipynb \
machine_learning/50_finger_tapping_lda_classification.ipynb \
modeling/31_glm_basis_functions.ipynb \
modeling/32_glm_fingertapping_example.ipynb \
modeling/33_glm_illustrative_example.ipynb \
signal_quality/20_scalp_coupling_index.ipynb \
signal_quality/21_data_quality_and_pruning.ipynb \
signal_quality/22_motion_artefacts_and_correction.ipynb \
head_models/40_image_reconstruction.ipynb \
head_models/41_photogrammetric_optode_coregistration.ipynb \
head_models/42_1010_system.ipynb \
head_models/43_crs_and_headmodel.ipynb

.PHONY: notebooks

notebooks: $(EXAMPLE_NOTEBOOKS)

$(EXAMPLE_NOTEBOOKS) : %.ipynb : ../../examples/%.ipynb
$(EXAMPLE_NOTEBOOKS): %.ipynb : ../../examples/%.ipynb
jupyter nbconvert --ExecutePreprocessor.store_widget_state=True --to notebook \
--execute --output-dir=. $^

clean:
rm -f $(EXAMPLE_NOTEBOOKS)
--execute --output-dir=$(dir $@) $<
9 changes: 0 additions & 9 deletions docs/examples/index.md

This file was deleted.

3 changes: 1 addition & 2 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@ A python-based framework for the data driven analysis of multimodal fNIRS and DO
```{toctree}
:maxdepth: 1
:caption: Contents
:titlesonly:
rationale.md
getting_started/index.md
data_structures/index.md
examples/index.md
examples
community/index.md
API <api/modules.rst>
references.rst
Expand Down
602 changes: 0 additions & 602 deletions examples/12_plots_example.ipynb

This file was deleted.

Loading

0 comments on commit 8eeec4a

Please sign in to comment.