def findFeature(cat, feat): if cat == "time": return [f for f in tds.posFeatures().keys() if f in feat] if cat == "freq": return [f for f in fds.posFeatures().keys() if f in feat] if cat == "vel": return [f for f in vel.posFeatures().keys() if f in feat] if cat == "peak": return [f for f in ps.posFeatures().keys() if f in feat]
def getAllFeatures(): part = { 'time': { 'cols': tds.posCols(), 'features': tds.posFeatures().keys() }, 'freq': { 'cols': fds.posCols(), 'features': fds.posFeatures().keys() }, 'vel': { 'cols': vs.posCols(), 'features': vs.posFeatures().keys() }, 'peak': { 'cols': ps.posPeaks(), 'features': ps.posFeatures().keys() } } return { 'ankle': part, 'hip': part }
def extractBodyPart(data, bodyPart, requiredFeatures=None): requiredFeatures = checkRequiredFeatures(requiredFeatures, {'time': None, 'freq': None, 'peak': None, 'vel': None}) features = dict() features.update(fds.getSimpleFreqDomainFeatures(data, requiredFeatures['freq'])) features.update(tds.getSimpleTimeDomainFeatures(data, requiredFeatures['time'])) features.update(ps.getSimplePeakFeatures(data, requiredFeatures['peak'])) features.update(vs.getVelocityFeatures(data, requiredFeatures['vel'])) features = dict((bodyPart + '.' + key, features[key]) for key in features.keys()) return features