Skip to content

Commit

Permalink
phc2sys, ts2phc missing samples
Browse files Browse the repository at this point in the history
  • Loading branch information
jnunyez committed Oct 27, 2023
1 parent 6e4ba47 commit ac4ba90
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 5 deletions.
9 changes: 7 additions & 2 deletions src/vse_sync_pp/analyzers/analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,13 @@ def _timestamp_from_dec(self, dec):
# relative time
return dec

@staticmethod
def _check_missing_samples(data, result, reason):
if reason is None:
if len(data.timestamp.diff().astype(float).round(0).tail(-1).unique()) > 1:
return (False, "missing test samples")
return result, reason

@property
def result(self):
"""The boolean result from this analyzer's test of the collected data"""
Expand Down Expand Up @@ -260,8 +267,6 @@ def test(self, data):
return (False, "short test duration")
if len(data) - 1 < self._duration_min:
return (False, "short test samples")
if len(data.timestamp.diff().astype(float).round(0).tail(-1).unique()) > 1:
return (False, "missing test samples")
return (True, None)

def explain(self, data):
Expand Down
11 changes: 9 additions & 2 deletions src/vse_sync_pp/analyzers/phc2sys.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,24 @@ class TimeErrorAnalyzer(TimeErrorAnalyzerBase):
id_ = 'phc2sys/time-error'
parser = id_
locked = frozenset({'s2'})


def test(self, data):
return self._check_missing_samples(data, *super().test(data))

class TimeDeviationAnalyzer(TimeDeviationAnalyzerBase):
"""Analyze time deviation"""
id_ = 'phc2sys/time-deviation'
parser = 'phc2sys/time-error'
locked = frozenset({'s2'})


def test(self, data):
return self._check_missing_samples(data, *super().test(data))

class MaxTimeIntervalErrorAnalyzer(MaxTimeIntervalErrorAnalyzerBase):
"""Analyze max time interval error"""
id_ = 'phc2sys/mtie'
parser = 'phc2sys/time-error'
locked = frozenset({'s2'})

def test(self, data):
return self._check_missing_samples(data, *super().test(data))
9 changes: 8 additions & 1 deletion src/vse_sync_pp/analyzers/ts2phc.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,24 @@ class TimeErrorAnalyzer(TimeErrorAnalyzerBase):
id_ = 'ts2phc/time-error'
parser = id_
locked = frozenset({'s2'})


def test(self, data):
return self._check_missing_samples(data, *super().test(data))

class TimeDeviationAnalyzer(TimeDeviationAnalyzerBase):
"""Analyze time deviation"""
id_ = 'ts2phc/time-deviation'
parser = 'ts2phc/time-error'
locked = frozenset({'s2'})

def test(self, data):
return self._check_missing_samples(data, *super().test(data))

class MaxTimeIntervalErrorAnalyzer(MaxTimeIntervalErrorAnalyzerBase):
"""Analyze max time interval error"""
id_ = 'ts2phc/mtie'
parser = 'ts2phc/time-error'
locked = frozenset({'s2'})

def test(self, data):
return self._check_missing_samples(data, *super().test(data))

0 comments on commit ac4ba90

Please sign in to comment.