recover_pk selftests: show curve & hash
[RRG-proxmark3.git] / fpga / tests / plot_edgedetect.py
blob63925bd99374bc5e493cc72bf47d1411de850903
1 #!/usr/bin/env python3
2 #-----------------------------------------------------------------------------
3 # Copyright (C) 2014 iZsh <izsh at fail0verflow.com>
5 # This code is licensed to you under the terms of the GNU GPL, version 2 or,
6 # at your option, any later version. See the LICENSE.txt file for the text of
7 # the license.
8 #-----------------------------------------------------------------------------
10 import sys
11 try:
12 import numpy
13 except ModuleNotFoundError:
14 print("Please install numpy module first.")
15 sys.exit(1)
17 try:
18 import matplotlib.pyplot as plt
19 except ModuleNotFoundError:
20 print("Please install matplotlib module first.")
21 sys.exit(1)
23 if len(sys.argv) != 2:
24 print("Usage: %s <basename>" % sys.argv[0])
25 sys.exit(1)
27 BASENAME = sys.argv[1]
29 nx = numpy.fromfile(BASENAME + ".time")
31 def plot_time(dat1):
32 plt.plot(nx, dat1)
34 sig = bytearray(open(BASENAME + ".filtered", 'rb').read())
35 min_vals = bytearray(open(BASENAME + ".min", 'rb').read())
36 max_vals = bytearray(open(BASENAME + ".max", 'rb').read())
37 states = bytearray(open(BASENAME + ".state", 'rb').read())
38 toggles = bytearray(open(BASENAME+ ".toggle", 'rb').read())
39 high = bytearray(open(BASENAME + ".high", 'rb').read())
40 highz = bytearray(open(BASENAME + ".highz", 'rb').read())
41 lowz = bytearray(open(BASENAME + ".lowz", 'rb').read())
42 low = bytearray(open(BASENAME + ".low", 'rb').read())
44 plot_time(sig)
45 plot_time(min_vals)
46 plot_time(max_vals)
47 plot_time(states)
48 plot_time(toggles)
49 plot_time(high)
50 plot_time(highz)
51 plot_time(lowz)
52 plot_time(low)
54 plt.show()