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 table documentation uses non-standard FITS unit

See original GitHub issue

Description

While reading the documentation about fits table data, I noticed that there is a non-standard unit used: https://github.com/astropy/astropy/blame/main/docs/io/fits/usage/table.rst#L346

   >>> col2 = fits.Column(name='counts', format='J', unit='DN', array=counts)

Expected behavior

I’d expect that the documentation sticks to the standard.

Actual behavior

DN is not a standard FITS unit, and even not directly supported by astropy.units. For example, the following does not work:

counts = [0., 1.]
col2 = fits.Column(name='counts', format='J', unit='DN', array=counts)
tbl = QTable([col2])

It may sound nitpicking, but we should not encourage people to use phantasy units. The name “counts” would suggest as unit count.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
pllimcommented, Jun 8, 2021

@olebole , are you interested in submitting a PR? 😸

1reaction
jdavies-stcommented, Jun 8, 2021

DN are not fantasy units, though it does seem that they exist in some parallel, mystical place, not of this earth. Most HST, JWST and lots of Spitzer science data use DN to indicate counts. That’s why that unit was added to astropy.units (currently unreleased), so that the data from these telescopes could be read in easily as a Quantity.

Agree that the example in the docs should use a FITS standard unit. Just because there’s lots of existing (and soon-to-exist) data using DN, doesn’t mean we should encourage its use.

What does it mean? Some say Data Number. Some say Dumb Number. (h.t. @eslavich)

The history is that astropy.io.fits came via pyfits from STScI where DN was and is common usage for counts amongst the scientists and engineers, and all that pre-dated any standard for a count unit from the FITS working group. FITS had no standard for units of counts up through 2005, and only adopted count, ct or adu in 2008.

So yeah, let’s change the documentation example.

Read more comments on GitHub >

github_iconTop Results From Across the Web

FITS File Handling (astropy.io.fits)
An HDU (Header Data Unit) is the highest level component of the FITS file structure, consisting of a header and (typically) a data...
Read more >
Definition of the Flexible Image Transport System ... - NASA FITS
groups structure, the image extension, the ASCII table extension, and the binary table extension. ... ple, using a non-standard keyword, is.
Read more >
astropy.io.fits FAQ
The astropy. io. fits module (originally PyFITS) is a “pure Python” FITS reader in that all the code for parsing the FITS file...
Read more >
Getting started with the nom.tam.fits library. - GitHub
FITS, the Flexible Image Transport System, is the format commonly used in the archiving and transport of astronomical data. This document assumes a...
Read more >
web.mit.edu/12.410/idl_libs/old/SourceCode/text/fi...
... on a FITS file. and can be used with either binary or ASCII tables. ... convert between FITS tables and IDL structures,...
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