LUCI MOS Mask Alignment with mosalign (version 1.0 - 20 June 2012)
The mosalign script is not yet ready to deploy for science!
Since the 2012 fall restart I have been seeing unexpected rotations, offsets, and scale changes in the N1.80 data that require a more robust fitting to the through-slit data. Please do not use mosalign for science and expect robust results until further notice!
The scale change in the N3.75 camera caused by the change of the field lens disrupted the old mos acquisition script and an attempt to correct that did not yield acceptable results. So I have written an iraf script (mosalign
) in the LBTtools package to do the LUCI MOS mask alignment calculations. I've tried to make it a bit more automatic than the old method, but this depends critically on uniformity in the way data are taken. It will work with data taken with either the N3.75 or N1.80 camera, but until it sees some on-sky vetting I would suggest taking data in the N1.80 camera. This will let you use the old MOS ACQU script on the same data if there are any problems with mosalign
If you already know what to do:
skyN sourceN slitN LMSfilename
For future reference:
- All masks should be designed with 10 alignment stars when available
- Avoid the corners if possible (stay within radius < 2 arcmin)
- At least two sources should have boxes cut into the mask for verification
- They obviously need to be bright enough to see in a 40s exposure
- They do not need to be alignment stars (in fact, it will be better if they are not)
- Any filter is OK; J should be a bit deeper than K, but K will have better seeing
- In 40 seconds alignment stars down to K~17 or J~18 (estimate) are useful
- Longer or shorter exposures can be used
- It is critical that all three be the same exposure time
- All alignment sources should be visible in that exposure
- Anything even slightly visible on 2MASS is good
- Coordinates of the alignment stars MUST come from the same data as the science targets!
- Have some familiarity with iraf
- Be familiar with GEOMAP in iraf (read the help information)
- Be familiar with the way LBTtools is used (your ISA can help)
- Run the examples provided (see end of this page) for practice
- Sky image for subtraction from both source and slit data
- Source image, preferably back at the preset position
- Slit image to show the location of the mask
- The LMS file for this mask
The sky and source images are taken with an acquisition script. The observing
section of the script would normally look like this:
OFFSET_TYPE = relative
COORD_SYS = DETXY
OFFSET = 5.0 5.0 # Local "sky" image
ACQUISITION = -5.0 -5.0 # Source image back at preset position
command pauses execution of the script so that flexure compensation will remain ON until the acquisition is complete. Once the sky and source images have been taken and the script is paused, you need to move the mask into the FPU manually and start the slit image exposure needed by mosalign. Be sure to save it if the RMGUI is not on automatic save. Do not exit the acquisition script
until you complete the MOS mask alignment!
The LBTtools package makes some assumptions about where you are working, and expects you to give it the rest of the information it needs in the form of task parameters. To set up an iraf session running LBTtools, do the following on any of the obsN workstations:
- Open an xgterm and a DS9 window, start iraf
- cd /scratch ; mkdir <UTDATE> ; cd <UTDATE>
- Load a couple packages that are needed:
- stsdas -> analysis -> fourier
- noao -> digiphot -> apphot
- epar LBTtools, set the following
- camera = "LUC1"
- archive = "/newdata/"
- utdate = 20120511 # Use the correct date!
- Telside = "left"
- Exit the epar with a ":go" to load the package
- Type prepdir at the iraf prompt (sets up needed subdirectories)
- Copy your LMS files here or in the Misc subdirectory
- Type Sandbox at the iraf prompt to load that package
The other LBTtools parameters can also be changed, but it is critical that these be correct. LBTtools tasks use the camera, archive path, and the UTDate to construct filenames on the fly so you only need to refer to them by their timestamp (for LBC) or sequence number (LUCI or MODS). LBTtools also needs some subdirectories set up (primarily Misc and LOGs for this application), prepdir
did that for you. The mosalign
script currently resides in the Sandbox
sub-package, so you will need to load that as well.
Running the mosalign script:
You can list the parameters for mosalign to know what to expect:
Sandbox> lpar mosalign
sky = Sequence number of sky image
src = Sequence number of source image
slit = Sequence number of slit image
lmsfile = LMS file name
(Xoff = 1.5) Initial guess of DETXY X offset (arcsec)
(Yoff = -1.25) Initial guess of DETXY Y offset (arcsec)
(interactive = no) Use GEOMAP interactively?
(sendTel = no) Send offset command to telescope?
(verbose = yes) Verbose output to screen?
The first four parameters are required, in this order. The images are listed in the order they would normally be taken (sky, then source, then slit images). Xoff and Yoff add an initial offset to the predicted source positions to better match their typical positions relative to the slit mask. These default values are approximately the mean offsets seen in the 10 sets of test data used to develop mosalign and represent the offset between the pointing origin at the rotator axis and the mechanical center of the mask. With interactive set to "no" the script will run GEOMAP on the reference sources that it finds to be decently well detected and if the rms is below 100mas it will calculate the offsets and print them to the screen. If not, then it will re-run GEOMAP interactively using all of the input reference sources and you will need to manually delete the outliers. With interactive set to "yes" it will bypass this automatic step. With N1.80 data the automatic run of GEOMAP usually works, but in either case you can often improve the fit by deleting an outlier or two. The sendTel parameter is not currently used (and may not be), I'm just trying to plan ahead a little.
Once the three input images have been taken, note their sequence numbers and run mosalign
from the iraf command line like this:
mosalign 11 12 13 luci1.170.GDN170
The script will write progress and information messages to screen (as long as verbose is set to "yes"). It will check for the LMS file in the current working directory as well as the Misc subdirectory, and will add a ".lms" if needed. An example output from the script is given here:
LBTtools -->> mosalign.cl <<-- Wed 18:50:51 20-Jun-2012
Log file will be written to: LOGs/mosalign_015051.log
Verifying input files...
* Image /newdata/luci.20120511.0012 found
* Image /newdata/luci.20120511.0013 found
* Image /newdata/luci.20120511.0011 found
* LMS file Misc/luci1.170.GDN170.lms found
Verify consistency of image headers...
Parse LMS file...
Mask is for LUCIFER1
Mask Coordinates: 12:36:56.980 62:14:54.630 at PA=-83.00
Sky-subtract and display slit image
Find the mask center (be patient, takes ~17s)...
Mask center found at: 1018.65, 1001.85
Time to run crosscor: 17 seconds
Sky-subtract and display source image
Mark predicted positions of reference stars...
Source@(1774.20, 141.60) Mag~14.1(0.0) Accepted
Source@(1791.08,1721.48) Mag~14.0(0.0) Accepted
Source@( 656.03,1573.67) Mag~16.2(0.1) Accepted
Source@( 256.47,1056.29) Mag~15.6(0.0) Accepted
Source@( 837.39, 240.19) Mag~17.1(0.2) Accepted
Source@( 885.62,1244.55) Mag~15.5(0.0) Accepted
Source@( 379.06,1388.00) Mag~14.9(0.0) Accepted
Source@(1234.64,1247.22) Mag~15.4(0.0) Accepted
Source@( 865.74, 402.67) Mag~17.3(0.2) Accepted
Source@(1066.55, 557.22) Mag~17.8(0.3) Rejected
Running GEOMAP on accepted reference sources
DETXY offsets: dX = 1.630(0.194), dY = -1.182(0.185) arcsec
Rotation offset: dRot = 0.127 degrees
>>> Fit residuals are too high or interactive mode selected.
>>> Starting interactive GEOMAP, reject outliers as needed.
Running GEOMAP interactively on all reference sources
DETXY offsets: dX = 1.849(0.056), dY = -1.288(0.044) arcsec
Rotation offset: dRot = 0.086 degrees
Copy and paste these two commands to an xterm:
IRCL Register 'bentGregorianFront left' LUCIFER
IRCL OffsetPointing 0.086 1.849 -1.288 DETXY MOUNT true REL left
Logfile written to: LOGs/mosalign_015051.log
Time to run full script: 36 seconds
The script will display the slit image and after finding the mask center the positions of the slits will be outlined in green (see image below). If there is no complaint at this point and the slits are outlined correctly then the mask center was accurately determined. If it fails to find the mask center automatically, the script will ask you to click on the third reference slit from top right (the same as the old MOS ACQU script) and will apply any offset found before re-calculating the mask center.
Once the mask center is found, the script uses the RA and DEC coordinates of the alignment stars and the mask center from the LMS file to calculate the positions of the alignment stars on the mask. These are marked with a double green circle (see image below). The Xoff and Yoff input values are used to then predict the positions of the alignment sources on the source image, plotted with the green diamonds. Finally, the centroid and photometry of the sources detected in the box is extracted at these positions to find the actual pixel coordinates of the alignment stars, as well as estimate an SNR of the detection. These centroid positions are marked with the small green circles. Low SNR sources (< 4 sigma) are rejected, all others are accepted. If there is any significant problem at this point, the old MOS ACQU procedure must be used as I am still working on the recovery algorithm for this. After the alignment source detection step, the image in the DS9 window will look like this:
The pixel coordinates of the alignment stars on the source image and the predicted positions of where they should be are written out to a file and GEOMAP is run. The initial GEOMAP window looks like this:
The primary keys to use in GEOMAP are:
- x, y, r, s or g to switch between the different plots available
- f to re-fit the current set of data points
- d or u to delete or undelete the point nearest the cursor
- q to quit once you are satisfied with the fit
The main thing to keep in mind is that distortions in the camera most strongly affect alignment sources near the corners, deleting these will often show the largest improvement in the fit residuals. The fit residuals are shown at upper right on the plots (the g
plot shows both X and Y standard deviations). You would like the residuals to be below ~0.8 pixels in the N3.75 camera and ~0.4 pixels in the N1.80 camera. With a judicious deletion of the worst outliers, low SNR sources and a large initial set (~10) of alignment stars, the final rms can usually be below 50mas.
Finally, the commands to execute the offset are printed to the screen. Until I can get a working confirmation pause ("Are you sure you want to send these offsets?") in mosalign
, these will have to be manually copy-and-pasted to an xterm in order to execute them. They can also be sent from the iraf command line if you precede them with an exclamation point to pass the command to the system. Once the offset is executed, you can take a confirmation image if you like. A display script is also built into LBTtools that will let you sky-subtract this image and display it with a reasonable stretch:
Where again you only need to refer to the images by their sequence number.
Example data you can run offline:
The mosalign script was developed using a set of test data taken on 20120511, five different fields taken in both the N1.80 and N3.75 cameras. These are available on the obsN workstations and you can practice running mosalign on these data prior to real-time acquisitions on the sky. If you have set things up as described above, you can access these data by setting the following two parameters (epar LBTtools or copy and paste these lines to the iraf command line):
LBTtools.archive = "/home/dthompson/mosalign_examples/Data/"
LBTtools.utdate = 20120511
There is also a file in the mosalign_examples directory called examples.cl
that lists the mosalign commands needed to run these ten examples. You can cut-and-paste these commands into the iraf window to run them.
- Recover from larger than expected offsets between mask and source positions
- Handle when no sources are found
- Add confirmation request before sending offset command
- Send offset command from within iraf
- Capture science or verification sources that are bright enough and add to the fit
- Include radial scale distortions to better predict source and slit positions
As always, please send any comments or suggestions to scienceops at
- 20 Jun 2012