Science Operations

Longslit 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 slit and field images needed to center the target in the slit. The script then pauses while the observer runs modsAlign to compute and send the offset needed to align the target in the slit. The observer resumes the script, and a thru-slit confirmatory image is taken.
  2. The observation script moves the grating or prism in the beam and takes the series of spectroscopic exposures.


MODS acquisition scripts must be run with the acqMODS command (monocular) and acqBinoMODS (binocular).

acqBinoMODS is a shell script which executes acqMODS on MODS1 and MODS2 with the –bino option which enables synchronous binocular offsets when indicated by the syncoffset script command. Offsets that are not preceded by the syncoffset command are executed asynchronously and must be smaller than the copointing limit, 40 arcseconds.

acqBinoMODS is just a wrapper for two acqMODS commands and cannot take any options. acqMODS –mods# can take the options: –bino (binocular), –p (preset only), –i (configure instrument only) and –a (take acquisition images only), which provide the flexibility to repeat only a certain part of the script, if needed. See  MODS Scripts Engines for more details.
By default, the acquisition script uses the same exposure time for the slit and field images. However, different exposure times can be used, and this is recommended for direct acquisition on faint objects which may require exposure times up to ~60-120s. The sky background is bright enough that, even for a Blue acquisition through g_sdss, a 20s slit image adequately defines the slit edges. The command, ACQexptime t, is used to set the exposure time, t (sec), that is used by the subsequent SlitGo and AcqGo commands which take the slit and field images. In the acquisition script, insert a new ACQexptime t command between SlitGo and AcqGo to change the exposure time between the slit and field images. The latest version of the OT (v2019B.1.1.0) can generate acquisition scripts with different slit and field image exposure times. For details on how to set up this up in the OT, see the notes in the latest MODS OT library (v10.17) and in the OT Guide and Script Preparation.


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

acqMODS –modsN modsNacq.txt

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 and changes will appear on the Dashboard of the MODS GUI.

Running modsAlign

The script will pause after the slit 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 -y dY slitimage.fits fieldimage.fits if you want to center the target dY arcseconds above the mask center. For compact sources, dY = 11 is recommended for MODS1 and dY=9 for MODS2 as this results in the trace and surrounding background regions lying entirely in the top two quadrants and away from bad pixels.
modsAlign -l slitimage.fits fieldimage.fits if you want to select interactively where you want to position the target along the slit.

Measuring the slit center

If the -y dY option was used, the x-center of the slit dY arcseconds above the slit y-center will be automatically determined and the field image will be displayed.

If the -l option was used, the observer should position the cursor on the slit, near the y-position where they want to center the target, and click “x”, then “q”.

In both cases, the slit x-center is taken to be the midpoint between the slit edges, which are measured by a Sobel mean-squared edge detection algorithm (except for the 0.3″ slit, where a Gaussian is fit to the profile); the cursor position is used only as a starting guess.

Measuring the target centroid

On the field image, position the cursor over the target and click “a” to measure the centroid. If the target is faint or extended, and the centroid may not be reliable, then position the cursor carefully over what looks like the center or the region that you want to put on the slit, and click “x”. You may type “a” and “x” repeatedly; the last measurement is the one that will be used. When satisfied, click “q” to quit.

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:

offsetxy dx dy 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.
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 centering

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:

  • Click the button “Clear” to clear any entries for dx, dy or dtheta offsets.
  • Make sure the CoordSys is DETXY
    • Positive (+) delta X will move the target to the right on the detector
    • Positive (+) delta Y will move the target up on the detector
  • Make sure the MoveType is “Relative”
  • Enter the desired deltaX and deltaY offsets in arcseconds
    • Pixel scales are 0.12″/pix for the Blue and 0.123″/pix for the Red camera>
  • Delta PA is usually 0 deg for long-slit alignments, but if needed, as for multiple sources along the slit or adjusting the position angle:
    • In the DETXY system, a positive (+) dPA will rotate the stars clockwise.
  • 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.

  1. Make a copy of the acquisition script with a different name, e.g. mods1acq_recover.txt.
  2. 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.
  3. 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
  4. 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.
  5. acqBinoMODS mods1acq_recover.txt mods2acq_recover.txt will execute the binocular preset and take the pair of thru-slit MODS1 and MODS2 images.
  6. 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.