Skip to content

Instantly share code, notes, and snippets.

@keithshep
Created March 5, 2019 14:32
Show Gist options
  • Save keithshep/8978f57a66d8192fc48da10ee80e9d70 to your computer and use it in GitHub Desktop.
Save keithshep/8978f57a66d8192fc48da10ee80e9d70 to your computer and use it in GitHub Desktop.
h5py examples for mandy
# first open the file in read/write mode
with h5py.File('/path/to/file.h5', 'r+') as gait_h5:
# loop through all the videos. Here we assume current video is:
# LL1-B2B/2018-08-22_SPD/LL1-2_003890-F-AX11-5.28571428571429-43291-2-K1808155.avi
# ... somehow get your residual values into a numpy array for current video. This has to be
# done for all variables you're correcting for. Here using step_width as an example.
step_width_resid = np.array(...)
# now you need to create a dataset from the array for the relavent video (note the '%2F' escaping of '/')
gait_h5.create_dataset(
'LL1-B2B%2F2018-08-22_SPD%2FLL1-2_003890-F-AX11-5.28571428571429-43291-2-K1808155.avi/all_strides/step_width_resid',
data=step_width_resid)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment