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.

[io.fits] Position of the EXTEND keyword

See original GitHub issue

Hi,

while packaging parts of the Starjava software to get TOPCAT and STILTS into Debian, I stumbled upon their so-called FITS-Plus and colfits-plus formats. These formats are basically recognized by the keywords COLFITS (for colfits-plus) and VOTMETA keywords before the EXTEND keyword (order matters here!):

SIMPLE  =                    T / Standard FITS format
BITPIX  =                    8 / Character data
NAXIS   =                    1 / Text string
NAXIS1  =                 nnnn / Number of characters
VOTMETA =                    T / Table metadata in VOTABLE format
EXTEND  =                    T / There are standard extensions

While the primary problem here is to get this supported by the Java IO package nom.tam.fits (see nom-tam-fits/nom-tam-fits#113), I am wondering about the support in Astropy. Currently, the header are re-sorted so that EXTEND directly follows NAXIS* (similarly to currently nom.tam.fits):

>>> from astropy.io import fits
>>> p = fits.PrimaryHDU()
>>> p.header.set('VOTMETA', True, before='EXTEND')
>>> print(list(p.header))
['SIMPLE', 'BITPIX', 'NAXIS', 'VOTMETA', 'EXTEND']
>>> p.writeto('sample.fits')
>>> print(list(p.header))
['SIMPLE', 'BITPIX', 'NAXIS', 'EXTEND', 'VOTMETA']

In the current FITS definition, I couldnt find the requirement that EXTEND should directly follow NAXIS*; however it would probably be useful if the different FITS libraries are somehow consistent. Would it be possible to support these formats by Astropy? And what would be the optimal way to do this?

Issue Analytics

  • State:open
  • Created 7 years ago
  • Comments:41 (41 by maintainers)

github_iconTop GitHub Comments

1reaction
olebolecommented, Mar 28, 2017

Maybe @embray could have a look here? The EXTEND handling dates back 5 years from now in pyfits.

Read more comments on GitHub >

github_iconTop Results From Across the Web

FITS File Handling (astropy.io.fits)
This is because most FITS keywords may appear at any position in the header. It is also possible to update both the value...
Read more >
FITS Headers — Astropy v1.0.4
Most keywords in a FITS header have unique names. If there are more than two cards sharing the same name, it is the...
Read more >
python - astropy.io.fits - HIERARCH keywords don't work with ...
However, in practice it seems that both definitions work only mutually exclusive, i.e. we can not create a FITS file containing a keyword...
Read more >
Handling FITS files — Python4Astronomers 2.0 documentation
If you are already familiar with PyFITS, astropy.io.fits is in fact ... axis 3 EXTEND = T / FITS dataset may contain extensions...
Read more >
2.4 Headers and Keywords - HST User Documentation - HDox
from astropy.io import fits ... Table 2.6: ACS primary header keywords (FITS extension 0). ... PA_V3, Position angle of the V3-axis of HST...
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