readFITSbintable {FITSio}R Documentation

Read a FITS binary table

Description

Read a FITS binary table from an open connection to a FITS file.

Usage

readFITSbintable(zz, hdr)

Arguments

zz

File handle; see Example.

hdr

Header card images, raw or parsed.

Details

readFITSbintable reads the data from the binary table part of a FITS Header and Data Unit (hdu) containing binary table data. The header must be read first by readFITSheader; either this header or the parsed version from parseHdr are valid for the hdr variable. Binary tables are multi-column files with one or more rows. Each column has an individual data type and number of entries per cell (i.e., a cell may contain a scalar or vector).

64-bit integers are read as pairs of 32-bit integers, for a vector twice the length of most other vectors. Files read properly, but reconstructing the 64-bit representation is untested. The CRAN package int64 may be of use here.

8, 16, 24, and 32-bit bit arrays return as integers. Other lengths are not supported.

Binary table complex and array descriptor data types are not implemented in this release due to a lack of examples for testing.

Value

col

Data from each column, either a vector or an array.

hdr

Vector with parsed header.

colNames

Vector of column names, TTYPEn FITS variable.

colUnits

Vector of column units, TUNITn FITS variable.

TNULLn

Vector of undefined value definitions, FITS variable.

TSCALn

Vector of multipliers for scaling, FITS variable.

TZEROn

Vector of zeros for scaling, FITS variable.

TDISPn

Vector of format information, FITS variable.

Note

Graphical FITS viewers such as fv (https://heasarc.gsfc.nasa.gov/ftools/fv/) and SAOImage DS9 (http://ds9.si.edu/) have excellent facilities for displaying FITS data, headers, and file structure. Having one or more graphical viewers available will prove extremely useful for working with FITS files, even when the data are read into R for further processing. fv and SAOImage DS9 are in active devlopement with support for unix, Windows, and Mac OS-X operating systems, and are available at no cost.

Author(s)

Andrew Harris

References

Hanisch et al., Astron.\ Astrophys. 376, 359-380 (2001)

https://fits.gsfc.nasa.gov/

See Also

readFITS, readFITSheader, readFITSarray, file

Examples

require(FITSio)

## Either download example file from
## <https://fits.gsfc.nasa.gov/fits_samples.html>
## and use
## Not run: filename <- "IUElwp25637mxlo.fits"
## or, for local example use
filename <- system.file("fitsExamples", "IUElwp25637mxlo.fits",
                        package = "FITSio")

## Open file, read header and table, close file.
zz <- file(description = filename, open = "rb")
header0 <- readFITSheader(zz) # read primary header
header <- readFITSheader(zz) # read extension header
D <- readFITSbintable(zz, header)
close(zz)

## Look at contents
str(D)
str(header)
str(parseHdr(header))
D$hdr[which(D$hdr=="BITPIX")+1]   # BITPIX value from header
D$colNames
plot(D$col[[5]], ylab = "Value", main = D$colNames[5], type = "l")


[Package FITSio version 2.1-6 Index]