Commit 8aa97c1c authored by Joanne Hugé's avatar Joanne Hugé

Fix mistakes in parse-saleae-measures script

parent 8b9f44aa
......@@ -7,11 +7,6 @@ def parseLine(l):
(ts, ch0, ch1, *x) = l.split(", ")
#tts = int(float(ts) * 10**9)
#if tts == 413415271100:
# print(ts)
# exit()
ts = int(float(ts) * 10**9)
return (ts, int(ch0), int(ch1))
......@@ -38,9 +33,6 @@ def parsePulses(filename):
prevCh0Ts = ts
if ch1 == 1:
if prevCh1Ts == -1 or (ts - prevCh1Ts) > 9000 * 1000:
#if ts == 413415775140:
# print(prevCh1Ts)
# exit()
ch1Ts.append(ts)
prevCh1Ts = ts
......@@ -57,11 +49,6 @@ def parsePulses(filename):
max_d = max(deltas)
#for i in range(min(len(ch0Ts), len(ch1Ts))):
# if (ch0Ts[i] - ch1Ts[i]) == max_d:
# print((ch0Ts[i], ch1Ts[i]))
# exit()
return deltas
print("IO error")
exit()
......@@ -70,8 +57,22 @@ def parseToggles(filename):
with open(filename, "r") as f:
lines = [l for l in f]
lines = lines[1:]
values = [ line_to_ts(l) for l in lines]
lines = lines[3:]
values = [ parseLine(l) for l in lines]
# If both signals happenned at the same, they get merged at export
# We don't want this, so here we undo this merge
(pt, pc1, pc2) = values[0]
i = 0
while i < len(values):
(t, c1, c2) = values[i]
if c1 != pc1 and c2 != pc2:
values.insert(i, (t, c1, c2))
i += 1
(pt, pc1, pc2) = values[i]
i += 1
values = [ t for (t, *x) in values]
deltas = []
start = 1
......@@ -82,7 +83,7 @@ def parseToggles(filename):
if (i+1) < len(values):
if (values[i] - values[i - 1]) > (values[i + 1] - values[i]):
print("Instruction missed at line {} ?".format(i))
print("Instruction missed around line {} ? ({} - {} > {} - {})".format(i, values[i] / 10**9, values[i - 1] / 10**9, values[i + 1] / 10**9, values[i] / 10**9))
exit()
deltas.append(values[i] - values[i-1])
......@@ -114,8 +115,8 @@ def generateHistogram(deltas):
def parse_args():
parser = argparse
parser = argparse.ArgumentParser(description='Measure analysis')
parser.add_argument('-t', nargs=1, required=False, help='import json measures')
parser.add_argument('-p', nargs=1, required=False, help='import json measures')
parser.add_argument('-t', nargs=1, required=False, help='import shuttle-a20 json measures')
parser.add_argument('-p', nargs=1, required=False, help='import shuttle json measures')
args = parser.parse_args()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment