Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

List of stars #304

Closed
Bernmeister opened this issue Dec 12, 2019 · 3 comments
Closed

List of stars #304

Bernmeister opened this issue Dec 12, 2019 · 3 comments

Comments

@Bernmeister
Copy link

Bernmeister commented Dec 12, 2019

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 #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).

@brandon-rhodes
Copy link
Member

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?

@Bernmeister
Copy link
Author

Descriptive/readability beats clunky!

brandon-rhodes added a commit that referenced this issue Sep 24, 2020
This old experimental `NamedStar` API from 2015, which was never
documented, is now broken because the Hipparcos catalog is not (for the
moment) being downloaded in compressed form (see #454).  Rather than
delay today’s release to fix `NamedStar`, let’s remove it.

This is a dicey and uncharacteristic decision for me.  I usually pride
myself on not breaking anything that appears in a file like `api.py` and
that someone might have started using through their own research of the
code.  But in this case, with the function marked as deprecated for
several years, I am going to chance it.

Thanks to the original author, though, as the experiment led eventually
to the modern approach of loading stars using a Pandas Dataframe!

The actual dictionary of named stars is retained, per promises in #304.
@EricDuminil
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants