Skip to content

Commit ed54280

Browse files
small changes
1 parent 4e93ccd commit ed54280

File tree

2 files changed

+13
-14
lines changed

2 files changed

+13
-14
lines changed

deepcmbsim/camb_power_spectrum.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,14 @@ def get_noise(self):
6363
provides noise for the TT power spectrum and the polarization power spectra;
6464
shape is (2, max_l_use)
6565
"""
66-
if self.UserParams['noise_type'] == 'detector-white':
67-
t_noise = noise.detector_white_noise(self.UserParams['noise_uKarcmin'], self.UserParams['beamfwhm_arcmin'], self.max_l_use,
68-
TT=True)
69-
eb_noise = noise.detector_white_noise(self.UserParams['noise_uKarcmin'], self.UserParams['beamfwhm_arcmin'], self.max_l_use,
70-
TT=False)
66+
if ((self.UserParams['noise_type'] == 'detector-white') & (self.UserParams['noise_uKarcmin'] is not None)):
67+
t_noise = noise.detector_white_noise(self.UserParams['noise_uKarcmin'], TT=True)
68+
eb_noise = noise.detector_white_noise(self.UserParams['noise_uKarcmin'], TT=False)
7169
return t_noise, eb_noise
7270
elif self.UserParams['noise_type'] is None:
7371
return np.zeros((2, self.max_l_use))
72+
elif self.UserParams['noise_uKarcmin'] is None:
73+
return np.zeros((2, self.max_l_use))
7474
else:
7575
print("only detector white noise is currently implemented, via `noise_type = 'detector-white'` in `user_config.yaml`")
7676
return np.zeros((2, self.max_l_use))
@@ -111,12 +111,12 @@ def get_cls(self, save_to_dict=None, user_params=True):
111111
# need to run things to get one/some/all of tt, ee, bb, te
112112
tt, ee, bb, te = results.get_total_cls(raw_cl=self.normalize_cls, CMB_unit=self.TT_units)[:self.max_l_use + 1].T
113113
# add noise
114-
if self.UserParams['noise_type'] is not None:
115-
_noise = self.get_noise()
116-
tt += _noise[0]
117-
ee += _noise[1]
118-
bb += _noise[1]
119-
te += _noise[1]
114+
# if ((self.UserParams['noise_type'] is not None) & (self.UserParams['noise_uKarcmin'] is not None)):
115+
# _noise = self.get_noise()
116+
# tt += _noise[0]
117+
# ee += _noise[1]
118+
# bb += _noise[1]
119+
# te += _noise[1]
120120
# now add to outdict
121121
for key in ['clTT', 'clEE', 'clBB', 'clTE']:
122122
if key in cls_needed:

deepcmbsim/noise.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ def max_multipole(beamfwhm_arcmin, additional_factor=3):
2828

2929
def beam_effect(beamfwhm_arcmin, lmax):
3030
ells = np.arange(lmax + 1)
31-
return np.exp(ells * (ells + 1) * (beamfwhm_arcmin * arcmin_to_rad)**2 / (8 * np.log(2)))
31+
return np.exp(-ells * (ells + 1) * (beamfwhm_arcmin * arcmin_to_rad)**2 / (8 * np.log(2)))
3232

33-
def detector_white_noise(noise_uKarcmin, beamfwhm_arcmin, lmax, TT=True, units_uK = True):
33+
def detector_white_noise(noise_uKarcmin, TT=True, units_uK = True):
3434
"""
3535
describes white (no angular scale) noise from a detector
3636
implements Eq 8 of astro-ph/0111606 (Hu and Okamoto Astrophys.J. 574 (2002) 566-574)
@@ -57,5 +57,4 @@ def detector_white_noise(noise_uKarcmin, beamfwhm_arcmin, lmax, TT=True, units_u
5757
"""
5858
noise_uKarcmin = noise_uKarcmin if TT else noise_uKarcmin * np.sqrt(2)
5959
noise_uKarcmin = noise_uKarcmin if units_uK else noise_uKarcmin / 2.72548e6
60-
ells = np.arange(lmax+1)
6160
return (noise_uKarcmin * arcmin_to_rad) ** 2

0 commit comments

Comments
 (0)