Wednesday, August 5, 2009

fitsinfo

Return information about a FITS file

Syntax

  • S = fitsinfo(filename)

Description

S = fitsinfo(filename) returns a structure whose fields contain information about the contents of a Flexible Image Transport System (FITS) file. filename is a string that specifies the name of the FITS file.

The structure, S, obtained from a basic FITS file, contains the following fields.

Information Returned From a Basic FITS File

Fieldname
Description
Return Type
Contents
List of extensions in the file in the order that they occur
Cell array of Strings
FileModDate
File modification date
String
Filename
Name of the file
String
FileSize
Size of the file in bytes
Double
PrimaryData
Information about the primary data in the FITS file
Structure array

A FITS file may also include any number of extensions. For such files, fitsinfo returns a structure, S, with the fields listed above plus one or more of the following structure arrays.

Additional Information Returned From FITS Extensions
Fieldname
Description
Return Type
AsciiTable
ASCII Table extensions
Structure array
BinaryTable
Binary Table extensions
Structure array
Image
Image extensions
Structure array
Unknown
Nonstandard extensions
Structure array

The tables that follow show the fields of each of the structure arrays that can be returned by fitsinfo.

    Note For all Intercept and Slope fieldnames below, the equation used to calculate actual values is, actual_value = (Slope * array_value) + Intercept.



Fields of the PrimaryData Structure Array
Fieldname
Description
Return Type
DataSize
Size of the primary data in bytes
Double
DataType
Precision of the data
String
Intercept
Value, used with Slope, to calculate actual pixel values from the array pixel values
Double
Keywords
Keywords, values and comments of the header in each column
Cell array of strings
MissingDataValue
Value used to represent undefined data
Double
Offset
Number of bytes from beginning of the file to the first data value
Double
Size
Sizes of each dimension
Double array
Slope
Value, used along with Intercept, to calculate actual pixel values from the array pixel values
Double



Fields of the AsciiTable Structure Array
Fieldname
Description
Return Type
DataSize
Size of the data in the ASCII Table in bytes
Double
FieldFormat
Formats in which each field is encoded, using FORTRAN-77 format codes
Cell array of strings
FieldPos
Starting column for each field
Double array
FieldPrecision
Precision in which the values in each field are stored
Cell array of strings
FieldWidth
Number of characters in each field
Double array
Intercept
Values, used along with Slope, to calculate actual data values from the array data values
Double array
Keywords
Keywords, values and comments in the ASCII table header
Cell array of strings
MissingDataValue
Representation of undefined data in each field
Cell array of strings
NFields
Number of fields in each row
Double array
Offset
Number of bytes from beginning of the file to the first data value
Double
Rows
Number of rows in the table
Double
RowSize
Number of characters in each row
Double
Slope
Values, used with Intercept, to calculate actual data values from the array data values
Double array



Fields of the BinaryTable Structure Array
Fieldname
Description
Return Type
DataSize
Size of the data in the Binary Table, in bytes. Includes any data past the main part of the Binary Table.
Double
ExtensionOffset
Number of bytes from the beginning of the file to any data past the main part of the Binary Table
Double
ExtensionSize
Size of any data past the main part of the Binary Table, in bytes
Double
FieldFormat
Data type for each field, using FITS binary table format codes
Cell array of strings
FieldPrecision
Precisions in which the values in each field are stored
Cell array of strings
FieldSize
Number of values in each field
Double array
Intercept
Values, used along with Slope, to calculate actual data values from the array data values
Double array
Keywords
Keywords, values and comments in the Binary Table header
Cell array of strings
MissingDataValue
Representation of undefined data in each field
Cell array of double
NFields
Number of fields in each row
Double
Offset
Number of bytes from beginning of the file to the first data value
Double
Rows
Number of rows in the table
Double
RowSize
Number of bytes in each row
Double
Slope
Values, used with Intercept, to calculate actual data values from the array data values
Double array



Fields of the Image Structure Array
Fieldname
Description
Return Type
DataSize
Size of the data in the Image extension in bytes
Double
DataType
Precision of the data
String
Intercept
Value, used along with Slope, to calculate actual pixel values from the array pixel values
Double
Keywords
Keywords, values and comments in the Image header
Cell array of strings
MissingDataValue
Representation of undefined data
Double
Offset
Number of bytes from the beginning of the file to the first data value
Double
Size
Sizes of each dimension
Double array
Slope
Value, used along with Intercept, to calculate actual pixel values from the array pixel values
Double



Fields of the Unknown Structure Array
Fieldname
Description
Return Type
DataSize
Size of the data in nonstandard extensions, in bytes
Double
DataType
Precision of the data
String
Intercept
Value, used along with Slope, to calculate actual data values from the array data values
Double
Keywords
Keywords, values and comments in the extension header
Cell array of strings
MissingDataValue
Representation of undefined data
Double
Offset
Number of bytes from beginning of the file to the first data value
Double
Size
Sizes of each dimension
Double array
Slope
Value, used along with Intercept, to calculate actual data values from the array data values
Double

Example

Use fitsinfo to obtain information about FITS file, tst0012.fits. In addition to its primary data, the file also contains three extensions: Binary Table, Image, and ASCII Table.

  • S = fitsinfo('tst0012.fits');
    S =
    Filename: 'tst0012.fits'
    FileModDate: '27-Nov-2000 13:25:55'
    FileSize: 109440
    Contents: {'Primary' 'Binary Table' 'Image' 'ASCII'}
    PrimaryData: [1x1 struct]
    BinaryTable: [1x1 struct]
    Image: [1x1 struct]
    AsciiTable: [1x1 struct]

The PrimaryData substructure shows that the data resides in a 102-by-109 matrix of single-precision values. There are 44,472 bytes of primary data starting at an offset of 2,880 bytes from the start of the file.

  • S.PrimaryData
    ans =
    DataType: 'single'
    Size: [102 109]
    DataSize: 44472
    MissingDataValue: []
    Intercept: 0
    Slope: 1
    Offset: 2880
    Keywords: {25x3 cell}

Examining the ASCII Table substructure, you can see that this table has 53 rows, 59 columns, and contains 8 fields per row. The last field in each row, for example, begins in the 55th column and contains a 4-digit integer.

  • S.AsciiTable
    ans =
    Rows: 53
    RowSize: 59
    NFields: 8
    FieldFormat: {1x8 cell}
    FieldPrecision: {1x8 cell}
    FieldWidth: [9 6.2000 3 10.4000 20.1500 5 1 4]
    FieldPos: [1 11 18 22 33 54 54 55]
    DataSize: 3127
    MissingDataValue: {'*' '---.--' '*' [] '*' '*' '*' ''}
    Intercept: [0 0 -70.2000 0 0 0 0 0]
    Slope: [1 1 2.1000 1 1 1 1 1]
    Offset: 103680
    Keywords: {65x3 cell}

    S.AsciiTable.FieldFormat
    ans =
    'A9' 'F6.2' 'I3' 'E10.4' 'D20.15' 'A5' 'A1' 'I4'

The ASCII Table includes 65 keyword entries arranged in a 65-by-3 cell array.

  • key = S.AsciiTable.Keywords

    key =
    S.AsciiTable.Keywords
    ans =
    'XTENSION' 'TABLE' [1x48 char]
    'BITPIX' [ 8] [1x48 char]
    'NAXIS' [ 2] [1x48 char]
    'NAXIS1' [ 59] [1x48 char]
    . . .
    . . .
    . . .

One of the entries in this cell array is shown here. Each row of the array contains a keyword, its value, and comment.

  • key{2,:}

    ans =
    BITPIX % Keyword

    ans =
    8 % Keyword value

    ans =
    Character data 8 bits per pixel % Keyword comment

No comments:

Post a Comment