cheryl-tootty commited on
Commit
48f387a
·
verified ·
1 Parent(s): 749a113

Restore dataset README

Browse files
Files changed (1) hide show
  1. README.md +86 -0
README.md ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: other
3
+ pretty_name: Boo Level Walking
4
+ tags:
5
+ - biomechanics
6
+ - opensim
7
+ - inverse-dynamics
8
+ - gait
9
+ ---
10
+
11
+ # Policy Reference NPZ Data
12
+
13
+ This dataset contains per-subject, per-trial `.npz` files exported from processed OpenSim inverse dynamics results for level walking.
14
+
15
+ The files are intended for comparing policy inference outputs against OpenSim ID torques. Each exported trial uses the kinematics timeline as the master timeline, with time and timestep reset to start from zero.
16
+
17
+ ID torques are normalized by the subject's weight in kg from `Subject_Demographics.xlsx`. GRF force components are normalized by body weight in Newtons, computed as `subject_weight_kg * 9.80665`.
18
+
19
+ ## Folder Structure
20
+
21
+ ```text
22
+ S011/
23
+ S011_Trial01_Step01_Step02.npz
24
+ S011_Trial02_Step01_Step02.npz
25
+ ...
26
+ S012/
27
+ S012_Trial01_Step01_Step02.npz
28
+ ...
29
+ ```
30
+
31
+ Each `.npz` file corresponds to one subject/trial/step window.
32
+
33
+ ## Arrays
34
+
35
+ Each file contains:
36
+
37
+ | Key | Shape | Description |
38
+ | --- | --- | --- |
39
+ | `subject` | scalar string | Subject ID, for example `S011`. |
40
+ | `trial` | scalar string | Trial name, for example `Trial01`. |
41
+ | `step_label` | scalar string | Step label, currently `Step01_Step02`. |
42
+ | `timestep` | `(T,)` | Zero-based integer timestep over the kinematics sequence. |
43
+ | `time_sec` | `(T,)` | Kinematics time in seconds, shifted so the first frame is `0.0`. |
44
+ | `source_time_sec` | `(T,)` | Same zero-start kinematics time as `time_sec`. |
45
+ | `original_kinematics_time_sec` | `(T,)` | Original OpenSim kinematics timestamps before zero-shifting. |
46
+ | `id_source_time_sec` | `(N_id,)` | Original ID timestamps shifted relative to the first kinematics frame. |
47
+ | `original_id_source_time_sec` | `(N_id,)` | Original OpenSim ID timestamps before zero-shifting. |
48
+ | `joint_angle` | `(T, N_angle)` | Joint angle / coordinate values from kinematics, on the kinematics timeline. |
49
+ | `joint_angle_columns` | `(N_angle,)` | Column names for `joint_angle`. |
50
+ | `joint_torque` | `(T, N_torque)` | ID torques aligned onto the kinematics timeline and divided by `subject_weight_kg`. Missing rows are `NaN`. |
51
+ | `joint_torque_columns` | `(N_torque,)` | Column names for `joint_torque`. |
52
+ | `joint_torque_valid` | `(T,)` | Boolean mask where `joint_torque` has valid ID values. |
53
+ | `joint_torque_normalization` | scalar string | Normalization applied to `joint_torque`, currently `divided_by_subject_weight_kg`. |
54
+ | `joint_torque_units` | scalar string | Normalized torque units, currently `original_ID_units_per_kg`. |
55
+ | `subject_weight_kg` | scalar float | Subject weight used for normalizing `joint_torque`. |
56
+ | `subject_body_weight_n` | scalar float | Subject body weight in Newtons, computed as `subject_weight_kg * 9.80665`. |
57
+ | `computed_grf` | `(T, N_grf)` | Corrected GRF values interpolated onto the kinematics timeline. Force-vector columns are divided by `subject_body_weight_n`; COP and torque columns remain in original units. |
58
+ | `computed_grf_columns` | `(N_grf,)` | Column names for `computed_grf`. |
59
+ | `computed_grf_valid` | `(T,)` | Boolean mask where `computed_grf` has valid values. |
60
+ | `computed_grf_normalization` | scalar string | Normalization applied to `computed_grf`, currently `force_columns_divided_by_subject_body_weight_n`. |
61
+ | `computed_grf_units` | scalar string | Force columns are in body weight units; COP and torque columns remain in original units. |
62
+ | `source_files` | `(3,)` | Source kinematics, ID torque, and GRF file paths used for export. |
63
+
64
+ ## Policy Comparison
65
+
66
+ Run policy inference using `joint_angle`. The policy output should have the same first dimension `T`.
67
+
68
+ Compare predicted normalized torque against OpenSim ID only where `joint_torque_valid` is true:
69
+
70
+ ```python
71
+ import numpy as np
72
+
73
+ data = np.load("S011/S011_Trial01_Step01_Step02.npz")
74
+
75
+ joint_angle = data["joint_angle"]
76
+ target_torque = data["joint_torque"]
77
+ valid = data["joint_torque_valid"]
78
+ subject_weight_kg = float(data["subject_weight_kg"])
79
+
80
+ predicted_torque = policy(joint_angle)
81
+ predicted_torque = predicted_torque / subject_weight_kg
82
+
83
+ error = predicted_torque[valid] - target_torque[valid]
84
+ ```
85
+
86
+ Rows where `joint_torque_valid` is false correspond to kinematics frames without an ID result and should be skipped for torque comparison.