astropy / astropy/astropy

Add shortcut to get all component names from a coordinate object

Open
#8,373 1 comment 0 reactions 0 assignees View on GitHub
coordinates Feature Request
Dominant language
Python
Stars
5.3k
Forks
2.2k
Avg merge
1d 19h
Merged PRs (30d)
75

Description

Lately, I've had a few use cases where I need to grab all (6 in my case) of the position and velocity components off of a frame or SkyCoord instance. The code to do this is only a few lines, but many characters! So I'm wondering what you think about adding a convenience property that does something like:

```python
@property
def component_names(self):
names = list(self.get_representation_component_names().keys())

for key in self.data.differentials:
names += list(self.get_representation_component_names(key).keys())

return names
```

cc @mhvk @eteq

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the Frame and SkyCoord entry points, the existing get_representation_component_names() method, and the data.differentials access shown in the issue. Done means a convenience component_names property returns the position and differential component names for coordinate objects; no file or test is named, so those still need to be located.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.