Next: Wide Area Synchronization to the 10ms Level
Previous: The Gemini Telescope Control System
Table of Contents --- Search --- PS reprint


Astronomical Data Analysis Software and Systems V
ASP Conference Series, Vol. 101, 1996
George H. Jacoby and Jeannette Barnes, eds.

Quicklook IRAF Scripts for Data Acquisition Management

K. M. Merrill

NOAO/KPNO, P. O. Box 26732, Tucson, AZ 85726

Abstract:

I have prototyped ``quick-look'' interactive software to facilitate data acquisition at the telescope and acquisition based decision-making, exploiting IRAF and the SunOS to provide automated displays of ``quick-processed'' infrared data as it is taken. A robust set of such tools amplifies observing time by enabling observing decisions to be made in situ. Prompt assessment of the quality of the data being acquired (whether the data are acceptable and sufficient or whether more of the same/ancillary observations are needed or even whether a different type of observing protocol is required) are requisite to meaningful efficient observations. I briefly describe the software functionality for direct imaging, spectral imaging, real-time shift and add, and ``point and click'' target acquisition based on prior images of the field.

1. Introduction: the SQIID IR Image Reduction Package

In 1988, I began to develop software tools for exploiting the emergent IR array technology at NOAO. The aim was to provide, on the one hand, an analysis cookbook for the IR arrays with tested and seasoned recipes, and on the other hand, to provide an on-site quick-look capability to enhance observational efficiency. The near-term goal was to provide system-wide IRAF routines for general-purpose infrared data reduction and multi-wavelength analysis with immediate application to the SQIID four-color infrared camera. Towards this end a number of software ``hooks'' useful for multiwavelength image registration were incorporated into the IRAF imcombine, iralign/irmatch and imalign/imcentroid tasks. Using simple IRAF script procedures, a core set of tasks to perform list-based infrared image processing, including sky subtraction, accurate flatfielding, bad pixel masking and response linearization were generated to regularize the often complex task of IR data reduction: sqsky, sqflat, sqcorr, and sqproc.

IR observations generally produce spatially composite images. Since imaging is background limited with integration times measured in minutes, many on-target observations, interspersed with off-target sky frames, are required to attain high sensitivity. Owing to the restricted IR field of view, sources larger than a few arc minutes are best mapped using a series of pointed observations in an overlapping grid. Dithering compensates for bad pixels in the on-frames and assists source rejection in the off-frames. Overlap assures proper spatial registration and background intensity matching among the individual frames.

Image registration is a highly interactive task which is not generally amenable to automation. A series of interrelated scripts was developed to produce a generalized registration database which could be used by the IRAF imcombine task to produce a composite image of an arbitrary set of connected images which do not necessarily share a common overlap region. Spatial registration, using the interactive IRAF centroid task for an overlapping grid and the interactive xyget script for groups of overlapping images, relies on position matching individual stars appearing on multiple images. Groups of images are merged into a single registration database by mergecom. Since SQIID images at JHKL are taken simultaneously, registration using one channel (usually K) implicitly registers the other channels. The xyadopt script produces registration databases for the other channels from the master channel registration database using the relative linear geometric transformation (offset, rotation, and magnification) between channels as determined from observations of globular clusters by the interactive getmap script. Intensity offsets for data which do not contain a single region in common are determined by the zget script. The nircombine script produces a composite image from the registration database. Each frame is masked for bad pixels, geometrically transformed if required to lie atop the master channel frame, shifted linearly in X and Y, intensity offset as required according to the master database and combined into a composite image using the IRAF task imcombine with threshholding (to exclude bad pixels) and median filtering at each pixel in the resultant image. Careful comparison of photometry of individual and composite images has determined that these modest linear geometric transformations have no significant effect on aperture photometry.

Owing to the variable high background at wavelengths longer than 2.3 , imaging object (O) and sky (S) observations in the thermal IR are generally ordered as O:S:S:O:O:S... for optimal observing efficiency. Unlike shorter wavelengths where conditions support a single composite sky frame derived from the ensemble of observations in the group, only sky frames adjacent in time are suitable. The generalized list-based improc script was developed to automatically process a number of object/sky protocols using adjacent skies.

2. Imaging Spectroscopy and Acquisition Extensions

This past year procedures to support the imaging spectroscopy mode for the CRSP spectrograph and COB grism were developed following image-based (as opposed to a spectroscopic) paradigms. Spectral images are built up using a step and integrate technique: the telescope is nominally stepped a slit width between successive observations which are spatially ordered as O:S:O:O:S:O... for optimal observing efficiency.

The list-based crsptriad task processes this spatial protocol, performing sky subtraction and first order (instrumental) flatfielding. Sky frames are derived from the frame(s) nearest in time, optionally scaled (appropriately corrected for dark current) and matched to the target frame on the basis of the relative strength of a selected OH air-glow emission line. For crowded fields, contamination from stars in the sky frame can be muted by combining the pair of sky frames nearest in time into a composite sky using the lowest value at each pixel. The crsproc task completes the process: frames are rotated to align the dispersion axis along image columns (to take advantage of the inherent symmetry of the slit curvature about the dispersion axis). The image section illuminated by the spectrograph is extracted and geometrically transformed via the IRAF geotran routine to remove line curvature along the slit. Second-order (atmosphere specific) flatfielding is applied. Optionally, when the target does not extend to the edge of the field, residual airflow can be removed by subtracting the linear fit to the end columns for each row and the continuum can be removed by a higher order fit along each column. Fully processed data are collected into a three dimensional spectral image cube, with axes in RA, DEC, and dispersion for convenience in analysis. The stackimage task extracts images within spectral lines by combining selected on-line image slices, optionally subtracting the continuum fitted to off-line image slices on either side of the line to reduce contamination from stars in both the object and sky frames. The extracted spectral images are then magnified to produce rectilinear images.

A variety of automated tasks have been protyped to provide a continuously updated display of sky-subtracted images which are appropriate for assessing the suitability of the data as they are being collected. One task produces image statistics and provides access to the IRAF imexamine task. Another simultaneously displays the heavily overlapped 3X3 grid used for high background observations as adjacent images within a single ximtool frame in the same relative position as the data are taken. Although the interface is rather clumsy and undeveloped, these scripts have proven invaluable for controlling the course of observations with high and/or variable background, faint and/or extended targets or otherwise complicated geometry.

The tmove script is a simple ``point and click'' routine to interactively point the telescope: given a pre-existing image with known platescale and orientation and the telescope pointed at a known spot on that image, one can selectively reposition the telescope using the image cursor. The requisite TCP/WILDFIRE commands are composed by the program and can be pasted into the appropriate TCP/WILDFIRE control window and executed. Target acquisition on the basis of an actual image of the field is a powerful way to observe, particularly when positioning a spectrograph slit. Platescale and orientation are determined from the selected telescope and instrument parameters for the image.

3. Shift and Add Extensions

This past summer new optics were installed in COB which deliver a 0.1 arc second per pixel image at the 4m meter telescope on the 256X256 InSb array. WILDFIRE was modified to incorporate two DATACUBE real-time image processors and a integer shift and add algorithm, tracking the brightness pixel within a designated sub-array region of interest (ROI) was implemented by Nick Buchholz and Jerry Heim. The SAA acquisition algorithm sky subtracts each frame, masks bad pixels to zero, performs an integer shift (of the data and the flatfield image) to place the peak pixel at its location in the first image and accumulates the result for both the data and the gain frames. At wavelengths longward of 3 , for integration times from 100 to 500ms, integer SAA provides adequate tip-tilt compensation to produce diffraction limited (0.25 arc second) images of targets with a point source sufficiently bright to track.

Given the variability of the atmosphere, the efficiency and success of such observations necessitates a sophisticated near realtime quick-look capability. The DATACUBE was able to continuously display the sky subtracted target images in real-time. IRAF scripts based on the sqiid package were developed on-site to provide the rest. The SAA acquisition system produces sky subtracted target (data), sky, and gain images and a shift file which contains the location and intensity of the peak pixel for each integration in the SAA resultant image. Each data product is unambiguously identified by its unique postfix appended to the root image filename. The coordinates of the resultant peak pixel are stored in the data image header. Larger targets were observed in a 2X2 grid with the acquisition source successively in each corner. Since the position of the acquisition target within each image is known, groups of images can be automatically processed, registered, and combined into a composite image employing integer shifts shortly after acquisition.

The saareport script generates a log of each SAA image, including time, airmass, filter, sky background, the brightness of the peak pixel (which monitors saturation effects and atmospheric variability) and the location of the peak pixel and the assorted system parameters(which allow observations to be readily repeated). The saaphot script employs the IRAF imexamine task to generate a log of assorted photometric and image quality parameters for assessing the quality and the accuracy of each observation. The pltsaa script employs the STSDAS tables and sgraph tasks to generate assorted image statistics and a variety of graphs for assessing telescope tracking and general image motion, including the X and Y peak pixel coordinates and intensity with time and the XY scatter plot of the peak pixel coordinates. The saatime script produces a graph of image quality vs. integration time for selecting the appropriate integration time (Naturally, there is a tradeoff between signal to noise and image quality!).

Prompt image processing is provided by the saagain script, which ratios the data and gain images to ``flatfield'' the raw data and normalize the result by the number of ``good'' pixels accumulated at each pixel within the resultant image. The saaquick script automatically produces a registered and intensity matched (using the common overlap region) composite image for a group of data which share the same acquisition source. The data may be optionally previewed interactively to assess its suitability for inclusion into the final composite image.

4. Conclusion

Although not yet a formal IRAF package, the resultant SQIID IR image reduction package is now freely available and in widespread use within the IRAF environment. Quick-look capability---in the sense that the data can be selectively processed the same night they are taken and fully processed prior to the next night's observations---has proven to be a formidable tool in the observing arsenal. The ability to assess results as they came in proved to be crucial to the success of the real-time integer SAA experiment. Despite poor weather, we (the author, Ian Gatley, Steve Ridgway, Nick Buchholz and Jerry Heim) were able to operate with an efficiency sufficient to complete the acquisition and reduction software, establish the appropriate observation protocols and perform (and document) service observing for the programs awarded time through the TAC process.


Next: Wide Area Synchronization to the 10ms Level
Previous: The Gemini Telescope Control System
Table of Contents --- Search --- PS reprint
Wed Jul 3 07:58:04 MST 1996