15
15
.. autofunction:: galaxy_shear
16
16
.. autofunction:: gaussian_phz
17
17
18
- """ # noqa: D205, D400, D415
18
+ """ # noqa: D205, D400
19
19
20
20
from __future__ import annotations
21
21
@@ -45,20 +45,17 @@ def redshifts(
45
45
This function samples *n* redshifts from a distribution that follows
46
46
the given radial window function *w*.
47
47
48
+ Returns random redshifts following the radial window function.
49
+
48
50
Parameters
49
51
----------
50
- n : int or array_like
51
- Number of redshifts to sample. If an array is given, the
52
+ n:
53
+ Number of redshifts to sample. If an array is given, the
52
54
results are concatenated.
53
- w : :class:`~glass.RadialWindow`
55
+ w:
54
56
Radial window function.
55
- rng : :class:`~numpy.random.Generator`, optional
56
- Random number generator. If not given, a default RNG is used.
57
-
58
- Returns
59
- -------
60
- z : array_like
61
- Random redshifts following the radial window function.
57
+ rng:
58
+ Random number generator. If not given, a default RNG is used.
62
59
63
60
"""
64
61
return redshifts_from_nz (n , w .za , w .wa , rng = rng , warn = False )
@@ -77,31 +74,31 @@ def redshifts_from_nz(
77
74
78
75
The function supports sampling from multiple populations of
79
76
redshifts if *count* is an array or if there are additional axes in
80
- the *z* or *nz* arrays. In this case, the shape of *count* and the
77
+ the *z* or *nz* arrays. In this case, the shape of *count* and the
81
78
leading dimensions of *z* and *nz* are broadcast to a common shape,
82
79
and redshifts are sampled independently for each extra dimension.
83
80
The results are concatenated into a flat array.
84
81
82
+ Returns redshifts sampled from the given source distribution. For
83
+ inputs with extra dimensions, returns a flattened 1-D array of
84
+ samples from all populations.
85
+
85
86
Parameters
86
87
----------
87
- count : int or array_like
88
- Number of redshifts to sample. If an array is given, its shape
88
+ count:
89
+ Number of redshifts to sample. If an array is given, its shape
89
90
is broadcast against the leading axes of *z* and *nz*.
90
- z, nz : array_like
91
- Source distribution. Leading axes are broadcast against the
91
+ z:
92
+ Source distribution. Leading axes are broadcast against the
92
93
shape of *count*.
93
- rng : :class:`~numpy.random.Generator`, optional
94
- Random number generator. If not given, a default RNG is used.
95
- warn : bool
94
+ nz:
95
+ Source distribution. Leading axes are broadcast against the
96
+ shape of *count*.
97
+ rng:
98
+ Random number generator. If not given, a default RNG is used.
99
+ warn:
96
100
Throw relevant warnings.
97
101
98
- Returns
99
- -------
100
- redshifts : array_like
101
- Redshifts sampled from the given source distribution. For
102
- inputs with extra dimensions, returns a flattened 1-D array of
103
- samples from all populations.
104
-
105
102
"""
106
103
if warn :
107
104
warnings .warn (
@@ -158,22 +155,26 @@ def galaxy_shear( # noqa: PLR0913
158
155
Takes lensing maps for convergence and shear and produces a lensed
159
156
ellipticity (shear) for each intrinsic galaxy ellipticity.
160
157
158
+ Returns an array of complex-valued observed galaxy shears
159
+ (lensed ellipticities).
160
+
161
161
Parameters
162
162
----------
163
- lon, lat : array_like
164
- Arrays for galaxy longitudes and latitudes.
165
- eps : array_like
163
+ lon:
164
+ Array for galaxy longitudes.
165
+ lat:
166
+ Array for galaxy latitudes.
167
+ eps:
166
168
Array of galaxy :term:`ellipticity`.
167
- kappa, gamma1, gamma2 : array_like
168
- HEALPix maps for convergence and two components of shear.
169
- reduced_shear : bool, optional
170
- If ``False``, galaxy shears are not reduced by the convergence.
171
- Default is ``True``.
172
-
173
- Returns
174
- -------
175
- she : array_like
176
- Array of complex-valued observed galaxy shears (lensed ellipticities).
169
+ kappa:
170
+ HEALPix map for convergence.
171
+ gamma1:
172
+ HEALPix maps for a component of shear.
173
+ gamma2:
174
+ HEALPix maps for a component of shear.
175
+ reduced_shear:
176
+ If ``False``, galaxy shears are not reduced
177
+ by the convergence. Default is ``True``.
177
178
178
179
"""
179
180
nside = healpix .npix2nside (np .broadcast (kappa , gamma1 , gamma2 ).shape [- 1 ])
@@ -218,40 +219,38 @@ def gaussian_phz(
218
219
219
220
A simple toy model of photometric redshift errors that assumes a
220
221
Gaussian error with redshift-dependent standard deviation
221
- :math:`\sigma(z) = (1 + z) \sigma_0` [1]_.
222
+ :math:`\sigma(z) = (1 + z) \sigma_0` [1].
223
+
224
+ Returns photometric redshifts assuming Gaussian errors, of the same
225
+ shape as *z*.
222
226
223
227
Parameters
224
228
----------
225
- z : array_like
229
+ z:
226
230
True redshifts.
227
- sigma_0 : float or array_like
231
+ sigma_0:
228
232
Redshift error in the tomographic binning at zero redshift.
229
- lower, upper : float or array_like, optional
233
+ lower:
230
234
Bounds for the returned photometric redshifts.
231
- rng : :class:`~numpy.random.Generator`, optional
232
- Random number generator. If not given, a default RNG is used.
233
-
234
- Returns
235
- -------
236
- phz : array_like
237
- Photometric redshifts assuming Gaussian errors, of the same
238
- shape as *z*.
235
+ upper:
236
+ Bounds for the returned photometric redshifts.
237
+ rng:
238
+ Random number generator. If not given, a default RNG is used.
239
239
240
240
Warnings
241
241
--------
242
242
The *lower* and *upper* bounds are implemented using plain rejection
243
- sampling from the non-truncated normal distribution. If bounds are
243
+ sampling from the non-truncated normal distribution. If bounds are
244
244
used, they should always contain significant probability mass.
245
245
246
246
See Also
247
247
--------
248
- glass.tomo_nz_gausserr :
249
- Create tomographic redshift distributions assuming the same
250
- model.
248
+ glass.tomo_nz_gausserr:
249
+ Create tomographic redshift distributions assuming the same model.
251
250
252
251
References
253
252
----------
254
- .. [1] Amara A., Réfrégier A., 2007, MNRAS, 381, 1018.
253
+ * [1] Amara A., Réfrégier A., 2007, MNRAS, 381, 1018.
255
254
doi:10.1111/j.1365-2966.2007.12271.x
256
255
257
256
Examples
0 commit comments