Skip to content

angular_diameter_distance documents z1 while the parameter is z #20206

Closed

Description

@darkdi

Following up on #20205, where @pllim asked me to open one issue per remaining problem.

Cosmology.angular_diameter_distance heads its Parameters section with z1, z2:

def angular_diameter_distance(self, z: _InputT, z2: _InputT | None = None, /) -> u.Quantity:
    """...

    Parameters
    ----------
    z1, z2 : Quantity-like ['redshift'], array-like
        Input redshifts. If one argument ``z`` is given, the distance :math:`d_A(0, z)`
        is returned. If two arguments ``z1, z2`` are given, ...

The first parameter is z, not z1. Since both are positional-only, nothing breaks at call time, but the rendered signature and the section heading disagree, and numpydoc-style tooling that matches names will not pair the heading with the parameter.

I did not change it in the PR because the prose underneath deliberately explains the one-argument and two-argument forms in terms of z, z1 and z2, so renaming the heading to z, z2 may lose that. Two options I can see:

  • head the section z, z2 and keep the existing prose, which already spells out that a single argument is z;
  • leave it as is, if the current wording is considered clearer than the name match.

Happy to send a PR for either, or to leave it alone.

Found with a static checker comparing numpydoc parameter names against the signature below them; each finding was read by hand.

Activity

  1. pllim commented on Aug 5, 2026

    @pllim
    Member

    @nstarman , can you please advise? Thanks!

  2. nstarman commented on Aug 6, 2026

    @nstarman
    Member

    Thanks for the PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions