Learn R Programming

FITSio (version 2.1-6)

readFITSbintable: 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.

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.

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.

References

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

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

See Also

readFITS, readFITSheader, readFITSarray, file

Examples

Run this code
# NOT RUN {
require(FITSio)

## Either download example file from
## <https://fits.gsfc.nasa.gov/fits_samples.html>
## and use
# }
# NOT RUN {
filename <- "IUElwp25637mxlo.fits"
# }
# NOT RUN {
## 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")

# }

Run the code above in your browser using DataLab