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

Breaking change in separation_from()? #414

Closed
lucabaldini opened this issue Jul 25, 2020 · 4 comments
Closed

Breaking change in separation_from()? #414

lucabaldini opened this issue Jul 25, 2020 · 4 comments
Assignees

Comments

@lucabaldini
Copy link

Hi Brandon---abusing of your patience again.

In skyfield 1.20 I used to be able to do pos.separation_from(target_pos), where pos is holding an array of position at different times and target_pos is a fixed (scalar) position. Apparently this isn't possible anymore, and I get a ValueError from angle_between() because the two operands cannot be broadcast together.

Glancing through the commits, I believe this is the relevant one
edd7954
i.e., you got rid of the magic that made the broadcast work.

This is not necessarily a problem in skyfield, and I think I can find my way around it, but I have two questions:

  1. is the new behavior intended?
  2. do you have specific suggestions about how I would support my code against different skyfield versions?

Thanks in advance and keep up with your amazing work!
Luca

@brandon-rhodes brandon-rhodes self-assigned this Jul 25, 2020
@brandon-rhodes
Copy link
Member

  1. is the new behavior intended?

No, my intention was not to deliberately break a use case — but as there were, alas, no tests for separation_from() in the case of two angles with different NumPy shapes, I did not know about the change in behavior.

  1. do you have specific suggestions about how I would support my code against different skyfield versions?

No. In general, working code against anything — including Python itself — can only be maintained by specifying exact versions of what you depend on. So depending on a specific version of Skyfield is recommended. Skyfield itself, it turns out, can be sensitive to things like the NumPy version someone has installed, and it has been tricky to make sure I only use NumPy features that work against all NumPy versions someone might be using!

Thanks in advance and keep up with your amazing work!

Thanks for the encouragement!

I'll see about getting separation_from() fixed and getting a test case written.

The topic, by the way, of vectors of different broadcast dimensions is a big one that I'm hoping to tackle soon, so that folks can do things like have n dates and m comets and get all combinations computed at once!

@lucabaldini
Copy link
Author

Thanks---makes perfect sense.

Luca

@brandon-rhodes
Copy link
Member

There! I think I've solved it by adding a bit more logic. Could you try:

pip install https://github.com/skyfielders/python-skyfield/archive/master.zip

— and see if the issue is now fixed for you?

@brandon-rhodes
Copy link
Member

I have just released Skyfield 1.26, which includes this fix. Thanks again for letting me know!

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

2 participants