Science Operations

MOS spectroscopy

Two MODS scripts are needed to make a spectroscopic observation:

  1. The acquisition script slews the telescope, positions the guide probe, configures the instrument for imaging and takes the sequence of mask and field images which are needed to align the mask. The script then pauses as the observer runs modsAlign. Once the offset is applied, a final thru-mask confirmatory image is taken. If needed, final adjustments may be made through the MODS User Interface.
  2. The observation script moves the grating or prism into the beam and takes the series of spectroscopic exposures.



If you are using just one MODS, then, in a terminal window, run the monocular command, acqMODS.

acqMODS –modsN modsacq.txt will execute the script, modsacq.txt, on modsN, where N is either 1 or 2.

As each script command is sent and executed, output will be written to the terminal window and and changes will appear on the Dashboard of the MODS GUI.


If you are using both MODS1 and MODS2, then run the binocular wrapper, acqBinoMODS:

acqBinoMODS mods1acq.txt will send the same script, mods1acq.txt, to both MODS1 and MODS2, or
acqBinoMODS mods1acq.txt mods2acq.txt will send the script mods1acq.txt to MODS1 and mods2acq.txt to MODS2.
acqBinoMODS will launch 2 terminal windows, one for each MODS, and, as each script command is sent and executed, output will be written to the terminal window and changes will appear on the Dashboard of the MODS GUI.

Running modsAlign

The script will pause after the mask and field images have been taken. At this point, the observer needs to run modsAlign.

From a separate terminal window, type (note that you can copy/paste the image filenames from the modsDisp or mods2Disp log into the modsAlign command line):

modsAlign maskimage.fits fieldimage.fits maskfile.mms
modsAlign will look for the images in /newdata, but the mms file must be in the directory from which modsAlign is run. modsAlign will launch a dedicated ds9 window for each MODS in which it will display, first, the mask image and, then, the field image.

Measuring the alignment box positions

On the mask image, the positions of the alignment boxes will be automatically determined using the mms file and an edge-finding algorithm. Outlines based on these fits will be drawn in cyan (as shown below), and the observer will be asked to review the alignment boxes and accept them (‘a’), reject them and select them manually (‘m’) or abort (!).

Review the alignment boxes shown on ds9:
‘a’ = accept all alignment boxes shown and continue
‘m’ = reject all alignment boxes and select boxes manually
‘!’ = abort modsAlign and exit the program now
Option: (a|m|!)?: 

Usually, the fits are good, and ‘a’ is indicated, in which case the box centers are saved and the field image is displayed.

The option, ‘m’, might be needed if, for instance, a new guide star, which caused one of the boxes to be vignetted, had to be selected on-the-fly. If ‘m’ is selected, the observer is presented with the following options for selecting the alignment boxes. When finished, enter ‘q’ to save the choices and display the field image.

Select mask alignment boxes and press ‘q’ when done.
‘a’ select the alignment box nearest the cursor
‘x’ select the alignment box at the current cursor XY position
‘d’ delete the previously selected box nearest the cursor
‘q’ quit alignment box selection and save choices
‘!’ abort alignment box selection and exit modsAlign now
‘?’ list interactive cursor commands
You must select at least two (2) alignment boxes, and the
cursor must be inside the box being marked.

Measuring the alignment star centroids

Once the box centers have been determined, the field image is displayed. The alignment stars are automatically found and their centroids measured. The observer is then given the choice of:

  • ‘a’: accepting the centroids for all of the stars;
  • ‘e’: editing one or two stars. This could be used if one of the alignment stars was not automatically found or to delete an alignment star which would be an outlier, e.g. a star whose position had not been corrected for proper motion;
    • Edit alignment stars and press ‘q’ when done.
      ‘a’ add the star nearest the cursor with centroid calculation
      ‘x’ add a star at the current cursor XY position
      ‘d’ delete the star nearest the cursor
      ‘r’ change the star search radius [currently 15.0 pix]
      ‘q’ quit editing and save changes
      ‘!’ abort editing, discard all changes, and continue
      ‘?’ shows a list of all cursor commands
  • ‘m’: rejecting all of the alignment stars in order to select them manually. The menu in this case is the same as for the ‘e’ option above.

Review the alignment stars shown on ds9:
‘a’ = accept all alignment stars and continue
‘e’ = edit the alignment stars then continue
‘m’ = reject all alignment stars and select stars manually
‘!’ = abort modsAlign and exit the program now
Option: (a|e|m|!)?:

Sending the offset

The offset that is required to center the target at the desired location along the slit will be computed as a DETXY relative offset and displayed to the terminal with the query to send it or not (Y/N). The observer must type “y” or “Y” (otherwise nothing will be sent!) after which modsAlign will send the command:

offsetpointing dtheta dx dy detxy rel 

to the telescope, followed by the updatepointing command which will cause the pointing origin to be updated such that the position of the target after the offset will become the new reference position. Absolute offsets will be made with reference to this new position. 

Computed Mask Alignment Offset:
dX = -1.667 arcsec
dY = 1.236 arcsec
dPA = -0.078 deg
MODS1 Offset Command:
offsetpointing -0.0782 -1.667  1.236 detxy relSend this offset to the telescope (Y|N)?: Y 

The offset is complete when the prompt reappears in the terminal window and the “Offset” button in the MODS User Interface changes from an amber to grey background.

Taking the confirmatory thru-slit image

After the offset is complete, type <Enter> in the script-running window(s) to resume the script. The mask will be inserted again into the focal plane, and the thru-slit confirmatory image will be taken. 

Tweaking the alignment

Often the offset sent by modsAlign does not perfectly center the target in the slit. Use the Offset Pointing section of the MODS User Interface (indicated by the green rectangle in the figure below) to make tweaks:

  1. Click the button “Clear” to clear any entries for dx, dy or dtheta offsets.
  2. Make sure the “CoordSys” is DETXY and the “MoveType” is “Relative”.
  3. Enter the desired deltaX and deltaY offsets in arcseconds 
    1. (delta theta if needed, but it is difficult to tweak this and usually only deltaX, deltaY adjustments are made). 
    2. Pixel scales are 0.12″/pix for the Blue and 0.123″/pix for the Red camera
  4. Remember to click “Absorb” after these to send the updatepointing command again.


Now that the object is well-centered on the slit, run the observation script to configure the instrument for grating or prism spectroscopy and take the sequence of spectra.


If you are using just one MODS, then, in a terminal window, run the monocular command, execMODS: 

execMODS –modsN modsNobs.txt to send the script modsNobs.txt to MODSN, where N is 1 for MODS1 and 2 for MODS2.


If you are using MODS1 and MODS2, then use the shell script wrapper, execBinoMODS.

execBinoMODS mods1obs.txt will send the script mods1obs.txt to both MODS1 and MODS2, and
execBinoMODS mods1obs.txt mods2obs.txt will send the script, mods1obs.txt to MODS1 and mods2obs.txt to MODS2.

Taking a few more exposures

If a few more exposures are needed, to account for poorer-than-expected seeing or transparency, then it is preferable not to run the entire script again (specifically, not to run the “instconfig” command again), but to take the additional exposures either:

  • directly from the MODS User Interface, by clicking “Go” on the channel(s) needed, or by sending the “go”, “blue go” or “red go” command from the Command Window (indicated by the pink rectangle in the image above); or
  • by running execMODS with the -e option, which will do only the Exec: block, e.g.
    • execMODS –mods1 -e mods1obs.txt; and
    • execMODS –mods2 -e mods2obs.txt

In case the preset is lost…

If the preset is lost, you can save time in re-acquiring the object by incorporating the offset made by modsAlign into the acquisition script. Each time modsAlign is run, it writes (and overwrites) a file called modsN_lastoffset (where N is 1 or 2 for MODS1 or MODS2).

The steps to be taken are covered on the Troubleshooting page, however they are also repeated here for now.  

Make a copy of the acquisition script with a different name, e.g. mods1acq_recover.txt.

  1. go into the directory from which the acquisition with modsAlign was done and cat the file mods1_lastoffset (mods2_lastoffset for MODS2). This file contains the last offset command:  offsetxy dx dy rel for long-slit or offsetpointing dtheta dx dy detxy rel for MOS.
  2. Edit mods1acq_recover.txt to replace all of the contents of the Acquire: block with, on the first line, the contents of mods1_lastOffset and on the second, slitGO. The mods1acq_recover.txt script should have an Acquire block like:
                    offsetxy -0.228 10.824 detxy rel
  3. acqMODS –mods1 mods1acq_recover.txt will then execute the preset, followed by the offset that was needed to the do the alignment the last time, and take a thru-slit image.
  4. acqBinoMODS mods1acq_recover.txt mods2acq_recover.txt will execute the binocular preset and take the pair of thru-slit MODS1 and MODS2 images.
  5. copy the observation script to a recovery obs script, e.g. cp mods1obs.txt mods1obs_recover.txt and adjust the exposure time and/or the nimgs as needed to complete the observation sequence.