From 4e471837706db4175bed973c500acc86cd06b8b4 Mon Sep 17 00:00:00 2001 From: Humna Awan Date: Mon, 29 Jan 2024 22:28:34 -0500 Subject: [PATCH] added functionality to implement lmin-clipping via a user option. --- deepcmbsim/camb_power_spectrum.py | 8 ++++++++ deepcmbsim/settings/user_config.yaml | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/deepcmbsim/camb_power_spectrum.py b/deepcmbsim/camb_power_spectrum.py index f3a8f5e..892e565 100644 --- a/deepcmbsim/camb_power_spectrum.py +++ b/deepcmbsim/camb_power_spectrum.py @@ -146,6 +146,14 @@ def get_cls(self, save_to_dict=None, user_params=True): else: raise ValueError('somethings wrong.') + # see if lmin is specified - if so, discard the ells < lmin + if self.UserParams['lmin'] != 0: + ell_inds = np.where(outdict['l'] >= self.UserParams['lmin'])[0] + if bool(self.UserParams["verbose"]): + print(f'## discarding {len(outdict["l"]) - len(ell_inds)} ells given lmin specification.') + for key in outdict.keys(): + outdict[key] = outdict[key][ell_inds] + if bool(self.UserParams["verbose"]): time_end = dt.now() print('from', dt.strftime(time_start, '%H:%M:%S.%f %P'), 'to', dt.strftime(time_end, '%H:%M:%S.%f %P'), diff --git a/deepcmbsim/settings/user_config.yaml b/deepcmbsim/settings/user_config.yaml index 9fe9ecc..9c345ef 100644 --- a/deepcmbsim/settings/user_config.yaml +++ b/deepcmbsim/settings/user_config.yaml @@ -15,6 +15,10 @@ extra_l: 300 max_l_use: 10000 # max_l_use will differ from max_l and max_l_tensor by "extra_l" because # according to the CAMB documentation errors affect the last "100 or so" multipoles # --- +# decide on lmin: CAMB will still be called with lmin=0 but +# you may specifiy lmin for the output spectra +lmin: 0 +# --- # decide on what to output; either 'all' or a subset list of # ['clTT', 'clEE', 'clBB', 'clTE', 'clPP', 'clPT', 'clPE'] cls_to_output: 'all' \ No newline at end of file