From bd17081332b424dd4d4f752ec0e801ad258f7fd4 Mon Sep 17 00:00:00 2001 From: Michael Troxel Date: Thu, 11 Apr 2024 13:56:18 -0400 Subject: [PATCH 1/2] Addition of sampling over nz modes --- modules_desy6/photoz_uz/module.yaml | 51 ++++++++++++++++++++++++++++ modules_desy6/photoz_uz/photoz_uz.py | 36 ++++++++++++++++++++ 2 files changed, 87 insertions(+) create mode 100644 modules_desy6/photoz_uz/module.yaml create mode 100644 modules_desy6/photoz_uz/photoz_uz.py diff --git a/modules_desy6/photoz_uz/module.yaml b/modules_desy6/photoz_uz/module.yaml new file mode 100644 index 00000000..f1c09418 --- /dev/null +++ b/modules_desy6/photoz_uz/module.yaml @@ -0,0 +1,51 @@ +#This is a template for module description files +name: photoz_uz +version: 1 +purpose: Modify a set of loaded n(z) distributions by a set of eignmodes and amplitudes. +url: '' +interface: photoz_uz.py +attribution: Troxel & Gary Bernstein +rules: '' +cite: [] +assumptions: +- files containing information on n(z) modes and priors on amplitudes + +explanation: | + +params: + sample: + meaning: name of sample + type: str + default: "" + basis_file: + meaning: file containing n(z) mode array + type: str + default: "" + n_modes: + meaning: number of modes to use + type: int + default: 0 +inputs: + wl_number_density: + nbin: + meaning: Number of redshift bins + type: int + default: + z: + meaning: Redshift sample points of n(z) estimates + type: real 1d + default: + bin_i: + meaning: n(z)for i=1..nbin. n(z) estimates + type: real 1d + default: + {sample}_photoz_u: + bias_i: + meaning: For i=1..nmode. Amplitude for mode i. + type: real + default: +outputs: + wl_number_density: + bin_i: + meaning: n(z) for i=1..nbin. Modified n(z) estimates replaced old value + type: real 1d diff --git a/modules_desy6/photoz_uz/photoz_uz.py b/modules_desy6/photoz_uz/photoz_uz.py new file mode 100644 index 00000000..64aca26d --- /dev/null +++ b/modules_desy6/photoz_uz/photoz_uz.py @@ -0,0 +1,36 @@ +from builtins import range +from cosmosis.datablock import option_section, names +import numpy as np + +def setup(options): + sample = options.get_string(option_section, "sample", "") + bias_section = sample+"_photoz_u" + basis_file = options.get_string(option_section, "basis_file", "") + n_modes = options.get_int(option_section, "n_modes", 0) + U = np.loadtxt(basis_file)[:,:n_modes] + return {"sample": sample, + "bias_section": bias_section, + "basis":U, + "n_modes":n_modes} + +def execute(block, config): + pz = 'nz_'+config['sample'] + uvals = config['bias_section'] + U = config['basis'] + n_modes = config['n_modes'] + nbin = block[pz, "nbin"] + if nbin>4: + nbin=4 + z = block[pz, "z"] + dz = U@np.array([block[uvals, "u_%d" % j] for j in range(n_modes)]) + dz = dz.reshape((nbin,len(dz)//nbin)) + for i in range(1,nbin+1): + bin_name = "bin_%d" % i + nz = block[pz, bin_name] + nz[1:]+=dz[i-1,:] + nz /= np.trapz(nz, z) + block[pz, bin_name] = nz + return 0 + +def cleanup(config): + pass From c1e77503888daa47337f994a4eb8c6f0cd4dbc52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ot=C3=A1vio=20Alves?= Date: Thu, 18 Apr 2024 15:26:30 -0400 Subject: [PATCH 2/2] Updated DESI Y1 BAO data with non-truncated numbers. --- modules_desy6/desi_likelihood/desi_y1_bao_ani.txt | 12 ++++++------ modules_desy6/desi_likelihood/desi_y1_bao_iso.txt | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/modules_desy6/desi_likelihood/desi_y1_bao_ani.txt b/modules_desy6/desi_likelihood/desi_y1_bao_ani.txt index af91bcf5..30031bc9 100644 --- a/modules_desy6/desi_likelihood/desi_y1_bao_ani.txt +++ b/modules_desy6/desi_likelihood/desi_y1_bao_ani.txt @@ -1,7 +1,7 @@ -# zeff DM/rd error DH/rd error corr -0.51 13.62 0.25 20.98 0.61 -0.445 -0.71 16.84 0.32 20.08 0.60 -0.420 -0.93 21.73 0.28 17.87 0.35 -0.389 -1.32 27.80 0.69 13.82 0.42 -0.444 -2.33 39.71 0.94 8.52 0.17 -0.477 +# zeff DM/rd error DH/rd error corr +0.510 13.62003080 0.25192504 20.98334647 0.61071168 -0.44544776 +0.706 16.84645313 0.31933636 20.07872919 0.59535633 -0.42047527 +0.930 21.70841761 0.28207716 17.87612922 0.34631732 -0.38910542 +1.317 27.78720817 0.69034039 13.82372285 0.42222091 -0.44396689 +2.330 39.70838281 0.94326716 8.52256583 0.17083924 -0.4775 diff --git a/modules_desy6/desi_likelihood/desi_y1_bao_iso.txt b/modules_desy6/desi_likelihood/desi_y1_bao_iso.txt index 9211bf63..4647b100 100644 --- a/modules_desy6/desi_likelihood/desi_y1_bao_iso.txt +++ b/modules_desy6/desi_likelihood/desi_y1_bao_iso.txt @@ -1,3 +1,3 @@ -# zeff DV/rd error -0.30 7.92 0.15 -1.49 26.09 0.67 +# zeff DV/rd error +0.295 7.92512927 0.15074178 +1.491 26.07217182 0.66868153