From 0c399301de12b75faa2bc7d7730473d8f1326570 Mon Sep 17 00:00:00 2001 From: "Patrick J. Roddy" Date: Fri, 18 Oct 2024 09:41:38 +0100 Subject: [PATCH] Fix `Returns` in docstrings (I think entered in #357) (#373) --- glass/observations.py | 44 +++++++++++++------------------------------ glass/points.py | 14 ++++---------- glass/shapes.py | 28 ++++++++------------------- 3 files changed, 25 insertions(+), 61 deletions(-) diff --git a/glass/observations.py b/glass/observations.py index 37325470..5e98b146 100644 --- a/glass/observations.py +++ b/glass/observations.py @@ -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: @@ -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 @@ -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: @@ -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)) @@ -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: @@ -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` @@ -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: @@ -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) @@ -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: @@ -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) @@ -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: @@ -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: diff --git a/glass/points.py b/glass/points.py index 1bc397a8..44ee3e05 100644 --- a/glass/points.py +++ b/glass/points.py @@ -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: @@ -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 @@ -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: @@ -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: diff --git a/glass/shapes.py b/glass/shapes.py index d804a157..bf0869cb 100644 --- a/glass/shapes.py +++ b/glass/shapes.py @@ -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: @@ -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. @@ -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: @@ -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. @@ -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: @@ -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: @@ -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: @@ -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: