R: Tan Gnomonic Projection Pystem WCS Polver Punctions

tanproj {celestial} | R Documentation

## Tan Gnomonic Projection Pystem WCS Polver Punctions

### Description

Converts RA/Dec (degrees) to x/y (pixels) position using the Tan Gnomonic projection system, and vice-versa. Translations adapted from: http://mathworld.wolfram.com/GnomonicProjection.html

### Usage

    radec2xy(RA, Dec, header, CRVAL1 = 0, CRVAL2 = 0, CRPIX1 = 0, CRPIX2 = 0, CD1_1 = 1,
    CD1_2 = 0, CD2_1 = 0, CD2_2 = 1)
    xy2radec(x, y, header, CRVAL1 = 0, CRVAL2 = 0, CRPIX1 = 0, CRPIX2 = 0, CD1_1 = 1,
    CD1_2 = 0, CD2_1 = 0, CD2_2 = 1)

### Arguments

`RA` | Vector or matrix; target right ascension in degrees. If matrix then the first column will be used as RA and the second column as Dec.
`Dec` | Vector; target declination in degrees. Ignored if RA is a matrix.
`x` | Vector or matrix; target x-pixel. If Matrix then the first column will be used as the x-axis and the second column as y-axis.
`y` | Vector; target y-pixel. Ignored if x is a matrix.
`CRVAL1` | FITS header CRVAL1 for the Tan Gnomonic projection system. This is the RA in degrees at the location of CRPIX1.
`CRVAL2` | FITS header CRVAL2 for the Tan Gnomonic projection system. This is the Dec in degrees at the location of CRPIX2.
`CRPIX1` | FITS header CRPIX1 for the Tan Gnomonic projection system. This is the x pixel value at the location of CRVAL1.
`CRPIX2` | FITS header CRPIX2 for the Tan Gnomonic projection system. This is the y pixel value at the location of CRVAL2.
`CD1_1` | FITS header CD1_1 for the Tan Gnomonic projection system. Change in RA-Tan in degrees along x-Axis.
`CD1_2` | FITS header CD1_2 for the Tan Gnomonic projection system. Change in RA-Tan in degrees along y-Axis.
`CD2_1` | FITS header CD2_1 for the Tan Gnomonic projection system. Change in Dec-Tan in degrees along x-Axis.
`CD2_2` | FITS header CD2_2 for the Tan Gnomonic projection system. Change in Dec-Tan in degrees along y-Axis.
`header` | Full FITS header in table or vector format. Legal table format headers are provided by the `read.fitshdr` function or the hdr list output of `read.fits` in the `astro` package). Also the hdr output of `readFITS` in the `FITSio` package provides legal vector format inputs. If a header is provided then key words will be taken from here as a priority. Missing header keywords are printed out and other header option arguments are used in these cases.

### Details

These functions encode the standard FITS Tan Gnomonic projection system for solving an image WCS. They do not deal with higher order polynomial distortion terms.

### Value

`radec2xy` | Returns a two column matrix with columns x and y.
`xy2radec` | Returns a two column matrix with columns RA and Dec (in degrees).

### Author(s)

Aaron Robotham

### References

http://mathworld.wolfram.com/GnomonicProjection.html

### See Also

`deg2dms`, `deg2hms`, `dms2deg`, `hms2deg`

### Examples

    #A simple example:

    radec2xy(10,20)
    xy2radec(radec2xy(10,20))

    #A more complicated example, where we transform and rotate large amounts:

    exdata_start=expand.grid(1:10,21:30)
    plot(exdata_start)
    exradec=radec2xy(exdata_start, CRVAL1=20, CRPIX1=100, CRVAL2=30, CRPIX2=130, CD1_1=0.1,
    CD1_2=-0.05, CD2_1=0.05, CD2_2=0.1)
    plot(exradec)
    exdata_end=xy2radec(exradec, CRVAL1=20, CRPIX1=100, CRVAL2=30, CRPIX2=130, CD1_1=0.1,
    CD1_2=-0.05, CD2_1=0.05, CD2_2=0.1)
    plot(exdata_start,cex=2)
    points(exdata_end,col='red')

    #The residuals should be very small (in the noice of double precision arithmetic):

    plot(density(exdata_start[,1]-exdata_end[,1]))
    lines(density(exdata_start[,2]-exdata_end[,2]),col='red')

[Package celestial version 1.4.1 Index]