-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Allow in-place modifications of representations #10210
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
Conversation
5d1ae83 to
6f60fa0
Compare
|
@taldcroft - I think this is ready! Could you review? Especially the stuff related to table integration (i.e., |
taldcroft
left a comment
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 looks great from the table perspective, mostly minor comments.
| return result | ||
|
|
||
|
|
||
| def representation_equal(rep1, rep2): |
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.
Makes me wonder if this should be __eq__ on the class.
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.
Yes, it should be, but I thought to leave that for another PR (#10154??), in particular as I am not quite sure yet what to do with class mismatches.
|
None of this should be considered a blocker for this PR, but there are outstanding issues related to serialization that should either be fixed (as long as you are in the code) or transferred to separate issues: The differentials are still not being serialized at all in a SkyCoord: For a representation in a table the differential is being serialized as an encoded binary numpy instead of getting dropped in as a SerializedColumn. From a quick look we would need a deeper structure for the column name like |
|
Thanks, I had started to notice that something was odd with differentials, but hadn't quite understood what was happening yet, so this is very helpful. p.s. There also seems to be a strange problem with partial name clashes in serialized columns. If I can confirm that, I'll make it a separate issue, since it would need back-porting. |
30705ec to
0b1c18b
Compare
|
@taldcroft - OK, with your fix, I now could get the round-tripping in FITS/HDF5/ECSV to work. I think I also addressed all your comments, except that I couldn't easily get |
0b1c18b to
cc82180
Compare
adrn
left a comment
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.
So far have only had a quick look, but 👍 to the idea! No obvious big comments from first look, and may not have time to do a deeper dive before end of tomorrow...
ae8e4d4 to
dde7305
Compare
|
The failures are due to a strange but clearly temporary ability to fetch Thanks, @adrn and @taldcroft for reviews. @eteq - time to speak up if you disagree with representations becoming settable is now... |
|
I'm seeing the same weird CI problems. |
|
Re: CI -- downgrade doctestplus to 0.5 + pytest 5.3 |
|
@pllim - ah, good to know. Is it now fixed (is it you who restarted circle-ci? I don't seem to have permission myself) |
|
I didn't touch it. 😄 |
I think everyone with write access should have the power for circleCI. But you need to log-in with github to circleCI, and maybe also watch the repo. There should not be any failure any more as part of an upstream hackery I reverted the doctestplus release that was causing the trouble. |
|
Darn, the windows run consistently hangs in |
Try run it with |
…wargs And add test to ensure this doesn't recur.
3aaa7d6 to
d271991
Compare
|
OK, travis is now running (and logging out and back in again to circle-CI meant I could indeed cancel). |
|
And now I have to wait for the travis time-out... I hope this isn't going to take a number of iterations! |
|
Hmm, that didn't help: still get From trying to count tests, I think it is
so I'll go ahead and just try skipping this. This is painful! I hate windows and hard-to-debug stuff due to compiled code! |
d271991 to
27983b5
Compare
|
OK, I'm getting too annoyed and tired for my own good, so leaving this to tomorrow. It was approved already so hopefully this can be treated as "bug fix" (wish I even had a clue why the fast c reader cared about anything I did...) |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
p.s. I don't think remote data failures are related but you should double check. |
|
Wow, @pllim, that was some dedicated sleuthing! Thanks, so much! As you note, the remote-date failures are all unrelated, so I'll go ahead and merge. It must still be friday somewhere... |
|
@mhvk - this PR is breaking my local astropy. I get this from a clean build of astropy with this PR merged, and do not see a problem beforehand. This is with numpy 1.18.1. Slightly OT, but the whole leap second download stuff still seems to be a source of really inscrutable problems. I really think it would be worth something like a config option to say "Don't ever try leap second downloads". I use astropy on mission-critical and non-networked computers, and I don't want it failing on that account. |
|
Re: FutureWarning -- Hmm, why didn't the CI catch it? |
|
Another manifestation: |
|
So the question is if anyone else can reproduce this or if it's just me. |
|
I don't see how this could be related to this PR - but agree with the sentiment that the It is possible to avoid any download with |
| from .column import Column | ||
| from .table import Table, QTable, has_info_class | ||
| from astropy.units.quantity import QuantityInfo | ||
| from astropy.coordinates import representation as coorep |
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.
After much flailing I finally figured out that this line is what is breaking things and causing all the confusing problems for me with warnings and test fails and leap seconds re-downloading every time. It is tricky because of circular imports, so the problem only shows up in a certain import order. You should be able to reproduce with a single import astropy.io.ascii without anything first. But import astropy.coordinates; import astropy.io.ascii is fine. And import astropy.table first gives /Users/aldcroft/git/astropy/astropy/table/column.py:1020: FutureWarning: elementwise comparison failed; returning scalar instead, but in the future will perform elementwise comparison result = getattr(super(), op)(other)
This is latter warning is from the leap second stuff, and goes away if I remove this line here in serialize.py.
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.
Darn, that must be because it imports Time - I'm sorry that I've caught all this mess, @pllim already had to move other imports inline to get things to pass.
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 suggest a quick workaround to hardcode as strings all the representations currently in astropy.
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.
OK, will make a PR. Clearly trying to be clever comes back to haunt oneself...
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.
See #10282
This is a follow-up of #9857
(EDIT: and builds upon it, hence the many commits), making also representations mutable. As commented there, representations themselves have no reason not to be mutable, since the behaviour of setting is well defined (in a way, they are just glorified quantities). Now that coordinates have become mutable, it makes little sense to keep the representations immutable.I hope to follow this up with anEDIT: now addedDataInfoclass such that representations can also be added to tables; without this, they would be second-class citizens.fixes #6447 (as a side effect)