next up previous 256
Next: Example AST file
Up: Some registration examples
Previous: Registering images with SKY coordinates


Registering frames from a mosaic camera

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.

3220
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:

% astimp in='1?' astfile=instrument.ast indomain=obs1 
% astimp in='2?' astfile=instrument.ast indomain=obs2
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:
% 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:
% astimp in='2?' astfile=instrument.ast indomain=obs2-rot rot=180
-- 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:
% findobj in='"1?,2?"' outlist='*.find'
% findoff inlist='"1?,2?"' outlist='*.off'
% register inlist='"1?,2?"' fittype=2
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:
% pairndf in='"1?,2?"' outlist='*.off'
before continuing with the REGISTER command.

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
This is not yet sufficient to perform the resampling, since there is no single aligned coordinate system shared by all the images. To add a suitable one, we use WCSREG, specifying that it can align one image with another if they share OBS1, the OBS2 or the CCD_REG coordinates (it would be no good giving the PIXEL coordinate system for this purpose, since the images aren't aligned in pixel coordinates). Note that WCSREG can't do the impossible, so that if none of the images had CCD_REG coordinates there would be nothing to connect group 1 to group 2 and the process would fail. The command we use is therefore
% 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:
% drawndf '"1?,2?"' clear
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.

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.



next up previous 256
Next: Example AST file
Up: Some registration examples
Previous: Registering images with SKY coordinates

CCDPACK
Starlink User Note 139
Peter W. Draper, Mark Taylor, Alasdair Allan
1 February 2006
E-mail:ussc@star.rl.ac.uk

Copyright © 2008 Science and Technology Facilities Council