def createFile(finalSize=2000000000):
 chunk = np.random.normal(size=1000000).astype(np.float32)
 f = h5py.File('test.hdf5', 'w')
 f.create_dataset('data', data=chunk, chunks=True, maxshape=(None,))
 data = f['data']
 nChunks = (finalSize // (chunk.size * chunk.itemsize))
 with pg.ProgressDialog('Generating test.hdf5...', 0, nChunks) as dlg:
  for i in range(nChunks):
   newshape = [(data.shape[0] + chunk.shape[0])]
   data.resize(newshape)
   data[(- chunk.shape[0]):] = chunk
   dlg += 1
   if dlg.wasCanceled():
    f.close()
    os.remove('test.hdf5')
    sys.exit()
  dlg += 1
 f.close()

def createFile ( finalSize = 2000000000 ) : chunk = np . random . normal ( size = 1000000 ) . astype ( np . float32 ) f = h5py . File ( 'test.hdf5' , 'w' ) f . create_dataset ( 'data' , data = chunk , chunks = True , maxshape = ( None , ) ) data = f [ 'data' ] nChunks = ( finalSize // ( chunk . size * chunk . itemsize ) ) with pg . ProgressDialog ( 'Generating test.hdf5...' , 0 , nChunks ) as dlg : for i in range ( nChunks ) : newshape = [ ( data . shape [ 0 ] + chunk . shape [ 0 ] ) ] data . resize ( newshape ) data [ ( - chunk . shape [ 0 ] ) : ] = chunk dlg += 1 if dlg . wasCanceled ( ) : f . close ( ) os . remove ( 'test.hdf5' ) sys . exit ( ) dlg += 1 f . close ( )
create a large hdf5 data file for testing .