From 205663a59911636de2ff8bb144106d1ed71d830a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Agn=C3=A8s=20Fert=C3=A9?= Date: Fri, 8 Dec 2023 21:40:55 +0100 Subject: [PATCH] Add xlens module. --- modules_desy6/put_xlens.py | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 modules_desy6/put_xlens.py diff --git a/modules_desy6/put_xlens.py b/modules_desy6/put_xlens.py new file mode 100644 index 00000000..4562be9f --- /dev/null +++ b/modules_desy6/put_xlens.py @@ -0,0 +1,32 @@ +# Add Xlens to the model modifying the linear gal bias +# Based on Shivam Pandey's code for Y3 +from cosmosis.datablock import names, option_section +import numpy as np + +def setup(options): + # Get the name of the bias section + bias_section = options.get_string(option_section, "bias_section", "bias_lens") + # Get the name of the xlens section + r_section = options.get_string(option_section,"r_section", "x_lens") + + return bias_section, r_section + +def execute(block, config): + + bias_section, r_section = config + + rval = block[r_section, 'rmean_bin'] + + for i in range(1,6): + b1in_label = "b1E_bin%d"%i + b1_in = block[bias_section, b1in_label] + b1out_gt_label = "b1gt_bin%d"%i + b1out_wt_label = "b1wt_bin%d"%i + if not block.has_value(bias_section, b1in_label): + print("%s not found"%b1in_label) + break + block[bias_section, b1out_wt_label] = b1_in + b1_gt = rval*b1_in + block[bias_section, b1out_gt_label] = b1_gt + + return 0 \ No newline at end of file