def _test(n): _generate(n, 20, "tmp.1", "here are some data") import time t0 = time.clock() f = open("tmp.1", "r") q = read(f) t1 = time.clock() print "read:", t1 - t0, "seconds\n", q[0:5, 0:5] f.close() t0 = time.clock() f = open("tmp.2", "w") write(f, q) t1 = time.clock() print "write:", t1 - t0, "seconds" # compare with TableIO: try: import TableIO except: sys.exit(0) # exit silently t0 = time.clock() p = TableIO.readTableAsArray("tmp.1", "#") t1 = time.clock() print "TableIO.readTableAsArray:", t1 - t0, "seconds\n", p[0:5, 0:5] t0 = time.clock() TableIO.writeArray("tmp.3", p) t1 = time.clock() print "TableIO.writeArray:", t1 - t0, "seconds"
def data_fsave(arr, outputfile): """ fast, but unprecise way to store arrays to disk arr: array to store outputfile: no return value suitable for integer and short float numbers. """ try: import TableIO except ImportError: data_save(arr,outputfile) else: TableIO.writeArray(outputfile, arr)
def data_fsave(arr, outputfile): """ fast, but unprecise way to store arrays to disk arr: array to store outputfile: no return value suitable for integer and short float numbers. """ try: import TableIO except ImportError: data_save(arr, outputfile) else: TableIO.writeArray(outputfile, arr)