Repository navigation
Dynamic coordinate preferred representation - #2586
Conversation
|
I like this approach. It's simple from a user perspective, and maintains the seperation of representation and frame, while not converting under the hood. |
|
Spherical just got a lot less special... |
|
Some of test failures are (I think) not related to this PR exactly, but something has gotten whacked in configuration. Locally the full test suite passes except a couple of coordinate doctest fails. |
|
If anyone actually tries to look at the code changes, I'd recommend going one commit at a time since there are a lot of somewhat intricate changes. Otherwise the key will be testing, which doesn't exist yet... |
|
@vaticancameos @Cadair - As you have volunteered to help out, I will happily accept PR's on my branch for tests and documentation to support these changes (even if the tests you write are currently failing but should pass). I'll be basically offline all day Sunday, climbing. |
|
What about below for API, i.e. replace One might not like that this is making coordinates quasi-mutable and suggest: I think that the first option (quasi-mutability) is good here because no data are changing and it saves making a copy of the internal data. All that changes is the exterior representation of those coordinates, but it makes the process easier and more transparent for users. |
|
I think the quasi-mutable option is the one to go with too. You've effectively made it so that |
|
You haven't really left much for us to pitch in unless I'm mistaken :D. Is there any part in your mind that remains which you would like me to do? |
|
@vaticancameos @taldcroft mentioned tests and docs earlier. |
|
@vaticancameos Interesting that you think the property option is more natural than the method call. I wouldn't totally agree with that. I think I prefer the property as well. |
|
There was a length gitter discussion today that convinced me this is worth doing. But one high-level comment to leave for @taldcroft here: the code this PR has in So I'm fine with the nested-dict approach here, but I don't think we want all this to be done with private attributes - so dropping the leading underscore would help. I'll try to think a bit more about how to make defining this clearer and leave another comment later. Also note that the |
|
@eteq - Agreed about the messy code in |
|
I noticed infrastructure there to handle a frame with no special representation. I'm pretty sure some of the new code will break in that case, but there are currently no tests that bring this out. I suspect that a frame with no representation will break other parts as well. What was the intended use case? Some code could be simplified if we make the requirement that any frame object stores the data internally as a proper BTW, coordinate tests passed locally (maybe not doc testing, didn't run that). |
|
Known issue: SkyCoord needs a |
|
If I understand then the Without this PR then |
|
SkyCoord |
|
@taldcroft - something seems to now be conflicting in master... can you rebase? |
|
@eteq - I added a possibly-controversial commit 8acef8e just now. Please read the full commit message for explanation. About rebasing, I was planning to hold off until getting more comments. This avoids needless Travis churning for now. I think that this is now feature complete as far as changes to the low-level modules and you can review. There might be some minor tweaks still in SkyCoord. |
|
The only test fail now (on python 2.7) is due to removing Do we just remove this test, or ?? |
|
By the way, I have not touched the variable names with |
|
Just noticed a typo in the 8acef8e commit message. |
|
@eteq - rebased and passing all tests locally. |
|
@taldcroft what else needs doing on this? |
|
@Cadair - we can still use tests as outlined in the discussion for taldcroft#8. I think that in the end I had better write the docs, which I'll do today or tomorrow. That PR on my branch needs rebasing as there has been quite a bit of churn since then. I'd like to propose changing I did already lift a commit from @vaticancameos in a rush to get the doc tests passing just now. |
|
I have argued myself back to leaving |
|
OK, all the representations we built in can now be trivially used in every frame! Yay. 13cdcae and 32e9468 have further detail in the commit messages, please read. Tomorrow will add code to allow |
There was a problem hiding this comment.
Note to self: write tests for this. Every frame has representation_attrs name (it's a base property) so the test is not needed.
|
@taldcroft @vaticancameos and I shall try and get tests done asap. |
|
The change was introduced in taldcroft@ab82474 |
Testing <FrameObject>.representation getter and setter.
Working on SkyCoord initializer tests.
Tested in both spherical and cartesian representations for ICRS. Fixed a little mistake where I'd written icrs.lat instead of icrs.ra, and so on. Added tests for `data` object. Checked whether it remains the same whenever representations are changed. Started work on SkyCoord+Frame initialization tests. Using frame ICRS.
Parameterized the test function with inputs from a list. Dealt with Quantity, list/numpy array and others cases differently. Quantity is iterable, and so, had to make a separate if branch for it.
Decided to place the keyword arg version in a different method even though it is essentially the same.
Used the logic present in _parse_coordinate_arg() to break the string into arguments. Added a _break_string_arg() (need to know if advisable) which captures this logic. Added an if branch for the string arguments. Used Longitude,Latitude classes to wrap over them with unit="deg" (otherwise UnitsError was thrown).
|
This did not work since it doesn't know about that commit even when inside The rebase and amend worked, though required stack overflow and I can't say I'm particularly thrilled with our new sub-repo, it's been a bit of learning curve and I'm still a bit low on that curve. |
|
I don't quite understand why the submodule changed version. @embray, is it possible for the submodule to change what version it's pointing to without explicitly going in it and doing a git pull? |
|
@astrofrog @taldcroft - What commit was the submodule change introduced? I've noticed this a couple times I think when people do something like |
|
I've changed my process recently but I used to never do the |
|
@eteq - which is why |
|
agreed, @astrofrog ! I never use them, but some other people do... @taldcroft - I think |
|
Holy cow, tests finally passed. @eteq - this is really ready for final review. One thing you'll notice is that there is still an underscore on |
|
This is great! @eteq - is it good to go? |
|
I think so... I want to take one last look later tonight, but will merge it if there are no major items. Can always make any remaining items as separate PRs, and merging this will unblock #2620 and one other that @taldcroft wants to do. |
Included some additional minor fixes by @eteq post-PR
|
Alright @taldcroft @astrofrog - merged! I saw a few typos in the docs and just fixed them in a new commit before merging. I've got a couple more significant changes to this, but I'll issue those as separate PRs so as not to gum up the works any further. |
This is a way to allow dynamic preferred representation for coordinates (low-level and high-level). This is a possible way forward for the concerns raised in #2550.
DO NOT MERGE now.
Example: