| MATLAB Function Reference | ![]() |
Return information about a FITS file
Syntax
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.
| 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.
| 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.
|
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
See Also
| finish | fitsread | ![]() |