extractors.utilities

Module: extractors.utilities

Utility functions.

Authors:

Copyright 2015, Sage Bionetworks (http://sagebase.org), Apache v2.0 License

Functions

mhealthx.extractors.utilities.plotxyz(x, y, z, t, title='', limits=[])

Plot each accelerometer axis separately against relative time.

x : list or numpy array of floats y : list or numpy array of floats z : list or numpy array of floats t : list or numpy array of floats

time points

title : string limits : list of floats

>>> from mhealthx.extractors.dead_reckon import velocity_from_acceleration, position_from_velocity
>>> from mhealthx.xio import read_accel_json
>>> #input_file = '/Users/arno/DriveWork/mhealthx/mpower_sample_data/accel_walking_outbound.json.items-6dc4a144-55c3-4e6d-982c-19c7a701ca243282023468470322798.tmp'
>>> input_file = '/Users/arno/DriveWork/mhealthx/mpower_sample_data/deviceMotion_walking_outbound.json.items-5981e0a8-6481-41c8-b589-fa207bfd2ab38771455825726024828.tmp'
>>> #input_file = '/Users/arno/DriveWork/mhealthx/mpower_sample_data/deviceMotion_walking_outbound.json.items-a2ab9333-6d63-4676-977a-08591a5d837f5221783798792869048.tmp'
>>> start = 150
>>> device_motion = True
>>> t, axyz, gxyz, uxyz, rxyz, sample_rate, duration = read_accel_json(input_file, start, device_motion)
>>> ax, ay, az = axyz
>>> vx, vy, vz = velocity_from_acceleration(ax, ay, az, t)
>>> x, y, z, distance = position_from_velocity(vx, vy, vz, t)
>>> plotxyz(x, y, z, t, title='', limits=[])
mhealthx.extractors.utilities.plotxyz3d(x, y, z)

Plot accelerometer readings in 3-D.

x : list or numpy array of floats y : list or numpy array of floats z : list or numpy array of floats