OSMOS Mask Alignment Cookbook

A typical mask (or longslit) acquisition proceeds as follows:

  1. Check the telescope coordinates with a nearby bright star if you have not done so recently. Accurate telescope coordinates will lead to smaller, more precise translation offsets and consequently faster mask alignment. Also check that the rotation angle displayed on the TCS is equal to the mask position angle. The TCS rotator angle is not exactly equal to the final (aligned) mask position angle, but this step should insure that the rotation offset is on order a degree or less.
  2. Slew to the field and start the guider. Remember to run Calibrate on the guider if you have changed the rotator angle.
  3. Start oalign.pro in Prospero:
    call oalign.pro SLITNUM FILT1 FILT2 TARGNAME
    where SLITNUM is the slit number of the multi-object mask (or longslit if this is a longslit acquisition), FILT1 and FILT2 are the filters that will be used for acquisition images (the image through the mask is obtained with no filter), and TARGNAME is the name of the target. This script will confirm the configuration, take an image through the mask, take an acquisition image (no mask) of the field through the specified filters, and then pause so that you may run the mask alignment code oalign.py (type oalign.py with no arguments to get basic usage information).
  4. Run oalign.py in a separate terminal:
    oalign.py OMSFILE MASKIMAGE ACQIMAGE
    where OMSFILE is one of the outputs of OMS, MASKIMAGE is an image through the mask and is the first image obtained by oalign.pro, and ACQIMAGE is an image of the field (and is the second image obtained by oalign.pro). oalign.py will open the MASKIMAGE in ds9 and prompt the user to mark each alignment box with the 'x' key and press 'q' when finished. For example:
    oalign.py a267pmask.oms os20111029.0042b.fits os20111029.0043b.fits
    will print the following to the screen (note, these images have been bias-subtracted, which is helpful but not strictly necessary):
    no
    Maskimage os20111029.0042b.fits title is: A267 P-Mask Mask Image
    Alignment box coordinates file:  os20111029.0042b.box
    Box coordinate files os20111029.0042b.box and/or os20111029.0042b.reg do not exist
    z1=-28.61814 z2=29.67649
    
    ** Mark Alignment Star Boxes to use with a 'x'.
       and then press 'q' when finished.
       *** You must mark at least two (2) boxes ***
    
    Log file _oalign.log open
    
    and display this image:

    This image has a total of 13 alignment boxes (this is very excessive, and was just for testing -- four are recommended). The approximate locations of these alignment boxes were computed from the .oms file specified on the command line (a267pmask.oms in this example). All or any subset may be identified with the 'x' key. They may also be chosen in any order. If one picked the first three in this example and then typed 'q', the following will print to the screen:

    2482.02 2711.24  1014.5
    2382.36 1380.78  1144.5
    1256.21 1510.34   1045.
    0 Median at xc,yc is 1023.25
    1 Median at xc,yc is 1103.75
    2 Median at xc,yc is 1084.00
    Min for all boxes is 1023.25
    z1=-4.76159 z2=241.5081
    
    ** Mark the center of each alignment star with an 'a'
       and then press 'q' when finished.
       Stars must be selected in the *SAME ORDER* as the boxes.
    
    Log file _oalign.log open
    
    and now the acquisition image will be displayed in ds9:

    The first three rows of output in the terminal are the x,y pixel positions of the cursor when the 'x' key was typed and the counts in that pixel. After the 'q' key was pressed, the remaining lines print some debugging information. The ACQIMAGE will show the field, along with boxes at the centers only the alignment boxes identified in the previous step. Note that in the example only three boxes are shown, rather than all of them. They are also numbered in the order they were identified in the previous step, rather than the order they are listed in the OMS file. Identify the corresponding alignment stars in the same order with the 'a' key and then press 'q' when finished. oalign.py will then solve for and report the rotation and translation offsets. After you type 'q', oalign.py will solve for and report the rotation and translation offsets. In this example, the following is output to the screen after the 'a' key is pressed:

    #   COL    LINE     COORDINATES
    #     R    MAG    FLUX     SKY    PEAK    E   PA      ENCLOSED GAUSSIAN DIRECT
    2437.50 2736.96 2437.50 2736.96
      19.28 -15.13 1.124E6    118.  21809. 0.19   44          6.83     6.36   6.43
    2339.00 1403.59 2339.00 1403.59
      18.54 -14.19 473884.    122.   9226. 0.17   48          6.92     6.22   6.17
    1215.46 1544.12 1215.46 1544.12
      19.30 -15.88 2.243E6    128.  40413. 0.21   45          7.12     6.57   6.43
    
    Then, once the 'q' key is pressed the following output gives the solution:
    Geomap fit
    0  2478.52  2712.74  2437.50  2736.96  2477.96  2712.32  -0.56  -0.42
    1  2377.89  1379.30  2339.00  1403.59  2379.85  1378.92   1.96  -0.38
    2  1257.67  1518.31  1215.46  1544.12  1256.27  1519.12  -1.40   0.81
    # Geomap fit yields dx = 40.68 dy = -24.77 theta = 0.0169
    Mean offset relative to solution is 1.44 pixels
    ID BOX_X BOX_Y Star_X Star_Y New_Star_X New_Star_Y Delta_X Delta_Y Delta_S
    0  2478.52  2712.74  2437.50  2736.96  2477.96  2712.32  -0.56  -0.42   0.70
    1  2377.89  1379.30  2339.00  1403.59  2379.85  1378.92   1.96  -0.38   2.00
    2  1257.67  1518.31  1215.46  1544.12  1256.27  1519.12  -1.40   0.81   1.61
    
    Computed Mask Alignment Offset:
       dx:  11.104 arcsec
       dy:  -6.763 arcsec
      dPA: -0.0169 degrees
    
    These are the guider offsets to apply:
       gdx: 86.2606 steps
       gdy: 141.6363 steps
    
    
    And enter this rotation offset in the Rotator GUI:
       dPA: -0.0169 degrees
    
    
    /home/tuatara/martini/programs/python/oalign.py done.
    
    And the final image looks like:

    The guider offsets are the 'gdx' and 'gdy' values. The rotation offset is the 'dPA' value. Before you apply them, inspect the output to determine if the solution is reasonable. First, look at the numbers in the columns labeled "Delta_X Delta_Y Delta_S." These are the dx, dy, and sqrt(dx**2+dy**2) residuals between the star and box positions in pixels after the solution is applied. Note that a pixel is 0.273", so more than two pixel offsets (particularly in x) is cause for concern. A second piece of useful information is to inspect the final image from oalign.py. There will now be a magnenta 'x' at the location where each alignment star will fall once the offset is applied. This should hopefully be at the center of the each box. Here is a zoom in to box one that demonstrates a good solution:

    If one star has a substantially larger offset than the others, try to rerun oalign.py without that box/star (no need to take new observations).

    Note that if this is a longslit acquisition, the syntax is:

    oalign.py -l SLITIMAGE ACQIMAGE

  5. To apply the offsets: Turn off the guider, enter the rotation offset from oalign.py in the Rotator GUI (check the units are degrees), press the SEND button, and turn the guider back on. Provided the rotation offset is less than a degree (which is well within the capabilities of the rotator encoder), the guide star should not have moved substantially on the guider chip.
  6. Apply the dx and dy guider offsets reported by oalign.py with the guider on with the guider GUI. If either offset is greater than a hundred units, break the offset into steps of no more than a hundred so that the guide star is not lost as the guider 'drags' the telescope to the correct coordinates. Note that rotation offsets of less than 0.01 degrees are probably not worth applying. Similarly, offsets less than 0.2 arcseconds, particularly in y, are probably not necessary. (The ultimate criterion is of course to insure your brighter targets appear to be visible in their slits.)
  7. Press the RETURN key in the Prospero window and oalign.pro will take another image and prompt you to run oalign.py again with the new ACQIMAGE. At this point the rotation offset should be negligible and the x,y offsets should be small. Apply these offsets as in step 5 (if necessary) and step 6.
  8. Return to the Prospero window. If the offset was only a few arcseconds, answer N for another iteration (such small offsets are quite reliable). Otherwise answer Y and repeat step 7.
  9. The mask should now be aligned and oalign.pro will put the mask into position and exit. It is a good idea to take an image through the mask to confirm the mask alignment. Run oalign.py one last time (if necessary) to confirm that the stars are centered in the alignment boxes and at least the brighter targets are visible in their slits. You are now ready to insert the disperser and begin to take spectra.

Here are the files used in this example to practice using oalign.py:

oalign.py
a267pmask.oms
os20111029.0042b.fits
os20111029.0043b.fits

Return to: [ OSMOS Home Page | Paul's Home Page | MDM Observatory | ]

Updated: 2012 March 14 [pm]