File tree Expand file tree Collapse file tree 7 files changed +43
-30
lines changed
Expand file tree Collapse file tree 7 files changed +43
-30
lines changed Original file line number Diff line number Diff line change 22Data 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-
2716Base 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-
Original file line number Diff line number Diff line change 2020import torch
2121import 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
2731with open (DATA_DIR / "emg.pkl" , "rb" ) as f :
2832 emg_data = pkl .load (f )
Original file line number Diff line number Diff line change 1818import torch
1919import 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
2429with open (DATA_DIR / "emg.pkl" , "rb" ) as f :
2530 emg_data = pkl .load (f )
Original file line number Diff line number Diff line change 1818
1919from 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
2630creator = DatasetCreator (
Original file line number Diff line number Diff line change 1111
1212import 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
1923DEVICE = "cuda" if torch .cuda .is_available () else "cpu"
Original file line number Diff line number Diff line change 1919import torch
2020import 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
2630with open (DATA_DIR / "emg.pkl" , "rb" ) as f :
2731 emg_data = pkl .load (f )
Original file line number Diff line number Diff line change 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
3540with open (DATA_DIR / "emg.pkl" , "rb" ) as f :
3641 raw_data = pkl .load (f )["1" ][:80 ] # 80 channels: 64 (8x8) + 16 (4x4)
You can’t perform that action at this time.
0 commit comments