Skip to content

Commit

Permalink
update MTIE, TDEV analyzer results for plotting
Browse files Browse the repository at this point in the history
  • Loading branch information
jnunyez committed Oct 5, 2023
1 parent 680ea98 commit 6f65d7e
Show file tree
Hide file tree
Showing 6 changed files with 129 additions and 54 deletions.
4 changes: 4 additions & 0 deletions src/vse_sync_pp/analyzers/analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,8 @@ def explain(self, data):
'timestamp': self._timestamp_from_dec(data.iloc[0].timestamp),
'duration': data.iloc[-1].timestamp - data.iloc[0].timestamp,
'tdev': self._statistics(self._samples, 'ns'),
'tdev_taus': self._taus.tolist(),
'tdev_samples': self._samples.tolist(),
}
return analysis

Expand Down Expand Up @@ -473,5 +475,7 @@ def explain(self, data):
'timestamp': self._timestamp_from_dec(data.iloc[0].timestamp),
'duration': data.iloc[-1].timestamp - data.iloc[0].timestamp,
'mtie': self._statistics(self._samples, 'ns'),
'mtie_taus': self._taus.tolist(),
'mtie_samples': self._samples.tolist(),
}
return analysis
7 changes: 6 additions & 1 deletion src/vse_sync_pp/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import json
from decimal import Decimal
import numpy


def open_input(filename, encoding='utf-8', **kwargs):
Expand All @@ -20,11 +21,15 @@ def open_input(filename, encoding='utf-8', **kwargs):


class JsonEncoder(json.JSONEncoder):
"""A JSON encoder accepting :class:`Decimal` values"""
"""A JSON encoder accepting :class:`Decimal` values
and arrays `numpy.ndarray` values
"""
def default(self, o):
"""Return a commonly serializable value from `o`"""
if isinstance(o, Decimal):
return float(o)
if isinstance(o, numpy.ndarray):
return o.tolist()
return super().default(o)


Expand Down
16 changes: 16 additions & 0 deletions tests/vse_sync_pp/analyzers/test_gnss.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,8 @@ class TestMaxTimeIntervalErrorAnalyzer(TestCase, metaclass=AnalyzerTestBuilder):
'stddev': 0,
'variance': 0,
},
'mtie_samples': [0.],
'mtie_taus': [1.],
},
},
{
Expand Down Expand Up @@ -357,6 +359,8 @@ class TestMaxTimeIntervalErrorAnalyzer(TestCase, metaclass=AnalyzerTestBuilder):
'stddev': 0,
'variance': 0,
},
'mtie_samples': [0.],
'mtie_taus': [1.],
},
},
{
Expand Down Expand Up @@ -396,6 +400,8 @@ class TestMaxTimeIntervalErrorAnalyzer(TestCase, metaclass=AnalyzerTestBuilder):
'stddev': 0,
'variance': 0,
},
'mtie_samples': [0.],
'mtie_taus': [1.],
},
},
{
Expand Down Expand Up @@ -435,6 +441,8 @@ class TestMaxTimeIntervalErrorAnalyzer(TestCase, metaclass=AnalyzerTestBuilder):
'stddev': 0,
'variance': 0,
},
'mtie_samples': [0.],
'mtie_taus': [1.],
},
},
)
Expand Down Expand Up @@ -526,6 +534,8 @@ class TestTimeDeviationAnalyzer(TestCase, metaclass=AnalyzerTestBuilder):
'stddev': 0,
'variance': 0,
},
'tdev_samples': [0.],
'tdev_taus': [1.],
},
},
{
Expand Down Expand Up @@ -573,6 +583,8 @@ class TestTimeDeviationAnalyzer(TestCase, metaclass=AnalyzerTestBuilder):
'stddev': 0,
'variance': 0,
},
'tdev_samples': [0.],
'tdev_taus': [1.],
},
},
{
Expand Down Expand Up @@ -620,6 +632,8 @@ class TestTimeDeviationAnalyzer(TestCase, metaclass=AnalyzerTestBuilder):
'stddev': 0,
'variance': 0,
},
'tdev_samples': [0.],
'tdev_taus': [1.],
},
},
{
Expand Down Expand Up @@ -667,6 +681,8 @@ class TestTimeDeviationAnalyzer(TestCase, metaclass=AnalyzerTestBuilder):
'stddev': 0,
'variance': 0,
},
'tdev_samples': [0.],
'tdev_taus': [1.],
},
},
)
16 changes: 16 additions & 0 deletions tests/vse_sync_pp/analyzers/test_phc2sys.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,8 @@ class TestMaxTimeIntervalErrorAnalyzer(TestCase, metaclass=AnalyzerTestBuilder):
'stddev': 0,
'variance': 0,
},
'mtie_samples': [0.],
'mtie_taus': [1.],
},
},
{
Expand Down Expand Up @@ -336,6 +338,8 @@ class TestMaxTimeIntervalErrorAnalyzer(TestCase, metaclass=AnalyzerTestBuilder):
'stddev': 0,
'variance': 0,
},
'mtie_samples': [0.],
'mtie_taus': [1.],
},
},
{
Expand Down Expand Up @@ -375,6 +379,8 @@ class TestMaxTimeIntervalErrorAnalyzer(TestCase, metaclass=AnalyzerTestBuilder):
'stddev': 0,
'variance': 0,
},
'mtie_samples': [0.],
'mtie_taus': [1.],
},
},
{
Expand Down Expand Up @@ -414,6 +420,8 @@ class TestMaxTimeIntervalErrorAnalyzer(TestCase, metaclass=AnalyzerTestBuilder):
'stddev': 0,
'variance': 0,
},
'mtie_samples': [0.],
'mtie_taus': [1.],
},
},
)
Expand Down Expand Up @@ -505,6 +513,8 @@ class TestTimeDeviationAnalyzer(TestCase, metaclass=AnalyzerTestBuilder):
'stddev': 0,
'variance': 0,
},
'tdev_samples': [0.],
'tdev_taus': [1.],
},
},
{
Expand Down Expand Up @@ -552,6 +562,8 @@ class TestTimeDeviationAnalyzer(TestCase, metaclass=AnalyzerTestBuilder):
'stddev': 0,
'variance': 0,
},
'tdev_samples': [0.],
'tdev_taus': [1.],
},
},
{
Expand Down Expand Up @@ -599,6 +611,8 @@ class TestTimeDeviationAnalyzer(TestCase, metaclass=AnalyzerTestBuilder):
'stddev': 0,
'variance': 0,
},
'tdev_samples': [0.],
'tdev_taus': [1.],
},
},
{
Expand Down Expand Up @@ -646,6 +660,8 @@ class TestTimeDeviationAnalyzer(TestCase, metaclass=AnalyzerTestBuilder):
'stddev': 0,
'variance': 0,
},
'tdev_samples': [0.],
'tdev_taus': [1.],
},
},
)
Loading

0 comments on commit 6f65d7e

Please sign in to comment.