import numpy as np def read_nohead(path): with open(path) as file: return file.read() def read_reshape(path, shape): return np.asarray(read_nohead(path).split(), dtype=np.float64).reshape( shape ) def read_nohead_scalar(path, n): return read_reshape(path, (-1, n)) def read_nohead_k(path, n, k): return read_reshape(path, (-1, n, k)) def read_nohead_vect(path, n): return read_reshape(path, (-1, 2, n)) def read_nohead_vect_k(path, n): return read_reshape(path, (-1, 2, n, k))