Skip to content

Commit

Permalink
fixed some import bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
samueldmcdermott committed Jun 20, 2023
1 parent c265324 commit 35c0eab
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
6 changes: 3 additions & 3 deletions deepcmbsim/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
code for delensing the CMB and extracting r and Alens even in the presence of systematics
"""

from simcmb.params_io import config_obj
from simcmb.camb_power_spectrum import CAMBPowerSpectrum
from deepcmbsim.params_io import config_obj
from deepcmbsim.camb_power_spectrum import CAMBPowerSpectrum

try:
from simcmb.cl_plotting import flatmap
from deepcmbsim.cl_plotting import flatmap
except ModuleNotFoundError:
pass
13 changes: 8 additions & 5 deletions deepcmbsim/camb_power_spectrum.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import camb
import numpy as np
from datetime import datetime as dt
from simcmb import noise
from deepcmbsim import noise
import h5py
import json
from collections.abc import Iterable
Expand Down Expand Up @@ -33,7 +33,7 @@ def __init__(self, in_config_obj):
self.UserParams = in_config_obj.UserParams

# according to the CAMB documentation, errors affect the last "100 or so" multipoles
self.max_l_use = min(self.UserParams['max_l_use'], noise.max_multipole(self.UserParams['beam_fwhm']))
self.max_l_use = min(self.UserParams['max_l_use'], noise.max_multipole(self.UserParams['beamfwhm_arcmin']))
self.max_l_calc = int(self.max_l_use + self.UserParams['extra_l'])
self.CAMBparams.max_l = self.max_l_calc
self.CAMBparams.max_l_tensor = self.max_l_calc
Expand Down Expand Up @@ -62,9 +62,9 @@ def get_noise(self):
shape is (2, max_l_use)
"""
if self.UserParams['noise_type'] == 'white':
t_noise = noise.white_noise(self.UserParams['noise_level'], self.UserParams['beam_fwhm'], self.max_l_use,
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_level'], self.UserParams['beam_fwhm'], self.max_l_use,
eb_noise = noise.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:
Expand Down Expand Up @@ -187,7 +187,10 @@ def savecls(self, savedir=os.path.join(os.getcwd(), "outfiles"),
if type(saveids) == int:
saveids = np.random.choice(range(len(self.loop_runids)), saveids, replace=False) if randomids else self.loop_runids[:saveids]
elif isinstance(saveids, Iterable):
saveids = [self.loop_runids[x] for x in saveids]
if len(self.loop_runids) > 0:
saveids = [self.loop_runids[x] for x in saveids]
else:
saveids = list(self.results.keys())
else:
saveids = saveids
else:
Expand Down

0 comments on commit 35c0eab

Please sign in to comment.