Skip to content

Commit 6d7433e

Browse files
Revise README for better readability and structure
Updated README to improve clarity and formatting.
1 parent 7e3171a commit 6d7433e

File tree

1 file changed

+16
-23
lines changed

1 file changed

+16
-23
lines changed

README.md

Lines changed: 16 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# About This Tool
2-
This computational tool uses optimal control to predict muscle activity of mouse forelimb movements. Users should provide a video of a mouse forelimb movement with annotations on the paw, elbow, and shoulder. A physics simulation with a musculoskeletal model of the mouse forelimb will be performed to reproduce the annotated kinematics and will estimate biomechanical features (including joint positions/velocities, torques, muscle excitations, fiber lengths/velocities). The computational tool outputs a .mot file, which contains the activity of more than 20 forelimb muscles by time.
2+
This computational tool uses optimal control to predict muscle activity of mouse forelimb movements. Users should provide a video of a mouse forelimb movement with annotations on the paw, elbow, and shoulder. A physics simulation with a musculoskeletal model of the mouse forelimb will be performed to reproduce the annotated kinematics and will estimate biomechanical features (including joint positions/velocities, torques, muscle excitations, fiber lengths/velocities). The computational tool outputs a `.mot` file, which contains the activity of more than 20 forelimb muscles by time.
33

44
If you use this computational tool for your research, please cite:
55

@@ -101,28 +101,21 @@ RawData/
101101
│ └── muscle_kinematics_adjusted_kinematics_1.csv
102102
└── ...
103103
```
104+
105+
You can get your path by right clicking on the `.sto` file and clicking "Copy as Path." This will copy the path to you clipboard and you can paste it in with Ctrl+V. The code will look like this:
104106
```
105107
import pandas as pd
106-
import glob
107-
import numpy as np
108-
base_dir = "../../RawData/reachsets/" # Adjust this path to yours
109-
save_dir = "../../Data/" # Adjust this path to yours
110-
mcolnames = ["time", "/jointset/shoulder/elv_angle/value", "/jointset/shoulder/extension_angle/value", "/jointset/shoulder/rotation_angle/value", "/jointset/humerus_ulna/elbow_flex/value", "/jointset/ulna_radius_pj/radius_rot/value", "/jointset/wrist/wrist_angle/value", "/jointset/shoulder/elv_angle/speed", "/jointset/shoulder/extension_angle/speed", "/jointset/shoulder/rotation_angle/speed", "/jointset/humerus_ulna/elbow_flex/speed", "/jointset/ulna_radius_pj/radius_rot/speed", "/jointset/wrist/wrist_angle/speed", "/forceset/Pectoralis_Clavicle_Head/activation", "/forceset/Biceps_Short_Head/activation", "/forceset/Biceps_Long_Head/activation", "/forceset/Deltoid_Medial/activation", "/forceset/Triceps_Lat_Head/activation", "/forceset/Triceps_Long_Head/activation", "/forceset/Brachialis_Proximal_Head/activation", "/forceset/Brachialis_Distal_Head/activation", "/forceset/Anconeus/activation", "/forceset/Deltoid_Posterior/activation", "/forceset/Anconeus_Short_Head/activation", "/forceset/Subscapularis_SuperiorHead/activation", "/forceset/Infraspinatus/activation", "/forceset/PronatorTeres/activation", "/forceset/FlexorCarpiRadialis/activation", "/forceset/Brachioradialis/activation", "/forceset/Triceps_Medial_Head/activation", "/forceset/Latissimus_Dorsi_Rostral/activation", "/forceset/Latissimus_Dorsi_Caudal/activation", "/forceset/Pectoralis_Major_Anterior/activation", "/forceset/Pectoralis_Major_Posterior/activation", "/forceset/Pectoralis_Clavicle_Head", "/forceset/Biceps_Short_Head", "/forceset/Biceps_Long_Head", "/forceset/Deltoid_Medial", "/forceset/Triceps_Lat_Head", "/forceset/Triceps_Long_Head", "/forceset/Brachialis_Proximal_Head", "/forceset/Brachialis_Distal_Head", "/forceset/Anconeus", "/forceset/Deltoid_Posterior", "/forceset/Anconeus_Short_Head", "/forceset/Subscapularis_SuperiorHead", "/forceset/Infraspinatus", "/forceset/PronatorTeres", "/forceset/FlexorCarpiRadialis", "/forceset/Brachioradialis", "/forceset/Triceps_Medial_Head", "/forceset/Latissimus_Dorsi_Rostral", "/forceset/Latissimus_Dorsi_Caudal", "/forceset/Pectoralis_Major_Anterior", "/forceset/Pectoralis_Major_Posterior"]
111-
kcolnames = ["time","paw_x","paw_y","paw_z","elbow_x","elbow_y","elbow_z"]
112-
113-
def getMu(which_sets):
114-
mu = pd.DataFrame();
115-
for set in which_sets:
116-
for file in glob.glob(base_dir+"reachset_"+str(set)+"/muscle_sol*"):
117-
tdf = pd.read_csv(file, sep= r'\t',engine='python', header=18, names=mcolnames, index_col=None)
118-
mu = pd.concat([mu,tdf], ignore_index=True)
119-
return mu
120-
121-
def getKin(which_sets):
122-
kin = pd.DataFrame();
123-
for set in which_sets:
124-
for file in glob.glob(base_dir+"reachset_"+str(set)+"/muscle_kinematics_*"):
125-
tdf = pd.read_csv(file, sep= r',|\t',engine='python', header=4, names=kcolnames,index_col=None)
126-
kin = pd.concat([kin,tdf], ignore_index=True)
127-
return kin
108+
file = r".\Test Reaches\reachset_1\muscle_solution_adjusted_kinematics_2.sto" # REPLACE WITH YOUR PATH
109+
muscleSolution = pd.read_csv(file, sep= r'\t',engine='python', header=18, names=mcolnames, index_col=None)
110+
```
111+
112+
After this, you can run `print(muscleSolution.columns)` to get a list of your columns. Then, if you would like to plot any of them against time, you can do so like this (this will plot the biceps activations):
128113
```
114+
import matplotlib.pyplot as plt
115+
plt.plot(muscleSolution["time"], muscleSolution["/forceset/Biceps_Long_Head/activation"])
116+
plt.xlabel("Time (s)")
117+
plt.ylabel("Biceps Activation")
118+
plt.show()
119+
```
120+
121+
If you would like to get data on the muscle fiber lengths, you can do so using the `getMuscleLengths.py` script from this github repo. Those will be outputted to additional `.sto` files that you can plot and analyze with python code like above.

0 commit comments

Comments
 (0)