Learn R Programming

FITSio (version 2.1-6)

readFITSarray: Read an image (multi-dimensional array) from a FITS file

Description

Read an image (multi-dimensional array) from an open connection to a FITS file.

Usage

readFITSarray(zz, hdr)

Arguments

zz

File handle; see Example.

hdr

Header card images, raw or parsed.

Value

A list containing

imDat

Data array.

axDat

Data frame with axis scaling and labels.

hdr

Vector with the parsed header.

Details

readFITSarray reads the data from the image part of a FITS Header and Data Unit (hdu) containing image data. The header must be read first by readFITS or readFITSheader; either this header or the parsed version from parseHdr are valid for the hdr variable.

References

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

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

See Also

readFITS, readFITSheader, readFITSbintable, file

Examples

Run this code
# NOT RUN {
    require(FITSio)
    ## Make a test file.
    Z <- matrix(1:15, ncol = 3)
    filename <- paste(tempdir(), "test.fits", sep="")
    writeFITSim(Z, filename)
    ## Open file, read header and array, close file and delete.
    zz <- file(description = filename, open = "rb")
    header <- readFITSheader(zz)  # image data off primary header
    D <- readFITSarray(zz, header)
    close(zz)
    ## Look at data list, header file, and parsed header
    str(D)
    image(D$imDat)
    str(header)
    str(parseHdr(header))
# }

Run the code above in your browser using DataLab