casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
FITS.h
Go to the documentation of this file.
00001 //# Fits.h: The fits module -- FITS related classes.
00002 //# Copyright (C) 2005
00003 //# Associated Universities, Inc. Washington DC, USA.
00004 //#
00005 //# This library is free software; you can redistribute it and/or modify it
00006 //# under the terms of the GNU Library General Public License as published by
00007 //# the Free Software Foundation; either version 2 of the License, or (at your
00008 //# option) any later version.
00009 //#
00010 //# This library is distributed in the hope that it will be useful, but WITHOUT
00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00013 //# License for more details.
00014 //#
00015 //# You should have received a copy of the GNU Library General Public License
00016 //# along with this library; if not, write to the Free Software Foundation,
00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00018 //#
00019 //# Correspondence concerning AIPS++ should be addressed as follows:
00020 //#        Internet email: aips2-request@nrao.edu.
00021 //#        Postal address: AIPS++ Project Office
00022 //#                        National Radio Astronomy Observatory
00023 //#                        520 Edgemont Road
00024 //#                        Charlottesville, VA 22903-2475 USA
00025 //#
00026 
00027 #ifndef FITS_FITS_H
00028 #define FITS_FITS_H
00029 
00030 #include <fits/FITS/BasicFITS.h>        
00031 #include <fits/FITS/BinTable.h> 
00032 #include <fits/FITS/blockio.h>         
00033 #include <fits/FITS/CopyRecord.h>        
00034 #include <fits/FITS/FITS2.h>             
00035 #include <fits/FITS/FITSDateUtil.h>    
00036 #include <fits/FITS/FITSError.h>        
00037 #include <fits/FITS/FITSFieldCopier.h>
00038 #include <fits/FITS/FITSHistoryUtil.h>  
00039 #include <fits/FITS/FITSKeywordUtil.h>  
00040 #include <fits/FITS/FITSMultiTable.h>   
00041 #include <fits/FITS/FITSSpectralUtil.h>
00042 #include <fits/FITS/FITSTable.h>       
00043 #include <fits/FITS/FITSTimedTable.h>             
00044 #include <fits/FITS/fits.h>
00045 #include <fits/FITS/fitsio.h>
00046 #include <fits/FITS/hdu.h>
00047 #include <fits/FITS/SDFITSTable.h>
00048 
00049 namespace casa { //# NAMESPACE CASA - BEGIN
00050 
00051 // <module>
00052 //
00053 // <summary> Classes and global functions for system use </summary>
00054 
00055 // <reviewed reviewer="" date="" demos="">
00056 // </reviewed>
00057 //
00058 // <synopsis>
00059 //
00060 // This module is a bag of related fits classes and
00061 // global functions.
00062 //
00063 // The following functionality is available:
00064 // <ul>
00065 //  <li> Class <linkto class=FITSFieldCopier:description>
00066 //       FITSFieldCopier</linkto>
00067 //       A FITSFieldCopier for copying Array RecordFields to FitsFields.
00068 //  <li> Class <linkto class=AsciiTableExtension:description>
00069 //       AsciiTableExtension</linkto>
00070 //       (ascii) TABLE extension.
00071 //  <li> Class <linkto class=BinaryTable:description>
00072 //       BinaryTable</linkto>
00073 //       BinaryTable is used to translate a FITS binary table to an aips++ Table.
00074 //       BinaryTable inherits from the FITS BinaryTableExtension class and its
00075 //       primary use is to convert that class to an aips++ Table.
00076 //       The class starts with an already existing FitsInput object, which should
00077 //       be set at a BinaryTableExtension HDU.   Member functions provide a TableDesc 
00078 //       appropriate for the FITS data (to help in constructing an aips++ Table
00079 //       compatible with the BinaryTableExtension), a Table containing the
00080 //       current row of FITS data and a Table containing the next row of FITS data
00081 //       (which can be used to step through the FitsInput, copying each row
00082 //       using the RowCopier class), and a Table containin the entire FITS binary 
00083 //       table from the current row to the end of the table.
00084 //       <motivation>
00085 //       We need a way to get FITS data into aips++ Tables.
00086 //       </motivation>
00087 //  <li> Class <linkto class=BinaryTableExtension:description>
00088 //       BinaryTableExtension</linkto>
00089 //       BINTABLE extension.
00090 //  <li> Class <linkto class=BlockInput:description>
00091 //       BlockInput</linkto>
00092 //       fixed-length blocked sequential input base class.
00093 //  <li> Class <linkto class=BlockIO:description>
00094 //       BlockIO</linkto>
00095 //       fixed-length blocked sequentual I/O base class.
00096 //       BlockIO is a low level base class that implements fixed-length 
00097 //       blocked sequential I/O. Its derived classes, BlockInput and BlockOutput
00098 //       are used by the FitsInput and FitsOutput classes. Users will hardly ever
00099 //       need to use this class directly.
00100 //  <li> Class <linkto class=BlockOutput:description>
00101 //       BlockOutput</linkto>
00102 //       fixed-length blocked sequential output base class.
00103 //  <li> Class <linkto class=ConstFitsKeywordList:description>
00104 //       ConstFitsKeywordList</linkto>
00105 //       list of read-only FITS keywords.
00106 //  <li> Class <linkto class=CopyRecordToRecord:description>
00107 //       CopyRecordToRecord</linkto>
00108 //       Copies fields between Records, possibly to fields with another name.
00109 //  <li> Class <linkto class=CopyRecordToTable:description>
00110 //       CopyRecordToTable</linkto>
00111 //       Copies fields from a Record to columns of a Table.
00112 //       This class should be generalized, and made better. It is the analog of
00113 //       RowCopier, i.e. it copies all the fields from some Record to certain
00114 //       columns of a table. The mapping from fields to columns occurs at
00115 //       construction of the CopyRecordToTable object.
00116 //       <motivation>
00117 //       This class should be generalized, and made better. It is the analog of
00118 //       RowCopier, i.e. it copies all the fields from some Record to certain
00119 //       columns of a table. The mapping from fields to columns occurs at
00120 //       construction of the CopyRecordToTable object.
00121 //       </motivation>
00122 //  <li> Class <linkto class=ExtensionHeaderDataUnit:description>
00123 //       ExtensionHeaderDataUnit</linkto>
00124 //       Base class for generalized exentensions HDU.
00125 //  <li> Class <linkto class=FITS:description>
00126 //       FITS</linkto>
00127 //       Static functions and enumerations.
00128 //       Many of the static functions are utility functions used internally in the
00129 //       implementation of the member functions of the FITS classes. They are placed
00130 //       in a single class to encapsulate them and to avoid adding many names to the 
00131 //       global name space. More important, from the user's perspective, are the
00132 //       enumerations. They form the basic vocabulary of a FITS application. For example,
00133 //       instead of referring to the FITS <src>NAXIS</src> keyword, 
00134 //       <src>FITS::NAXIS</src> should be used.
00135 //  <li> Class <linkto class=FITSDateUtil:description>
00136 //       FITSDateUtil</linkto>
00137 //       A class with static functions to help deal with FITS dates
00138 //       This is a collection of static utility functions for creating and
00139 //       interpreting FITS date keywords (e.g. DATE-OBS).
00140 //       Its never necessary to construct a FITSDateUtil, just use the 
00141 //       static functions to help handle FITS dates.
00142 //       <motivation>
00143 //       The strings that make up the value of FITS dates have a 
00144 //       precise format.  This class encompasses knowlege of the formats
00145 //       used and hopefully simplifies their creation and conversion
00146 //       to and from aips++ MVTimes.
00147 //       </motivation>
00148 //  <li> Class <linkto class=FITSError:description>
00149 //       FITSError</linkto>
00150 //       Default FITS error handling function, typdef, and enumeration.
00151 //       FITSError contains the enumeration specifying the possible error
00152 //       message levels.  It also contains the default error handling function
00153 //       for the FITS classes. 
00154 //       <motivation>
00155 //       Originally, FITS error message were simply sent to an ostream.  In
00156 //       order to have these error messages go to the AIPS++ logger by default,
00157 //       this class was added.  This was made a separate class because both
00158 //       BlockIo and FITS need to use this class.  The anticipated replacements 
00159 //       for the current FITS classes use a somewhat similar scheme.
00160 //       </motivation>
00161 //  <li> Class <linkto class=FITSFieldCopier:description>
00162 //       FITSFieldCopier</linkto>
00163 //       Virtual base class for copying RORecordFields to FitsFields.
00164 //  <li> Class <linkto class=FITSGroupWriter:description>
00165 //       FITSGroupWriter</linkto>
00166 //       Simplified interface to create and write to FITS random groups.
00167 //       Like FITSTableWriter except that this must be the first HDU and
00168 //       all "columns" in the description must have the same type, i.e. float.
00169 //  <li> Class <linkto class=FITSHistoryUtil:description>
00170 //       FITSHistoryUtil</linkto>
00171 //       A class with static functions to help deal with FITS History cards.
00172 //       This is a collection of static utility functions for use with FITS
00173 //       HISTORY keywords.
00174 //       Manipulate HISTORY information. FITS HISTORY cards are interconverted with
00175 //       String as follows:
00176 //       <ul>
00177 //         <li> 'HISTORY ' and trailing blanks are removed from each card.
00178 //         <li> Continuation cards are CARDS that have '>' in the first line.
00179 //         <li> A string is made by concatenating the leading card and all continuation
00180 //              cards.
00181 //       </ul>
00182 //       <motivation>
00183 //       The FitsKeywordList class can be somewhat tedious to use, as it deals with,
00184 //       e.g., char* pointers rather than Strings. This class makes it easy to
00185 //       interconvert between the HISTORY keywords and a Vector of related history
00186 //       information.
00187 //       </motivation>
00188 //  <li> Class <linkto class=FITSKeywordUtil:description>
00189 //       FITSKeywordUtil</linkto>
00190 //       A class with static functions to help deal with FITS Keywords.
00191 //       This class provides functions to conveniently interconvert between AIPS++
00192 //       types and a FitsKeywordList which is needed by the native FITS classes.
00193 //       It is more convenient to maintain the list within AIPS++
00194 //       as a Record, so we only need methods to turn a FitsKeywordList into a 
00195 //       Record, and vice versa.
00196 //       Note that it is not necessary to construct a FITSKeywordUtil object
00197 //       since you can use its static functions directly.
00198 //       <motivation>
00199 //       The FitsKeywordList class can be somewhat tedious to use, as it deals with,
00200 //       e.g., char* pointers rather than Strings. This class makes it easy to
00201 //       interconvert between FITS keywords and AIPS++ types.
00202 //       </motivation>
00203 //  <li> Class <linkto class=FITSMultiTable:description>
00204 //       FITSMultiTable</linkto>
00205 //       View multiple FITS files as a single table.
00206 //       A FITSMultiTable is used to view a collection of FITS files on disk as a 
00207 //       single Table. That is, when next() is called, when one Table ends the next
00208 //       is reopened until all files are exhausted. The FITS files must all have the
00209 //       same description. Something clever should be done about the keywords.
00210 //  <li> Class <linkto class=FITSSpectralUtil:description>
00211 //       FITSSpectralUtil</linkto>
00212 //       A class with static functions to help deal with FITS spectral axes.
00213 //       This class provides functions to extract information from a FITS
00214 //       header about the spectral axis, to setup a FITS header with
00215 //       appropriate information for the spectral axis, and to translate
00216 //       to and from the MFrequency refrence frame codes and their FITS
00217 //       equivalents.
00218 //       It is never necessary to construct a FITSSpectralUtil, just use the 
00219 //       static functions to help handle FITS Spectral axes.
00220 //       <motivation>
00221 //       This is designed to be used after the keywords have been extracted from
00222 //       the FITS file using the <linkto class=FITSKeywordUtil>FITSKeywordUtil</linkto>
00223 //       class.  Extracting spectral axis and related information requires detailed
00224 //       knowledge of FITS conventions that this class strives to encapsulize.
00225 //       </motivation>
00226 //  <li> Class <linkto class=FITSTable:description>
00227 //       FITSTable</linkto>
00228 //       Attach a FITSTabular to a binary or ASCII table.
00229 //       FITSTable is a FITSTabular which is attached to a FITS table (on disk only
00230 //       presently), either Binary or ASCII.
00231 //  <li> Class <linkto class=FITSTableWriter:description>
00232 //       FITSTableWriter</linkto>
00233 //       Simplified interface to create and write to a FITS Binary Table.
00234 //  <li> Class <linkto class=FITSTabular:description>
00235 //       FITSTabular</linkto>
00236 //       Simplified interface to FITS tables with AIPS++ Look and Feel.
00237 //       FITSTablular is an obstract base class which is used for read-only access to
00238 //       tabular FITS-like data structures.
00239 //  <li> Class <linkto class=FITSTimedTable:description>
00240 //       FITSTimedTable</linkto>
00241 //       FITSTimedTable is used to look at FITS tables which have a time column. In
00242 //       particular, it peeks ahead, and knows the time of the currentRow and of the
00243 //       nextRow.
00244 //       It is constructed with a pointer to any FITSTabular. Presently, no memory 
00245 //       management is imposed to ensure that the pointer remains valid.
00246 //  <li> Class <linkto class=FitsArray:description>
00247 //       FitsArray</linkto>
00248 //       FITS array of given type.
00249 //  <li> Class <linkto class=FitsArray:description>
00250 //       <src>FitsArray<FitsBit></src></linkto>
00251 //       FITS array of FitsBit type.
00252 //  <li> Class <linkto class=FitsBase:description>
00253 //       FitsBase</linkto>
00254 //       Base class fore FitsField.
00255 //  <li> Class <linkto class=FitsBit:description>
00256 //       FitsBit</linkto>
00257 //       Helper class for FITS Binary Tables.
00258 //       This class is not intended for general use.  It only has meaning
00259 //       in the context of FITS Binary tables.  There its use is incorporated
00260 //       into the concept of a FitsField, where FitsBit is given a specialized
00261 //       interpretation.
00262 //  <li> Class <linkto class=FitsDiskInput:description>
00263 //       FitsDiskInput</linkto>
00264 //       FITS input from disk.
00265 //  <li> Class <linkto class=FitsDiskOutput:description>
00266 //       FitsDiskOutput</linkto>
00267 //       FITS output to disk.
00268 //  <li> Class <linkto class=FitsField:description>
00269 //       FitsField</linkto>
00270 //       Helper class.
00271 //  <li> Class <linkto class=FitsField:description>
00272 //       <src>FitsField<FitsBit></src></linkto>
00273 //       Helper class.
00274 //  <li> Class <linkto class=FitsFPUtil:description>
00275 //       FitsFPUtil</linkto>
00276 //       Utility functions for floating point values.
00277 //  <li> Class <linkto class=FitsInput:description>
00278 //       FitsInput</linkto>
00279 //       Fixed-length sequential blocked FITS input.
00280 //  <li> Class <linkto class=FitsIO:description>
00281 //       FitsIO</linkto>
00282 //       sequential FITS I/O.
00283 //       FitsIO is a base class that handles all the sequential blocked
00284 //       FITS I/O. Special derived classes do the input and output.
00285 //       No interpretation of the data is attempted here, there are 
00286 //       special FITS classes that handle syntax and interpretation.
00287 //  <li> Class <linkto class=FitsKeyCardTranslator:description>
00288 //       FitsKeyCardTranslator</linkto>
00289 //       Translator between Keyword lists and fixed FITS cars.
00290 //  <li> Class <linkto class=FitsKeyword:description>
00291 //       FitsKeyword</linkto>
00292 //       A FITS keyword contains a name, a value and a comment..
00293 //  <li> Class <linkto class=FitsKeywordList:description>
00294 //       FitsKeywordList</linkto>
00295 //       Linked list of FITS keywords.
00296 //  <li> Class <linkto class=FitsLogical:description>
00297 //       FitsLogical</linkto>
00298 //       FitsLogical is a helper class that is not intended for general use. 
00299 //  <li> Class <linkto class=FitsNameResult:description>
00300 //       FitsNameResult</linkto>
00301 //       Analyse the name of a header card.
00302 //  <li> Class <linkto class=FitsOutput:description>
00303 //       FitsOutput</linkto>
00304 //       Fixed-length sequential blocked FITS output.
00305 //  <li> Class <linkto class=FitsParse:description>
00306 //       FitsParse</linkto>
00307 //       Parse a header card.
00308 //  <li> Class <linkto class=FitsStdInput:description>
00309 //       FitsStdInput</linkto>
00310 //       FITS input from standard input.
00311 //  <li> Class <linkto class=FitsStdOutput:description>
00312 //       FitsStdOutput</linkto>
00313 //       FITS output to standard output.
00314 //  <li> Class <linkto class=FitsTape9Input:description>
00315 //       FitsTape9Input</linkto>
00316 //       FITS input from 9-track tape.
00317 //  <li> Class <linkto class=FitsTape9Output:description>
00318 //       FitsTape9Output</linkto>
00319 //       FITS output to 9-track tape.
00320 //  <li> Class <linkto class=FitsVADesc:description>
00321 //       FitsVADesc</linkto>
00322 //       Variable Length Array Descriptor.
00323 //  <li> Class <linkto class=FitsValueResult:description>
00324 //       FitsValueResult</linkto>
00325 //       Analyse the value of a header card.
00326 //  <li> Class <linkto class=HeaderDataUnit:description>
00327 //       HeaderDataUnit</linkto>
00328 //       Base class that defines a HDU.
00329 //       The class HeaderDataUnit contains what is common to all 
00330 //       header-data-units, including the collection of keywords.
00331 //       From this class a number of FITS header-data-units are 
00332 //       derived, each of them with their own rich assortment of 
00333 //       functions for accessing and manipulating data of specific types.
00334 //  <li> Class <linkto class=ImageExtension:description>
00335 //       ImageExtension</linkto>
00336 //       IMAGE extension of given type.
00337 //  <li> Class <linkto class=NoConvert:description>
00338 //       NoConvert</linkto>
00339 //       FITS templated helper class.
00340 //       NoConvert is a template class that is not intended for
00341 //       general use, it is used internally.
00342 //  <li> Class <linkto class=PrimaryArray:description>
00343 //       PrimaryArray</linkto>
00344 //       Templated primary array base class of given type.
00345 //       A Primary Data Array is represented by the following:
00346 //       <srcblock>
00347 //            <Type> data_array [NAXIS1][NAXIS2]...[NAXISN]
00348 //       </srcblock>
00349 //       For a PrimaryArray, dims() gives the number of dimensions
00350 //       and dim(i) gives the value of the i-th dimension
00351 //       WARNING!  Multi-dimensional arrays are stored in FORTRAN order, 
00352 //       NOT in C order.  Options on the store, copy, and move functions exist 
00353 //       to convert from one order to the other, if that is necessary.
00354 // 
00355 //       It is important to understand the proper sequence of operations with
00356 //       respect to I/O and data access.  For input, the `read()' functions
00357 //       allocate an internal buffer of the appropriate size, if not already
00358 //       allocated, as well as reading and converting data; a `read()' function
00359 //       must be performed prior to accessing the data, i. e. before executing
00360 //       any `()', `data()', `copy()', or `move()' function.  For output, the
00361 //       `store()' function similarly allocates an internal buffer before
00362 //       transfering data, and must be executed prior to any data access or
00363 //       `write()' function. Note: If you call any version of store(), do not
00364 //       call set_next().
00365 // 
00366 //       Writing portions of an array at a time, rather than the entire array,
00367 //       is a special case.  The `set_next()' function is provided for this
00368 //       purpose. It declares the intention to write out the next N elements and
00369 //       must be executed prior to any `data()' function.  It allocates a buffer
00370 //       of appropriate size, if not already allocated.  Again, via the `data()'
00371 //       functions, one accesses the array as if the entire array were in
00372 //       memory.  The `write()' function always writes the number of current
00373 //       elements in the internal buffer.  The sequence of operations for each
00374 //       portion of the array written would be: 
00375 //       <ul>
00376 //            <li> `set_next(N)', 
00377 //            <li> fill the array using `data(N)' or other `data()' functions
00378 //            <li> `write(fout)'. 
00379 //       </ul> 
00380 //       The `set_next()' function must NOT be used with
00381 //       `read()' or `store()' functions; unpredictable results will occur.  
00382 //  <li> Class <linkto class=PrimaryGroup:description>
00383 //       PrimaryGroup</linkto>
00384 //       Random Group datastructure.
00385 //       <note role=warning>
00386 //       Please note that the NOST has deprecated the Random Group 
00387 //       datastructure, it has been replaced by the much more powerfull
00388 //       BINTABLE extension.
00389 //       </note>
00390 //  <li> Class <linkto class=ReservedFitsKeyword:description>
00391 //       ReservedFitsKeyword</linkto>
00392 //       Reserved FITS keyword.
00393 //  <li> Class <linkto class=ReservedFitsKeywordCollection:description>
00394 //       ReservedFitsKeywordCollection</linkto>
00395 //       Collection of reserved FITS keywords.
00396 //  <li> Class <linkto class=ScalarFITSFieldCopier:description>
00397 //       ScalarFITSFieldCopier</linkto>
00398 //       A FITSFieldCopier for copying scalar non-string RecordFields to FitsFields.
00399 //  <li> Class <linkto class=SDFITSTable:description>
00400 //       SDFITSTable</linkto>
00401 //       SDFITSTable is derived from FITSTable.  It contains additional
00402 //       checks and behaviour appropriate to the Single Dish FITS Convention
00403 //       hence this is a Single Dish FITS Table, or SDFITSTable.
00404 //       This class behaves much like FITSTable.  It additionally verifies
00405 //       that the indicated HDU in the input FITS file follows the SDFITS
00406 //       convention (it has all of the required columns) and it treats
00407 //       keywords as virtual columns when appropriate.  These virtual
00408 //       columns will appear as fields in the currentRecord and description
00409 //       and will NOT appear in the keywords.
00410 //       <motivation>
00411 //       It was useful to encapsulate this behaviour in a class so that
00412 //       the checks on a valid SDFITS table and the treatment of keywords
00413 //       as virtual columns would not need to appear everywhere it might
00414 //       be used.
00415 //      </motivation>
00416 //  <li> Class <linkto class=StringFITSFieldCopier:description>
00417 //       StringFITSFieldCopier</linkto>
00418 //       A FITSFieldCopier for copying String RecordFields to FitsFields.
00419 //  <li> Class <linkto class=VariableArrayFITSFieldCopier:description>
00420 //       VariableArrayFITSFieldCopier</linkto>
00421 //       Copy the current contents of the input RORecordFieldPtr to the output FitsField.
00422 // </ul>
00423 //
00424 // <note role=tip> You may want to look at the individual header files
00425 // to see whether you might not prefer to include only the header
00426 // files you really need; it may be more efficient to do so.
00427 // </note>
00428 //
00429 // </synopsis>
00430 //
00431 //# <todo asof="2005/06/20">
00432 //#   <li>
00433 //# </todo>
00434 //
00435 // </module>
00436 
00437 
00438 } //# NAMESPACE CASA - END
00439 
00440 #endif
00441