From e811611f785568cdb447345c3af433e63ea2dbb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jose=20Nu=C3=B1ez?= Date: Tue, 26 Sep 2023 23:09:51 +0200 Subject: [PATCH] more updates reviewer 2 --- src/vse_sync_pp/analyzers/analyzer.py | 30 +++++++++++++++------------ src/vse_sync_pp/analyzers/gnss.py | 16 ++------------ 2 files changed, 19 insertions(+), 27 deletions(-) diff --git a/src/vse_sync_pp/analyzers/analyzer.py b/src/vse_sync_pp/analyzers/analyzer.py index b4d95ea..84fb1fc 100644 --- a/src/vse_sync_pp/analyzers/analyzer.py +++ b/src/vse_sync_pp/analyzers/analyzer.py @@ -296,22 +296,13 @@ def __init__(self, config): self._taus_list = np.concatenate((taus_below_tenkey, taus_above_tenkey)) self._rate = None self._lpf_signal = None - - def prepare(self, rows): - idx = 0 - try: - tstart = rows[0].timestamp + self._transient - except IndexError: - pass - else: - while idx < len(rows): - if tstart <= rows[idx].timestamp: - break - idx += 1 - return super().prepare(rows[idx:]) + # atributtes to be initialized in derived class + self._accuracy = None def calculate_limit(self, tau): # return limit based on `tau` + if self._accuracy is None: + raise AttributeError('atributte not initialized') for (low, high), f in self._accuracy.items(): if ((low is None or tau > low) and (tau <= high)): return f(tau) * (self._limit / 100) @@ -324,6 +315,19 @@ def out_of_range(self, taus, samples): return True return False + def prepare(self, rows): + idx = 0 + try: + tstart = rows[0].timestamp + self._transient + except IndexError: + pass + else: + while idx < len(rows): + if tstart <= rows[idx].timestamp: + break + idx += 1 + return super().prepare(rows[idx:]) + def calculate_filter(self, input_signal): """Calculate digital low-pass filter from `input_signal` diff --git a/src/vse_sync_pp/analyzers/gnss.py b/src/vse_sync_pp/analyzers/gnss.py index 642e026..7bc597d 100644 --- a/src/vse_sync_pp/analyzers/gnss.py +++ b/src/vse_sync_pp/analyzers/gnss.py @@ -25,13 +25,7 @@ class TimeDeviationAnalyzer(TimeDeviationAnalyzerBase): """Analyze time deviation""" id_ = 'gnss/time-deviation' parser = 'gnss/time-error' - # 'state' values are assumed to be u-blox gpsFix values - # 0 = no fix - # 1 = dead reckoning only - # 2 = 2D-Fix - # 3 = 3D-Fix - # 4 = GPS + dead reckoning combined - # 5 = time only fix + # see 'state' values in `TimeErrorAnalyzer` comments locked = frozenset({3, 4, 5}) @@ -39,11 +33,5 @@ class MaxTimeIntervalErrorAnalyzer(MaxTimeIntervalErrorAnalyzerBase): """Analyze time deviation""" id_ = 'gnss/mtie' parser = 'gnss/time-error' - # 'state' values are assumed to be u-blox gpsFix values - # 0 = no fix - # 1 = dead reckoning only - # 2 = 2D-Fix - # 3 = 3D-Fix - # 4 = GPS + dead reckoning combined - # 5 = time only fix + # see 'state' values in `TimeErrorAnalyzer` comments locked = frozenset({3, 4, 5})