Skip to content

Commit

Permalink
more updates reviewer 2
Browse files Browse the repository at this point in the history
  • Loading branch information
jnunyez committed Sep 26, 2023
1 parent a3d0b8f commit e811611
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 27 deletions.
30 changes: 17 additions & 13 deletions src/vse_sync_pp/analyzers/analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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`
Expand Down
16 changes: 2 additions & 14 deletions src/vse_sync_pp/analyzers/gnss.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,25 +25,13 @@ 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})


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})

0 comments on commit e811611

Please sign in to comment.