Skip to content

Commit 4902dfb

Browse files
committed
Fix documentation for new module structure and example paths
1 parent ea8f095 commit 4902dfb

File tree

7 files changed

+43
-30
lines changed

7 files changed

+43
-30
lines changed

docs/source/modules/datatypes.rst

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Data Types
33
================
44

5-
Data types are used to store and process data in MyoVerse. They are used to store data in a structured way and to apply filters to the data.
5+
Data types are used to store and process data in MyoVerse. They are used to store data in a structured way.
66

77
.. currentmodule:: myoverse.datatypes
88
.. autosummary::
@@ -13,17 +13,6 @@ Data types are used to store and process data in MyoVerse. They are used to stor
1313
KinematicsData
1414
VirtualHandKinematics
1515

16-
If you wish to apply :ref:`filters` to the data, you can use the following functions:
17-
18-
.. currentmodule:: myoverse.datatypes
19-
.. autosummary::
20-
:toctree: generated/datatypes
21-
:template: function.rst
22-
23-
_Data.apply_filter
24-
_Data.apply_filter_sequence
25-
_Data.apply_filter_pipeline
26-
2716
Base Data Class
2817
-----------------
2918
.. important:: If you wish to add a new data type make sure they inherit from the following base class.
@@ -34,5 +23,3 @@ Base Data Class
3423
:template: class.rst
3524

3625
_Data
37-
38-

examples/01_tutorials/1_understanding_basics.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,13 @@
2020
import torch
2121
import myoverse
2222

23-
# Get the path to the data file
24-
SCRIPT_DIR = Path(__file__).parent.resolve()
25-
DATA_DIR = SCRIPT_DIR.parent / "data"
23+
# Get the path to the data file (works in both script and Sphinx-Gallery context)
24+
try:
25+
SCRIPT_DIR = Path(__file__).parent.resolve()
26+
DATA_DIR = SCRIPT_DIR.parent / "data"
27+
except NameError:
28+
# Running in Sphinx-Gallery - cwd is project root
29+
DATA_DIR = Path.cwd() / "examples" / "data"
2630

2731
with open(DATA_DIR / "emg.pkl", "rb") as f:
2832
emg_data = pkl.load(f)

examples/01_tutorials/2_complex_filtering.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,13 @@
1818
import torch
1919
import myoverse
2020

21-
SCRIPT_DIR = Path(__file__).parent.resolve()
22-
DATA_DIR = SCRIPT_DIR.parent / "data"
21+
# Get the path to the data file (works in both script and Sphinx-Gallery context)
22+
try:
23+
SCRIPT_DIR = Path(__file__).parent.resolve()
24+
DATA_DIR = SCRIPT_DIR.parent / "data"
25+
except NameError:
26+
# Running in Sphinx-Gallery - cwd is project root
27+
DATA_DIR = Path.cwd() / "examples" / "data"
2328

2429
with open(DATA_DIR / "emg.pkl", "rb") as f:
2530
emg_data = pkl.load(f)

examples/01_tutorials/3_create_dataset.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,13 @@
1818

1919
from myoverse.datasets import DatasetCreator, Modality
2020

21-
# Get the directory where this script is located
22-
SCRIPT_DIR = Path(__file__).parent.resolve()
23-
DATA_DIR = SCRIPT_DIR.parent / "data"
21+
# Get the directory where this script is located (works in both script and Sphinx-Gallery context)
22+
try:
23+
SCRIPT_DIR = Path(__file__).parent.resolve()
24+
DATA_DIR = SCRIPT_DIR.parent / "data"
25+
except NameError:
26+
# Running in Sphinx-Gallery - cwd is project root
27+
DATA_DIR = Path.cwd() / "examples" / "data"
2428

2529
# Create dataset with multiple modalities
2630
creator = DatasetCreator(

examples/01_tutorials/4_train_model.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,13 @@
1111

1212
import torch
1313

14-
# Get paths
15-
SCRIPT_DIR = Path(__file__).parent.resolve()
16-
DATA_DIR = SCRIPT_DIR.parent / "data"
14+
# Get paths (works in both script and Sphinx-Gallery context)
15+
try:
16+
SCRIPT_DIR = Path(__file__).parent.resolve()
17+
DATA_DIR = SCRIPT_DIR.parent / "data"
18+
except NameError:
19+
# Running in Sphinx-Gallery - cwd is project root
20+
DATA_DIR = Path.cwd() / "examples" / "data"
1721

1822
# Determine device
1923
DEVICE = "cuda" if torch.cuda.is_available() else "cpu"

examples/02_filters/2_temporal_filters.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,13 @@
1919
import torch
2020
import myoverse
2121

22-
# Get the path to the data file
23-
SCRIPT_DIR = Path(__file__).parent.resolve()
24-
DATA_DIR = SCRIPT_DIR.parent / "data"
22+
# Get the path to the data file (works in both script and Sphinx-Gallery context)
23+
try:
24+
SCRIPT_DIR = Path(__file__).parent.resolve()
25+
DATA_DIR = SCRIPT_DIR.parent / "data"
26+
except NameError:
27+
# Running in Sphinx-Gallery - cwd is project root
28+
DATA_DIR = Path.cwd() / "examples" / "data"
2529

2630
with open(DATA_DIR / "emg.pkl", "rb") as f:
2731
emg_data = pkl.load(f)

examples/02_filters/3_spatial_filters.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,13 @@
2929
# ----------------
3030
# Load EMG data and create a tensor with grid layouts.
3131

32-
SCRIPT_DIR = Path(__file__).parent.resolve()
33-
DATA_DIR = SCRIPT_DIR.parent / "data"
32+
# Get the path to the data file (works in both script and Sphinx-Gallery context)
33+
try:
34+
SCRIPT_DIR = Path(__file__).parent.resolve()
35+
DATA_DIR = SCRIPT_DIR.parent / "data"
36+
except NameError:
37+
# Running in Sphinx-Gallery - cwd is project root
38+
DATA_DIR = Path.cwd() / "examples" / "data"
3439

3540
with open(DATA_DIR / "emg.pkl", "rb") as f:
3641
raw_data = pkl.load(f)["1"][:80] # 80 channels: 64 (8x8) + 16 (4x4)

0 commit comments

Comments
 (0)