Description Usage Arguments Details Value Note Author(s) References See Also Examples
Read an image (multi-dimensional array) from an open connection to a FITS file.
1 | readFITSarray(zz, hdr)
|
zz |
File handle; see Example. |
hdr |
Header card images, raw or parsed. |
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.
A list containing
imDat |
Data array. |
axDat |
Data frame with axis scaling and labels. |
hdr |
Vector with the parsed header. |
Function assigns values of 1 to CRPIX, CRVAL, and CDELT if they are unspecified in the header.
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.
Andrew Harris
Hanisch et al., Astron.\ Astrophys. 376, 359-380 (2001)
readFITS
, readFITSheader
,
readFITSbintable
, file
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | 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))
|
List of 3
$ imDat: int [1:5, 1:3] 1 2 3 4 5 6 7 8 9 10 ...
$ axDat:'data.frame': 2 obs. of 6 variables:
..$ crpix: num [1:2] 1 1
..$ crval: num [1:2] 1 1
..$ cdelt: num [1:2] 1 1
..$ len : int [1:2] 5 3
..$ ctype: chr [1:2] "" ""
..$ cunit: chr [1:2] "" ""
$ hdr : chr [1:35] "SIMPLE" "T" "BITPIX" "32" ...
chr [1:19] "SIMPLE = T / File conforms to FITS standard " ...
chr [1:35] "SIMPLE" "T" "BITPIX" "32" "NAXIS" "2" "NAXIS1" "5" "NAXIS2" ...
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.