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

fix(time): Make Star.names iterable in skyfield_star_from_ra_dec #270

Merged
merged 1 commit into from
Jul 24, 2024

Conversation

ketiltrout
Copy link
Member

The skyfield documentation is poor, but I think the intention is that the Star.names attribute is meant to be iterable. The skyfield code doesn't reference Star.names at all, and there's no documentation on the meaning of the attribute (or any of the parameters of Star.__init__), so it's very much unclear.

The default value for Star.names is an empty tuple. Probably any (non-str) iterable would be reasonable.

This changes skyfield_star_from_ra_dec to convert a str passed as name into a single-element tuple when assigning it to Star.names, and also updates the docstring to indicate that a tuple or list of names is an acceptable value for the name parameter.

@ketiltrout ketiltrout requested a review from ljgray July 24, 2024 18:26
Copy link
Contributor

@ljgray ljgray left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think these changes are fine. I'm not 100% clear on what skyfield intends here - is the idea to have a single body which can have multiple names?

The skyfield documentation is poor, but I think the intention is
that the `Star.names` attribute is meant to be iterable.  The
skyfield code doesn't reference `Star.names` at all, and there's
no documentation on the meaning of the attribute (or any of the
parameters of `Star.__init__`), so it's very much unclear.

The default value for `Star.names` is an empty tuple.  Probably
any (non-`str`) iterable would be reasonable.

This changes `skyfield_star_from_ra_dec` to convert a `str` passed
as `name` into a single-element tuple when assigning it to
`Star.names`, and also updates the docstring to indicate that a
tuple or list of names is an acceptable value for the `name`
parameter.
@ketiltrout
Copy link
Member Author

I'm not 100% clear on what skyfield intends here

I'm with you here. Skyfield needs better docs, but my guess is it's meant to handle the fact that stellar bodies all have multiple names. e.g. there's 50-ish alternate names listed for Cas-A in our own source catalog in ch_util.

@ketiltrout ketiltrout requested a review from rikvl July 24, 2024 18:43
@ketiltrout
Copy link
Member Author

This comes out of me thinking about this old ch_util PR: chime-experiment/ch_util#24

@ketiltrout ketiltrout merged commit 0123612 into master Jul 24, 2024
5 checks passed
@ketiltrout ketiltrout deleted the ssfrd_name branch July 24, 2024 18:48
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

Successfully merging this pull request may close these issues.

2 participants