return k, paramsk, mod if __name__ == "__main__": #bs, nc = 256, 128 bs, nc = 1024, 256 model = 'ModelA' ik = 50 ii = 50 ffile = '../../data/bparams-L%04d-N%04d-%s.txt' % (bs, nc, model) header = 'b1, b2, bg, b0, bk \nFit bias upto 0.3\nFit tf upto 1.0' pm = ParticleMesh(BoxSize=bs, Nmesh=[nc, nc, nc]) rank = pm.comm.rank grid = pm.mesh_coordinates() * bs / nc lin = BigFileMesh( '/global/cscratch1/sd/chmodi/m3127/cm_lowres/5stepT-B1/%d-%d-9100/linear' % (bs, nc), 'LinearDensityK').paint() tosave = [] for aa in [0.1429, 0.2000, 0.3333]: zz = 1 / aa - 1 print(aa) dyn = BigFileCatalog( '/global/cscratch1/sd/chmodi/m3127/cm_lowres/5stepT-B1/%d-%d-9100/fastpm_%0.4f/1' % (bs, nc, aa)) hmesh = BigFileMesh( '/global/cscratch1/sd/chmodi/m3127/H1mass/highres/%d-9100/fastpm_%0.4f/HImesh-N%04d/'
if not args.evaluateOnly: #target map if args.target == 'dm': targetmap = load_TNG_map(TNG_basepath=args.TNGDarkpath, snapNum=args.snapNum, field=args.target, pm=pm) else: targetmap = load_TNG_map(TNG_basepath=args.TNGpath, snapNum=args.snapNum, field=args.target, pm=pm) #split among training, validation and test set index = pm.mesh_coordinates() Nmesh_test = int(0.44 * args.Nmesh) Nmesh_validate = args.Nmesh - Nmesh_test select_test = ((index[:, 0] < Nmesh_test) & (index[:, 1] < Nmesh_test) & (index[:, 2] < Nmesh_test)).reshape(targetmap.shape) select_validate = ((index[:, 0] >= Nmesh_test) & (index[:, 1] < Nmesh_validate) & (index[:, 2] < Nmesh_validate)).reshape(targetmap.shape) mask_train = np.ones_like(targetmap, dtype='?') mask_validate = np.zeros_like(targetmap, dtype='?') mask_test = np.zeros_like(targetmap, dtype='?') mask_train[select_test] = False mask_train[select_validate] = False mask_validate[select_validate] = True mask_test[select_test] = True