[fitsbits] INF/NAN as header values

Richard J. Mathar mathar at mpia-hd.mpg.de
Tue Jun 11 04:14:59 EDT 2013


i) The description in Section 6.3 of the standard, "...the IEEE NaN should
be used to represent an undefined value.." clearly indicates that the
other IEEE numbers in that category (the infinities, denormalized reps etc)
should *not* be used for the bitpix =-32/-64 data.

ii) For implementations in C++ one would probably set these with assignments like

#include <limits>
float blankF = numeric_limits<float>::quiet_NaN() ;

and the equivalent <double>, and detect them with 

#include <cmath>
if ( isnan(....) ) ...

Since Python 2.6 (at least), isnan(...) will detect NaN's, and is_nan() or the
types NaN and sNaN in the number_class() of the Decimal type does the same.

iii) Users of CCfits 2.4 will face a little challenge because the member
  function readAllKeys() does not read the BLANK card. (Actually the function
  does not read some others as well deemed to be in the wrong keyword class..)
  So one will not find it in the map'ed array, and at that point absence of
  the keyword does not indicate that the FITS file comes without.
  One needs to use an explicit readKeyword("BLANK",..) to detect its presence
  (plus catch the exception if not) and value.
  So the underlying cfitsio reads it, but CCfits uses an additional filter.

iv) Users of CCfits 2.4 will likely need another patch
   similar to http://www.mpia-hd.mpg.de/~mathar/progs/CCfits.patch
  if they want to add a BLANK keyword to a header.

IEEE: http://754r.ucbtest.org/standards/854.pdf

Richard J. Mathar




More information about the fitsbits mailing list