Skip to content

Skycoord __getitem__ not being applied to frame attributes #5743

@dmopalmer

Description

@dmopalmer

I have a bunch of observations of the same object at different times (e.g. for an asteroid). According to the SkyCoord documentation
Inputs may be scalars or lists/tuples/arrays, yielding scalar or array coordinates (can be checked via SkyCoord.isscalar).

So I assumed that I could have a coordinate array with the ra,dec and obstime inputs being lists:

path=SkyCoord([5,10],[20,30],unit=u.deg,obstime=['2017-01-01T00:00','2017-01-01T00:10'])

This initially seems to work:

In[14]: for i in range(len(path)):
...         print(path.ra[i],path.dec[i],path.obstime[i])
... 
5d00m00s 20d00m00s 2017-01-01T00:00
10d00m00s 30d00m00s 2017-01-01T00:10

but it actually doesn't

In[15]: print(path[0].obstime)
['2017-01-01T00:00', '2017-01-01T00:10']

And things can go bad in other ways. The conclusion is that you can't have multiple obstimes in an array coordinate.

So to clarify the documentation, I suggest adding the word:
**Coordinate** inputs may be scalars or lists/tuples/arrays, yielding scalar or array coordinates (can be checked via SkyCoord.isscalar).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions