write.fits: Write data to a fits file

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/write.fits.R

Description

This is a very basic function to write some data from R to a fits file. The function is a wrapper for the C program R2fits.

Usage

1
write.fits(x, outfile, nx, ny, na.val = 0)

Arguments

x

The input data. This can be a vector of length (at least) nx x ny, or a matrix with dimensions nx and ny.

outfile

The name of the fits file to be written. To force overwriting an existing file us a leading "!".

nx, ny

The x and y dimensions of the image to be written. These have to be specified if x is a vector. If x is a matrix, its dimensions are used. nx and ny can also be vectors giving the world coordinates of the image pixels. In this case, the number of pixels in each direction is computed automatically.

na.val

Numerical value to replace NA in the input data x.

Details

The output created by R2fits and hence by this function is a very basic fits file whose header only contains the image dimensions and the date of writing. Any extra information on the data will have to be added automatically.

Value

None.

Author(s)

Oliver Czoske

See Also

write.kinmap

Examples

1
2
3
4
5
x <- y <- seq(-2, 2, by=0.2)
z <- outer(x, y, function(x, y){exp(-x^2 - y^2/2^2)})
file <- paste("/tmp/slacR.tmp.", floor(10000*runif(1)), sep="")

write.fits(z, file)

oczoske/slacR documentation built on May 20, 2019, 8:23 p.m.