From 751c11c221573f7a0bfe2779ef6986ca6c937994 Mon Sep 17 00:00:00 2001 From: Scott Huberty Date: Wed, 1 Nov 2023 17:52:22 -0400 Subject: [PATCH 1/3] DOC, ENH: add sphinx gallery --- .github/workflows/build_docs.yml | 1 + docs/conf.py | 7 +++++++ examples/README.txt | 5 +++++ examples/plot_eegeyenet.py | 19 +++++++++++++++++++ 4 files changed, 32 insertions(+) create mode 100644 examples/README.txt create mode 100644 examples/plot_eegeyenet.py diff --git a/.github/workflows/build_docs.yml b/.github/workflows/build_docs.yml index 424aeac..cf76bd5 100644 --- a/.github/workflows/build_docs.yml +++ b/.github/workflows/build_docs.yml @@ -24,6 +24,7 @@ jobs: run: | python -m pip install --upgrade pip pip install -e .[doc] + pip install pymatreader - name: Build documentation run: | diff --git a/docs/conf.py b/docs/conf.py index c759527..50fbd0b 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -27,6 +27,7 @@ "sphinx.ext.autodoc", "sphinx.ext.todo", "sphinx_design", + "sphinx_gallery.gen_gallery", "sphinxemoji.sphinxemoji", ] @@ -83,3 +84,9 @@ "dtype", "object", } + +# Sphinx Gallery configuration ------------------------------------------------ +sphinx_gallery_conf = { + "examples_dirs": "../examples", # path to tutorial python scripts + "gallery_dirs": "auto_examples", # path to where to save gallery generated output +} diff --git a/examples/README.txt b/examples/README.txt new file mode 100644 index 0000000..d4787a9 --- /dev/null +++ b/examples/README.txt @@ -0,0 +1,5 @@ +eog-learn Tutorials +=================== + +Here we list some (work in progress!) tutorials for using eog-learn with eeg-eyetracking +data. Mainly these will cover loading eeg-eyetracking data and training the model. \ No newline at end of file diff --git a/examples/plot_eegeyenet.py b/examples/plot_eegeyenet.py new file mode 100644 index 0000000..26fdac3 --- /dev/null +++ b/examples/plot_eegeyenet.py @@ -0,0 +1,19 @@ +""" + +Load an example file from EEGEyeNet +=================================== + +This example shows how to load an example file from EEGEyeNet, an open-access +dataset of EEG and eyetracking data. We'll load one file from the "dots" task, +which presents a subject with a series of dots at fixed locations on the screen. +""" + +# %% +# Import the necessary packages +from eoglearn.datasets import fetch_eeyeenet +from eoglearn.io import read_raw_eegeyenet + +fpath = fetch_eeyeenet() +fname = fpath / "EP10_DOTS1_EEG.mat" +raw = read_raw_eegeyenet(fname) +raw.plot() From f19e8d7dd6e05a5d2f493676857831d680bfa28c Mon Sep 17 00:00:00 2001 From: Scott Huberty Date: Wed, 1 Nov 2023 17:52:47 -0400 Subject: [PATCH 2/3] FIX: forgot to add io API doc --- docs/API/io.rst | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 docs/API/io.rst diff --git a/docs/API/io.rst b/docs/API/io.rst new file mode 100644 index 0000000..7f7bd5d --- /dev/null +++ b/docs/API/io.rst @@ -0,0 +1,8 @@ +File IO +======= + +eog-learn provides some helper functions for reading data from open-access +EEG-eyetracking datasets. + +.. automodule:: eoglearn.io.eegeyenet + :members: \ No newline at end of file From dc20d3f938ff2a394a7643bfadb6d2ba079aeb56 Mon Sep 17 00:00:00 2001 From: Scott Huberty Date: Wed, 1 Nov 2023 17:54:19 -0400 Subject: [PATCH 3/3] DOC: add tutorial docs --- .gitignore | 5 ++++- docs/index.rst | 1 + examples/plot_eegeyenet.py | 4 ++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index bc9a904..2280311 100644 --- a/.gitignore +++ b/.gitignore @@ -134,4 +134,7 @@ dmypy.json my_project_ll_config.yaml # VSCode ignore -.vscode \ No newline at end of file +.vscode + +# sphinx gallery +docs/auto_examples/ diff --git a/docs/index.rst b/docs/index.rst index c015053..f2a2680 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -18,4 +18,5 @@ Please see the contributing section or the Roadmap for details on how to get inv installation implementation API/API_index + auto_examples/index.rst contributing \ No newline at end of file diff --git a/examples/plot_eegeyenet.py b/examples/plot_eegeyenet.py index 26fdac3..6275d30 100644 --- a/examples/plot_eegeyenet.py +++ b/examples/plot_eegeyenet.py @@ -10,10 +10,10 @@ # %% # Import the necessary packages -from eoglearn.datasets import fetch_eeyeenet +from eoglearn.datasets import fetch_eegeyenet from eoglearn.io import read_raw_eegeyenet -fpath = fetch_eeyeenet() +fpath = fetch_eegeyenet() fname = fpath / "EP10_DOTS1_EEG.mat" raw = read_raw_eegeyenet(fname) raw.plot()