mirror of
https://github.com/Richard-Sti/csiborgtools_public.git
synced 2025-05-14 06:31:11 +00:00
Add z_obs output (#119)
* Update SN model to output zobs too * Add TF predicted zobs * Add imoprt * Update nb * Calculate chi2 * Update nb * Update script
This commit is contained in:
parent
f7285b2600
commit
4093186f9a
6 changed files with 462 additions and 47 deletions
|
@ -104,11 +104,19 @@ def run_model(model, nsteps, nburn, nchains, nsim, dump_folder,
|
|||
samples = mcmc.get_samples()
|
||||
thinned_samples = csiborgtools.thin_samples_by_acl(samples)
|
||||
|
||||
# Calculate the chi2
|
||||
keys = list(thinned_samples.keys())
|
||||
nsamples = len(thinned_samples[keys[0]])
|
||||
zobs_mean, zobs_std = model.predict_zobs(thinned_samples)
|
||||
nu = model.ndata - len(keys)
|
||||
chi2 = [np.sum((zobs_mean[:, i] - model._z_obs)**2 / zobs_std[:, i]**2) / nu # noqa
|
||||
for i in range(nsamples)]
|
||||
|
||||
gof = csiborgtools.numpyro_gof(model, mcmc, model_kwargs)
|
||||
|
||||
# Save the samples to the temporary folder.
|
||||
fname = join(dump_folder, f"samples_{nsim}.npz")
|
||||
np.savez(fname, **thinned_samples, **gof)
|
||||
np.savez(fname, **thinned_samples, **gof, chi2=chi2)
|
||||
|
||||
|
||||
def combine_from_simulations(catalogue_name, simname, nsims, outfolder,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
memory=4
|
||||
on_login=0
|
||||
on_login=1
|
||||
nthreads=${1}
|
||||
ksmooth=${2}
|
||||
|
||||
|
@ -7,8 +7,8 @@ queue="berg"
|
|||
env="/mnt/users/rstiskalek/csiborgtools/venv_csiborg/bin/python"
|
||||
file="flow_validation.py"
|
||||
|
||||
catalogue="Pantheon+"
|
||||
simname="csiborg2_main"
|
||||
catalogue="LOSS"
|
||||
simname="Carrick2015"
|
||||
|
||||
|
||||
pythoncm="$env $file --catalogue $catalogue --simname $simname --ksmooth $ksmooth"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue