Loading...
Searching...
No Matches
FITS_module
fits package (libcasa_fits)

More...

## Classes

struct | casacore::BasicFITS_global_functions_ReadFITS
| More...
struct | casacore::BasicFITS_global_functions_WriteFITS
| write a FITS file to a Casacore array More...
class | casacore::BinaryTable
| More...
class | casacore::BlockIO
| fixed-length blocked sequentual I/O base class More...
class | casacore::BlockInput
| fixed-length blocked sequential input base class More...
class | casacore::BlockOutput
| fixed-length blocked sequential output base class More...
class | casacore::CopyRecordToTable
| More...
class | casacore::CopyRecordToRecord
| Copies fields between Records, possibly to fields with another name. More...
class | casacore::NoConvert< TYPE >
| More...
class | casacore::FitsLogical
| FITS helper class. More...
class | casacore::FitsBit
| helper class for FITS Binary Tables More...
class | casacore::FitsVADesc
| Variable Length Array Descriptor. More...
class | casacore::FITS
| static functions and enumerations More...
class | casacore::ReservedFitsKeyword
| reserved FITS keyword More...
class | casacore::ReservedFitsKeywordCollection
| collection of reserved FITS keywords More...
class | casacore::FitsNameResult
| analyse the name of a header card More...
class | casacore::FitsValueResult
| analyse the value of a header card More...
class | casacore::FitsParse
| parse a header card More...
class | casacore::FitsKeyword
| FITS keyword. More...
class | casacore::FitsKeywordList
| linked list of FITS keywords More...
class | casacore::ConstFitsKeywordList
| list of read-only FITS keywords More...
class | casacore::FitsKeyCardTranslator
| translator between Keyword lists and fixed FITS cars More...
class | casacore::FitsFPUtil
| Utility functions for floating point values. More...
struct | casacore::FITS2_global_functions_ReadFITSin
| More...
class | casacore::FITSDateUtil
| More...
class | casacore::FITSError
| More...
class | casacore::FITSHistoryUtil
| More...
class | casacore::FitsIO
| More...
class | casacore::FitsInput
| fixed-length sequential blocked FITS input More...
class | casacore::FitsOutput
| fixed-length sequential blocked FITS output More...
class | casacore::FitsDiskInput
| FITS input from disk. More...
class | casacore::FitsDiskOutput
| FITS output to disk. More...
class | casacore::FitsStdInput
| FITS input from standard input. More...
class | casacore::FitsStdOutput
| FITS output to standard output. More...
class | casacore::FitsTape9Input
| FITS input from 9-track tape. More...
class | casacore::FitsTape9Output
| FITS output to 9-track tape. More...
class | casacore::FITSKeywordUtil
| More...
class | casacore::FITSSpectralUtil
| More...
class | casacore::FITSTabular
| More...
class | casacore::FITSTable
| Attach a FITSTabular to a binary or ASCII table. More...
class | casacore::FITSTableWriter
| Simplified interface to create and write to a FITS Binary Table. More...
class | casacore::FITSGroupWriter
| Simplified interface to create and write to FITS random groups. More...
class | casacore::FITSTimedTable
| More...
class | casacore::HeaderDataUnit
| More...
class | casacore::ImageExtension< TYPE >
| IMAGE extension of given type. More...
class | casacore::PrimaryGroup< TYPE >
| Random Group datastructure. More...
class | casacore::PrimaryTable< TYPE >
| Primary Table structure. More...
class | casacore::ExtensionHeaderDataUnit
| base class for generalized exentensions HDU More...
class | casacore::FitsBase
| helper class More...
class | casacore::FitsField< TYPE >
| helper class Note: Note that FitsField does not allocate space for the data; Space is external to FitsField and its address is set via the setaddr function; More...
class | casacore::FitsField< FitsBit >
| helper class More...
class | casacore::FitsArray< TYPE >
| FITS array of given type. More...
class | casacore::FitsArray< FitsBit >
| FITS array of FitsBit type Note: We must specify a FitsArray<FitsBit> as a specialization; . More...
class | casacore::BinaryTableExtension
| BINTABLE extension. More...
class | casacore::AsciiTableExtension
| (ascii) TABLE extension More...
class | casacore::SDFITSTable
| More...

## Typedefs

typedef void(* | casacore::FITSErrorHandler) (const char *errMessage, FITSError::ErrorLevel severity)
| Define a typedef for the handler function signature for convenience.

## Functions

| casacore::PrimaryArray (FitsInput &, FITSErrorHandler=FITSError::defaultHandler)
| templated primary array base class of given type

## Detailed Description

Classes and global functions for system use

See below for an overview of the classes in this module.

### Synopsis

This module is a bag of related fits classes and global functions.

The following functionality is available:

1. Class FITSFieldCopier A FITSFieldCopier for copying Array RecordFields to FitsFields.
2. Class AsciiTableExtension (ascii) TABLE extension.

3. Class BinaryTable BinaryTable is used to translate a FITS binary table to a Casacore Table. BinaryTable inherits from the FITS BinaryTableExtension class and its primary use is to convert that class to a Casacore Table. The class starts with an already existing FitsInput object, which should be set at a BinaryTableExtension HDU. Member functions provide a TableDesc appropriate for the FITS data (to help in constructing a Casacore Table compatible with the BinaryTableExtension), a Table containing the current row of FITS data and a Table containing the next row of FITS data (which can be used to step through the FitsInput, copying each row using the RowCopier class), and a Table containin the entire FITS binary table from the current row to the end of the table.

   ### Motivation

   We need a way to get FITS data into Casacore Tables.

4. Class BinaryTableExtension BINTABLE extension.
5. Class BlockInput fixed-length blocked sequential input base class.
6. Class BlockIO fixed-length blocked sequentual I/O base class. BlockIO is a low level base class that implements fixed-length blocked sequential I/O. Its derived classes, BlockInput and BlockOutput are used by the FitsInput and FitsOutput classes. Users will hardly ever need to use this class directly.
7. Class BlockOutput fixed-length blocked sequential output base class.
8. Class ConstFitsKeywordList list of read-only FITS keywords.
9. Class CopyRecordToRecord Copies fields between Records, possibly to fields with another name.

10. Class CopyRecordToTable Copies fields from a Record to columns of a Table. This class should be generalized, and made better. It is the analog of RowCopier, i.e. it copies all the fields from some Record to certain columns of a table. The mapping from fields to columns occurs at construction of the CopyRecordToTable object.

    ### Motivation

    This class should be generalized, and made better. It is the analog of RowCopier, i.e. it copies all the fields from some Record to certain columns of a table. The mapping from fields to columns occurs at construction of the CopyRecordToTable object.

11. Class ExtensionHeaderDataUnit Base class for generalized exentensions HDU.
12. Class FITS Static functions and enumerations. Many of the static functions are utility functions used internally in the implementation of the member functions of the FITS classes. They are placed in a single class to encapsulate them and to avoid adding many names to the global name space. More important, from the user's perspective, are the enumerations. They form the basic vocabulary of a FITS application. For example, instead of referring to the FITS NAXIS keyword, FITS::NAXIS should be used.

13. Class FITSDateUtil A class with static functions to help deal with FITS dates This is a collection of static utility functions for creating and interpreting FITS date keywords (e.g. DATE-OBS). Its never necessary to construct a FITSDateUtil, just use the static functions to help handle FITS dates.

    ### Motivation

    The strings that make up the value of FITS dates have a precise format. This class encompasses knowlege of the formats used and hopefully simplifies their creation and conversion to and from Casacore MVTimes.

14. Class FITSError Default FITS error handling function, typdef, and enumeration. FITSError contains the enumeration specifying the possible error message levels. It also contains the default error handling function for the FITS classes.

    ### Motivation

    Originally, FITS error message were simply sent to an ostream. In order to have these error messages go to the Casacore logger by default, this class was added. This was made a separate class because both BlockIo and FITS need to use this class. The anticipated replacements for the current FITS classes use a somewhat similar scheme.

15. Class FITSFieldCopier Virtual base class for copying RORecordFields to FitsFields.
16. Class FITSGroupWriter Simplified interface to create and write to FITS random groups. Like FITSTableWriter except that this must be the first HDU and all "columns" in the description must have the same type, i.e. float.

17. Class FITSHistoryUtil A class with static functions to help deal with FITS History cards. This is a collection of static utility functions for use with FITS HISTORY keywords. Manipulate HISTORY information. FITS HISTORY cards are interconverted with String as follows:

    - 'HISTORY ' and trailing blanks are removed from each card.
    - Continuation cards are CARDS that have '>' in the first line.
    - A string is made by concatenating the leading card and all continuation cards.

    ### Motivation

    The FitsKeywordList class can be somewhat tedious to use, as it deals with, e.g., char* pointers rather than Strings. This class makes it easy to interconvert between the HISTORY keywords and a Vector of related history information.

18. Class FITSKeywordUtil A class with static functions to help deal with FITS Keywords. This class provides functions to conveniently interconvert between Casacore types and a FitsKeywordList which is needed by the native FITS classes. It is more convenient to maintain the list within Casacore as a Record, so we only need methods to turn a FitsKeywordList into a Record, and vice versa. Note that it is not necessary to construct a FITSKeywordUtil object since you can use its static functions directly.

    ### Motivation

    The FitsKeywordList class can be somewhat tedious to use, as it deals with, e.g., char* pointers rather than Strings. This class makes it easy to interconvert between FITS keywords and Casacore types.

19. Class FITSMultiTable View multiple FITS files as a single table. A FITSMultiTable is used to view a collection of FITS files on disk as a single Table. That is, when next() is called, when one Table ends the next is reopened until all files are exhausted. The FITS files must all have the same description. Something clever should be done about the keywords.

20. Class FITSSpectralUtil A class with static functions to help deal with FITS spectral axes. This class provides functions to extract information from a FITS header about the spectral axis, to setup a FITS header with appropriate information for the spectral axis, and to translate to and from the MFrequency refrence frame codes and their FITS equivalents. It is never necessary to construct a FITSSpectralUtil, just use the static functions to help handle FITS Spectral axes.

    ### Motivation

    This is designed to be used after the keywords have been extracted from the FITS file using the FITSKeywordUtil class. Extracting spectral axis and related information requires detailed knowledge of FITS conventions that this class strives to encapsulize.

21. Class FITSTable Attach a FITSTabular to a binary or ASCII table. FITSTable is a FITSTabular which is attached to a FITS table (on disk only presently), either Binary or ASCII.
22. Class FITSTableWriter Simplified interface to create and write to a FITS Binary Table.
23. Class FITSTabular Simplified interface to FITS tables with Casacore Look and Feel. FITSTablular is an obstract base class which is used for read-only access to tabular FITS-like data structures.
24. Class FITSTimedTable FITSTimedTable is used to look at FITS tables which have a time column. In particular, it peeks ahead, and knows the time of the currentRow and of the nextRow. It is constructed with a pointer to any FITSTabular. Presently, no memory management is imposed to ensure that the pointer remains valid.
25. Class FitsArray FITS array of given type.
26. Class FitsArray<FitsBit> FITS array of FitsBit type.
27. Class FitsBase Base class fore FitsField.
28. Class FitsBit Helper class for FITS Binary Tables. This class is not intended for general use. It only has meaning in the context of FITS Binary tables. There its use is incorporated into the concept of a FitsField, where FitsBit is given a specialized interpretation.
29. Class FitsDiskInput FITS input from disk.
30. Class FitsDiskOutput FITS output to disk.
31. Class FitsField Helper class.
32. Class FitsField<FitsBit> Helper class.
33. Class FitsFPUtil Utility functions for floating point values.
34. Class FitsInput Fixed-length sequential blocked FITS input.
35. Class FitsIO sequential FITS I/O. FitsIO is a base class that handles all the sequential blocked FITS I/O. Special derived classes do the input and output. No interpretation of the data is attempted here, there are special FITS classes that handle syntax and interpretation.
36. Class FitsKeyCardTranslator Translator between Keyword lists and fixed FITS cars.
37. Class FitsKeyword A FITS keyword contains a name, a value and a comment..
38. Class FitsKeywordList Linked list of FITS keywords.
39. Class FitsLogical FitsLogical is a helper class that is not intended for general use.
40. Class FitsNameResult Analyse the name of a header card.
41. Class FitsOutput Fixed-length sequential blocked FITS output.
42. Class FitsParse Parse a header card.
43. Class FitsStdInput FITS input from standard input.
44. Class FitsStdOutput FITS output to standard output.
45. Class FitsTape9Input FITS input from 9-track tape.
46. Class FitsTape9Output FITS output to 9-track tape.
47. Class FitsVADesc Variable Length Array Descriptor.
48. Class FitsValueResult Analyse the value of a header card.
49. Class HeaderDataUnit Base class that defines a HDU. The class HeaderDataUnit contains what is common to all header-data-units, including the collection of keywords. From this class a number of FITS header-data-units are derived, each of them with their own rich assortment of functions for accessing and manipulating data of specific types.
50. Class ImageExtension IMAGE extension of given type.
51. Class NoConvert FITS templated helper class. NoConvert is a template class that is not intended for general use, it is used internally.

52. Class PrimaryArray Templated primary array base class of given type. A Primary Data Array is represented by the following:

    <Type> data_array [NAXIS1][NAXIS2]...[NAXISN]

    For a PrimaryArray, dims() gives the number of dimensions and dim(i) gives the value of the i-th dimension WARNING! Multi-dimensional arrays are stored in FORTRAN order, NOT in C order. Options on the store, copy, and move functions exist to convert from one order to the other, if that is necessary.

    It is important to understand the proper sequence of operations with respect to I/O and data access. For input, the read()' functions allocate an internal buffer of the appropriate size, if not already allocated, as well as reading and converting data; a read()' function must be performed prior to accessing the data, i. e. before executing any ()', data()', copy()', or move()' function. For output, the store()' function similarly allocates an internal buffer before transfering data, and must be executed prior to any data access or write()' function. Note: If you call any version of store(), do not call set_next().

    Writing portions of an array at a time, rather than the entire array, is a special case. The set_next()' function is provided for this purpose. It declares the intention to write out the next N elements and must be executed prior to any data()' function. It allocates a buffer of appropriate size, if not already allocated. Again, via the data()' functions, one accesses the array as if the entire array were in memory. The write()' function always writes the number of current elements in the internal buffer. The sequence of operations for each portion of the array written would be:

    - set_next(N)', <li> fill the array using data(N)' or other data()' functions <li> write(fout)'.

    The set_next()' function must NOT be used with read()' or `store()' functions; unpredictable results will occur.

53. Class PrimaryGroup Random Group datastructure.
    Warning: Please note that the NOST has deprecated the Random Group datastructure, it has been replaced by the much more powerfull BINTABLE extension;
54. Class ReservedFitsKeyword Reserved FITS keyword.
55. Class ReservedFitsKeywordCollection Collection of reserved FITS keywords.
56. Class ScalarFITSFieldCopier A FITSFieldCopier for copying scalar non-string RecordFields to FitsFields.

57. Class SDFITSTable SDFITSTable is derived from FITSTable. It contains additional checks and behaviour appropriate to the Single Dish FITS Convention hence this is a Single Dish FITS Table, or SDFITSTable. This class behaves much like FITSTable. It additionally verifies that the indicated HDU in the input FITS file follows the SDFITS convention (it has all of the required columns) and it treats keywords as virtual columns when appropriate. These virtual columns will appear as fields in the currentRecord and description and will NOT appear in the keywords.

    ### Motivation

    It was useful to encapsulate this behaviour in a class so that the checks on a valid SDFITS table and the treatment of keywords as virtual columns would not need to appear everywhere it might be used.

58. Class StringFITSFieldCopier A FITSFieldCopier for copying String RecordFields to FitsFields.
59. Class VariableArrayFITSFieldCopier Copy the current contents of the input RORecordFieldPtr to the output FitsField.

Tip: You may want to look at the individual header files to see whether you might not prefer to include only the header files you really need; it may be more efficient to do so;

*/ /**

## Typedef Documentation

## FITSErrorHandler

typedef void(* casacore::FITSErrorHandler) (const char *errMessage, FITSError::ErrorLevel severity)

Define a typedef for the handler function signature for convenience.

### Intended use:

Public interface

### Review Status

Reviewed By:
  UNKNOWN
Date Reviewed:
  before2004/08/25

Definition at line 108 of file FITSError.h.

## Function Documentation

## PrimaryArray()

casacore::PrimaryArray | ( | FitsInput & | ,
|  | FITSErrorHandler | = FITSError::defaultHandler )

templated primary array base class of given type

### Synopsis

A Primary Data Array is represented by the following:

<Type> data_array [NAXIS1][NAXIS2]...[NAXISN]

For a PrimaryArray, dims() gives the number of dimensions and dim(i) gives the value of the i-th dimension

WARNING! Multi-dimensional arrays are stored in FORTRAN order, NOT in C order. Options on the store, copy, and move functions exist to convert from one order to the other, if that is necessary.

It is important to understand the proper sequence of operations with respect to I/O and data access. For input, the read()' functions allocate an internal buffer of the appropriate size, if not already allocated, as well as reading and converting data; a read()' function must be performed prior to accessing the data, i. e. before executing any ()', data()', copy()', or move()' function. For output, the store()' function similarly allocates an internal buffer before transfering data, and must be executed prior to any data access or write()' function. Note: If you call any version of store(), do not call set_next().

Writing portions of an array at a time, rather than the entire array, is a special case. The set_next()' function is provided for this purpose. It declares the intention to write out the next N elements and must be executed prior to any data()' function. It allocates a buffer of appropriate size, if not already allocated. Again, via the data()' functions, one accesses the array as if the entire array were in memory. The write()' function always writes the number of current elements in the internal buffer. The sequence of operations for each portion of the array written would be:

- set_next(N)', <li> fill the array using data(N)' or other data()' functions <li> write(fout)'.

The set_next()' function must NOT be used with read()' or `store()' functions; unpredictable results will occur.

### Example

The following example illustrates the output cases.

Suppose we have an image array with 512 rows and 1024 columns stored in C-order. The C declaration would be:

int source[1024][512];

To write out the entire array:

FitsOutput fout; // some properly constructed FitsOutput
PrimaryArray<FitsLong> pa; // some properly constructed PrimaryArray
pa.store(source,CtoF);
pa.write(fout);
casacore::FitsOutput
fixed-length sequential blocked FITS output
Definition fitsio.h:226
casacore::PrimaryArray
PrimaryArray(FitsInput &, FITSErrorHandler=FITSError::defaultHandler)
templated primary array base class of given type
casacore::pa
LatticeExprNode pa(const LatticeExprNode &left, const LatticeExprNode &right)
This function finds 180/pi*atan2(left,right)/2.

Suppose we wanted to write out the two-dimensional image array a column at a time, rather than write out the entire array. For FITS, dim(0) is 512, dim(1) is 1024. The following code fragment writes one column at a time in the proper FITS Fortran-order.

for (i = 0; i < dim(1); ++i) {
pa.set_next(dim(0));
for (j = 0; j < dim(0); ++j)
data(j,i) = source[i][j];
pa.write(fout);
}

*/ template <class TYPE> class PrimaryArray : public HeaderDataUnit { public: typedef TYPE ElementType;

/** constructor from a FitsInput

References casacore::FITSError::defaultHandler().

Referenced by casacore::ImageExtension< unsigned char >::ie_assign(), casacore::PrimaryGroup< unsigned char >::pg_assign(), casacore::PrimaryTable< unsigned char >::pt_assign(), and casacore::FITS2_global_functions_ReadFITSin::ReadFITSin().