casacore
Loading...
Searching...
No Matches
FITS.h
Go to the documentation of this file.
1//# Fits.h: The fits module -- FITS related classes.
2//# Copyright (C) 2005
3//# Associated Universities, Inc. Washington DC, USA.
4//#
5//# This library is free software; you can redistribute it and/or modify it
6//# under the terms of the GNU Library General Public License as published by
7//# the Free Software Foundation; either version 2 of the License, or (at your
8//# option) any later version.
9//#
10//# This library is distributed in the hope that it will be useful, but WITHOUT
11//# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12//# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13//# License for more details.
14//#
15//# You should have received a copy of the GNU Library General Public License
16//# along with this library; if not, write to the Free Software Foundation,
17//# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18//#
19//# Correspondence concerning AIPS++ should be addressed as follows:
20//# Internet email: casa-feedback@nrao.edu.
21//# Postal address: AIPS++ Project Office
22//# National Radio Astronomy Observatory
23//# 520 Edgemont Road
24//# Charlottesville, VA 22903-2475 USA
25
26#ifndef FITS_FITS_H
27#define FITS_FITS_H
28
29#include <casacore/casa/aips.h>
30#include <casacore/fits/FITS/BasicFITS.h>
31#include <casacore/fits/FITS/BinTable.h>
32#include <casacore/fits/FITS/blockio.h>
33#include <casacore/fits/FITS/CopyRecord.h>
34#include <casacore/fits/FITS/FITS2.h>
35#include <casacore/fits/FITS/FITSDateUtil.h>
36#include <casacore/fits/FITS/FITSError.h>
37#include <casacore/fits/FITS/FITSFieldCopier.h>
38#include <casacore/fits/FITS/FITSHistoryUtil.h>
39#include <casacore/fits/FITS/FITSKeywordUtil.h>
40#include <casacore/fits/FITS/FITSMultiTable.h>
41#include <casacore/fits/FITS/FITSSpectralUtil.h>
42#include <casacore/fits/FITS/FITSTable.h>
43#include <casacore/fits/FITS/FITSTimedTable.h>
44#include <casacore/fits/FITS/fits.h>
45#include <casacore/fits/FITS/fitsio.h>
46#include <casacore/fits/FITS/hdu.h>
47#include <casacore/fits/FITS/SDFITSTable.h>
48
49namespace casacore { //# NAMESPACE CASACORE - BEGIN
50
51// <module>
52//
53// <summary>
54// Classes and global functions for system use
55// </summary>
56
57// <reviewed reviewer="" date="" demos="">
58// </reviewed>
59//
60// <synopsis>
61//
62// This module is a bag of related fits classes and
63// global functions.
64//
65// The following functionality is available:
66// <ol>
67// <li> Class <linkto class=FITSFieldCopier:description>
68// FITSFieldCopier</linkto>
69// A FITSFieldCopier for copying Array RecordFields to FitsFields.
70// <li> Class <linkto class=AsciiTableExtension:description>
71// AsciiTableExtension</linkto>
72// (ascii) TABLE extension.
73// <li> Class <linkto class=BinaryTable:description>
74// BinaryTable</linkto>
75// BinaryTable is used to translate a FITS binary table to a Casacore Table.
76// BinaryTable inherits from the FITS BinaryTableExtension class and its
77// primary use is to convert that class to a Casacore Table.
78// The class starts with an already existing FitsInput object, which should
79// be set at a BinaryTableExtension HDU. Member functions provide a TableDesc
80// appropriate for the FITS data (to help in constructing a Casacore Table
81// compatible with the BinaryTableExtension), a Table containing the
82// current row of FITS data and a Table containing the next row of FITS data
83// (which can be used to step through the FitsInput, copying each row
84// using the RowCopier class), and a Table containin the entire FITS binary
85// table from the current row to the end of the table.
86// <motivation>
87// We need a way to get FITS data into Casacore Tables.
88// </motivation>
89// <li> Class <linkto class=BinaryTableExtension:description>
90// BinaryTableExtension</linkto>
91// BINTABLE extension.
92// <li> Class <linkto class=BlockInput:description>
93// BlockInput</linkto>
94// fixed-length blocked sequential input base class.
95// <li> Class <linkto class=BlockIO:description>
96// BlockIO</linkto>
97// fixed-length blocked sequentual I/O base class.
98// BlockIO is a low level base class that implements fixed-length
99// blocked sequential I/O. Its derived classes, BlockInput and BlockOutput
100// are used by the FitsInput and FitsOutput classes. Users will hardly ever
101// need to use this class directly.
102// <li> Class <linkto class=BlockOutput:description>
103// BlockOutput</linkto>
104// fixed-length blocked sequential output base class.
105// <li> Class <linkto class=ConstFitsKeywordList:description>
106// ConstFitsKeywordList</linkto>
107// list of read-only FITS keywords.
108// <li> Class <linkto class=CopyRecordToRecord:description>
109// CopyRecordToRecord</linkto>
110// Copies fields between Records, possibly to fields with another name.
111// <li> Class <linkto class=CopyRecordToTable:description>
112// CopyRecordToTable</linkto>
113// Copies fields from a Record to columns of a Table.
114// This class should be generalized, and made better. It is the analog of
115// RowCopier, i.e. it copies all the fields from some Record to certain
116// columns of a table. The mapping from fields to columns occurs at
117// construction of the CopyRecordToTable object.
118// <motivation>
119// This class should be generalized, and made better. It is the analog of
120// RowCopier, i.e. it copies all the fields from some Record to certain
121// columns of a table. The mapping from fields to columns occurs at
122// construction of the CopyRecordToTable object.
123// </motivation>
124// <li> Class <linkto class=ExtensionHeaderDataUnit:description>
125// ExtensionHeaderDataUnit</linkto>
126// Base class for generalized exentensions HDU.
127// <li> Class <linkto class=FITS:description>
128// FITS</linkto>
129// Static functions and enumerations.
130// Many of the static functions are utility functions used internally in the
131// implementation of the member functions of the FITS classes. They are placed
132// in a single class to encapsulate them and to avoid adding many names to the
133// global name space. More important, from the user's perspective, are the
134// enumerations. They form the basic vocabulary of a FITS application. For example,
135// instead of referring to the FITS <src>NAXIS</src> keyword,
136// <src>FITS::NAXIS</src> should be used.
137// <li> Class <linkto class=FITSDateUtil:description>
138// FITSDateUtil</linkto>
139// A class with static functions to help deal with FITS dates
140// This is a collection of static utility functions for creating and
141// interpreting FITS date keywords (e.g. DATE-OBS).
142// Its never necessary to construct a FITSDateUtil, just use the
143// static functions to help handle FITS dates.
144// <motivation>
145// The strings that make up the value of FITS dates have a
146// precise format. This class encompasses knowlege of the formats
147// used and hopefully simplifies their creation and conversion
148// to and from Casacore MVTimes.
149// </motivation>
150// <li> Class <linkto class=FITSError:description>
151// FITSError</linkto>
152// Default FITS error handling function, typdef, and enumeration.
153// FITSError contains the enumeration specifying the possible error
154// message levels. It also contains the default error handling function
155// for the FITS classes.
156// <motivation>
157// Originally, FITS error message were simply sent to an ostream. In
158// order to have these error messages go to the Casacore logger by default,
159// this class was added. This was made a separate class because both
160// BlockIo and FITS need to use this class. The anticipated replacements
161// for the current FITS classes use a somewhat similar scheme.
162// </motivation>
163// <li> Class <linkto class=FITSFieldCopier:description>
164// FITSFieldCopier</linkto>
165// Virtual base class for copying RORecordFields to FitsFields.
166// <li> Class <linkto class=FITSGroupWriter:description>
167// FITSGroupWriter</linkto>
168// Simplified interface to create and write to FITS random groups.
169// Like FITSTableWriter except that this must be the first HDU and
170// all "columns" in the description must have the same type, i.e. float.
171// <li> Class <linkto class=FITSHistoryUtil:description>
172// FITSHistoryUtil</linkto>
173// A class with static functions to help deal with FITS History cards.
174// This is a collection of static utility functions for use with FITS
175// HISTORY keywords.
176// Manipulate HISTORY information. FITS HISTORY cards are interconverted with
177// String as follows:
178// <ul>
179// <li> 'HISTORY ' and trailing blanks are removed from each card.
180// <li> Continuation cards are CARDS that have '>' in the first line.
181// <li> A string is made by concatenating the leading card and all continuation
182// cards.
183// </ul>
184// <motivation>
185// The FitsKeywordList class can be somewhat tedious to use, as it deals with,
186// e.g., char* pointers rather than Strings. This class makes it easy to
187// interconvert between the HISTORY keywords and a Vector of related history
188// information.
189// </motivation>
190// <li> Class <linkto class=FITSKeywordUtil:description>
191// FITSKeywordUtil</linkto>
192// A class with static functions to help deal with FITS Keywords.
193// This class provides functions to conveniently interconvert between Casacore
194// types and a FitsKeywordList which is needed by the native FITS classes.
195// It is more convenient to maintain the list within Casacore
196// as a Record, so we only need methods to turn a FitsKeywordList into a
197// Record, and vice versa.
198// Note that it is not necessary to construct a FITSKeywordUtil object
199// since you can use its static functions directly.
200// <motivation>
201// The FitsKeywordList class can be somewhat tedious to use, as it deals with,
202// e.g., char* pointers rather than Strings. This class makes it easy to
203// interconvert between FITS keywords and Casacore types.
204// </motivation>
205// <li> Class <linkto class=FITSMultiTable:description>
206// FITSMultiTable</linkto>
207// View multiple FITS files as a single table.
208// A FITSMultiTable is used to view a collection of FITS files on disk as a
209// single Table. That is, when next() is called, when one Table ends the next
210// is reopened until all files are exhausted. The FITS files must all have the
211// same description. Something clever should be done about the keywords.
212// <li> Class <linkto class=FITSSpectralUtil:description>
213// FITSSpectralUtil</linkto>
214// A class with static functions to help deal with FITS spectral axes.
215// This class provides functions to extract information from a FITS
216// header about the spectral axis, to setup a FITS header with
217// appropriate information for the spectral axis, and to translate
218// to and from the MFrequency refrence frame codes and their FITS
219// equivalents.
220// It is never necessary to construct a FITSSpectralUtil, just use the
221// static functions to help handle FITS Spectral axes.
222// <motivation>
223// This is designed to be used after the keywords have been extracted from
224// the FITS file using the <linkto class=FITSKeywordUtil>FITSKeywordUtil</linkto>
225// class. Extracting spectral axis and related information requires detailed
226// knowledge of FITS conventions that this class strives to encapsulize.
227// </motivation>
228// <li> Class <linkto class=FITSTable:description>
229// FITSTable</linkto>
230// Attach a FITSTabular to a binary or ASCII table.
231// FITSTable is a FITSTabular which is attached to a FITS table (on disk only
232// presently), either Binary or ASCII.
233// <li> Class <linkto class=FITSTableWriter:description>
234// FITSTableWriter</linkto>
235// Simplified interface to create and write to a FITS Binary Table.
236// <li> Class <linkto class=FITSTabular:description>
237// FITSTabular</linkto>
238// Simplified interface to FITS tables with Casacore Look and Feel.
239// FITSTablular is an obstract base class which is used for read-only access to
240// tabular FITS-like data structures.
241// <li> Class <linkto class=FITSTimedTable:description>
242// FITSTimedTable</linkto>
243// FITSTimedTable is used to look at FITS tables which have a time column. In
244// particular, it peeks ahead, and knows the time of the currentRow and of the
245// nextRow.
246// It is constructed with a pointer to any FITSTabular. Presently, no memory
247// management is imposed to ensure that the pointer remains valid.
248// <li> Class <linkto class=FitsArray:description>
249// FitsArray</linkto>
250// FITS array of given type.
251// <li> Class <linkto class=FitsArray:description>
252// <src>FitsArray<FitsBit></src></linkto>
253// FITS array of FitsBit type.
254// <li> Class <linkto class=FitsBase:description>
255// FitsBase</linkto>
256// Base class fore FitsField.
257// <li> Class <linkto class=FitsBit:description>
258// FitsBit</linkto>
259// Helper class for FITS Binary Tables.
260// This class is not intended for general use. It only has meaning
261// in the context of FITS Binary tables. There its use is incorporated
262// into the concept of a FitsField, where FitsBit is given a specialized
263// interpretation.
264// <li> Class <linkto class=FitsDiskInput:description>
265// FitsDiskInput</linkto>
266// FITS input from disk.
267// <li> Class <linkto class=FitsDiskOutput:description>
268// FitsDiskOutput</linkto>
269// FITS output to disk.
270// <li> Class <linkto class=FitsField:description>
271// FitsField</linkto>
272// Helper class.
273// <li> Class <linkto class=FitsField:description>
274// <src>FitsField<FitsBit></src></linkto>
275// Helper class.
276// <li> Class <linkto class=FitsFPUtil:description>
277// FitsFPUtil</linkto>
278// Utility functions for floating point values.
279// <li> Class <linkto class=FitsInput:description>
280// FitsInput</linkto>
281// Fixed-length sequential blocked FITS input.
282// <li> Class <linkto class=FitsIO:description>
283// FitsIO</linkto>
284// sequential FITS I/O.
285// FitsIO is a base class that handles all the sequential blocked
286// FITS I/O. Special derived classes do the input and output.
287// No interpretation of the data is attempted here, there are
288// special FITS classes that handle syntax and interpretation.
289// <li> Class <linkto class=FitsKeyCardTranslator:description>
290// FitsKeyCardTranslator</linkto>
291// Translator between Keyword lists and fixed FITS cars.
292// <li> Class <linkto class=FitsKeyword:description>
293// FitsKeyword</linkto>
294// A FITS keyword contains a name, a value and a comment..
295// <li> Class <linkto class=FitsKeywordList:description>
296// FitsKeywordList</linkto>
297// Linked list of FITS keywords.
298// <li> Class <linkto class=FitsLogical:description>
299// FitsLogical</linkto>
300// FitsLogical is a helper class that is not intended for general use.
301// <li> Class <linkto class=FitsNameResult:description>
302// FitsNameResult</linkto>
303// Analyse the name of a header card.
304// <li> Class <linkto class=FitsOutput:description>
305// FitsOutput</linkto>
306// Fixed-length sequential blocked FITS output.
307// <li> Class <linkto class=FitsParse:description>
308// FitsParse</linkto>
309// Parse a header card.
310// <li> Class <linkto class=FitsStdInput:description>
311// FitsStdInput</linkto>
312// FITS input from standard input.
313// <li> Class <linkto class=FitsStdOutput:description>
314// FitsStdOutput</linkto>
315// FITS output to standard output.
316// <li> Class <linkto class=FitsTape9Input:description>
317// FitsTape9Input</linkto>
318// FITS input from 9-track tape.
319// <li> Class <linkto class=FitsTape9Output:description>
320// FitsTape9Output</linkto>
321// FITS output to 9-track tape.
322// <li> Class <linkto class=FitsVADesc:description>
323// FitsVADesc</linkto>
324// Variable Length Array Descriptor.
325// <li> Class <linkto class=FitsValueResult:description>
326// FitsValueResult</linkto>
327// Analyse the value of a header card.
328// <li> Class <linkto class=HeaderDataUnit:description>
329// HeaderDataUnit</linkto>
330// Base class that defines a HDU.
331// The class HeaderDataUnit contains what is common to all
332// header-data-units, including the collection of keywords.
333// From this class a number of FITS header-data-units are
334// derived, each of them with their own rich assortment of
335// functions for accessing and manipulating data of specific types.
336// <li> Class <linkto class=ImageExtension:description>
337// ImageExtension</linkto>
338// IMAGE extension of given type.
339// <li> Class <linkto class=NoConvert:description>
340// NoConvert</linkto>
341// FITS templated helper class.
342// NoConvert is a template class that is not intended for
343// general use, it is used internally.
344// <li> Class <linkto class=PrimaryArray:description>
345// PrimaryArray</linkto>
346// Templated primary array base class of given type.
347// A Primary Data Array is represented by the following:
348// <srcblock>
349// <Type> data_array [NAXIS1][NAXIS2]...[NAXISN]
350// </srcblock>
351// For a PrimaryArray, dims() gives the number of dimensions
352// and dim(i) gives the value of the i-th dimension
353// WARNING! Multi-dimensional arrays are stored in FORTRAN order,
354// NOT in C order. Options on the store, copy, and move functions exist
355// to convert from one order to the other, if that is necessary.
356//
357// It is important to understand the proper sequence of operations with
358// respect to I/O and data access. For input, the `read()' functions
359// allocate an internal buffer of the appropriate size, if not already
360// allocated, as well as reading and converting data; a `read()' function
361// must be performed prior to accessing the data, i. e. before executing
362// any `()', `data()', `copy()', or `move()' function. For output, the
363// `store()' function similarly allocates an internal buffer before
364// transfering data, and must be executed prior to any data access or
365// `write()' function. Note: If you call any version of store(), do not
366// call set_next().
367//
368// Writing portions of an array at a time, rather than the entire array,
369// is a special case. The `set_next()' function is provided for this
370// purpose. It declares the intention to write out the next N elements and
371// must be executed prior to any `data()' function. It allocates a buffer
372// of appropriate size, if not already allocated. Again, via the `data()'
373// functions, one accesses the array as if the entire array were in
374// memory. The `write()' function always writes the number of current
375// elements in the internal buffer. The sequence of operations for each
376// portion of the array written would be:
377// <ul>
378// <li> `set_next(N)',
379// <li> fill the array using `data(N)' or other `data()' functions
380// <li> `write(fout)'.
381// </ul>
382// The `set_next()' function must NOT be used with
383// `read()' or `store()' functions; unpredictable results will occur.
384// <li> Class <linkto class=PrimaryGroup:description>
385// PrimaryGroup</linkto>
386// Random Group datastructure.
387// <note role=warning>
388// Please note that the NOST has deprecated the Random Group
389// datastructure, it has been replaced by the much more powerfull
390// BINTABLE extension.
391// </note>
392// <li> Class <linkto class=ReservedFitsKeyword:description>
393// ReservedFitsKeyword</linkto>
394// Reserved FITS keyword.
395// <li> Class <linkto class=ReservedFitsKeywordCollection:description>
396// ReservedFitsKeywordCollection</linkto>
397// Collection of reserved FITS keywords.
398// <li> Class <linkto class=ScalarFITSFieldCopier:description>
399// ScalarFITSFieldCopier</linkto>
400// A FITSFieldCopier for copying scalar non-string RecordFields to FitsFields.
401// <li> Class <linkto class=SDFITSTable:description>
402// SDFITSTable</linkto>
403// SDFITSTable is derived from FITSTable. It contains additional
404// checks and behaviour appropriate to the Single Dish FITS Convention
405// hence this is a Single Dish FITS Table, or SDFITSTable.
406// This class behaves much like FITSTable. It additionally verifies
407// that the indicated HDU in the input FITS file follows the SDFITS
408// convention (it has all of the required columns) and it treats
409// keywords as virtual columns when appropriate. These virtual
410// columns will appear as fields in the currentRecord and description
411// and will NOT appear in the keywords.
412// <motivation>
413// It was useful to encapsulate this behaviour in a class so that
414// the checks on a valid SDFITS table and the treatment of keywords
415// as virtual columns would not need to appear everywhere it might
416// be used.
417// </motivation>
418// <li> Class <linkto class=StringFITSFieldCopier:description>
419// StringFITSFieldCopier</linkto>
420// A FITSFieldCopier for copying String RecordFields to FitsFields.
421// <li> Class <linkto class=VariableArrayFITSFieldCopier:description>
422// VariableArrayFITSFieldCopier</linkto>
423// Copy the current contents of the input RORecordFieldPtr to the output FitsField.
424// </ol>
425//
426// <note role=tip> You may want to look at the individual header files
427// to see whether you might not prefer to include only the header
428// files you really need; it may be more efficient to do so.
429// </note>
430//
431// </synopsis>
432//
433//# <todo asof="2005/06/20">
434//# <li>
435//# </todo>
436//
437// </module>
438
439
440} //# NAMESPACE CASACORE - END
441
442#endif
443
this file contains all the compiler specific defines
Definition mainpage.dox:28