Skip to content

Should frames and coordinates have a distance atttribute? #11114

Closed

Description

@mhvk

Right now, they only have it if their representation is spherical, but it would seem generally useful.

A side benefit would be that this new property could guarantee a Distance instance, thus removing the need to explicitly set anything with units of length in SphericalRepresentation to a distance.

Activity

  1. astrojuanlu commented on Dec 1, 2020

    @astrojuanlu
    Member

    If I understand correctly, you suggest moving the validation of Distance from SphericalRepresentation to BaseCoordinateFrame and SkyCoord somehow?

  2. mhvk commented on Dec 1, 2020

    @mhvk
    ContributorAuthor

    Even now the only real validation it does is checking values are not negative, so I'm not sure how much we lose there.

    My proposal was mostly for the output side: right now, you can easily do frame.distance.kpc and having a distance property would mean this remains true even if the underlying SphericalRepresentation has a Quantity for the distance.

  3. FelipeMeiga commented on May 20, 2025

    @FelipeMeiga

    Hi, im new to the project and would like to contribute, can i work on this issue? Do you guys have a preferred solution to this?

  4. ayshih commented on May 21, 2025

    @ayshih
    Contributor

    I'll point out that some SunPy frames rename that spherical component to radius. So, I wonder:

    • When using a spherical representation, would .distance be available in addition to .radius?
    • When not using a spherical representation, would .distance be available or .radius?
  5. mhvk commented on May 21, 2025

    @mhvk
    ContributorAuthor

    Hmm, I had forgotten I raised this issue -- @FelipeMeiga - thanks for reviving it!. Looking at it again, I am not really sure it was a good idea in the first place -- the present system is at least consistent in just making the attributes of the representation available, and @ayshih's comment makes clear that even .distance is not that unique a name. So, let me just close the issue.

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

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions