Convert from World (celestial) to FPC coordinates by applying an aspect solution.
Array_Type pix_dmTanWorldToPix( Array_Type world, Array_Type asp,
Array_Type crpix, Array_Type cdelt )
This routine converts a position in the World (Celestial) coordinate
system to the Focal Plane coordinate (FPC) system.
To perform this conversion the routine needs to know the
aspect solution, knowledge of where the telescope
was pointing at the time the photon was detected.
The FPC system corresponds
to the ( DETX, DETY ) columns of a Chandra event file.
The world position (the world argument) is given
as a two-element array in units of degrees.
The pointing position is given in the three-element
array asp, which should contain the
ra, dec, and roll values in degrees.
The crpix argument is a two-element array which gives
the pixel location for the aimpoint.
The cdelt argument is also a two-argument
array and gives the pixel size
in degrees. For the ACIS detectors you would use
crpix = [ 4096.5, 4096.5 ] cdelt = [ -0.492, 0.492 ] / 3600.0
The return value is a two-element array which gives the
FPC coordinates in pixels.
chips> require("pixlib")
chips> require("paramio")
chips> pix_init_pixlib
chips> evt = readfile( "acis_evt2.fits[cols ra,dec]" )
chips> wcspos = [ evt.RA[0], evt.DEC[0] ]
chips> !dmkeypar acis_evt2.fits ra_nom
chips> ra_nom = pget( "dmkeypar", "value" )
chips> !dmkeypar acis_evt2.fits dec_nom
chips> dec_nom = pget( "dmkeypar", "value" )
chips> !dmkeypar acis_evt2.fits roll_nom
chips> roll_nom = pget( "dmkeypar", "value" )
chips> asp = [ ra_nom, dec_nom, roll_nom ]
chips> crpix = [ 4096.5, 4096.5 ]
chips> crdelt = [ -0.492, 0.492 ] / 3600
chips> detpos = pix_dmTanWorldToPix( wcspos, asp, crpix, crdelt )
In this example we have used the pix_dmTanWorldToWorld() routine
to convert the celestial position of the first event
in acis_evt2.fits into the detector position it would have
using the nominal pointing position.
We used the dmkeypar tool to get the RA_NOM, DEC_NOM,
and ROLL_NOM keywords from the header of the acis_evt2.fits file.
Since dmkeypar stores the keyword in its parameter file
as the "value" parameter, we use the pget() function - from
the paramio module - to read these values into S-Lang variables.
|