Esempio n. 1
0
 def test_save(self):
     trace_set = InspectorTraceSet.read("test/data/example.trs")
     with tempfile.TemporaryDirectory() as dirname:
         path = os.path.join(dirname, "out.trs")
         trace_set.write(path)
         self.assertTrue(os.path.exists(path))
         self.assertIsNotNone(InspectorTraceSet.read(path))
Esempio n. 2
0
 def test_large_align(self):
     example = InspectorTraceSet.read("test/data/example.trs")
     result, offsets = align_correlation(*example,
                                         reference_offset=100000,
                                         reference_length=20000,
                                         max_offset=15000)
     self.assertIsNotNone(result)
Esempio n. 3
0
 def test_load_fname(self):
     result = InspectorTraceSet.read("test/data/example.trs")
     self.assertIsNotNone(result)
     self.assertEqual(result.global_title, "Example trace set")
     self.assertEqual(len(result), 10)
     self.assertEqual(len(list(result)), 10)
     self.assertIn("InspectorTraceSet", str(result))
     self.assertIs(result[0].trace_set, result)
     self.assertEqual(result.sampling_frequency, 12500000)
Esempio n. 4
0
def main(profiler, operations, directory):
    traces = InspectorTraceSet.read("test/data/example.trs")
    with Profiler(profiler, directory,
                  f"combine_average_example_{operations}"):
        for _ in range(operations):
            average(*traces)
    with Profiler(profiler, directory,
                  f"combine_condavg_example_{operations}"):
        for _ in range(operations):
            conditional_average(*traces, condition=lambda trace: trace[0] > 0)
    with Profiler(profiler, directory,
                  f"combine_variance_example_{operations}"):
        for _ in range(operations):
            variance(*traces)
    with Profiler(profiler, directory, f"combine_stddev_example_{operations}"):
        for _ in range(operations):
            standard_deviation(*traces)
    with Profiler(profiler, directory, f"combine_add_example_{operations}"):
        for _ in range(operations):
            add(*traces)
    with Profiler(profiler, directory,
                  f"combine_subtract_example_{operations}"):
        for _ in range(operations):
            subtract(traces[0], traces[1])
Esempio n. 5
0
 def test_large_dtw_align(self):
     example = InspectorTraceSet.read("test/data/example.trs")
     result = align_dtw(*example[:5])
     self.assertIsNotNone(result)
Esempio n. 6
0
 def test_load_bytes(self):
     with open("test/data/example.trs", "rb") as f:
         self.assertIsNotNone(InspectorTraceSet.read(f.read()))
Esempio n. 7
0
 def test_create(self):
     self.assertIsNotNone(TraceSet())
     self.assertIsNotNone(InspectorTraceSet())
     self.assertIsNotNone(ChipWhispererTraceSet())
     self.assertIsNotNone(PickleTraceSet())
     self.assertIsNotNone(HDF5TraceSet())