Skip to content

Commit

Permalink
changed white_noise to detector_white_noise
Browse files Browse the repository at this point in the history
  • Loading branch information
samueldmcdermott committed Nov 14, 2023
1 parent e24e310 commit b819b82
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
10 changes: 5 additions & 5 deletions deepcmbsim/camb_power_spectrum.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
3 changes: 2 additions & 1 deletion deepcmbsim/noise.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions tests/test_noise.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit b819b82

Please sign in to comment.