extractors.tapping

Module: extractors.tapping

Inheritance diagram for mhealthx.extractors.tapping:

This program implements some touch screen tapping feature extraction methods.

Elias’s R code translated by Arno to Python.

Authors:

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

Class

TapFeatures

class mhealthx.extractors.tapping.TapFeatures

Class to add tap features.

__init__()

Initialize attributes of object:

Functions

mhealthx.extractors.tapping.compute_drift(x, y)

Compute drift.

x : numpy array of floats y : numpy array of floats

drift : float

>>> import numpy as np
>>> from mhealthx.extractors.tapping import compute_drift
>>> x = np.random.random(100)
>>> y = np.random.random(100)
>>> drift = compute_drift(x, y)
mhealthx.extractors.tapping.compute_intertap_gap(intervals)

Difference between fastest and slowest intertap intervals.

intervals : list or array of floats
intertap intervals (s)
delta10 : float
difference between mean slowest 10 percent and mean fastest 10 percent
delta25 : float
difference between mean slowest 25 percent and mean fastest 25 percent
delta50 : float
difference between mean slowest 50 percent and mean fastest 50 percent
>>> import numpy as np
>>> from mhealthx.extractors.tapping import compute_intertap_gap
>>> intervals = np.random.random(100)
>>> delta10, delta25, delta50 = compute_intertap_gap(intervals)
mhealthx.extractors.tapping.compute_tap_features(xtaps, ytaps, t, threshold=20)

Elias Chaibub-Neto’s tapping feature extraction methods.

Arno translated Elias’s R code to Python.

xtaps : numpy array of integers
x coordinates of touch screen where tapped
ytaps : numpy array of integers
y coordinates of touch screen where tapped
t : numpy array of floats
time points of taps
threshold : integer
x offset threshold for left/right press event (pixels)
T : class
many features stored in TapFeatures class
>>> import numpy as np
>>> from mhealthx.extractors.tapping import compute_tap_features
>>> xtaps = np.round(200 * np.random.random(100))
>>> ytaps = np.round(300 * np.random.random(100))
>>> t = np.linspace(1, 100, 100) / 5.0
>>> threshold = 20
>>> T = compute_tap_features(xtaps, ytaps, t, threshold)
mhealthx.extractors.tapping.compute_tap_intervals(xtaps, t, threshold=20)

Compute tapping time series (tapping interval and tapping position).

xtaps : numpy array of floats
x coordinates of touch screen where tapped
t : numpy array of floats
time points of taps
threshold : integer
x offset threshold for left/right press event (pixels)
ipress : numpy array of integers
indices of taps above threshold pixels from mean x coordinate
tap_intervals : numpy array of floats
time intervals between taps (above threshold from mean x coordinate)
>>> from mhealthx.extractors.tapping import compute_tap_intervals
>>> xtaps = [10,  20, 50, 80, 110]
>>> t = [1.1, 2.3, 3.4, 6.7, 9.0]
>>> threshold = 20
>>> ipress, tap_intervals = compute_tap_intervals(xtaps, t, threshold)