import numpy as np import features as ft import datalib import diagnostic as dg import re, os, h5py, json from functools import partial from nbodykit.source.catalog import BigFileCatalog from nbodykit.lab import cosmology, HaloCatalog, Zheng07Model from pmesh.pm import ParticleMesh import sys sys.path.append('/global/homes/c/chmodi/Programs/cosmo4d/cosmo4d/') import mymass_function as MF pfile = "/global/homes/c/chmodi/Data/ics_matterpow_0.dat" mf = MF.Mass_Func(pfile, 0.3175) #proj = '/project/projectdirs/cosmosim/lbl/chmodi/cosmo4d/' #proj = '/global/cscratch1/sd/chmodi/cosmo4d/' proj = '/project/projectdirs/astro250/chmodi/cosmo4d/' def relu(x): xx = x.copy() mask = x > 0 xx[~mask] = 0 return xx def elu(x, alpha=1): xx = x.copy() mask = x > 0 xx[~mask] = alpha * (np.exp(x[~mask]) - 1)
sys.path.append('/global/homes/c/chmodi/Programs/cosmo4d/cosmo4d/') sys.path.append('/global/homes/c/chmodi/Programs/cosmo4d/train_nets') import features as ft import datalib as lib import datatools as dtools import nettools as ntools import sigtools as stools import diagnostic as dg scratch = '/global/cscratch1/sd/chmodi/cosmo4d/' train = scratch + 'train/' data = scratch + 'data/' pfile = "/global/homes/c/chmodi/Data/ics_matterpow_0.dat" klin, plin = np.loadtxt(pfile, unpack=True) mf = mass_function.Mass_Func(pfile, 0.3175) from cosmo4d import report as dgrep import yaml ######## with open(scratch + 'train/models.yaml', 'r') as ymlfile: cfg = yaml.load(ymlfile) scratch = '/global/cscratch1/sd/chmodi/cosmo4d/' train = scratch + 'train/' abund = True bs, nc, numd, seed = 400, 128, 1e-3, 100 doexp = False
stretch='normal') font = { 'family': fontmanage.get_family()[0], 'style': fontmanage.get_style(), 'weight': fontmanage.get_weight(), 'size': fontmanage.get_size(), } # sys.path.append('../utils/') sys.path.append('../') from uvbg import qlf import mymass_function as massfunc cosmodef = {'omegam': 0.309167, 'h': 0.677, 'omegab': 0.048} omM = cosmodef['omegam'] mf = massfunc.Mass_Func('../../data/pk_Planck2018BAO_matterpower_z000.dat', M=omM) # import argparse parser = argparse.ArgumentParser() parser.add_argument('-s', '--size', help='which box size simulation', default='big') args = parser.parse_args() boxsize = args.size ## suff = 'm1_00p3mh-alpha-0p8-subvol' if boxsize == 'big': suff = suff + '-big'