8000 Longitude.std() does not drop to Angle · Issue #10245 · astropy/astropy · GitHub
[go: up one dir, main page]

Skip to content

Longitude.std() does not drop to Angle #10245

@mhvk

Description

@mhvk

For Longitude and Latitude, the intent is that any arithmetic operation drops them back to Angle, since, e.g., the standard deviation of a longitude is not a longitude anymore (with wrapping making little sense). But:

from astropy.coordinates import Longitude
import numpy as np
l = Longitude(np.arange(10.), 'deg')
l.std()
# <Longitude 2.87228132 deg>

The method -> _wrap_function -> _result_as_quantity -> _new_view path bypasses _no_angle_subclass in __array_ufunc__. It will need some careful thought about how to proceed.

(Found by @astrofrog while trying to implement SpectralQuantity.)

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

      0