extractors.dead_reckon¶
Module: extractors.dead_reckon
¶
Attempt dead reckoning (estimating position) from accelerometer data.
- Authors:
- Arno Klein, 2015 (arno@sagebase.org) http://binarybottle.com
Copyright 2015, Sage Bionetworks (http://sagebase.org), Apache v2.0 License
Functions¶
-
mhealthx.extractors.dead_reckon.
dead_reckon
(ax, ay, az, t)¶ ttempt dead reckoning (estimating position) from accelerometer data.
- ax : list or numpy array of floats
- accelerometer x-axis data
- ay : list or numpy array of floats
- accelerometer y-axis data
- az : list or numpy array of floats
- accelerometer z-axis data
- t : list or numpy array of floats
- accelerometer time points
- x : list or numpy array of floats
- estimated position along x-axis
- y : list or numpy array of floats
- estimated position along y-axis
- z : list or numpy array of floats
- estimated position along z-axis
- distance : float
- estimated change in position
>>> from mhealthx.extractors.dead_reckon import dead_reckon >>> 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' >>> 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 >>> x, y, z, distance = dead_reckon(ax, ay, az, t)
-
mhealthx.extractors.dead_reckon.
position_from_velocity
(vx, vy, vz, t)¶ Estimate position from velocity.
- vx : list or numpy array of floats
- estimated velocity along x-axis
- vy : list or numpy array of floats
- estimated velocity along y-axis
- vz : list or numpy array of floats
- estimated velocity along z-axis
- t : list or numpy array of floats
- accelerometer time points
- x : list or numpy array of floats
- estimated position along x-axis
- y : list or numpy array of floats
- estimated position along y-axis
- z : list or numpy array of floats
- estimated position along z-axis
- distance : float
- estimated change in position
>>> 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)
-
mhealthx.extractors.dead_reckon.
velocity_from_acceleration
(ax, ay, az, t)¶ Estimate velocity from accelerometer readings.
- ax : list or numpy array of floats
- accelerometer x-axis data
- ay : list or numpy array of floats
- accelerometer y-axis data
- az : list or numpy array of floats
- accelerometer z-axis data
- t : list or numpy array of floats
- accelerometer time points
- vx : list or numpy array of floats
- estimated velocity along x-axis
- vy : list or numpy array of floats
- estimated velocity along y-axis
- vz : list or numpy array of floats
- estimated velocity along z-axis
>>> from mhealthx.extractors.dead_reckon import velocity_from_acceleration >>> 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)