Fixed issue where -1 size_t was returned
[legacy-proxmark3.git] / fpga / tests / plot_edgedetect.py
blob4e244ebc3740dbff9d399b38c53c8f30522dc0d8
1 #!/usr/bin/env python
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 #-----------------------------------------------------------------------------
9 import numpy
10 import matplotlib.pyplot as plt
11 import sys
13 if len(sys.argv) != 2:
14 print "Usage: %s <basename>" % sys.argv[0]
15 sys.exit(1)
17 BASENAME = sys.argv[1]
19 nx = numpy.fromfile(BASENAME + ".time")
21 def plot_time(dat1):
22 plt.plot(nx, dat1)
24 sig = open(BASENAME + ".filtered").read()
25 sig = map(lambda x: ord(x), sig)
27 min_vals = open(BASENAME + ".min").read()
28 min_vals = map(lambda x: ord(x), min_vals)
30 max_vals = open(BASENAME + ".max").read()
31 max_vals = map(lambda x: ord(x), max_vals)
33 states = open(BASENAME + ".state").read()
34 states = map(lambda x: ord(x) * 10 + 65, states)
36 toggles = open(BASENAME+ ".toggle").read()
37 toggles = map(lambda x: ord(x) * 10 + 80, toggles)
39 high = open(BASENAME + ".high").read()
40 high = map(lambda x: ord(x), high)
41 highz = open(BASENAME + ".highz").read()
42 highz = map(lambda x: ord(x), highz)
43 lowz = open(BASENAME + ".lowz").read()
44 lowz = map(lambda x: ord(x), lowz)
45 low = open(BASENAME + ".low").read()
46 low = map(lambda x: ord(x), low)
48 plot_time(sig)
49 plot_time(min_vals)
50 plot_time(max_vals)
51 plot_time(states)
52 plot_time(toggles)
53 plot_time(high)
54 plot_time(highz)
55 plot_time(lowz)
56 plot_time(low)
58 plt.show()