Repository navigation
Table.as_array() converts to native byteorder - #4080
Conversation
711ec23 to
927e133
Compare
|
Rebased on non-broken version of #4079. |
|
@embray - I like this idea! Will give the code a look later. |
|
I'm also going to implement the implicit byteswap of FITS data when memmap=False, as well as look into fixing the issue in PyTables in the first place (if indeed it's relatively easy to fix, which I think it should be....) |
|
Strange import-related bug on Python 2. Will investigate more later.... |
package data can be retrieved from packages other than the one the function was called from. Also converted most of the examples for those functions into working doctests, which revealed some bugs in both the tests and the functions themseves. One such test is skipped due to astropy/astropy-data#4
|
Ah, #4083 should have fixed the Python 2 issues with this. Will rebase and try again. |
…otherwise specified with keep_byteorder=True
927e133 to
aa46d25
Compare
There was a problem hiding this comment.
I didn't realize that you can use a bool index like this. Nevertheless this seems like a job for the ternary conditional.
There was a problem hiding this comment.
I like this syntax because it shows the two possibilities side by side rather at other ends of the expression (it's maybe a little confusing that the false case is listed first).
|
@embray - I've finished my review with a few minor comments. |
There was a problem hiding this comment.
I need to fill in this number.
…le-endian and big-endian machines, and address other minor review comments.
Table.as_array() converts to native byteorder
As discussed in #4069, this changes
Table.as_array()to always convert all fields in the output structured array to native byteorder. Since this method makes a copy of all the table data anyways, there's little advantage to keeping fields in non-native byteorder, in most cases.Given the experience of @taldcroft and several others previous, this seems like the most useful default. Though if
keep_byteorder=Truethe output structured array keeps all fields in their byte orders.This isn't a total solution to #4069 but it should help alleviate the issue.
(Note: This PR depends on #4079, but can reworked to not require it if that PR isn't merged first.)