-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Fix a bug that caused writing to FITS of Table objects that had index columns to fail #8077
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
|
Check results are now reported in the status checks at the bottom of this page. |
|
It would be more generic to handle this case in |
|
@taldcroft - do you have any thoughts on this? |
|
@saimn - on further thoughts, I guess my thinking is that Table has already made a choice to raise a clear exception in this use case of replace_column, and this PR fixes a bug in the FITS code that uses that. Changing the behavior in Table would actually be an API change. So I personally think we should just treat this as a bug fix and not modify Table. I guess we could also add a keyword argument to control this but again this would be a change in API and I'd like to get this fix in v3.1. |
|
This looks fine as a bug fix. Ideally the right answer is to serialize the index so it round-trips, which would make generating the index more useful since it would persist. In theory the machinery is mostly there, but it probably would not be trivial in the end. |
|
@astrofrog - I can understand your reasoning, but for me it is a Table thing, not FITS or Time. Looking back in time, #4090 (comment) shows - I think - that there is no real reason for raising an error in this case. |
|
@taldcroft - the serialization is not the issue (it seems that indexes are dropped when writing tables to fits), the crash happens when using astropy/astropy/io/fits/fitstime.py Lines 527 to 533 in 1a41c94
|
Codecov Report
@@ Coverage Diff @@
## master #8077 +/- ##
==========================================
- Coverage 86.96% 86.92% -0.04%
==========================================
Files 408 383 -25
Lines 61428 57826 -3602
Branches 1096 1056 -40
==========================================
- Hits 53422 50267 -3155
+ Misses 7383 6945 -438
+ Partials 623 614 -9
Continue to review full report at Codecov.
|
|
Ok let's delay this for now, I don't have time to work on it more for 3.1 |
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.
As noted in discussion comment.
|
Hi humans 👋 - this pull request hasn't had any new commits for approximately 7 months. I plan to close this in a month if the pull request doesn't have any new commits by then. In lieu of a stalled pull request, please consider closing this and open an issue instead if a reminder is needed to revisit in the future. Maintainers may also choose to add If this PR still needs to be reviewed, as an author, you can rebase it to reset the clock. If you believe I commented on this pull request incorrectly, please report this here. |
|
I'm going to close this pull request as per my previous message. If you think what is being added/fixed here is still important, please remember to open an issue to keep track of it. Thanks! If this is the first time I am commenting on this issue, or if you believe I closed this issue incorrectly, please report this here. |
|
I re-opened this as I think that this approach is OK and fixes a real issue. The only outstanding problem is the comment above that the current code actually corrupts the original table by removing indices on |
|
@astrofrog - could you please rebase and address the comment to make it ready to be merged? |
|
@bsipocz - I think you just missed that this would be best done by waiting on a fix for #9009, at which point the table copy (with However, there definitely should be a test that this operation does not corrupt the original table. That will fail right now, but will start working once #9009 is fixed. |
|
Oh, indeed. Then I add the keep-open here, as either that or a rebase that makes sure this doesn't get closed again when the bot runs next time. |
… time columns to fail
60d051e to
1ef279e
Compare
1ef279e to
af611a3
Compare
|
@astrofrog et al. - I think should be good now, please review. The crux lines of code depend on table improvements in 4.0-dev, so I don't recommend trying to backport. |
|
@taldcroft - There are no more backports except critical fixes like the one we need for iers :) |
|
@taldcroft - #9009 still seems to be relevant, is that not an issue for this any more? |
Edit: THIS REQUIRES #9009, keep open while that is addressed.
Before this fix, the following failed:
The solution is to remove the index columns.
@taldcroft - is there a better way to just remove all indices from a table?