import tablesimport numpy as npfilename = 'dist.dat'ROW_SIZE = 100NUM_COLUMNS = 200f = tables.open_file(filename, mode='w')atom = tables.Float64Atom()array_c = f.create_earray(f.root, 'data', atom, (0, ROW_SIZE))for idx in range(NUM_COLUMNS):x = np.random.rand(1, ROW_SIZE)array_c.append(x)f.close()f = tables.open_file(filename, mode='a')f.root.data.append(x)f = tables.open_file(filename, mode='r')print(f.root.data[1:10,2:20])from pathlib import Pathimport numpy as npimport osp = Path('temp.npy')with p.open('ab') as f:np.save(f, np.zeros(2))np.save(f, np.ones(2))with p.open('rb') as f:fsz = os.fstat(f.fileno()).st_sizeout = np.load(f)while f.tell() < fsz:out = np.vstack((out, np.load(f)))import numpy as npimport numpy.lib.format as fmtdef get_header(fnames):dtype = Noneshape_0 = 0shape_1 = Nonefor i, fname in enumerate(fnames):m = np.load(fname, mmap_mode='r')if i == 0:dtype = m.dtypeshape_1 = m.shape[1]else:assert m.dtype == dtypeassert m.shape[1] == shape_1shape_0 += m.shape[0]return {'descr': fmt.dtype_to_descr(dtype), 'fortran_order': False, 'shape':(shape_0, shape_1)}