Exemplo n.º 1
0
def main():
  print json.dumps(log_parser.parseLog("hello.js"), indent=2)
  print json.dumps(log_parser.parseLog(os.path.join(testfixtures_dir, "test_notestresults.htm")), indent=2)
  print json.dumps(log_parser.parseLog(os.path.join(testfixtures_dir, "test_onetestresult.htm")), indent=2)
  print json.dumps(log_parser.parseLog(os.path.join(testfixtures_dir, "test_nobuildid.htm")), indent=2)
  print json.dumps(log_parser.parseLog(os.path.join(testfixtures_dir, "test_twobuildids.htm")), indent=2)
  print json.dumps(log_parser.parseLog(os.path.join(testfixtures_dir, "testbuild1.htm")), indent=2)
  print json.dumps(log_parser.parseLog(os.path.join(testfixtures_dir, "testbuild2.htm")), indent=2)
  print json.dumps(log_parser.parseLog(os.path.join(testfixtures_dir, "testbuild3.htm")), indent=2)
  print json.dumps(log_parser.parseLog(os.path.join(testfixtures_dir, "testbuild4.htm")), indent=2)
  print json.dumps(log_parser.parseLog(os.path.join(testfixtures_dir, "testbuild5.htm")), indent=2)
start_time = datetime.datetime.strptime(args.start, "%Y-%m-%d %H:%M:%S")
end_time = datetime.datetime.strptime(args.end, "%Y-%m-%d %H:%M:%S")
device_filter = args.device
show_events = args.event

filter_data = args.filterdata
filter_fn = None
if args.filter:
    if args.filter in filter_table:
        filter_fn = filter_table[args.filter]
    else:
        print "Can find filter function '{}'!".format(args.filter)


# Import/parse
rssi_log = parseLog(input_name, device_filter=device_filter, start_time=start_time, end_time=end_time)

# Show raw RSSI values
print "Plotting..."
fig = plt.figure()
plt.xlabel("Time")
plt.ylabel("RSS [dBm]")

for address in rssi_log["addresses"]:
    plt.plot(rssi_log[address]["timestamp"][::skip], rssi_log[address]["rssi"][::skip], ".", alpha=0.5)
    plt.hold(True)
    print "{} median: {}, mean: {} dBm, variance: {} dB^2.".format(
        address,
        numpy.median(rssi_log[address]["rssi"]),
        numpy.mean(rssi_log[address]["rssi"]),
        numpy.var(rssi_log[address]["rssi"]),
Exemplo n.º 3
0
start_time = datetime.datetime.strptime(args.start, "%Y-%m-%d %H:%M:%S")
end_time = datetime.datetime.strptime(args.end, "%Y-%m-%d %H:%M:%S")
device_filter = args.device
show_events = args.event

filter_data = args.filterdata
filter_fn = None
if args.filter:
    if args.filter in filter_table:
        filter_fn = filter_table[args.filter]
    else:
        print "Can find filter function '{}'!".format(args.filter)


# Import/parse
rssi_log = parseLog(input_name, device_filter=device_filter, start_time=start_time, end_time=end_time)

# Show raw RSSI values
print "Plotting..."
fig = plt.figure()
plt.xlabel("Time")
plt.ylabel("RSS [dBm]")

for address in rssi_log["addresses"]:
    plt.plot(rssi_log[address]["timestamp"][::skip], rssi_log[address]["rssi"][::skip], ".", alpha=0.5)
    plt.hold(True)
    print '{} median: {}, mean: {} dBm, variance: {} dB^2.'.format(address, numpy.median(rssi_log[address]["rssi"]), numpy.mean(rssi_log[address]["rssi"]), numpy.var(rssi_log[address]["rssi"]))
plt.grid()
plt.legend(rssi_log["addresses"])
ax = plt.gca()
ax.xaxis.set_major_formatter(pltdates.DateFormatter("%H:%M:%S"))