Conversation
@eteq - congratulations on getting this and APE5 out! From my 10 minute skim this morning it looks great and I had only a couple of minor questions, but I'm sure there will be more as the discussion gets rolling. |
coords.SphericalRepresentation(lat=[5, 6]*u.deg, lon=[8, 9]*u.hour, distance=[10, 11, 12]*u.kpc) # distance, lat, and lon must match | ||
with raises(ValueError): | ||
coords.SphericalRepresentation(lat=[5, 6]*u.deg, lon=[8, 9, 10]*u.hour, distance=[10, 11]*u.kpc) # distance, lat, and lon must match | ||
c2 = coords.SphericalRepresentation(lat=[5, 6]*u.deg, lon=[8, 9]*u.hour, distance=10*u.kpc) # if distance is a scalar, assume that's meant for all the angles |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This broadcasting of distance
is good. One might go further treat all the inputs lat
, lon
and distance
on an equal basis and broadcast them all to the highest common shape. (And raise an exception where this isn't possible). Having one common direction and several distances is not an outlandish scenario, but in any case this is a minor point.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A very good point - that should be trivial to implement with np.broadcast_arrays
. Will add a note about this in the version I'll push up in a bit
@eteq - I will review this over the next couple of days, but just a minor esthetic request - some of the lines are very long, could you space it out more vertically and include the comments maybe before the lines rather than inline (since the code lines are already long). |
with raises(ValueError): | ||
coords.SphericalRepresentation('5:10:20.52 +23:23:23.5') # this is ambiguous so it fails | ||
|
||
#a `store_as` option is important for some cases - see astropy/astropy#1421 for justification |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor point, but this is included in the string-input option block, but store_as
is a different question. In fact I get the impression this is not a decision, but instead an illustration of a new keyword arg store_as
that definitely has a need.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I put it in the option block because the idea is that you don't necessarily need it if Representation
s don't do any string parsing beyond what's in Angle
. The key point is that Representation
s accept normal angle objects. That is, the equivalent, with no need for store_as
is:
c2 = coords.SphericalRepresentation(Longitude('5:10:20.52', u.hourangle).to(u.radian), Latitude('+23:23:23.5', u.degree).to(u.radian))
Or do you (or @mdboom) still think store_as
is needed in this case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can see how store_as
might be more convenient in some cases, but it doesn't seem strictly necessary. Despite usually being on the side of "only one way to do it", I think in this case, we should have a store_as
here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, I'm leave this in but with a non string-related example.
I don't see any specifications of the class signatures. In particular, will there be class-specific args like It makes me unhappy to see function signatures with too much overloading, e.g. having a first argument named |
I'll try to work my way through comments soon, but one logistical item: @astrofrog, I see your point about shorter lines, but if I do that now, it will hide any of the inline comments on those lines. So I can either do that while going through existing comments and have you look over after that, or you can give comments on the current version and I can clean up the lines after you've looked through these - either way is fine with me. |
c2 = coords.SphericalRepresentation(lat=[5, 6]*u.deg, lon=[8, 9, 10]*u.hour) | ||
|
||
# a `store_as` option is important for some cases - this is basically a | ||
# convinience to make it easier to combine inhomogenous angle array or string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: convenience
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are a few more below, so maybe just search and replace.
@eteq - apart from my comments above, one last thing I'd like to see done if possible is to improve PEP8-compliance of this document. I'm probably obsessive, but I find it hard(er) to read comments that start |
@eteq - finally had a look, and overall I think it is great! I added some comments, one in part asking whether this would resolve astropy/astropy#1850, the other about the need for For the representation classes, I would argue for having an explicit initialiser, e.g., Finally, in the end we will need to add proper motions. While we should not do that here, it may be good to think whether the current API would allow adding them. My sense is that it does, that for each it will be possible to add a p.s. With this implemented, it should also be trivial to adapt astropy/astropy#1928 and have an |
@mhvk If you're going to add proper motions, then it should also support also radial velocities :). I don't know how I feel about having kinematic information in the same object -- maybe someone else has though about this more but we should probably have a discussion at some point about how to best handle this. I do agree with your point that it shouldn't hold up this PR though! |
Proper motion is also important to include in |
@adrn - indeed, the 3rd value of the proper motion tuple would have to have to be in |
@eteq - let me know once you've had a chance to address the various comments above, and we can then send it out to the list for a final coupe of days of review before we merge. |
Sorry this has been languishing for the last week. I'll go through and fix up the typos/PEP8-compliance @astrofrog pointed once the questions above have been answered, as some of those require a bit more clarification. On the question of PMs and RVs (@mhvk, @adrn, and @astrofrog): I envisioned those be adding later, just as @mhvk said in his last comment. (I'm also thinking about a quite different approach where PM/RV objects generate low-level classes instead of being contained within them). But I don't want to get mired in that discussion right now unless it's crucial - that is, if the current API will actually prevent PMs and RVs from getting added later. @astrofrog - hopefully another email to the list won't prompt another round of comments and delay things further... But I suppose you're right it should be done ;) @mhvk - I agree this will make astropy/astropy#1928 quite a bit easier, but I actually think we may not want to do it right away: once this is implemented, the road is clear to adopt the IAU2000 coordinate stack, and the "lowest" layer of that is ITRS, a much more formal/accurate way of defining |
@eteq - apart from the question of strictness in the initializer, I think this is all set. |
Alright, I think I've got almost everything in the commit I just pushed up, but a few small items remain. @astrofrog - if you want to send the message, or just merge after a day or so, you might do so because these are fairly minor:
|
@eteq - here are my comments:
Otherwise this looks good to go! |
Comments on the comments:
|
@mhvk @astrofrog - To explain On |
👍 to both suggestions! |
Alright, I've taken care of both of those, although of course I can revert them if anyone has objections. |
I for one am 👍 merge. |
No objections have been raised, and this looks good, so merging! |
Woop woop!! |
This is a re-working of the coordinates API intended for v0.4 . It is written to be a "compromise" API to address a variety of problems and suggestions that have come up since coordinates was introduced in v0.2 . It is a companion to APE5, which will be submitted shortly.
Note that there are a number of places that have the text
OPTION
- these are items where it was not clear if an optional addition is worthwhile or not, so feedback on those, in particular, would be helpful. While they are mostly relatively minor, there is one possibly major architecture choice: whether parsing of single strings with both ra/dec should be included in the low-level classes, or just the high-level class. See the document for details on this, but it's definitely a decision that needs to be made.