Skip to content

Table.as_array() converts to native byteorder - #4080

Merged
embray merged 5 commits into
astropy:masterfrom
embray:table/as-array-swap
Aug 28, 2015
Merged

embray merged 5 commits into
astropy:masterfrom
embray:table/as-array-swap

Conversation

@embray

@embray embray commented Aug 14, 2015

Copy link
Copy Markdown
Member

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=True the 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.)

@embray

embray commented Aug 14, 2015

Copy link
Copy Markdown
Member Author

Rebased on non-broken version of #4079.

@taldcroft

Copy link
Copy Markdown
Member

@embray - I like this idea! Will give the code a look later.

@embray

embray commented Aug 14, 2015

Copy link
Copy Markdown
Member Author

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....)

@embray

embray commented Aug 14, 2015

Copy link
Copy Markdown
Member Author

Strange import-related bug on Python 2. Will investigate more later....

embray added 2 commits August 17, 2015 17:48
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
@embray

embray commented Aug 27, 2015

Copy link
Copy Markdown
Member Author

Ah, #4083 should have fixed the Python 2 issues with this. Will rebase and try again.

…otherwise specified with keep_byteorder=True
@embray
embray force-pushed the table/as-array-swap branch from 927e133 to aa46d25 Compare August 27, 2015 21:33
Comment thread astropy/table/table.py

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't realize that you can use a bool index like this. Nevertheless this seems like a job for the ternary conditional.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

@taldcroft

Copy link
Copy Markdown
Member

@embray - I've finished my review with a few minor comments.

Comment thread astropy/table/tests/test_table.py Outdated

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need to fill in this number.

@embray embray added this to the v1.1.0 milestone Aug 28, 2015
embray added a commit that referenced this pull request Aug 28, 2015
Table.as_array() converts to native byteorder
@embray
embray merged commit 19c7568 into astropy:master Aug 28, 2015
@embray
embray deleted the table/as-array-swap branch August 28, 2015 17:44
dhomeier pushed a commit to dhomeier/astropy that referenced this pull request Dec 17, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants