question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

FITS Binary Table to Astropy Table round trip re-orders COMMENT cards

See original GitHub issue

I’m really not sure if this could be considered a true bug or not, but I imagine it will cause some users some frustration. When a FITS Binary file is round-tripped from an Astropy Table back to a FITS file (using Astropy.table.Table.read and fits.table_to_hdu) the COMMENT cards all get shuffled to the bottom of the header. A lot of HST data uses these COMMENT cards like section titles, not sure if other data tends to do this. I’m using astropy 3.1.dev21825 in this example.

Original, near the top of the header: screen shot 2018-06-04 at 12 06 35 pm

Output after round tripping, at the bottom of the header: screen shot 2018-06-04 at 12 06 17 pm

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:11 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
saimncommented, Jun 4, 2018

Table.meta is an OrderedDict by default I think. The issue has more to do with the way COMMENT/HISTORY/BLANK are managed by the fits.Header code (by default normal cards are inserted before these cards I think, hence the use of end=True).

0reactions
pllimcommented, Jul 9, 2018

Keeping the order (in a way that makes sense) gets complicated when header changes, e.g., add/remove keyword/comment/history/column. Sara and I talked about this and at some point concluded that it is easier to just show people how to re-order their header via some manual scripting. 😬

Read more comments on GitHub >

github_iconTop Results From Across the Web

Table Data — Astropy v5.2
The data in a FITS table HDU is basically a record array with added attributes. The metadata (i.e., information about the table data)...
Read more >
python 3.x - Re-order cards in a FITS header - Stack Overflow
The problem with FITS is it mixes information that describes the binary structure of the file itself along with metadata in the same...
Read more >
TOPCAT - Tool for OPerations on Catalogues And Tables
HISTORY and COMMENT cards are run together as one multi-line value. ... As well as normal binary and ASCII FITS tables, STIL supports...
Read more >
STIL - Starlink Tables Infrastructure Library
HISTORY and COMMENT cards are run together as one multi-line value. ... As well as normal binary and ASCII FITS tables, STIL supports...
Read more >
Astropy Documentation - Read the Docs
coordinates, and table subpackages integrate better with Quantity, ... Binary installers are available on Windows for Python 2.6, 2.7, 3.1, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found