Getting started with the analysis of nvg data

This notebook assumes that data exists in a database in the hdf5 format. For instructions how to set up the database with data see [../readme.md].

Import modules


In [1]:
import numpy as np
import matplotlib.pyplot as plt
import nvg.ximu.ximudata as ximudata
%matplotlib notebook

Load the database


In [2]:
reload(ximudata)
dbfilename = "/home/kjartan/Dropbox/Public/nvg201209.hdf5"
db = ximudata.NVGData(dbfilename);

Explore contents of the database file


In [3]:
dbfile = db.hdfFile;
print "Subjects: ",  dbfile.keys()
print "Trials: ", dbfile['S5'].keys()
print "IMUs: ", dbfile['S5/B'].keys()
print "Attributes of example trial", dbfile['S5/B'].attrs.keys()
print "Shape of example IMU data entry", dbfile['S5/B/N'].shape


Subjects:  [u'S10', u'S11', u'S12', u'S2', u'S3', u'S4', u'S5', u'S6', u'S7', u'S8', u'S9']
Trials:  [u'B', u'D', u'M', u'N']
IMUs:  [u'B', u'LA', u'LH', u'LT', u'N', u'RA', u'RH', u'RT']
Attributes of example trial [u'PNAtICLA', u'PNAtICRA', u'PNAtCycleEvents', u'cycleFrequency', u'verticalDisplacement']
Shape of example IMU data entry (87243, 10)

The content of the raw IMU file

The columns of the IMU data contain: 0: Packet number, 1: Gyroscope X (deg/s), 2: Gyroscope Y (deg/s), 3: Gyroscope Z (deg/s), 4: Accelerometer X (g), 5: Accelerometer Y (g), 6: Accelerometer Z (g), 7: Magnetometer X (G), 8: Magnetometer Y (G), 9: Magnetometer Z (G)

Plot example data


In [4]:
db.plot_imu_data()


Out[4]:
<HDF5 dataset "N": shape (87250, 10), type "<f8">

Implemented analysis methods


In [7]:
print [s for s in dir(db) if s.startswith("get")]


['get_PN_at_sync', 'get_ROM_joint_angle', 'get_RoM_angle_to_vertical', 'get_angle_between_segments', 'get_angle_to_vertical', 'get_cycle_data', 'get_cycle_frequency', 'get_imu_data', 'get_minmax_angle_to_vertical', 'get_minmax_joint_angle', 'get_orientation', 'get_range_of_motion', 'get_trial_attribute', 'get_vertical_displacement']

In [ ]: