graph_accelerometer: Support axis-level comparison of adxl345 data

Signed-off-by: Dmitry Butyugin <dmbutyugin@google.com>
This commit is contained in:
Dmitry Butyugin 2021-03-14 14:58:29 +01:00 committed by KevinOConnor
parent b6908e56aa
commit 2d8945dc1c
2 changed files with 8 additions and 3 deletions

View file

@ -139,6 +139,8 @@ class CalibrationData:
self.psd_y = psd_y
self.psd_z = psd_z
self._psd_list = [self.psd_sum, self.psd_x, self.psd_y, self.psd_z]
self._psd_map = {'x': self.psd_x, 'y': self.psd_y, 'z': self.psd_z,
'all': self.psd_sum}
self.data_sets = 1
def join(self, other):
np = self.numpy
@ -159,6 +161,8 @@ class CalibrationData:
psd /= self.freq_bins + .1
# Remove low-frequency noise
psd[self.freq_bins < MIN_FREQ] = 0.
def get_psd(self, axis='all'):
return self._psd_map[axis]
CalibrationResult = collections.namedtuple(