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
Table io null fix #14723
Table io null fix #14723
Conversation
Thank you for your contribution to Astropy! 🌌 This checklist is meant to remind the package maintainers who will review this pull request of some common things to look for.
|
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.
Welcome to Astropy 👋 and congratulations on your first pull request! 🎉
A project member will respond to you as soon as possible; in the meantime, please have a look over the Checklist for Contributed Code and make sure you've addressed as many of the questions there as possible.
If you feel that this pull request has not been responded to in a timely manner, please send a message directly to the development mailing list. If the issue is urgent or sensitive in nature (e.g., a security vulnerability) please send an e-mail directly to the private e-mail feedback@astropy.org.
Thanks! Needs a change log. I restarted the failed jobs... might be transient. |
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.
Thanks @gpsgibb - this looks generally good. I just put in a couple of small comments.
fill_value=NULL_VALUE, | ||
) | ||
t = Table([c1]) | ||
|
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.
Can you add a specific unit test of the Table.as_array()
functionality here by doing tn = t.as_array()
and confirm the correct fill_value
?
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.
Done (see aab7ab6)
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.
It seems this commit was lost in one of the rebase ?
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 rebased and added the commit.
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.
PR looks good, thanks @gpsgibb.
Double backticks are needed to avoid reference errors with Sphinx.
@gpsgibb - Can you also rebase on main to get rid of the merge commits ? Thanks. |
I think that's me rebased it... (sorry if I have messed up) |
Re: rebase -- Unless you really wrote 32 commits here, I would say something is wrong. Try this:
Check to see if the history now makes more sense. |
I'm getting conflicts when trying to rebase:
How should I proceed? |
@gpsgibb - sorry, looks like you got your branch into a bad place. The lesson for future PR's is never do a I'm not a git expert, but I've been in this mess before and for me the fastest way back was to effectively start from scratch. It sounds painful but looking at your PR, there are really only a handful of change blocks and so you can recover the change in 15 minutes. Specifically:
This should work. |
It should be possible to avoid manual copy-pasting by using |
38c31a6
to
8df18dd
Compare
Thanks @saimn that seems to have done the trick... down to 10 commits in the diff, all my own |
@gpsgibb - note also the pre-commit failure (end of line). And at the end we'll probably also ask you to squash this down to one commit since it has gotten a bit large. Thanks for hanging in there and making this important fix! |
8df18dd
to
95f87f9
Compare
95f87f9
to
ccbb3ac
Compare
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.
Looks good to me, thanks @gpsgibb !
Last minute fix: `np.NaN` was removed in the NumPy 2.0 release. Use `np.nan` instead
Don't feel like dealing with 3 backport PRs, so just 6.0 now since the other two branches gonna die soon. @meeseeksdev backport to v6.0.x |
p.s. Not sure why the backport labels didn't trigger in the first place but GitHub was having issues. 🤷 |
…723-on-v6.0.x Backport PR #14723 on branch v6.0.x (Table io null fix)
Description
This pull request addresses two related bugs in writing/reading astropy.table.Table objects with NULL values in int columns to/from FITS. The first bug is in reading a table from a FITS file, where the
fill_value
parameter of the MaskedColumn is the default (999999) not the value recorded in the input file'sTNULL
parameter. The second bug is when writing a table to file, the value of thefill_value
column is not propagated through to the written table, so for an int columnTNULL
is always defaulted to 999999.The changes proposed by this PR ensure that
TNULL
/fill_value
are correctly propagated to/from the Table object upon read/write.Also included in this PR is the propagation of the FITS standard's NULL for floats (
NaN
) and strings (""
) into a column'sfill_value
, rather than the default (fromnumpy.ma
) of1E20
and"N/A"
for floats and strings respectively.Fixes #14693