@@ -0,0 +1,1510 @@
+#!/usr/bin/env python%0A%0Afrom __future__ import print_function, division, absolute_import%0Afrom builtins import range%0Aimport argparse%0Aimport logging%0Aimport time%0A%0Aimport katdal%0Afrom katdal.lazy_indexer import DaskLazyIndexer%0Aimport dask.array as da%0Aimport numpy as np%0A%0A%0Aparser = argparse.ArgumentParser()%0Aparser.add_argument('filename')%0Aparser.add_argument('--time', type=int, default=10, help='Number of times to read per batch')%0Aparser.add_argument('--channels', type=int, help='Number of channels to read')%0Aparser.add_argument('--dumps', type=int, help='Number of times to read')%0Aparser.add_argument('--joint', action='store_true', help='Load vis, weights, flags together')%0Aargs = parser.parse_args()%0A%0Alogging.basicConfig(level='INFO', format='%25(asctime)s %5B%25(levelname)s%5D %25(message)s')%0Alogging.info('Starting')%0Af = katdal.open(args.filename)%0Alogging.info('File loaded, shape %25s', f.shape)%0Aif args.channels:%0A    f.select(channels=np.s_%5B:args.channels%5D)%0Aif args.dumps:%0A    f.select(dumps=np.s_%5B:args.dumps%5D)%0Astart = time.time()%0Afor st in range(0, f.shape%5B0%5D, args.time):%0A    et = st + args.time%0A    if args.joint:%0A        vis, weights, flags = DaskLazyIndexer.get(%5Bf.vis, f.weights, f.flags%5D, np.s_%5Bst:et%5D)%0A    else:%0A        vis = f.vis%5Bst:et%5D%0A        weights = f.weights%5Bst:et%5D%0A        flags = f.flags%5Bst:et%5D%0A    logging.info('Loaded %25d dumps', vis.shape%5B0%5D)%0Asize = np.product(f.shape) * 10%0Aelapsed = time.time() - start%0Alogging.info('Loaded %25d bytes in %25.3f s (%25.3f MB/s)', size, elapsed, size / elapsed / 1e6)%0A

Add a tool for benchmarking read performance