Repository navigation
Implementation of APE5 coordinates scheme - #2422
Conversation
|
Question for @astrofrog @Cadair or @mhvk : in c787d4e I had to xfail a few tests that broke when I rebased against master. It appears that some of the |
|
+many on this :D @eteq I know of nothing that should have changed. |
|
I've started to test this, and one thing that doesn't seem to work anymore is: Is there a reason why we can't continue to support this? After all, if the units are unambiguous, we can pass strings: so why not keep the ability to specify the units explicitly? This would help maintain backward-compatibility and is actually quite a handy feature. |
|
@eteq - this will need a rebase following the merging of the APE3 changes. I think the conflicts will be relatively minimal though - I checked beforehand and I could only see a couple of places where a conflict might occur. |
For output I have a function with tests here that you or I could adapt ... but I think this changeset is big enough as is, so 👍 to doing this after this is merged in a separate issue. |
|
@eteq Could you please post the docs online and share a link here? |
|
Is this planned for Astropy 0.4 or will this only be available in 0.5? |
|
I always have to go to the docs to remember how to create coordinate objects. Or maybe casual users are not supposed to use that constructor any more? |
@astrofrog I've been thinking about that too -- I'm in favor of adding the |
|
I'm relatively neutral on what the low-level classes really should support, but I believe that @eteq will say that the APE5 API strongly encourages users to always use the high-level I will say that I was a little surprised at reaching this conclusion despite all the previous discussion, but I've gotten used to the idea, especially being one of the original proponents of the one-class high-level interface. |
|
It's also worth noting that the input interface for |
I'm not convinced that allowing somewhat free form input (i.e. complex catalog identifiers) as an initializer to |
|
I agree that users should make use of the high-level interface in most cases, but I personally still find the following behavior inconsistent: I see several options:
I'll have a think about it! (I guess my main thought about the |
|
@astrofrog @adrn - What @taldcroft said is right: it's by design that the low-level classes are supposed to support a small subset of initialization techniques, and On the more specific question of That's all it would do internally, anyway. So I'm +1 for @astrofrog option 2, and -1 to the others. Note that passing in I'd like to add an option 5, too, though: @astrofrog option 2, but with "compatibility" layers for users of pre-0.4 coordinates, which would work like this: That would be trivial to code up, too, as long as we don't consider that a violation of the feature freeze rule (I'm willing to call it a "bug fix" if the rest of you are...) |
|
Now, for @cdeil's comments/questions:
Unfortunately, it's a lot more work to do the
Just so I understand: what's unclear about that? Is it that you want examples in the docstrings? The typical instatiation would just be: That said, just as you surmised, the recommended "user" route is now
See http://eteq.github.io/astropy/coordinates/index.html#reference-api - that should now have the docs from this branch as of when I left this comment. Note that the narrative docs still need a fair amount of updating, but the API should be right. |
|
(And I'll rebase this once we come to a conclusion on the |
|
@eteq - I agree a compatibility layer is a good idea, but currently I think your suggestion is the wrong way around: because users aren't going to change to use the compat sub-package, only to find a deprecation warning. Also: would not emit a deprecation warning. Technically, it's unambiguous, but we still want people to use This leads me to the following suggestion: For this pull requestWe do not make the frame classes available at the top-level of the we then leave (for 2 versions) the old frames as compatibility layers at the top-level of i.e. any usage of the old coordinate classes to initialize values raises a deprecation warning. This is just a slightly modified version of @eteq's suggestion number 5 - except that the compatibility layer stays where the classes are currently defined, and the 'new' classes are moved to a A bonus is that this separates the compatibility classes from the frame classes - that is, the frame classes in Minor - I would actually suggest renaming Post-0.4Post-0.4 I would like to make the suggestion that we do not allow data to be attached to frames, because there really should only be one way to initialize coordinates, and it would keep a better distinction between |
|
@eteq No, I don't think adding examples to the What is unclear at the moment when typing |
|
@cdeil - I think the current confusion is due to the fact that the frame classes are designed both for users and for internal use, and the features required for internal use (passing e.g. representation or coordinates) are not things users should have to do. One solution for the docstrings is:
So then a docstring would look like: |
|
@astrofrog - If I understand, your suggestion is to mix the old On a question asked much earlier by @eteq, I looked at the |
|
@astrofrog - Hmm... Let me clarify the intent of my idea, first: The compatibility layer is intended to be explicit, because otherwise users won't necessarily know anything changed, and perhaps miss more subtle pieces that have changed. For example, There's one major issue I see with e.g. (And in case it's not apparent, to add to what @taldcroft said, it's a non-starter to actually bring back in old-style All that said, I see your point that this might be a source of many complaints. And maybe these subtleties I'm worrying about aren't relevant for the vast majority of users... So I could be convinced we should go your option (we'll call it option 6 😉) And in that case, I'm 👍 on Any other opinions on this? (I.e.,
No, the low-level frames are intended to be used in that way, as long as it's unambiguous. So that's by design not giving any warnings. The guideline in my head for the low-level classes is that any unambiguous individual component is acceptable, but anything beyond that should instead be an error. So it's primarily a "translation layer" between the representations and the frame-specific mappings to representations (e.g., "ra" = "spherical lon"). Post-0.4I disagree that frame classes should be divorced from the data. I think it's also important for allowing user-created coordinate frames/transforms. We don't want to tell users to subclass (This discussion is moderately relevant for the PR, in that it partially motivates whether or not the frames should be top-level...) |
|
@cdeil - OK, I agree that |
|
@eteq - I see your points, and I'm happy to defer to your judgment. I understand that implementing a full compatibility layer would be a nightmare, so maybe a clean break is needed. One could even simply move the frames out of the top-level so that any old imports break, and users are forced to switch to won't see any warnings at initialization time, even though users are never meant to initialize frames with coordinates. This discussion and the discussion about the docstrings made me realize that the fundamental issue here is that users should now no longer instantiate frames with data (correct?) and should use SkyCoord instead. Initializing with data is something used only internally, correct? If so, then I will leave you with my last option of the day, option 7, after which I will present no more options! This option consists of keeping everything exactly as it is right now, with the exception that initializing frames with data is done via a private class method (or a public one if you do want to keep the option for advanced users to do it). That is, one can only initialize the frames with the frame parameters: and initializing frames with data requires using a class method: with any kwargs passed to the original This then also solves the docstring issue because the This does go back to having a backward-incompatible API, but it will at least be consistently backward-incompatible, in that even I'm going to be on gitter if anyone wants to discuss this option further :) |
|
Some of us (me, @astrofrog, and @adrn) discussed this on gitter (for more detail look in the log there for May 7). We have a plan to move forward: @astrofrog's option 1 + an option 8: the low-level classes will be top-level, but they will only accept The one catch with this is that it may take some effort to re-write |
|
Alright, @astrofrog, I've skipped the relevant doctests. I also just realized an obvious solution to the unicode literals problem: remove the |
|
@astrofrog - The tests are now passing! 🎆 😤 As far as I'm concerned, this is all set to merge, now, but someone else should do the honors! |
|
👏 Just push the button! |
|
All right - let's do this! I gave it one final look over and it's good to go! :) |
Implementation of APE5 coordinates scheme
|
👍 to that!! Nice work everyone! |
|
Woohoo! Do we have a plan for getting some wider community testing of this from astropy-dev or even the astropy list (pre-release stress testing)? I aim to work on docs for SkyCoord this weekend and have something reasonable that people could look at next week. I think we will benefit from at least a week or two of people outside of the coordinates dev group pounding on it. |
|
@taldcroft SunPy have a GSOC student who is going to be adapting this to our uses, so we will be giving it a hammering from the dev perspective, but that will not entirely be in time for 0.4. ping @vaticancameos. |
|
@taldcroft - this is a good point: how about we (you and I) try to get the docs hammered out by the start of next week, and then we can make a post on the astropy list. That still leaves a couple weeks for testing. |
|
@eteq - sounds good. To the extent possible it would be good if you first laid out the overall structure and left SkyCoord-related sections for me, either empty or with material that is marked as NEEDS REWORK. I won't start on this until the weekend to give you a head start. |
|
@taldcroft - sounds like a plan! |
This is the long-awaited overhaul of the coordinates framework to implement APE5.
It's close to the original API proposal, but with some subtle changes - look at
astropy/coordinates/tests/test_api_ape5.pyto see what's actually in here. The only part not yet implemented that was in the original APIis parsing and output of strings likeSDSS J123456.89-012345.6or similar formats (that can be added later). Other than that, the changes are most mild syntax changes that made sense once we got to implementing.The docs still need to be re-written and fleshed out for this, but there's time to do that before release.
And thanks to @adrn @astrofrog @Cadair @mhvk, and @taldcroft for their work on this!