In this example we again wish to use coordinate information from different sources, but the procedure is more involved, bringing together many of the capabilities discussed in the earlier sections. If your data are fairly simple, you may never need to use such a complicated procedure.
Note that while this example provides a good demonstration of much of the
CCDPACK World Coordinate System functionality,
the steps here could be achieved more simply by using
CCDPACK Sets.
See the example in Section
for details.
Figure: Overlapping observations
taken using a mosaic camera.
We suppose that we have two observations from a mosaic camera, which were taken on the sky in roughly the positions shown in the figure. Because of the way they overlap the object matching methods of a previous section can be used to apply a common coordinate system to some, but not all, of the images. Furthermore, the geometry of the CCD chips in the instrument is known and stored in an AST file instrument.ast as explained earlier, so that a common coordinate system can be applied to images 1a, 1b and 1c, and another to images 2a, 2b and 2c.
First of all therefore, we attach the instrument coordinates to each set of files as follows:
The file instrument.ast has been set up previously so that it attaches coordinate systems to the images according to a FITS header which distinguishes them from each other. The FITS headers in this case contain no information about telescope pointing or orientation however, so we have to add our knowledge that the camera was rotated 180 degrees between exposures by adding a new coordinate system to one set, related to the one just added by a linear transformation:% astimp in='1?' astfile=instrument.ast indomain=obs1 % astimp in='2?' astfile=instrument.ast indomain=obs2
% wcsedit in='2?' mode=add frame=obs2 domain=obs2-rot
maptype=linear coeffs='[0,-1,0,0,0,-1]'
In fact since this is quite a common situation the ASTIMP
command has a parameter for adding rotations, so that the second
ASTIMP and the WCSEDIT could be replaced by:
-- this step can also be automated under some circumstances by using ASTIMP's FITSROT parameter. Since all the images now have the same orientation (i.e. the X directions in the Current coordinate systems of all is the same), they are related by a simple offset so that the automatic object matching routines can be applied to the overlapping frames:% astimp in='2?' astfile=instrument.ast indomain=obs2-rot rot=180
Note that unlike the previous example we do not use restrict=true here, since although the orientations are now (about) right the positionings may not be. If FINDOFF has trouble or you would rather do the alignment by eye you could use PAIRNDF instead of FINDOBJ and FINDOFF like this:% findobj in='"1?,2?"' outlist='*.find' % findoff inlist='"1?,2?"' outlist='*.off' % register inlist='"1?,2?"' fittype=2
before continuing with the REGISTER command.% pairndf in='"1?,2?"' outlist='*.off'
To see what coordinate systems have now been attached we can examine the images using WCSEDIT:
% wcsedit '1?' show
WCSEDIT
=======
3 NDFs accessed using parameter IN
Index Cur Domain Title
----- --- ------ -----
1a:
1 GRID Data grid indices; first pixel at (1,1)
2 PIXEL Pixel coordinates; first pixel at (0.5,0.5)
3 AXIS Axis coordinates; first pixel at (0.5,0.5)
4 * OBS1 Alignment on instrument focal plane
1b:
1 GRID Data grid indices; first pixel at (1,1)
2 PIXEL Pixel coordinates; first pixel at (0.5,0.5)
3 AXIS Axis coordinates; first pixel at (0.5,0.5)
4 OBS1 Alignment on instrument focal plane
5 * CCD_REG Alignment by REGISTER
1c:
1 GRID Data grid indices; first pixel at (1,1)
2 PIXEL Pixel coordinates; first pixel at (0.5,0.5)
3 AXIS Axis coordinates; first pixel at (0.5,0.5)
4 OBS1 Alignment on instrument focal plane
5 * CCD_REG Alignment by REGISTER
and similarly for the other three.
We can see that, because of the way the images overlap,
REGISTER has managed to add an aligning coordinate system
to 1b and 1c, but not 1a.
The following table summarises the coordinate systems that we have
added to all the images (ignoring the ever-present GRID, PIXEL and AXIS):
| OBS1 | OBS2 | OBS2-ROT | CCD_REG | |
| 1a | x | |||
| 1b | x | x | ||
| 1c | x | x | ||
| 2a | x | x | ||
| 2b | x | x | x | |
| 2c | x | x | x |
% wcsreg '"1?,2?"' domains='[ccd_reg,obs1,obs2]'
WCSREG
======
6 NDFs accessed using parameter IN
NDFs with graph node indices
----------------------------
1) 1a
2) 1b
3) 1c
4) 2a
5) 2b
6) 2c
The graph is fully connected.
1) 1a:
(reference NDF)
2) 1b:
2 -> 1 OBS1
3) 1c:
3 -> 1 OBS1
4) 2a:
4 -> 5 OBS2
5 -> 3 CCD_REG
3 -> 1 OBS1
5) 2b:
5 -> 2 CCD_REG
2 -> 1 OBS1
6) 2c:
6 -> 2 CCD_REG
2 -> 1 OBS1
This completes successfully and adds a new coordinate system
labelled CCD_WCSREG to each of the images.
Since they are all aligned with the same coordinates, we should now be
ready to do the resampling.
It is a good idea at this stage to check that the alignment looks right
before generating the mosaic, which may be time-consuming.
You can see the alignment by using the DRAWNDF
command:
This should display a plot which resembles the above figure; if it shows an alignment different from what you expect, now is the time to go back and find the problem rather than producing an incorrect mosaic.% drawndf '"1?,2?"' clear
Assuming all is well, it only remains to do the resampling and combination as before:
% tranndf '"1?,2?"' '*-r' % makemos '*-r' mosaic
To see this sort of procedure in action you can run the demonstration script wcsexercise.
CCDPACK