Esempio n. 1
0
    if l == "":
        l = "??"
    ch = "%s-%s" % (l,c)
    print "processing '%s'" % file
    print "  reading ...",
    timer.start()
    fh = open(file, 'r')
    lines = fh.readlines()
    fh.close()
    print "done (%f seconds)" % timer.split()
    print "  parsing ...",
    dataless = Dataless(lines, quiet=True)
    dataless.process()
    print "done (%f seconds)" % timer.split()
    print "  calculating ...",
    calib = Calib(dataless, st, ch)
    calib.calculate_calib(period, correct)
    results[key] = calib
    print "done (%f seconds)" % timer.split()
    timer.stop()
    print "took %f seconds" % timer.span()
    print

for resp,calib in sorted(results.items()):
    cor_str = ""
    if correct:
        cor_str = " (corrected)"
    print "[%s]>  CALPER=%f  CALIB=%f%s" % (resp.ljust(19), calib.calper, calib.calib, cor_str)

t_timer.stop()
status,(count,total,done) = ("preparing ...", (-1, -1, False))
while not done:
    progress = ""
    if count > -1:
        if (total > 0) and (count <= total):
            percent = float(count) / float(total) * 100.0
            progress = " - %d/%d (%0.1f%%)" % (count, total, percent)
        else:
            progress = " - %d" % count
    else:
        progress = " ..."

    print "%s%s" % (status, progress)

    status,(count,total,done) = queue.get()

# Print a pretty version of the parsed RESP file
#for resp in resp_list:
#    pprint.pprint(resp.resp_map)

print "All responses ready."

for resp in resp_list:
    calib = Calib(resp)
    calib.calculate_calib(period, False)
    print "[%s]>  CALPER=%f  CALIB=%f" % (resp.get_channel_key(), calib.calper, calib.calib)
    calib.calculate_calib(period, True)
    print "[%s]>  CALPER=%f  CALIB=%f  (Corrected)" % (resp.get_channel_key(), calib.calper, calib.calib)