Skip to content

Commit

Permalink
renamed config seed param for clarity.
Browse files Browse the repository at this point in the history
  • Loading branch information
humnaawan committed Nov 29, 2023
1 parent 2cc9d2d commit abc456d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
26 changes: 13 additions & 13 deletions deepcmbsim/cl_plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ class flatmap:
number of pixels on each side of a flat map
degrees : float
number of degrees on each side of a flat map
seed : int, default -1
random seed to provide `namaster` (potential bug in `namaster`, does not always have the
namaster_seed : int, default -1
random namaster_seed to provide `namaster` (potential bug in `namaster`, does not always have the
behavior that is described at https://namaster.readthedocs.io/en/latest/pymaster.html
cl_dict : dict, optional
dictionary of power spectra. Necessary to use the primary method of this class.
Expand All @@ -40,7 +40,7 @@ class flatmap:
function for plotting a realization of a flat-sky map with the given number of pixels
representing the given size of sky patch based on the provided power spectra
"""
def __init__(self, pixels, degrees, seed = -1, cl_dict = None):
def __init__(self, pixels, degrees, namaster_seed = -1, cl_dict = None):
"""
initialize a map-making class
Parameters
Expand All @@ -49,32 +49,32 @@ def __init__(self, pixels, degrees, seed = -1, cl_dict = None):
number of pixels on each side of a flat map
degrees : float
number of degrees on each side of a flat map
seed : int, default -1
random seed to provide `namaster` (potential bug in `namaster`, does not always have the
namaster_seed : int, default -1
random namaster_seed to provide `namaster` (potential bug in `namaster`, does not always have the
behavior that is described at https://namaster.readthedocs.io/en/latest/pymaster.html
cl_dict : dict, optional
dictionary of power spectra. Necessary to use the primary method of this class.
If not specified, can still use the hidden mapping function.
"""
self.pixels, self.degrees = pixels, degrees # pixels on each side, degrees on each side
self.seed, self.cl_dict = seed, cl_dict # random seed if applicable, dictionary of CLs if you want to include them
self.namaster_seed, self.cl_dict = namaster_seed, cl_dict # random namaster_seed if applicable, dictionary of CLs if you want to include them
self.reso = self.degrees / self.pixels
self.nx, self.lx, self.lx_rad, self.ny, self.ly, self.ly_rad = [int(self.pixels), int(self.degrees), self.degrees*np.pi/180]*2
self.ticks, self.labels = np.linspace(0, self.pixels, self.degrees+1), np.arange(0, self.degrees+1, dtype=float)

def _flatmap(self, cl_array, spin_array = [0], seed = None):
seed = seed if seed is not None else self.seed
return nmt.synfast_flat(self.nx, self.ny, self.lx_rad, self.ly_rad, np.array([x for x in cl_array]), spin_array, seed = seed)
def _flatmap(self, cl_array, spin_array = [0], namaster_seed = None):
namaster_seed = namaster_seed if namaster_seed is not None else self.namaster_seed
return nmt.synfast_flat(self.nx, self.ny, self.lx_rad, self.ly_rad, np.array([x for x in cl_array]), spin_array, namaster_seed = namaster_seed)

def flatmap(self, maps_out, seed = None):
def flatmap(self, maps_out, namaster_seed = None):
"""
Parameters
----------
maps_out : ["T", "E", "B", "P", "TT", "EE", "BB", "TE", "PP", "PT", "PE", "clTT", "clEE", "clBB", "clTE", "clPP", "clPT", "clPE", "TEB", "TQU"]
map(s) that you would like to produce
seed : int, optional
random seed to provide `namaster` (potential bug in `namaster`, does not always have the
namaster_seed : int, optional
random namaster_seed to provide `namaster` (potential bug in `namaster`, does not always have the
behavior that is described at https://namaster.readthedocs.io/en/latest/pymaster.html
Returns
-------
Expand All @@ -98,6 +98,6 @@ def flatmap(self, maps_out, seed = None):
else:
print("not a valid map specification")
return None
return self._flatmap(cl_arr, spin_arr, seed=seed)
return self._flatmap(cl_arr, spin_arr, namaster_seed=namaster_seed)
else:
print("if you don't want to restrict to a `cl_dict` dictionary, use `self._flatmap` instead")
2 changes: 1 addition & 1 deletion deepcmbsim/settings/user_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ FORCAMB: # these simply overwrite any values in BASECAMBPARAMS
ITERABLES: # these provide iterables that can overwrite their corresponding values in BASECAMBPARAMS in loop settings
InitPower.r : [0.01, 0.1, 3] # for nested CAMBparams attributes, use the dot structure
Alens : [.8, 1.2, 3]
seed: 0
namaster_seed: 0 # seed for the map realization using namaster
verbose: 1
normalize_cls: False #raw_cl – return Cl rather than l*(l+1)*Cl/2π (Cl alone is not conventional)
TT_units: muK #return uK**2 units for the TT, EE, BB, TE Cls
Expand Down

0 comments on commit abc456d

Please sign in to comment.