| """Minimal haptic signal feature extractor.""" | |
| class MotokoHapticFeatureExtractor: | |
| def __init__(self, mean=None, std=None): | |
| self.mean = mean or [0.0] * 6 | |
| self.std = std or [1.0] * 6 | |
| def __call__(self, samples): | |
| return self.normalize(samples) | |
| def normalize(self, samples): | |
| return [ | |
| [ | |
| (value - self.mean[channel]) / self.std[channel] | |
| for channel, value in enumerate(frame) | |
| ] | |
| for frame in samples | |
| ] | |