Skip to content

Commit e0ca878

Browse files
updated doc strings
1 parent c3bd481 commit e0ca878

File tree

4 files changed

+33
-37
lines changed

4 files changed

+33
-37
lines changed

deepszsim/filters.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import numpy as np
66

77
def get_tSZ_signal_aperture_photometry(dT_map, radmax_arcmin, pixel_scale,
8-
fmax_arcmin=np.sqrt(2)):
8+
fmax=np.sqrt(2)):
99
"""
1010
Parameters:
1111
----------
@@ -14,8 +14,8 @@ def get_tSZ_signal_aperture_photometry(dT_map, radmax_arcmin, pixel_scale,
1414
the radius of the inner aperture, in arcmin
1515
pixel_scale: float
1616
How many arcmin per pixel for the current settings
17-
fmax_arcmin: float
18-
fmax+radmax is the radius of the outer aperture, in arcmin
17+
fmax: float
18+
fmax * radmax_arcmin is the radius of the outer aperture, in arcmin
1919
2020
Returns:
2121
-------
@@ -28,7 +28,7 @@ def get_tSZ_signal_aperture_photometry(dT_map, radmax_arcmin, pixel_scale,
2828
"""
2929

3030
radmax_pixels = radmax_arcmin / pixel_scale
31-
radius_out_pixels = radmax_pixels * fmax_arcmin
31+
radius_out_pixels = radmax_pixels * fmax
3232

3333
center = np.array(dT_map.shape) // 2
3434
x, y = np.indices(dT_map.shape)

deepszsim/make_sz_cluster.py

+16-23
Original file line numberDiff line numberDiff line change
@@ -228,8 +228,7 @@ def Pth_Battaglia2012(radius_mpc, M200_SM, redshift_z, load_vars_dict = None,
228228
return _Pth_Battaglia2012(P0, radius_mpc, R200_Mpc, alpha, beta, gamma, xc)
229229

230230

231-
def Pe_to_y(profile, radii_mpc, M200_SM, redshift_z, load_vars_dict, alpha = 1.0, gamma = -0.3, R200_Mpc = None,
232-
Rmaxy = None):
231+
def Pe_to_y(profile, radii_mpc, M200_SM, redshift_z, load_vars_dict, alpha = 1.0, gamma = -0.3, R200_Mpc = None):
233232
'''
234233
Converts from an electron pressure profile to a compton-y profile,
235234
integrates over line of sight from -1 to 1 Mpc relative to center.
@@ -264,28 +263,12 @@ def Pe_to_y(profile, radii_mpc, M200_SM, redshift_z, load_vars_dict, alpha = 1.0
264263
if R200_Mpc is None:
265264
R200_Mpc = get_r200_angsize_and_c200(M200_SM, redshift_z, load_vars_dict)[1]
266265
radii_mpc = (radii_mpc * u.Mpc).value
267-
if Rmaxy is None:
268-
rmax = radii_mpc.max()
269-
elif '200' in Rmaxy:
270-
rmax = R200_Mpc
271-
else:
272-
print('please specify a valid `Rmaxy`')
273-
return None
274266
if profile != "Battaglia2012":
275267
print("only implementing `Battaglia2012` for profile")
276268
profile = Pth_Battaglia2012
277269
pressure_integ = np.empty_like(radii_mpc)
278270
P200_kevcm3 = P200_Battaglia2012(M200_SM, redshift_z, load_vars_dict, R200_Mpc = R200_Mpc).value
279271

280-
# integral = np.trapz(np.array([profile(np.sqrt(np.linspace(0, np.sqrt(radii_mpc.max()**2. - rv**2.)+1.,
281-
# 1000)**2 +
282-
# rv**2), M200_SM, redshift_z, load_vars_dict = None, alpha = alpha,
283-
# gamma = gamma, R200_Mpc = r200) for rv in radii_mpc]), np.array([np.linspace(0,
284-
# np.sqrt(radii_mpc.max(
285-
# )**2. - rv**2.)+1., 1000) for rv in radii_mpc]))
286-
# y_pro = integral * P200_kevcm3 * keVcm3_to_Jm3 * Thomson_scale * \
287-
# thermal_to_electron_pressure * 2*Mpc_to_m
288-
# return y_pro
289272
for i, radius in enumerate(radii_mpc):
290273
# Multiply profile by P200 specifically for Battaglia 2012 profile,
291274
# since it returns Pth/P200 instead of Pth
@@ -303,7 +286,7 @@ def Pe_to_y(profile, radii_mpc, M200_SM, redshift_z, load_vars_dict, alpha = 1.0
303286

304287

305288
def _make_y_submap(profile, M200_SM, redshift_z, load_vars_dict, image_size_pixels, pixel_size_arcmin, alpha = 1.0,
306-
gamma = -0.3, R200_Mpc = None, Rmaxy = None):
289+
gamma = -0.3, R200_Mpc = None):
307290
'''
308291
Converts from an electron pressure profile to a compton-y profile,
309292
integrates over line of sight from -1 to 1 Mpc relative to center.
@@ -324,6 +307,10 @@ def _make_y_submap(profile, M200_SM, redshift_z, load_vars_dict, image_size_pixe
324307
size of final submap in number of pixels
325308
pixel_size_arcmin: float
326309
size of each pixel in arcmin
310+
alpha: float
311+
variable fixed by Battaglia et al 2012 to 1.0
312+
gamma: float
313+
variable fixed by Battaglia et al 2012 to -0.3
327314
R200_Mpc: None or float
328315
if None, will calculate the radius that corresponds to the mass M200, the redshift redshift_z,
329316
and the cosmology contained in load_vars_dict
@@ -341,8 +328,7 @@ def _make_y_submap(profile, M200_SM, redshift_z, load_vars_dict, image_size_pixe
341328
mindist = utils.arcmin_to_Mpc(pixel_size_arcmin*0.1, redshift_z, load_vars_dict['cosmo'])
342329
R = np.maximum(mindist, np.sqrt(X[:, None]**2 + X[None, :]**2).flatten())
343330

344-
cy = Pe_to_y(profile, R, M200_SM, redshift_z, load_vars_dict, alpha = alpha, gamma = gamma, R200_Mpc = R200_Mpc,
345-
Rmaxy = Rmaxy) #
331+
cy = Pe_to_y(profile, R, M200_SM, redshift_z, load_vars_dict, alpha = alpha, gamma = gamma, R200_Mpc = R200_Mpc) #
346332
# evaluate compton-y for each
347333
# neccesary radius
348334

@@ -366,7 +352,7 @@ def _make_y_submap(profile, M200_SM, redshift_z, load_vars_dict, image_size_pixe
366352

367353
def generate_y_submap(M200_SM, redshift_z, profile = "Battaglia2012",
368354
image_size_pixels = None, pixel_size_arcmin = None, load_vars_dict = None, alpha = 1.0, gamma = -0.3,
369-
R200_Mpc = None, Rmaxy = None):
355+
R200_Mpc = None):
370356
'''
371357
Converts from an electron pressure profile to a compton-y profile,
372358
integrates over line of sight from -1 to 1 Mpc relative to center.
@@ -387,6 +373,10 @@ def generate_y_submap(M200_SM, redshift_z, profile = "Battaglia2012",
387373
load_vars_dict: dict
388374
result of running the load_vars() function, which includes a dictionary of cosmological and experimental
389375
parameters
376+
alpha: float
377+
variable fixed by Battaglia et al 2012 to 1.0
378+
gamma: float
379+
variable fixed by Battaglia et al 2012 to -0.3
390380
R200_Mpc: None or float
391381
if None, will calculate the radius that corresponds to the mass M200, the redshift redshift_z,
392382
and the cosmology contained in load_vars_dict
@@ -406,7 +396,7 @@ def generate_y_submap(M200_SM, redshift_z, profile = "Battaglia2012",
406396

407397
y_map = _make_y_submap(profile, M200_SM, redshift_z, load_vars_dict,
408398
image_size_pixels, pixel_size_arcmin,
409-
alpha = alpha, gamma = gamma, R200_Mpc = R200_Mpc, Rmaxy = Rmaxy)
399+
alpha = alpha, gamma = gamma, R200_Mpc = R200_Mpc)
410400

411401
return y_map
412402

@@ -421,6 +411,9 @@ def get_r200_angsize_and_c200(M200_SM, redshift_z, load_vars_dict, angsize_densi
421411
load_vars_dict: dict
422412
must contain 'cosmo' (a FlatLambaCDM instance describing the background cosmology),
423413
'sigma8' (float, around 0.8), and 'ns' (float, around 0.96)
414+
angsize_density: None or str
415+
density measure at which to calculate the angular size, if desired. If `None`, will not
416+
calculate an angular size. Otherwise, use a valid choice as specified in `colossus.halo.mass_adv`
424417
425418
Returns:
426419
-------

deepszsim/noise.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,12 @@ def generate_noise_map(image_size, noise_level, pix_size):
99
Generates a white noise map based on the noise level and beam size.
1010
1111
Args:
12-
image_size (int): Size of the noise map (N x N).
13-
noise_level (float): Noise level of the survey.
12+
image_size: int
13+
Size of the noise map (N x N).
14+
noise_level: float
15+
Noise level of the survey.
16+
pix_size: int
17+
size of pixels in arcminutes
1418
1519
Returns:
1620
ndarray: Noise map.

deepszsim/simclusters.py

+7-8
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
class simulate_clusters:
1212
def __init__(self, M200 = None, redshift_z = None, num_halos = None, halo_params_dict = None,
13-
R200_Mpc = None, Rmaxy = None, profile = "Battaglia2012",
13+
R200_Mpc = None, profile = "Battaglia2012",
1414
image_size_pixels = None, image_size_arcmin = None, pixel_size_arcmin = None,
1515
alpha = 1.0, gamma = -0.3,
1616
load_vars_yaml = os.path.join(os.path.dirname(__file__), 'Settings', 'inputdata.yaml'),
@@ -19,9 +19,9 @@ def __init__(self, M200 = None, redshift_z = None, num_halos = None, halo_params
1919
"""
2020
Parameters
2121
----------
22-
M200_dist: float or array-like of float
22+
M200: float or array-like of float
2323
the mass contained within R200 in solar masses (same length as z_dist)
24-
z_dist: float or array-like of float
24+
redshift_z: float or array-like of float
2525
the redshift of the cluster (unitless) (same length as M200_dist)
2626
num_halos: None or int
2727
number of halos to simulate if none supplied
@@ -47,6 +47,8 @@ def __init__(self, M200 = None, redshift_z = None, num_halos = None, halo_params
4747
path to yaml file with params
4848
seed: None or int
4949
random seed value to sample with
50+
tqverb: bool
51+
whether or not to display tqdm progress bar while making T maps
5052
"""
5153

5254
if (M200 is not None) and (redshift_z is not None):
@@ -98,8 +100,6 @@ def __init__(self, M200 = None, redshift_z = None, num_halos = None, halo_params
98100
angsize_density = '500c')[1:3]
99101
for i in range(self._size)]).T
100102

101-
self.Rmaxy = Rmaxy
102-
103103
self.id_list = [
104104
str(self.M200[i])[:5] + str(self.redshift_z[i] * 100)[:2] + str(self._rng.integers(10**6)).zfill(6)
105105
for i in range(self._size)]
@@ -112,7 +112,6 @@ def __init__(self, M200 = None, redshift_z = None, num_halos = None, halo_params
112112

113113
def get_y_maps(self):
114114
"""
115-
116115
Returns
117116
-------
118117
np.ndarray(float)
@@ -125,14 +124,12 @@ def get_y_maps(self):
125124
self.y_maps = np.array([make_sz_cluster.generate_y_submap(self.M200[i],
126125
self.redshift_z[i],
127126
R200_Mpc = self.R200_Mpc[i],
128-
Rmaxy = self.Rmaxy,
129127
load_vars_dict = self.vars)
130128
for i in tqdm(range(self._size), disable = (not self.tqverb))])
131129
return self.y_maps
132130

133131
def get_dT_maps(self):
134132
"""
135-
136133
Returns
137134
-------
138135
np.ndarray(float)
@@ -153,6 +150,8 @@ def get_T_maps(self, add_CMB = True, returnval = False):
153150
----------
154151
add_CMB: bool
155152
whether or not to include the CMB contribution to the final map
153+
returnval: bool
154+
whether or not to return the T maps themselves or simply update internal attribute
156155
157156
Returns
158157
-------

0 commit comments

Comments
 (0)