Beispiel #1
0
    else:
        nnmass = ntools.applynet(mftt, mtup).reshape(nc, nc, nc)
    if doexp:
        nnmass = mf.fmexp(ntools.relu(nnmass), mexp, cc)
    predict = pm.create(mode='real')
    predict[...] = nnpred * nnmass
    predictR = ft.smooth(predict, Rsm, 'fingauss')

    #data

    hdictf = ntools.gridhalos(pm,
                              scratch + '/data/L%04d_N%04d_S%04d_40step/' %
                              (bs, fine * nc, seed),
                              R1=R1,
                              R2=R2,
                              pmesh=True,
                              abund=abund,
                              doexp=doexp,
                              mexp=mexp,
                              cc=cc,
                              stellar=stellar)[1]
    datap = pm.paint(hdictf['position'][:num], hdictf['mass'][:num])
    datapR = ft.smooth(datap, Rsm, 'fingauss')

    predicts.append(predictR[...].copy())
    datas.append(datapR[...].copy())

    for i, sg in enumerate(sgs):
        hmass, hpos = dg.scatter_catalog(hdictf['mass'],
                                         hdictf['position'],
                                         sg,
predictR = ft.smooth(predict, Rsm, 'fingauss')

#data

print('Generating data')
#hdictf = ntools.gridhalos(pm, scratch +'/data/L%04d_N%04d_S%04d_40step/'%(bs, 4*nc, seed), rank=num, R1=R1, R2=R2, pmesh=True)
#datapt = pm.create(mode='real', zeros=True)
#datapt[...] = hdictf[0]['halomesh']
if zz != 0:
    hdictf = ntools.gridhalos(pm,
                              dpath=scratch +
                              '/data/z%02d/L%04d_N%04d_S%04d_40step/' %
                              (zz * 10, bs, sfine * nc, seed),
                              R1=R1,
                              R2=R2,
                              pmesh=False,
                              abund=abund,
                              doexp=doexp,
                              mexp=mexp,
                              cc=cc,
                              stellar=stellar)[1]
else:
    #hdictf = ntools.gridhalos(pm, dpath=scratch +'/data/L%04d_N%04d_S%04d_40step/'%(bs, sfine*nc, seed),
    #                          R1=R1, R2=R2, pmesh=False, abund=abund, doexp=doexp, mexp=mexp, cc=cc, stellar=stellar)[1]
    hdictf = ntools.gridhalos(
        pm,
        dpath=scratch + '/output/L%04d_N%04d_05step-fof/highres4_S%04d/' %
        (bs, nc, seed),
        R1=R1,
        R2=R2,
        pmesh=False,
Beispiel #3
0
ftt = ntools.createdata(pm, meshdict, pdict['pftname'], plocal)
mftt = ntools.createdata(pm, meshdict, mftname, mlocal)
nnpred = ntools.applynet(ftt, ptup).reshape(nc, nc, nc)
nnmass = ntools.applynet(mftt, mtup).reshape(nc, nc, nc)
predict = pm.create(mode='real', value=nnpred * nnmass)
predictR = ft.smooth(predict, Rsm, 'fingauss')

#data

print('Generating data')

hdictf = ntools.gridhalos(pm,
                          dpath=scratch +
                          '/data/z%02d/L%04d_N%04d_S%04d_40step/' %
                          (zz * 10, bs, sfine * nc, seed),
                          R1=R1,
                          R2=R2,
                          pmesh=False,
                          abund=abund)[1]
datap = pm.paint(hdictf['position'][:num], mass=hdictf['mass'][:num])
datapR = ft.smooth(datap, Rsm, 'fingauss')

print('Data generated')

func = dg.normal
colors = ['r', 'b', 'g', 'y', 'm', 'orange', 'brown', 'k']

###########################################

mbins = np.logspace(10, 13, 16)[::-1]
msave = [mbins[0] * 100] + list(mbins)
Beispiel #4
0
mftt = ntools.createdata(pm, meshdict, mftname, mlocal)
nnpred = ntools.applynet(ftt, ptup).reshape(nc, nc, nc)
nnmass = ntools.applynet(mftt, mtup).reshape(nc, nc, nc)
predict = pm.create(mode='real')
predict[...] = nnpred * nnmass
predictR = ft.smooth(predict, 3, 'fingauss')

#data

#hdictf = ntools.gridhalos(pm, scratch +'/data/L%04d_N%04d_S%04d_40step/'%(bs, 4*nc, seed), rank=num, R1=R1, R2=R2, pmesh=True)
#datapt = pm.create(mode='real', zeros=True)
#datapt[...] = hdictf[0]['halomesh']
hdictf = ntools.gridhalos(pm,
                          scratch + '/data/L%04d_N%04d_S%04d_40step/' %
                          (bs, fine * nc, seed),
                          R1=R1,
                          R2=R2,
                          pmesh=True,
                          abund=abund)[1]
datap = pm.paint(hdictf['position'][:num], hdictf['mass'][:num])
datapR = ft.smooth(datap, 3, 'fingauss')

bins = np.linspace(-4, 4, 200)
func = dg.normal
colors = ['r', 'b', 'g', 'y', 'm', 'orange', 'brown', 'c', 'k']


def scatter_cat(hmass, hpos, seed=100, smin=0.1, smax=0.2):
    logl = np.log10(hmass)
    rng = np.random.RandomState(seed)
    t = rng.normal(scale=rng.uniform(smin, smax, size=len(logl)))
Beispiel #5
0
    #for seed in ddict['seeds']:
    #    pass
    seed = 100
    proj = '/project/projectdirs/astro250/chmodi/cosmo4d/'
    dpath = proj + 'data/z%02d/L%04d_N%04d_S%04d_%02dstep/' % (zz * 10, bs, nc,
                                                               seed, 5)
    dpathf = proj + 'data/z%02d/L%04d_N%04d_S%04d_%02dstep/' % (
        zz * 10, bs, fine * nc, seed, 40)
    meshdict, halos = readfiles(pm,
                                dpath,
                                R1,
                                R2,
                                abund=False,
                                quad=False,
                                z=zz,
                                shear=False)
    halosf = gridhalos(pm,
                       dpath=dpathf,
                       rank=None,
                       abund=False,
                       sigma=False,
                       seed=seed,
                       pmesh=True,
                       z=zz)

    print('Keys in meshdict ', meshdict.keys())
    print('Keys in halos ', halos.keys())
    print('Length of list halosf ', len(halosf))
    print('Keys in halosf[0] ', halosf[0].keys())
    print('Keys in halosf[1] ', halosf[1].keys())