Closed Bernmeister closed 4 years ago
My guess is that named_star_dict
sticks around. I always prefer to wrap official sources of data where they exist, but in this case — as you note — stable sources of data seem hard to find, and the amount of data here is so small and so unlikely to change — so the maintenance burden of having a copy of the data inline in Skyfield will hopefully be small.
I might delete the comment now that the Wikipedia entry is gone, thanks for letting me know the link was out of date.
The name named_star_dict
is pretty clunky but it’s at least descriptive?
Descriptive/readability beats clunky!
Google brought me here, while searching for a way to get star names in skyfield.
Just in case it could help someone else, here's a way to get common star names in the Hipparcos dataframe:
from skyfield.api import load
from skyfield.data import hipparcos
from skyfield.named_stars import named_star_dict
# Load Hipparcos data
with load.open(hipparcos.URL) as f:
df = hipparcos.load_dataframe(f)
hip_to_name = {v: k for k, v in named_star_dict.items()}
def get_star_name(hip):
return hip_to_name.get(hip, f"HIP{hip}")
df["name"] = df.index.map(get_star_name)
df
now contains a name
column.
Here's a way to display the 20 brightest stars:
print(df.sort_values("magnitude")[:20][["magnitude", "name"]])
It outputs:
magnitude name
hip
32349 -1.44 Sirius
30438 -0.62 Canopus
69673 -0.05 Arcturus
71683 -0.01 Toliman
91262 0.03 Vega
24608 0.08 Capella
24436 0.18 Rigel
37279 0.40 Procyon
7588 0.45 Achernar
27989 0.45 Betelgeuse
68702 0.61 Hadar
97649 0.76 Altair
60718 0.77 Acrux
21421 0.87 Aldebaran
65474 0.98 Spica
80763 1.06 Antares
37826 1.16 Pollux
113368 1.17 Fomalhaut
102098 1.25 Deneb
62434 1.25 Mimosa
In the file
named_stars.py
, there is a list of stars but the function at the end is deprecated. Is it safe to use the list of stars (not the function) or will it eventually be removed? You mentioned in https://github.com/skyfielders/python-skyfield/issues/174 that you might look at the list and keep it.In my application, I want to provide a list of typical/named/visible stars, similar to that in PyEphem, and the list in
named_stars.py
works well, particularly with the associated HIP (makes it easy to load up the star from the dataframe).Finally, the link mentioned to the list of stars on Wikipedia https://en.wikipedia.org/wiki/List_of_stars_in_the_Hipparcos_Catalogue has been deleted. FWIW I found this older version https://web.archive.org/web/20131012032059/https://en.wikipedia.org/wiki/List_of_stars_in_the_Hipparcos_Catalogue
Edit: I found https://www.cosmos.esa.int/web/hipparcos/common-star-names which may be useful given the missing Wikipedia entry. Note this list contains a duplicate Hipparcos Identifier of 68702 for a star with two common names: Agena and Hadar (the official name is Hadar).