Skip to content

Commit

Permalink
added kwarg for cutoff for central pixel
Browse files Browse the repository at this point in the history
  • Loading branch information
samueldmcdermott committed Aug 21, 2024
1 parent 943bb01 commit cca881d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
8 changes: 4 additions & 4 deletions deepszsim/make_sz_cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ def Pe_to_y(profile, radii_mpc, M200_SM, redshift_z, load_vars_dict, alpha = 1.0


def _make_y_submap(profile, M200_SM, redshift_z, load_vars_dict, image_size_pixels, pixel_size_arcmin, alpha = 1.0,
gamma = -0.3, R200_Mpc = None):
gamma = -0.3, R200_Mpc = None, ctr_pix_res = 0.1):
'''
Converts from an electron pressure profile to a compton-y profile,
integrates over line of sight from -1 to 1 Mpc relative to center.
Expand Down Expand Up @@ -327,7 +327,7 @@ def _make_y_submap(profile, M200_SM, redshift_z, load_vars_dict, image_size_pixe
X = utils.arcmin_to_Mpc(X, redshift_z, load_vars_dict['cosmo'])
# Solves issues of div by 0
#X[(X <= pixel_size_arcmin / 10) & (X >= -pixel_size_arcmin / 10)] = pixel_size_arcmin / 10
mindist = utils.arcmin_to_Mpc(pixel_size_arcmin*0.1, redshift_z, load_vars_dict['cosmo'])
mindist = utils.arcmin_to_Mpc(pixel_size_arcmin*ctr_pix_res, redshift_z, load_vars_dict['cosmo'])
R = np.maximum(mindist, np.sqrt(X[:, None]**2 + X[None, :]**2).flatten())

cy = Pe_to_y(profile, R, M200_SM, redshift_z, load_vars_dict, alpha = alpha, gamma = gamma, R200_Mpc = R200_Mpc) #
Expand All @@ -354,7 +354,7 @@ def _make_y_submap(profile, M200_SM, redshift_z, load_vars_dict, image_size_pixe

def generate_y_submap(M200_SM, redshift_z, profile = "Battaglia2012",
image_size_pixels = None, pixel_size_arcmin = None, load_vars_dict = None, alpha = 1.0, gamma = -0.3,
R200_Mpc = None):
R200_Mpc = None, ctr_pix_res = 0.1):
'''
Converts from an electron pressure profile to a compton-y profile,
integrates over line of sight from -1 to 1 Mpc relative to center.
Expand Down Expand Up @@ -398,7 +398,7 @@ def generate_y_submap(M200_SM, redshift_z, profile = "Battaglia2012",

y_map = _make_y_submap(profile, M200_SM, redshift_z, load_vars_dict,
image_size_pixels, pixel_size_arcmin,
alpha = alpha, gamma = gamma, R200_Mpc = R200_Mpc)
alpha = alpha, gamma = gamma, R200_Mpc = R200_Mpc, ctr_pix_res = ctr_pix_res)

return y_map

Expand Down
6 changes: 4 additions & 2 deletions deepszsim/simclusters.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

class simulate_clusters:
def __init__(self, M200 = None, redshift_z = None, num_halos = None, halo_params_dict = None,
R200_Mpc = None, profile = "Battaglia2012",
R200_Mpc = None, ctr_pix_res = 0.1, profile = "Battaglia2012",
image_size_pixels = None, image_size_arcmin = None, pixel_size_arcmin = None,
alpha = 1.0, gamma = -0.3,
load_vars_yaml = os.path.join(os.path.dirname(__file__), 'Settings', 'config_everything.yaml'),
Expand Down Expand Up @@ -88,6 +88,7 @@ def __init__(self, M200 = None, redshift_z = None, num_halos = None, halo_params
self.beam_size_arcmin = self.vars['beam_size_arcmin']
self.cosmo = self.vars['cosmo']
self.tqverb = tqverb
self.ctr_pix_res = ctr_pix_res

self.alpha, self.gamma = alpha, gamma
self.seed, self._rng = seed, np.random.default_rng(seed)
Expand Down Expand Up @@ -128,7 +129,8 @@ def get_y_maps(self):
self.y_maps = np.array([make_sz_cluster.generate_y_submap(self.M200[i],
self.redshift_z[i],
R200_Mpc = self.R200_Mpc[i],
load_vars_dict = self.vars)
load_vars_dict = self.vars,
ctr_pix_res = self.ctr_pix_res)
for i in tqdm(range(self._size), disable = (not self.tqverb))])
return self.y_maps

Expand Down

0 comments on commit cca881d

Please sign in to comment.