ad.to.xy: RA/Dec to Pixel via Header Astrometry

View source: R/ad.to.xy.R

ad.to.xyR Documentation

RA/Dec to Pixel via Header Astrometry

Description

Converts RA/DEC (degrees) to X/Y (pixels) position using the TAN Gnomonic projection system.

Usage

ad.to.xy(ra, dec, astr.struc, diagnostic = FALSE)

Arguments

ra

numeric (n) vector; RA values

dec

numeric (n) vector; Dec values

astr.struc

list; Astrometry Keywords and values returned from read of a fits header. See "read.astrometry" function

diagnostic

logical; if TRUE, diagnostic information will be output as type ‘message’

Value

numeric (n,2) array; two numeric (n) vectors ‘X’ and ‘Y’, column-bound

Note

While this routine is designed for use with the TAN Gnomonic projection, an orthographic SIN projection *without rotation* is degenerate and therefore also valid for use

Author(s)

Angus H Wright ICRAR angus.wright@icrar.org

See Also

radec.to.xy, read.astrometry, measure.fluxes

Examples


#Load LAMBDAR
library(LAMBDAR)

#Load sample image
data(SDSS.sample)
#Load sample catalogue
data(ApCat.sample)
#Save sample image to File
write.fits(file="SampleImage.fits",SDSS.sample)
#Read Astrometry
astr<-read.astrometry("SampleImage.fits")
#Determine the pixel-locations of the aperture catalogue objects
xy<-ad.to.xy(ra=ApCat.sample$RAdeg,dec=ApCat.sample$DECdeg,astr.struc=astr)
#Print sample
print(head(xy))

#Show the positions on the image
#Plot the Image
image(x=1:length(SDSS.sample$dat[[1]][,1]),y=1:length(SDSS.sample$dat[[1]][1,]),z=SDSS.sample$dat[[1]],col=grey.colors(1E3),
      zlim=quantile(SDSS.sample$dat[[1]],c(0,0.995)),useRaster=TRUE,xlab="X (pix)",ylab="Y (pix)")
#Overlay the points
points(xy,pch=3,col='red')



AngusWright/LAMBDAR documentation built on Sept. 19, 2024, 10:26 a.m.