From b819b82798c66665e5693136231bf2529f6c84ae Mon Sep 17 00:00:00 2001 From: samueldmcdermott Date: Tue, 14 Nov 2023 15:12:03 -0500 Subject: [PATCH] changed `white_noise` to `detector_white_noise` --- deepcmbsim/camb_power_spectrum.py | 10 +++++----- deepcmbsim/noise.py | 3 ++- tests/test_noise.py | 4 ++-- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/deepcmbsim/camb_power_spectrum.py b/deepcmbsim/camb_power_spectrum.py index 057f3ce..e0a5964 100644 --- a/deepcmbsim/camb_power_spectrum.py +++ b/deepcmbsim/camb_power_spectrum.py @@ -64,15 +64,15 @@ def get_noise(self): shape is (2, max_l_use) """ if self.UserParams['noise_type'] == 'white': - t_noise = noise.white_noise(self.UserParams['noise_uKarcmin'], self.UserParams['beamfwhm_arcmin'], self.max_l_use, - TT=True) - eb_noise = noise.white_noise(self.UserParams['noise_uKarcmin'], self.UserParams['beamfwhm_arcmin'], self.max_l_use, - TT=False) + t_noise = noise.detector_white_noise(self.UserParams['noise_uKarcmin'], self.UserParams['beamfwhm_arcmin'], self.max_l_use, + TT=True) + eb_noise = noise.detector_white_noise(self.UserParams['noise_uKarcmin'], self.UserParams['beamfwhm_arcmin'], self.max_l_use, + TT=False) return t_noise, eb_noise elif self.UserParams['noise_type'] is None: return np.zeros((2, self.max_l_use)) else: - print("only white noise is currently implemented") + print("only detector white noise is currently implemented, via `noise_type = 'white'` in `user_config.yaml`") return np.zeros((2, self.max_l_use)) def get_cls(self, save_to_dict=None, user_params=True): diff --git a/deepcmbsim/noise.py b/deepcmbsim/noise.py index 986b534..2d56ba4 100644 --- a/deepcmbsim/noise.py +++ b/deepcmbsim/noise.py @@ -26,8 +26,9 @@ def max_multipole(beamfwhm_arcmin, additional_factor=3): """ return 180 * 60 * additional_factor / beamfwhm_arcmin -def white_noise(noise_uKarcmin, beamfwhm_arcmin, lmax, TT=True, units_uK = True): +def detector_white_noise(noise_uKarcmin, beamfwhm_arcmin, lmax, TT=True, units_uK = True): """ + describes white (no angular scale) noise from a detector implements Eq 8 of astro-ph/0111606 (Hu and Okamoto Astrophys.J. 574 (2002) 566-574) related ideas first in Knox 1995 astro-ph/9504054 for T only and in Seljak and Zaldarriaga 1996 astro-ph/9609170 for polarization diff --git a/tests/test_noise.py b/tests/test_noise.py index 627c7a2..6548792 100644 --- a/tests/test_noise.py +++ b/tests/test_noise.py @@ -14,12 +14,12 @@ def test_max_multipole(): assert max_multipole_5_3 == 180*60*additional_factor/fwhm_arcmin -def test_white_noise(): +def test_detector_white_noise(): arcmin_to_rad = np.pi / 180 / 60 ell = int(1e4) noise_uK_arcmin = 10 fwhm_arcmin = 1 out = (noise_uK_arcmin * arcmin_to_rad)**2 * np.exp( ell * (ell + 1) * (fwhm_arcmin * arcmin_to_rad)**2 / (8 * np.log(2)) ) - final_wn_10_1_1e4 = deepcmbsim.noise.white_noise(noise_uK_arcmin, fwhm_arcmin, ell, TT=True, units_uK = True)[-1] + final_wn_10_1_1e4 = deepcmbsim.noise.detector_white_noise(noise_uK_arcmin, fwhm_arcmin, ell, TT=True, units_uK = True)[-1] assert final_wn_10_1_1e4 == approx(out)