next up previous
Next: Frame - Coordinate system description
Up: AST Class Descriptions
Previous: DssMap - Map points using a Digitised Sky Survey plate solution

   
FitsChan - I/O Channel using FITS header cards to represent Objects

Description:
A FitsChan is a specialised form of Channel which supports I/O operations involving the use of FITS (Flexible Image Transport System) header cards. Writing an Object to a FitsChan (using AST_WRITE) will, if the Object is suitable, generate a description of that Object composed of FITS header cards, and reading from a FitsChan will create a new Object from its FITS header card description.

While a FitsChan is active, it represents a buffer which may contain zero or more 80-character "header cards" conforming to FITS conventions. Any sequence of FITS-conforming header cards may be stored, apart from the "END" card whose existence is merely implied. The cards may be accessed in any order by using the FitsChan's integer Card attribute, which identifies a "current" card, to which subsequent operations apply. Searches based on keyword may be performed (using AST_FINDFITS), new cards may be inserted (AST_PUTFITS) and existing ones may be deleted (AST_DELFITS).

When you create a FitsChan, you have the option of specifying "source" and "sink" functions which connect it to external data stores by reading and writing FITS header cards. If you provide a source function, it is used to fill the FitsChan with header cards when it is created. If you do not provide a source function, the FitsChan remains empty until you explicitly enter data into it (e.g. using AST_PUTFITS or AST_WRITE). If you provide a sink function, it is used to deliver any remaining contents of a FitsChan to an external data store when the FitsChan is deleted. If you do not provide a sink function, any header cards remaining when the FitsChan is deleted will be lost, so you should arrange to extract them first if necessary (e.g. using AST_FINDFITS or AST_READ).

Coordinate system information may be described using FITS header cards using several different conventions, termed "encodings". When an AST Object is written to (or read from) a FitsChan, the value of the FitsChan's Encoding attribute determines how the Object is converted to (or from) a description involving FITS header cards. In general, different encodings will result in different sets of header cards to describe the same Object. Examples of encodings include the DSS encoding (based on conventions used by the STScI Digitised Sky Survey data), the FITS-WCS encoding (based on a proposed FITS standard) and the NATIVE encoding (a near loss-less way of storing AST Objects in FITS headers).

The available encodings differ in the range of Objects they can represent, in the number of Object descriptions that can coexist in the same FitsChan, and in their accessibility to other (external) astronomy applications (see the Encoding attribute for details). Encodings are not necessarily mutually exclusive and it may sometimes be possible to describe the same Object in several ways within a particular set of FITS header cards by using several different encodings.

The detailed behaviour of AST_READ and AST_WRITE, when used with a FitsChan, depends on the encoding in use. In general, however, all use of AST_READ is destructive, so that FITS header cards are consumed in the process of reading an Object, and are removed from the FitsChan.

If the encoding in use allows only a single Object description to be stored in a FitsChan (e.g. the DSS, FITS-WCS and FITS-IRAF encodings), then write operations using AST_WRITE will over-write any existing Object description using that encoding. Otherwise (e.g. the NATIVE encoding), multiple Object descriptions are written sequentially and may later be read back in the same sequence.

Note, currently the FitsChan class does not recognise spectral axes. They are treated as an ``unknown'' axis type, and are represented by simple a 1-dimensional Frame (not a SpecFrame).

Constructor Function:
AST_FITSCHAN

Inheritance
The FitsChan class inherits from the Channel class.

Attributes
In addition to those attributes common to all Channels, every FitsChan also has the following attributes:

  • AllWarnings: A list of the available conditions
  • Card: Index of current FITS card in a FitsChan
  • CarLin: Ignore spherical rotations on CAR projections?
  • Clean: Remove cards used whilst reading even if an error occurs?
  • DefB1950: Use FK4 B1950 as default equatorial coordinates?
  • Encoding: System for encoding Objects as FITS headers
  • FitsDigits: Digits of precision for floating-point FITS values
  • Ncard: Number of FITS header cards in a FitsChan
  • Warnings: Produces warnings about selected conditions

Functions
In addition to those routines applicable to all Channels, the following routines may also be applied to all FitsChans:

  • AST_DELFITS: Delete the current FITS card in a FitsChan
  • AST_FINDFITS: Find a FITS card in a FitsChan by keyword
  • AST_PUTFITS: Store a FITS header card in a FitsChan



next up previous
Next: Frame - Coordinate system description
Up: AST Class Descriptions
Previous: DssMap - Map points using a Digitised Sky Survey plate solution

AST A Library for Handling World Coordinate Systems in Astronomy
Starlink User Note 210
R.F. Warren-Smith & D.S. Berry
30th April 2003
E-mail:ussc@star.rl.ac.uk

Copyright (C) 2003 Central Laboratory of the Research Councils