Science Operations



Description of the task

The python script, modsAlign, is used for all MODS alignments: long-slit, MOS and spectrophotometric standards through the 5″ wide slit. For the long-slit and MOS acquisitions, modsAlign will display, first, the mask image from which it will automatically (or, optionally, through user interaction) find slit or box centers, and, second, the field image where again it will automatically (or interactively) find the target or the alignment star centroids. It will determine the offset needed and prompt the observer to enter “Y” or “y” to send it. Note that hitting return or entering any key other than “Y” or “y” will not send the offset.
modsAlign is run when the acquisition script is paused after having taken the set of slit/mask and field images, or just the field image in the case of wide-slit spectrophotometric standard star acquisitions. Once the offset is computed, the observer continues the script, the mask is put back into the focal plane and a confirmatory thru-slit image is obtained. If this image shows that adjustments are needed, they can be done through the MODS GUI. It is a good practice to click “Absorb” after any tweaks done through the MODS GUI, however the observation scripts should have an “updatepointing” command which does the same thing as “Absorb”.
modsAlign will by default look for images in the /newdata directory, but for MOS alignments, the mms file must be in the same directory from which modsAlign is run.
modsAlign writes out a file mods_lastOffset which contains the last offset performed when running modsAlign. The troubleshooting section on Recovering from a Lost Preset outlines how this file is useful in getting back on sky in such an event.

Long-slit alignments

-y dY   or   -l

modsAlign -y dY maskimage.fits fieldimage.fits
  • will center the source in the slit at a position dY arcseconds above the slit Y-center. With the -y option, the reference (Xr,Yr) position is fully determined by a fit to the slit profile at the position dY above the slit Y-center. Note that the slit Y-center is not the same as the middle row of the detector. For compact sources, we recommend -y 11 for MODS1 and -y 9 for MODS2. These values position the object trace and a surrounding background region entirely within the top two quadrants and also, for the MODS1 red channel, above a block of bad pixels.
modsAlign -l maskimage.fits fieldimage.fits
  • will require the observer to position the cursor at the vertical position along the slit where they want their target to be and type “x”. This will define the reference (Xr,Yr) position. Type “q” to exit and display the field image.


On the field image, the observer positions the cursor on the target and enters either “a” to compute a centroid or “x” to take the cursor position. “a” or “x” can be tried multiple times. When happy with the result, enter “q” to quit and compute the offset between the reference (Xr,Yr) and the object (Xo,Yo) positions. Enter “Y” or “y” to send the offset to the telescope.

MOS alignments

modsAlign maskimage.fits fieldimage.fits maskfile.mms
The slitmask image will be displayed first, with best-fit box positions overlaid, where the box centroids are determined by a two-step process: first using the mms file to locate the boxes, and second, using a Sobel mean-square fitting algorithm to measure the box edges. The observer will be given the option to either accept these centroids “a”, reject them and select the boxes manually “m” or abort “!”. If the observer chooses the option “m”, then he or she should position the cursor on each box and type “a”. This will determine the center of the nearest box, so long as the cursor is not further than the box width from it; “x” on the other hand will put a box at the cursor position. Once all boxes are marked, type “q” to save the box centroids and continue.
The field image is then displayed and a regions file depicting the box positions will be overlaid. The centroids of the alignment stars will be automatically determined and shown in green. Type “a” to accept these centroids, or “e” to delete or add stars followed by “q”.
The offset in x, y and rotation will be printed and you will be queried whether to send or not. If reasonable, send with “Y” or “y”.

Once the offset is made, continue the script to obtain a confirmatory thru-slit image.

Spectrophometric standards


modsAlign -r fieldimage.fits
The field image will be displayed and an overlay of the wide 5″ slit will be drawn, on which the reference position of the slit center will be marked by a cross. The reference positions are (501.2, 620) for MODS1 and (508, 590) for MODS2. Position the cursor on the spectrophotometric standard star, and type “a” to centroid or “x” to take the cursor position. The offset between the object and reference positions will be computed and the user will be prompted to enter “Y” or “y” to send it.
modsAlign -r confirmatoryimage.fits
modsAlign with the -r option can be run on the confirmatory thru-slit image to refine the centering, so long as the star is mostly in the slit. In this case, the star centroid and the slit center will be found automatically, an offset computed and the user again prompted to enter “Y” or “y” to send it.

modsAlign options

In addition to the options: -l; -y dY; and -r; there are other command-line options which can be helpful. Type modsAlign followed by <Enter> to get the full list. Each is described here (some must be prefaced by a single dash and some by a double-dash):


suppress quick bias subtraction: Not a real bias-subtraction, the “quick-bias” algorithm subtracts the median background levels for all of the even and all of the odd columns in each quadrant and then adds back an average background. This effectively removes the even-odd striping and quadrant-to-quadrant level differences and helps bring out faint objects. But extended emission will influence the medians, and so “quick-bias” subtraction does not work well for extended objects.


(MOS) Use named slit ID in mmsFile as the acquisition slit: This option was developed for exoplanet transit spectroscopy using MOS masks, and, it enables a long-slit alignment to center the star (target or reference) in the wide slit, thereby avoiding the need for alignment stars and boxes.


The command:

modsAlign fieldImage.fits maskImage.fits mmsFile.mms –slit=star
will look for the slit named “star” in the MMS file (see a portion of an mms file set up for this) and use that to do a long-slit alignment. Note that the slit name must be defined in the MMS file and be unique (otherwise it grabs the first instance). The string match is case-insensitive, so {Star, STAR, StAR, … } will all work. If the MMS file was not created with a name for the science slits, it will need to be carefully hacked to give the slit of interest a name.

–sw f

(MOS) Change the star search width factor [default: 1.5]

–mw f

(MOS) Change the star-to-box matching width factor [default: 2.0]

–maxiter N

(MOS) Iterate MOS fit up to N times [default: 1]

–reject S

(MOS) Reject S*sigma outliers [default: 4.0]. Requires –maxiter > 1


Turbo mode, don’t ask questions, except at the end.


Print version info and exit.