Skip to content

Commit

Permalink
Fix Returns in docstrings (I think entered in #357) (#373)
Browse files Browse the repository at this point in the history
  • Loading branch information
paddyroddy authored Oct 18, 2024
1 parent c020f18 commit 0c39930
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 61 deletions.
44 changes: 13 additions & 31 deletions glass/observations.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ def vmap_galactic_ecliptic(
the galactic and ecliptic planes. The location of the stripes is set with
optional parameters.
Returns a HEALPix :term:`visibility map`.
Parameters
----------
nside:
Expand All @@ -59,11 +61,6 @@ def vmap_galactic_ecliptic(
ecliptic:
The location of the ecliptic plane in the respective coordinate system.
Returns
-------
vis:
A HEALPix :term:`visibility map`.
Raises
------
TypeError
Expand Down Expand Up @@ -100,6 +97,8 @@ def gaussian_nz(
If ``mean`` or ``sigma`` are array_like, their axes will be the leading
axes of the redshift distribution.
Returns the redshift distribution at the given ``z`` values.
Parameters
----------
z:
Expand All @@ -111,11 +110,6 @@ def gaussian_nz(
norm:
If given, the normalisation of the distribution.
Returns
-------
nz:
Redshift distribution at the given ``z`` values.
"""
mean = np.reshape(mean, np.shape(mean) + (1,) * np.ndim(z))
sigma = np.reshape(sigma, np.shape(sigma) + (1,) * np.ndim(z))
Expand All @@ -142,6 +136,8 @@ def smail_nz(
The redshift follows the Smail et al. [1] redshift distribution.
Returns the redshift distribution at the given ``z`` values.
Parameters
----------
z:
Expand All @@ -155,11 +151,6 @@ def smail_nz(
norm:
If given, the normalisation of the distribution.
Returns
-------
pz:
Redshift distribution at the given ``z`` values.
Notes
-----
The probability distribution function :math:`p(z)` for redshift :math:`z`
Expand Down Expand Up @@ -204,6 +195,8 @@ def fixed_zbins(
This function creates contiguous tomographic redshift bins of fixed size.
It takes either the number or size of the bins.
Returns a list of redshift bin edges.
Parameters
----------
zmin:
Expand All @@ -215,11 +208,6 @@ def fixed_zbins(
dz:
Size of redshift bin. Only one of ``nbins`` and ``dz`` can be given.
Returns
-------
zbins:
List of redshift bin edges.
"""
if nbins is not None and dz is None:
zbinedges = np.linspace(zmin, zmax, nbins + 1)
Expand All @@ -243,6 +231,8 @@ def equal_dens_zbins(
This function subdivides a source redshift distribution into ``nbins``
tomographic redshift bins with equal density.
Returns a list of redshift bin edges.
Parameters
----------
z:
Expand All @@ -252,11 +242,6 @@ def equal_dens_zbins(
nbins:
Number of redshift bins.
Returns
-------
zbins:
List of redshift bin edges.
"""
# compute the normalised cumulative distribution function
# first compute the cumulative integral (by trapezoidal rule)
Expand Down Expand Up @@ -285,6 +270,9 @@ def tomo_nz_gausserr(
standard deviation of the Gaussian depends on redshift and is given by
``sigma(z) = sigma_0*(1 + z)``.
Returns the tomographic redshift bins convolved with a gaussian error.
Array has a shape (nbins, len(z))
Parameters
----------
z:
Expand All @@ -296,12 +284,6 @@ def tomo_nz_gausserr(
zbins:
List of redshift bin edges.
Returns
-------
binned_nz:
Tomographic redshift bins convolved with a gaussian error.
Array has a shape (nbins, len(z))
See Also
--------
equal_dens_zbins:
Expand Down
14 changes: 4 additions & 10 deletions glass/points.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ def effective_bias(z, bz, w): # type: ignore[no-untyped-def]
and computes an effective bias parameter :math:`\bar{b}` for a
given window function :math:`w(z)`.
Returns the effective bias parameter for the window.
Parameters
----------
z:
Expand All @@ -54,11 +56,6 @@ def effective_bias(z, bz, w): # type: ignore[no-untyped-def]
w:
The radial window function :math:`w(z)`.
Returns
-------
beff:
Effective bias parameter for the window.
Notes
-----
The effective bias parameter :math:`\bar{b}` is computed using the
Expand Down Expand Up @@ -313,6 +310,8 @@ def position_weights(densities, bias=None): # type: ignore[no-untyped-def]
redshift distribution and bias factor :math:`n(z) \, b(z)` for the
discretised shells.
Returns the relative weight of each shell for angular clustering.
Parameters
----------
densities:
Expand All @@ -321,11 +320,6 @@ def position_weights(densities, bias=None): # type: ignore[no-untyped-def]
bias:
Value or values of the linear bias parameter for each shell.
Returns
-------
weights:
Relative weight of each shell for angular clustering.
"""
# bring densities and bias into the same shape
if bias is not None:
Expand Down
28 changes: 8 additions & 20 deletions glass/shapes.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ def triaxial_axis_ratio(zeta, xi, size=None, *, rng=None): # type: ignore[no-un
Given the two axis ratios `1 >= zeta >= xi` of a randomly oriented triaxial
ellipsoid, computes the axis ratio `q` of the projection.
Returns the axis ratio of the randomly projected ellipsoid.
Parameters
----------
zeta:
Expand All @@ -49,11 +51,6 @@ def triaxial_axis_ratio(zeta, xi, size=None, *, rng=None): # type: ignore[no-un
rng:
Random number generator. If not given, a default RNG will be used.
Returns
-------
q:
Axis ratio of the randomly projected ellipsoid.
Notes
-----
See equations (11) and (12) in [1] for details.
Expand Down Expand Up @@ -106,6 +103,8 @@ def ellipticity_ryden04(mu, sigma, gamma, sigma_gamma, size=None, *, rng=None):
standard deviation :math:`\sigma_\gamma` [2]. Both distributions are
truncated to produce ratios in the range 0 to 1 using rejection sampling.
Returns an array of :term:`ellipticity` from projected axis ratios.
Parameters
----------
mu:
Expand All @@ -121,11 +120,6 @@ def ellipticity_ryden04(mu, sigma, gamma, sigma_gamma, size=None, *, rng=None):
rng:
Random number generator. If not given, a default RNG will be used.
Returns
-------
eps:
Array of :term:`ellipticity` from projected axis ratios.
References
----------
* [1] Ryden B. S., 2004, ApJ, 601, 214.
Expand Down Expand Up @@ -186,6 +180,8 @@ def ellipticity_gaussian(
this function with too large values of ``sigma``, or the sampling
will become inefficient.
Returns an array of galaxy :term:`ellipticity`.
Parameters
----------
count:
Expand All @@ -195,11 +191,6 @@ def ellipticity_gaussian(
rng:
Random number generator. If not given, a default RNG is used.
Returns
-------
eps:
Array of galaxy :term:`ellipticity`.
"""
# default RNG if not provided
if rng is None:
Expand Down Expand Up @@ -240,6 +231,8 @@ def ellipticity_intnorm(
The ellipticities are sampled from an intrinsic normal distribution
with standard deviation ``sigma`` for each component.
Returns an array of galaxy :term:`ellipticity`.
Parameters
----------
count:
Expand All @@ -249,11 +242,6 @@ def ellipticity_intnorm(
rng:
Random number generator. If not given, a default RNG is used.
Returns
-------
eps:
Array of galaxy :term:`ellipticity`.
"""
# default RNG if not provided
if rng is None:
Expand Down

0 comments on commit 0c39930

Please sign in to comment.