Documentation Center

  • Trial Software
  • Product Updates

fitsinfo

Information about FITS file

Syntax

info = fitsinfo(filename)

Description

info = fitsinfo(filename) returns the structure, info, with fields that contain information about the contents of a Flexible Image Transport System (FITS) file. filename is a string enclosed in single quotes that specifies the name of the FITS file.

The info structure contains the following fields, listed in the order they appear in the structure. In addition, the info structure can also contain information about any number of optional file components, called extensions in FITS terminology. For more information, see FITS File Extensions.

Field Name

Description

Return Type

Filename

Name of the file

String

FileModDate

File modification date

String

FileSize

Size of the file in bytes

double

Contents

List of extensions in the file in the order that they occur

Cell array of strings

PrimaryData

Information about the primary data in the FITS file

Structure array

PrimaryData

The PrimaryData field is a structure that describes the primary data in the file. The following table lists the fields in the order they appear in the structure.

Field Name

Description

Return Type

DataType

Precision of the data

String

Size

Size of each dimension. The number of rows correspond to the value of the NAXIS2 keyword, while the number of columns correspond to the value of the NAXIS1 keyword. Any further dimensions correspond to NAXIS3, NAXIS4, and so on.

double array

DataSize

Size of the primary data in bytes

double

MissingDataValue

Value used to represent undefined data

double

Intercept

Value, used with Slope, to calculate actual pixel values from the array pixel values, using the equation: actual_value = Slope*array_value + Intercept

double

Slope

Value, used with Intercept, to calculate actual pixel values from the array pixel values, using the equation: actual_value = Slope*array_value + Intercept

double

Offset

Number of bytes from beginning of the file to the location of the first data value

double

Keywords

A number-of-keywords-by-3 cell array containing keywords, values, and comments of the header in each column

Cell array of strings

FITS File Extensions

A FITS file can also include optional extensions. If the file contains any of these extensions, the info structure can contain these additional fields.

  • AsciiTable — Numeric information in tabular format, stored as ASCII characters

  • BinaryTable — Numeric information in tabular format, stored in binary representation

  • Image — A multidimensional array of pixels

  • Unknown — Nonstandard extension

AsciiTable Extension

The AsciiTable structure contains the following fields, listed in the order they appear in the structure.

Field Name

Description

Return Type

Rows

Number of rows in the table

double

RowSize

Number of characters in each row

double

NFields

Number of fields in each row

double array

FieldFormat

A 1-by-NFields cell containing formats in which each field is encoded. The formats are FORTRAN-77 format codes.

Cell array of strings

FieldPrecision

A 1-by-NFields cell containing precision of the data in each field

Cell array of strings

FieldWidth

A 1-by-NFields array containing the number of characters in each field

double array

FieldPos

A 1-by-NFields array of numbers representing the starting column for each field

double array

DataSize

Size of the data in the table in bytes

double

MissingDataValue

A 1-by-NFields array of numbers used to represent undefined data in each field

Cell array of strings

Intercept

A 1-by-NFields array of numbers used along with Slope to calculate actual data values from the array data values using the equation: actual_value = Slope*array_value+Intercept

double array

Slope

A 1-by-NFields array of numbers used with Intercept to calculate true data values from the array data values using the equation: actual_value = Slope*array_value+Intercept

double array

Offset

Number of bytes from beginning of the file to the location of the first data value in the table

double

Keywords

A number-of-keywords-by-3 cell array containing all the Keywords, Values and Comments in the ASCII table header

Cell array of strings

BinaryTable Extension

The BinaryTable structure contains the following fields, listed in the order they appear in the structure.

Field Name

Description

Return Type

Rows

Number of rows in the table

double

RowSize

Number of bytes in each row

double

NFields

Number of fields in each row

double

FieldFormat

A 1-by-NFields cell array containing the data type of the data in each field. The data type is represented by a FITS binary table format code.

Cell array of strings

FieldPrecision

A 1-by-NFields cell containing precision of the data in each field

Cell array of strings

FieldSize

A 1-by-NFields array, where each element contains the number of values in the Nth field

double array

DataSize

Size of the data in the Binary Table, in bytes. Includes any data past the main table.

double

MissingDataValue

An 1-by-NFields array of numbers used to represent undefined data in each field

Cell array of double

Intercept

A 1-by-NFields array of numbers used along with Slope to calculate actual data values from the array data values using the equation: actual_value = slope*array_value+Intercept

double array

Slope

A 1-by-NFields array of numbers used with Intercept to calculate true data values from the array data values using the equation: actual_value = Slope*array_value+Intercept

double array

Offset

Number of bytes from beginning of the file to the location of the first data value

double

ExtensionSize

Size of any data past the main table, in bytes

double

ExtensionOffset

Number of bytes from the beginning of the file to any data past the main table

double

Keywords

A number-of-keywords-by-3 cell array containing all the Keywords, values, and comments in the Binary Table header

Cell array of strings

Image Extension

The Image structure contains the following fields, listed in the order they appear in the structure.

Field Name

Description

Return Type

DataType

Precision of the data

String

Size

Size of each dimension. The number of rows correspond to the value of the NAXIS2 keyword, while the number of columns correspond to the value of the NAXIS1 keyword. Any further dimensions correspond to NAXIS3, NAXIS4, and so on.

double array

DataSize

Size of the data in the Image extension in bytes

double

Offset

Number of bytes from the beginning of the file to the first data value

double

MissingDataValue

Value used to represent undefined data

double

Intercept

Value, used with Slope, to calculate actual pixel values from the array pixel values, using the equation: actual_value = Slope*array_value+Intercept

double

Slope

Value, used with Intercept, to calculate actual pixel values from the array pixel values, using the equation: actual_value = Slope*array_value + Intercept

double

Keywords

A number-of-keywords-by-3 cell array containing all the Keywords, values, and comments in the Binary Table header

Cell array of strings

Unknown Structure

The Unknown structure contains the following fields, listed in the order they appear in the structure.

Field Name

Description

Return Type

DataType

Precision of the data

String

Size

Sizes of each dimension

double array

DataSize

Size of the data in nonstandard extensions, in bytes

double

Offset

Number of bytes from beginning of the file to the first data value

double

MissingDataValue

Representation of undefined data

double

Intercept

Value, used with Slope, to calculate actual data values from the array data values, using the equation: actual_value = Slope*array_value+Intercept

double

Slope

Value, used with Intercept, to calculate actual data values from the array data values, using the equation: actual_value = Slope*array_value+Intercept

double

Keywords

A number-of-keywords-by-3 cell array containing all the Keywords, values, and comments in the Binary Table header

Cell array of strings

Examples

expand all

Get Information About FITS File

Use fitsinfo to obtain information about the FITS file tst0012.fits. In addition to its primary data, the file also contains an example of the extensions BinaryTable, Unknown, Image, and AsciiTable.

S = fitsinfo('tst0012.fits')
S = 
         Filename: 'matlabroot\toolbox\matlab\demos\tst0012.fits'
      FileModDate: '12-Mar-2001 18:37:46'
         FileSize: 109440
         Contents: {'Primary' 'Binary Table' 'Unknown' 
'Image' 'ASCII Table'}
      PrimaryData: [1x1 struct]
      BinaryTable: [1x1 struct]
          Unknown: [1x1 struct]
            Image: [1x1 struct]
       AsciiTable: [1x1 struct]

View the PrimaryData field.

S.PrimaryData
ans = 

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

The PrimaryData field describes the data in the file. For example, the Size field indicates the data is a 109-by-102 matrix.

View the AsciiTable field.

S.AsciiTable
ans = 
             Rows: 53
          RowSize: 59
          NFields: 8
      FieldFormat: {'A9' 'F6.2' 'I3' 'E10.4' 'D20.15' 'A5' 'A1' 'I4'}
   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}

The AsciiTable field describes the AsciiTable extension. For example, using the FieldWidth and FieldPos fields you can determine the length and location of each field within a row.

See Also

| |

Was this topic helpful?