Skip to content

Consider adding __array__ method to TimeBase to return value? #10859

@taldcroft

Description

@taldcroft

Description

From this slack question, I was wondering about a protocol for Time that np.array(tm) or np.asarray(tm) would return tm.value. In theory this could apply to SkyCoord. Currently in both cases doing np.array(..) returns an array of Time or SkyCoord objects, which in practice is rarely what you wanted.

I guess one snag is if the Time value has missing values and tm.value returns a MaskedArray.

There is also the original suggestion of adding a .value attribute to Column to make it more like Time and Quantity. Again this could in theory apply to SkyCoord, where it would return e.g. an N x 3 np.array.

This is definitely a question for @mhvk!

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