Skip to content

Commit

Permalink
add failure missing test samples
Browse files Browse the repository at this point in the history
  • Loading branch information
jnunyez committed Oct 27, 2023
1 parent c64b213 commit 15791e8
Show file tree
Hide file tree
Showing 7 changed files with 153 additions and 3 deletions.
9 changes: 9 additions & 0 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 @@ -379,6 +386,8 @@ def _test_common(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 None

def _explain_common(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))
32 changes: 32 additions & 0 deletions tests/vse_sync_pp/analyzers/test_gnss.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,38 @@ class TestTimeErrorAnalyzer(TestCase, metaclass=AnalyzerTestBuilder):
},
},
},
{
'requirements': 'G.8272/PRTC-A',
'parameters': {
'time-error-limit/%': 100,
'transient-period/s': 1,
'min-test-duration/s': 4,
},
'rows': (
TERR(Decimal(0), 0, 5),
TERR(Decimal(1), 0, 5),
TERR(Decimal(2), 0, 5),
TERR(Decimal(3), 0, 5),
# oops, missing sample
TERR(Decimal(5), 0, 5),
TERR(Decimal(6), 0, 5),
),
'result': False,
'reason': "missing test samples",
'timestamp': Decimal(1),
'duration': Decimal(5),
'analysis': {
'terror': {
'units': 'ns',
'min': 0,
'max': 0,
'range': 0,
'mean': 0,
'stddev': 0,
'variance': 0,
},
},
},
{
'requirements': 'G.8272/PRTC-A',
'parameters': {
Expand Down
32 changes: 32 additions & 0 deletions tests/vse_sync_pp/analyzers/test_phc2sys.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,38 @@ class TestTimeErrorAnalyzer(TestCase, metaclass=AnalyzerTestBuilder):
},
},
},
{
'requirements': 'workload/RAN',
'parameters': {
'time-error-limit/%': 100,
'transient-period/s': 1,
'min-test-duration/s': 4,
},
'rows': (
TERR(Decimal(0), 0, 's2', 620),
TERR(Decimal(1), 0, 's2', 620),
TERR(Decimal(2), 0, 's2', 620),
TERR(Decimal(3), 0, 's2', 620),
# oops, missing sample
TERR(Decimal(5), 0, 's2', 620),
TERR(Decimal(6), 0, 's2', 620),
),
'result': False,
'reason': "missing test samples",
'timestamp': Decimal(1),
'duration': Decimal(5),
'analysis': {
'terror': {
'units': 'ns',
'min': 0,
'max': 0,
'range': 0,
'mean': 0,
'stddev': 0,
'variance': 0,
},
},
},
{
'requirements': 'workload/RAN',
'parameters': {
Expand Down
31 changes: 31 additions & 0 deletions tests/vse_sync_pp/analyzers/test_ppsdpll.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,37 @@ class TestTimeErrorAnalyzer(TestCase, metaclass=AnalyzerTestBuilder):
},
},
},
{
'requirements': 'G.8272/PRTC-B',
'parameters': {
'time-error-limit/%': 100,
'transient-period/s': 1,
'min-test-duration/s': 3,
},
'rows': (
DPLLS(Decimal('1876878.28'), 3, 3, Decimal(1)),
DPLLS(Decimal('1876879.28'), 3, 3, Decimal(1)),
# oops, lost sample
DPLLS(Decimal('1876881.28'), 3, 3, Decimal(1)),
DPLLS(Decimal('1876882.28'), 3, 3, Decimal(1)),
DPLLS(Decimal('1876883.28'), 3, 3, Decimal(1)),
),
'result': False,
'reason': "missing test samples",
'timestamp': Decimal('1876879.28'),
'duration': Decimal(4),
'analysis': {
'terror': {
'units': 'ns',
'min': 1,
'max': 1,
'range': 0,
'mean': 1,
'stddev': 0,
'variance': 0,
},
},
},
{
'requirements': 'G.8272/PRTC-B',
'parameters': {
Expand Down
32 changes: 32 additions & 0 deletions tests/vse_sync_pp/analyzers/test_ts2phc.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,38 @@ class TestTimeErrorAnalyzer(TestCase, metaclass=AnalyzerTestBuilder):
},
},
},
{
'requirements': 'G.8272/PRTC-A',
'parameters': {
'time-error-limit/%': 100,
'transient-period/s': 1,
'min-test-duration/s': 4,
},
'rows': (
TERR(Decimal(0), 0, 's2'),
TERR(Decimal(1), 0, 's2'),
TERR(Decimal(2), 0, 's2'),
TERR(Decimal(3), 0, 's2'),
# oops, missing sample
TERR(Decimal(5), 0, 's2'),
TERR(Decimal(6), 0, 's2'),
),
'result': False,
'reason': "missing test samples",
'timestamp': Decimal(1),
'duration': Decimal(5),
'analysis': {
'terror': {
'units': 'ns',
'min': 0,
'max': 0,
'range': 0,
'mean': 0,
'stddev': 0,
'variance': 0,
},
},
},
{
'requirements': 'G.8272/PRTC-A',
'parameters': {
Expand Down

0 comments on commit 15791e8

Please sign in to comment.