5.3 Deconvolving images

The most widely used deconvolution method is Clean, originally described by Högbom. All AIPS Clean tasks implement a Clean deconvolution of the type devised for array processors by Barry Clark (Astron. & Astrophys. 89, 377 (1980)). (Your computer does not need not to have an array processor or other special vector hardware to run them, however.) The recommended task IMAGR implements Clark’s algorithm with enhancements designed by Bill Cotton and Fred Schwab. These enhancements involve going back to the original uv data at each “major cycle” to subtract the current Clean-component model and re-make the images. This allows for more accurate subtraction of the components, for Cleaning simultaneously multiple (perhaps widely spaced) smaller images of portions of the field of view, for Cleaning of nearly the full image area, for more accurate removal of sidelobes, and for corrections for various wide-field and wide-bandwidth effects. Of course, all these extras do come at a price. For large data sets with fairly simple imaging requirements, image-based Cleans, particularly APCLN, may be significantly faster.

The next section describes the basic parameters of Cleaning with IMAGR. The second section describes the use and limitations of multiple fields in IMAGR; the third section describes the setting of Clean “boxes” and the TV option in IMAGR; the fourth section describes some experimental extensions to standard Clean; and the fifth section describes various wide-field and wide-bandwidth correction options. Clean component files are tables which can be manipulated, edited, and plotted both by general-purpose table tasks and by tasks designed especially for CC files. Some aspects of this are discussed in the fifth section. Images may also be deconvolved by other methods in AIPS. §5.3.7 mentions several of these and describes the most popular alternatives, image-based Clean with APCLN and SDCLN and a Maximum Entropy method embodied in the task VTESS.

5.3.1 Basic Cleaning with IMAGR

IMAGR implements a Clean deconvolution of the type devised by Barry Clark and enhanced by Bill Cotton and Fred Schwab. Clean components — point sources at the centers of cells — are found during “minor” iteration cycles by Cleaning the brightest parts of the residual image with a “beam patch” of limited size. More precise Cleaning is achieved at the ends of “major” iteration cycles when the Fourier transform of the Clean components is computed, subtracted from the visibility data, and a new residual dirty image computed. The rule for deciding when a major iteration should end in order to achieve a desired accuracy is complicated (see the Clark paper). IMAGR lets you vary the major iteration rule somewhat to suit the requirements of your image. Type DOCRT FALSE; EXPLAIN IMAGR  C R, if you haven’t already, to print out advice on imaging and Cleaning.

IMAGR both makes and Cleans images. See §5.2 for the inputs needed to make the images. The inputs for basic Cleaning are:

> OUTS 0  C R

to create a new output file. If OUTSEQ = 0, the specified value is used. OUTSEQ must be set to restart a Clean (see below).

> GAIN 0.1  C R

to set the loop gain parameter, defaults to 0.1. Values of 0.2 or more may be suitable for simple, point-like sources, while even smaller values may be required for complex sources with smooth structure.

> FLUX f  C R

to stop Cleaning when the peak of the residual image falls to f Jy/beam.

> NITER n  C R

to stop Cleaning when n components have been subtracted. There is no default; zero means no Cleaning.

> BCOMP 0  C R

to begin a new Clean — see below for restarting one.


to specify no Clean search areas in advance; see §5.3.3.


to allow IMAGR to use DFT or gridded-FFT component subtraction at each major cycle, depending on which is faster. ’DFT’ forces DFT and ’GRID’ forces gridded subtraction at all iterations. Use the default. DFT is more accurate, but usually much slower; see the explain file for details.


to use the “normal” criteria for deciding when to do a major cycle; see below.

> BMAJ 0  C R

to have IMAGR use a Clean beam which is a fit to the central lobe of the dirty beam.

> DOTV  1  C R

to have dirty and residual images displayed on the TV; see §5.3.3.

> LTYPE  3  C R

to have axis labels plotted on the TV along with each image; see §5.3.3. LTYPE2 causes the labeling to be omitted.

> INP  C R

to review the inputs — read carefully.

> GO  C R

to start IMAGR.

The procedure MAPPR may be used for single-field Cleaning.

The FACTOR parameter in IMAGR can be used to speed up or to slow down the Cleaning process by increasing or decreasing the number of minor cycles in the major cycles. The default FACTOR 0 causes major cycles to be ended using Barry Clark’s original criterion. Setting FACTOR in the range 0 to +1.0 will speed up the Clean, by up to 20% for FACTOR 1.0, at the risk of poorer representation of extended structure. Setting FACTOR in the range 0 to -1.0 will slow it down, but gives better representation of extended structure.

Two other subtle parameters which help to control the Clean may need to be changed from their defaults. MINPATCH controls the minimum radius in the dirty beam (in pixels) used during the minor cycles to subtract sidelobes of one component from other nearby pixels. If your dirty beam is complicated, with significant near-in sidelobes and your source extended, then the default 51 cells may be too small. IMAGR uses a larger patch during the first few major cycles, but will be reduced eventually to a MINPATCH patch. IMAGR normally creates a dirty beam twice the size of the largest field (or 4096 pixels whichever is smaller). This allows for a very large beam patch in the early cycles, letting widely spaced bright spots be Cleaned more accurately. If your image does not have widely spaced bright spots, you can save some compute time by reducing this beam size with IMAGRPRM(10); see the help file. MAXPIXEL controls the maximum number of image pixels searched for components during any major cycle. If MAXPIXEL were very large, IMAGR would spend all of its time examining and subtracting from pixels it is never going to use for components. If it is too small, however, then pixels that should be used during a major cycle will not be used and major cycles may end up using only a few components before doing another (expensive) component subtraction and re-imaging. Again, we do not know what to recommend in detail. The default (20050) seems good for normal 1024x1024 images, smaller values are better for smaller images of compact objects, and rather larger values may be good for extended objects or large numbers of fields. If the first Clean component of a major cycle is significantly larger than the last component of the previous cycle (and the messages let you tell this), then too few cells are being used.

If you do not specify the parameters of the Clean beam, a Gaussian Clean beam will be fitted to the central portion of the dirty beam. The results may not be desirable since the central portions of many dirty beams are not well represented by a single Gaussian and since the present fitting algorithm is not very elaborate. If you use the default, check that the fitted Clean beam represents the central part of the dirty beam to your satisfaction. Use task PRTIM on the central part of the dirty beam to check the results — another reason to make an un-Cleaned image and beam first. To set the Clean beam parameters:

> BMAJ bmaj  C R

to set the FWHM of the major axis of the restoring beam to bmaj arc-sec. BMAJ = 0 specifies that the beam is to be fitted.

> BMIN bmin  C R

to set the FWHM of the minor-axis of the restoring beam to bmin arc-sec; used if BMAJ > 0.

> BPA bpa  C R

to set the position angle of beam axis to bpa degrees measured counter-clockwise from North (i.e., East from North); used if BMAJ > 0.

Note that specification of the Clean beam makes the spatial resolution and units of the restored components different fromthose of the residual image. IMAGR will smooth and scale the residual image before adding the components to the output so that all portions of the image have the same spatial resolution and brightness units. Use BMAJ < 0 if you want the residual image, rather than the Clean one, to be stored in the output file.

Note that the number of Clean iterations, and many of the other Cleaning parameters, may be changed interactively while IMAGR is running by use of the AIPS SHOW and TELL utilities. Type SHOW IMAGR  C R while the task is running to see what parameters can be reset, and their current values. Then reset the parameters as appropriate and TELL IMAGR  C R to change its parameters as it is running. (The changes are written to a disk file that IMAGR checks at appropriate stages of execution, so they may not be passed on to the program immediately — watch your AIPS monitor for an acknowledgment that the changes have been received, perhaps some minutes later if the iteration cycles are long or your machine is heavily loaded. AIPS verb STQUEUE will show all queued TELLs.) Of particular interest is the ability to turn the TV display back on and to extend the Clean by increasing NITER. There are two ways to tell IMAGR that it has done enough Cleaning: by selecting the appropriate menu item in the TV display or by sending a OPTELL = ’QUITwith TELL. The former can only be done at the end of a major cycle and only if the TV display option is currently selected, while the latter can be done at any time (although it will only be carried out when the current major cycle finishes).

IMAGR makes a uv “workfile” which is used in its Clean step to hold the residual fringe visibilities. Its name is controlled with the IN2NAME, IN2CLASS, IN2SEQ, and IN2DISK parameters. If the first three are left blank and 0, the workfile will be deleted when IMAGR terminates. Even if the workfile already exists, IMAGR assumes that its contents must be initialized from the main uv file unless the ALLOKAY adverb is set 2.. This file is useful if you suspect that there are bad samples in your data. Use LISTR (§O.1.5) UVFND (§6.2.1), PRTUV (§6.2.1), UVPLT (§6.3.1) or even TVFLG (§O.1.6) to examine the file. If you find data which you think are corrupt, remove them from the input uv data set with UVFLG. These workfiles may eventually use an annoying amount of disk if IN2SEQ is left 0. Be sure to delete old ones with ZAP in this case.

IMAGR may be restarted to continue a Clean begun in a previous execution. To do this, you must set the OUTSEQ to the sequence number of file you are restarting. A good way to do this is


to set the output name parameters to the name parameters of catalog entry ctn on disk d.

The other parameters that must be set to restart a Clean are OUTVER, the output Clean Components version number, and BCOMP, the number of Clean components to take from the previous Cleans. A restart saves you much of the time it took IMAGR to do the previous Clean, although it will make new beam images and a new file of residual visibilities unless you specify that it should not using ALLOKAY. An image can be re-convolved by setting NITER = the sum of the BCOMPs and specifying the desired (new) Clean beam. Images can be switched between residual and Clean (restored) form in the same way, setting BMAJ = -1 to get a residual image. (For single fields, tasks RSTOR and CCRES may be used for this purpose.) IMAGR writes over the Clean image file(s) as it proceeds to Clean deeper. You can preserve intermediate Clean images, however, either by copying them to another disk file with SUBIM or by writing them to tape with FITAB or FITTP.

5.3.2 Multiple fields in IMAGR

IMAGR can also deconvolve components from up to 4096 fields of view simultaneously, taking correct account of the w term at each field center (DO3DIMAG false) or even re-projecting the (u,v,w) coordinates as well as the phases to each field center (DO3DIMAG true). This is a vital advantage if there are many localized bright emission regions throughout your primary beam; only the regions containing significant emission need to be imaged and cleaned, rather than the entire (mainly empty) area of sky encompassing them all. It may even be necessary to image regions well outside the primary beam, not because you will believe the resulting images, but to remove the sidelobes of sources in those distant fields from the primary fields. To take advantage of this option, you must have prior knowledge of the location and size of the regions of emission that are important — yet another reason to make a low resolution image of your data first. Task SETFC helps you prepare multi-field input to IMAGR using the NRAO VLA Sky Survey (NVSS) source catalog and even the current coordinate of the Sun. It can also recommend cell and image sizes. After Cleaning, multiple fields (and even multiple pointings of a mosaic) from IMAGR may be put into a single large image on a single geometry by FLATN. Task CHKFC may be used with FLATN to check that a given BOXFILE covers the desired portion of sky with fields and Clean boxes. The BOXFILE may be edited by task BOXES to put Clean boxes around sources from a source list such as the NVSS or WENSS. The task FIXBX may be used to convert the Clean boxes from the facets and cell sizes of one box file to those of another.

The use of IMAGR to make images of multiple fields was described in §5.2.2. To repeat some of the description, you specify the multiple-field information with:


to make images of n fields.

> IMSIZE i,j  C R

to set the minimum image size in x and y to i and j, where i and j must be integer powers of two up to 8192.

> RASHIFT x1,x2,x3,  C R

to specify the x shift of each field center from the tangent point; xn > 0 shifts the map center to the East (left).

> DECSHIFT y1,y2,y3,  C R

to specify the y shift of each field center from the tangent point; yn > 0 shifts the map center to the North (up).

> FLDSIZ i1,j1,i2,j2,i3,j3,  C R

to set the area of interest in x and y for each field in turn. Each in and jn is rounded up to the greater of the next power of 2 and the corresponding IMSIZE. FLDSIZE controls the actual size of each image and sets an initial guess for the area over which Clean searches for components. (That area is then modified by the various box options discussed in §5.3.3.)

If ROTATE is not zero, the shifts are actually with respect to the rotated coordinates, not right ascension and declination. The actual x shift will be RASHIFT which is (α - α0)cos(δ). IMAGR has an optional BOXFILE text file which may be used to specify some or all of the FLDSIZE, RASHIFT, and DECSHIFT values. It is the only way to specify these parameters for fields > 64. To simplify the coordinate computations, the shift parameters may also be given as right ascension and declination of the field center, leaving IMAGR to compute the correct shifts, including any rotation. BOXFILE may also be used to specify initial Clean (and “UNClean”) boxes for some or all fields, values for BCOMP, spectral-channel-dependent weights, a list of “star” positions to be added to plots, and even a list of facets to ignore totally.

The manner in which the multi-field Clean is conducted requires some discussion. When ONEBEAM is true, there is a single dirty beam for all fields. For either value of DO3DIMAG, the dirty beams for each facet are, at least subtly, different. Using a single dirty beam allows the task to run faster at some compromise to accuracy. Since the Clean component models are subtracted from the uv data at each major cycle, Clean will correct much of this compromised accuracy. In OVERLAP < 2 mode with one beam, all pixels within Clean windows above the current threshold from all fields are selected for the Clark Clean at the same time. The component flux at which the major cycle terminates is adjusted by the number of iterations before and during that major cycle. All components found from all fields in the major cycle are subtracted at once from the residual data and a new set of residual images is constructed. When ONEBEAM is false, there is a different dirty beam for each field. Thresholds are set by reviewing the data in all fields as above. However, a major cycle is then conducted for each field individually in order of decreasing peak residuals (within the Clean boxes). The first field alone determines the flux at which the major cycle terminates for all fields. Components are subtracted from the residual data one field at a time.

There is a third arrangement, selected by specifying OVERLAP2, which is useful if the multiple fields overlap. All fields are imaged at the beginning to allow the user to set the initial Clean boxes. Then, at each cycle, the one field thought to have the highest residual with its Clean boxes is imaged, a major cycle of Clean performed, and the components found subtracted from the residual uv data. The process is repeated using the previous estimates of the maxima (with a revised value for the field just Cleaned). This arrangement requires some extra imaging at the beginning (and occasionally during Cleaning), has some uncertainties about the setting of thresholds and major cycle flux limits, and will invoke the DOTV option for every field individually except at the beginning. It has the benefit of removing the strongest sources (if there is overlap) and their sidelobes from the later fields before they are imaged. This arrangement removes the instabilities that arise if the same spot is Cleaned from 2 fields. IMAGR carefully checks the Clean boxes in OVERLAP < 2 mode and eliminates one of any two overlapping boxes.

It appears that the most reasonable approach would be to use ONEBEAM FALSE ; OVERLAP 2 at the beginning of a deep Cleaning in order to deal carefully with the brightest source components, avoiding putting erroneous components on their sidelobes. But when the dynamic range of the residual image is reduced, ONEBEAM TRUE ; OVERLAP 1 will be accurate enough and much faster. IMAGR has an OVRSWTCH option to control switching from the former to the latter without having to restart the Clean.

There are a number of aspects of multi-field Clean that can trip up the unwary. The first is that the sidelobes of an object found in one field are not subtracted from the other fields in the minor Clean cycle. In fact, they are not even subtracted from pixels more than the beam patch size away in the same field. This can cause sidelobes of the strongest sources to be taken to be real sources during the current major cycle. (The OVERLAP 2 sequence reduces this effect significantly.) At the end of the major cycle, all components from all fields are subtracted from the uv data. At this point, all sidelobes of the components are gone from all fields, but the erroneously chosen “objects” with their sidelobes will appear (in negative usually). This is normally not a problem. During the next cycle, Clean will put components of the opposite sign on the erroneous spots and they will eventually be corrected. Nonetheless, it is a good idea to restrict the Cleaning to the obvious sources to begin with, saving Clean the trouble of having to correct itself, and to open up the search areas later in the Clean. The TV options make this easy to do in IMAGR; see §5.3.3.

The situation is more complex if the multiple fields overlap. If a sidelobe in the overlap area is taken as a source in one major cycle, it will appear as a negative source in both fields at the start of the next major cycle (only when OVERLAP < 2). Clean will then find negative components in both fields and correct its original error twice, producing a positive “source” at the next major cycle. Such errors never get fully corrected. A simple rule of thumb is never to allow the search areas of one field to overlap with the search areas of another field — or use OVERLAP 2.. Even then, there is one other “gotcha.” In the restore step, Clean only restores components to the fields in which they were found (again, unless OVERLAP > 0). Thus, a real source visible in two fields will be found in only one after Clean; your two images of the same celestial coordinate will be in substantial disagreement. Therefore, you must be careful about which parts of which images you believe to represent the sky. Instead, use OVERLAP 1 to have Clean components from all fields restored to all fields as needed. If OVERLAP 2 , the Clean and imaging are done in a fashion which greatly reduces the instabilities arising from Cleaning the same source (or sidelobe) from more than one field.

5.3.3 Clean boxes and the TV in IMAGR

Clean works better if it is told which pixels in an image are allowed to have components. The initial information on this is provided by the FLDSIZE adverb which gives the pixel dimensions of a rectangular window centered in each field in which Clean looks for components. This window can be nearly the full size of the image because the components are subtracted from the ungridded uv data. Cleaning windows or “boxes” can be specified with the adverbs:


to set the number of boxes in which to search for Clean components. Must be 50; if 0, one Clean box given via FLDSIZE is used and CLBOX is ignored.

> CLBOX lx1,by1,rx1,ty1,lx2,by2,rx2,ty2,  C R

to specify the pixel coordinates of the Clean windows as leftmost x, bottom-most y, rightmost x, topmost y for boxes 1 through NBOXES. Circular boxes may also be specified as -1, radius, center x, center y interspersed in any order with the rectangular boxes. Default is given by FLDSIZE(1).

> BOXFILE area : infilename  C R

to specify the name of a text file listing the Cleaning windows. Blank means no file.

> OBOXFILE area : outfilename  C R

to specify the name of an output text file to list the Cleaning windows after any modifications made while running IMAGR. Blank means a temporary file in $HOME. OBOXFILE can be the same as BOXFILE. Can also be simply an environment variable followed by a colon to be assigned a unique name in that area corresponding to this execution of IMAGR.

The BOXFILE text file is an optional means by which Clean windows may be entered at the start of a run of IMAGR for all fields, not just the first. It is also the only way to enter more than 50 boxes for the first field; the limit is min (2048, 131072/NFIELD) (!) boxes per field with this option. The format of the file is one box per line beginning with the field number followed by the four numbers describing the box as in CLBOX above. Any line in which the first non-blank character is not a number is taken as a comment, a field definition (see §5.2.2), a BCOMP value, a channel weight, or an “UNClean” box definition. This last begins with a U or u, followed by a field number and a circular or rectangular box which defines a region in which Clean components are not allowed to be found. This is used to force time-dependent components into their own field in the TDEPEND set of procedures. There may well be other reasons, such as centering a point component on a pixel in its own field, for forbidding the Cleaning of a source in a particular field. NBOXES and CLBOX are overridden if any boxes for the first field are given in the file.

You can use the TV cursor in advance of running IMAGR to set the Cleaning boxes. First, load the TV display with either the dirty image or a previous version of the Clean image of the first field; see §6.4.1. Then type:


to begin an interactive, graphical setting of up to 50 boxes, or


to do a similar setting of the boxes, beginning with the NBOXES boxes already in CLBOX.

Position the TV cursor at the bottom left corner of the first Cleaning box and press a trackball or mouse button. Then position the cursor at the top right corner of the box and press Button B. Repeat for all desired boxes. This will fill the CLBOX array and set NBOXES for the first field. Note that the terminal will display some additional instructions. These will tell you how to switch to a circular box and how to reset any of the previously set corners or radii/centers should you need to do so. HELP REBOX  C R will provide rather more details. The verb DELBOX allows you to delete boxes from CLBOX interactively.

You can also use the TV cursor in a very similar way to build and modify the BOXFILE text file. (You can also use your favorite text editor of course; see §3.10.1 for general information about specifying and using external text files.) The verb FILEBOX reads the text file (if any) given by BOXFILE selecting those boxes (if any) already specified for the specified field number which fit fully on the current image on the TV. Which field number you want is given with the NFIELD adverb, or, if that is zero, deduced from the Class name of the image on the TV. (Be careful to load the TV with the desired image before running FILEBOX!) You then carry out a graphical setting or resetting of boxes in exactly the same manner as with REBOX. The new and changed boxes are then added to the end of the text file. Different portions of the current field and other fields may be done and redone as often as needed. Verb DFILEBOX may be used like DELBOX to delete boxes interactively from a BOXFILE. The BOXFILE may be edited by task BOXES to put Clean boxes around sources from a source list such as the NVSS or WENSS. The task FIXBX may be used to convert the Clean boxes from the fields and cell sizes of one box file to those of another.

Task FILIT does something like FILEBOX but it does the TV load for you, using a roam mode if the image is larger than the TV display area. From a TV menu, you may then add boxes, change boxes, and delete boxes and even use an auto-boxing feature to add boxes automatically based on the peak values and noise in the image. FILIT will work on a set of facet images and should become the task of choice for examining multi-facet images and their Clean boxes. The non-interactive task SABOX will find boxes to use for a set of facet images, prepared, for example, by a shallow un-boxed Clean. If you need to take your boxes to CASA, MASKS will make a mask image for you.

IMAGR will also create Clean boxes for you automatically. The adverbs IM2PARM(1) through IM2PARM(6) control the process, selecting the maximum number of boxes to be found at any one time, the cutoff levels as factors times the residual image robust rms, and more. IM2PARM(7) controls the starting list of Clean boxes for the next spectral channel — do they start with those input to IMAGR or also include those found in the current channel. See HELP IM2PARM  C R for information and AIPS Memo No. 115 “Auto-boxing for Clean in AIPS” by Greisen for a detailed explanation of this new option.

The real power of IMAGR becomes apparent if you set DOTV = n, where NFIELD n > 0 is the field number first displayed on the TV. Before each major cycle, the current residual image is displayed on the TV and a menu of options is offered to you. (Note that the residual image before the first major cycle is the un-Cleaned dirty image.) The image displayed is interpolated up or decremented down (by taking every nth pixel in each direction) to make it fit on the display and the current Clean boxes are shown. If you do not select a menu option, IMAGR proceeds after 30 seconds.

The interactive options appear in two columns. To select an option, move the TV cursor to the option (remember the left mouse button — see §2.3.2) and press buttons A, B, or C. Button D will get you some on-line help about the menu option. The basic options, in the order in which they are displayed, are:


to stop the task abruptly, destroying the output images and exiting as quickly as possible.


to resume the Cleaning now and stop using the TV to display the residual images. To turn the TV display back on, if needed, use the TELL IMAGR verb with suitable adverbs, including DOTV TRUE.


to stop the Clean at this point, restore the components to the residual images, write them on disk, and exit.


to turn off any zoom magnification


to turn off any black & white enhancement


to turn off any pseudo-coloring


to interactively zoom and enhance the display in black & and white or pseudo-color contours as in AIPS


to enhance in black & white as in AIPS


to select many pseudo-colorings as in AIPS


to enhance with flame-like pseudo-colorings as in AIPS


to set the zoom interactively as in AIPS


to display the pixel value and x,y pixel coordinates at the TV cursor position as in AIPS


to compute and display robust and normal statistics on the current residual image


to select a sub-image of the whole to be reloaded with better resolution — all boxes must be included.


to select the full image and reload the display


to set the Clean boxes for this field beginning at the beginning as in AIPS. If existing boxes will be deleted, you are asked if you want that. If no, REBOX is done instead.


to reset the current Clean boxes and create more as in AIPS


to delete some of the current Clean boxes as in AIPS


to make or re-make “UNClean” boxes for this field


to resume Cleaning now rather than wait for the time out period.


to change the character size used in the TV display.

A blank OBOXFILE adverb causes a temporary one to be created in $HOME. A TELL operation can change this adverb to a more permanent file. If TVBOX, REBOX, or DELBOX used, the new Clean boxes will be written to the text file, replacing any previously in that file. (All non-box cards in that file are preserved unchanged; a new OBOXFILE will be filled with the non-box cards from BOXFILE.)

If NFIELD > 1, a sufficient number of additional options appear of the form


to display field n, allowing its Clean boxes to be altered or


to prompt on the terminal for a new field number to be displayed, allowing its Clean boxes to be altered (when > 64 fields).


to select the next higher numbered field (when > 64 fields).


to select the next lower numbered field (when > 64 fields).

Thus you can look interactively at the initial dirty images, place boxes around the brightest sources, and start the Clean. As it proceeds and weaker source become visible, you can expand the boxes and add more to include other sources of emission. Do be careful, however. Boxes that are too tight around a source can affect its apparent structure. The author once made Cas A into a square when stuck with a too-tight box. If OVERLAP = 2, the SELECT FIELD options are displayed when all residual images are current, i.e., at the beginning, but are replaced by the options


to re-compute all fields using the current residual uv data and then to display all fields on the TV.


to indicate that only field n is displayed and available to have its boxes altered.


to prompt on the terminal for a field number, exit TV, re-compute and display that field with current residual data (if needed) and then Clean that field (only available if NFIELD > 64 or DOWAIT true).


to mark field n as Cleaned sufficiently.


to allow further cleaning of previously stopped field n.


to see if Clean boxes in one field overlap with Clean boxes in other fields and drop some to avoid this situation.

We encourage use of DOTV TRUE  C R when you are Cleaning an image, especially for the first time or when using the options described in the next section. Watching the TV display as the Clean proceeds will help you to gauge how to set up control parameters for future Cleans and how long to iterate. It may also warn you about instabilities in the deconvolution if you compare the appearance of extended structures early and late in the Cleaning process. The instabilities referred to in §5.2.4 were first seen while Cleaning with the TV option.

5.3.4 Experimental variations on Clean in IMAGR

Experimental variations of the familiar Cleaning methods have been introduced in IMAGR. One deals with the so-called “Clean bias” which causes the fluxes of the real sources to be underestimated. The other two deal with the inadequacies of Clean in modeling extended sources. Clean-component filtering

It has been found that Clean will eventually assign some components to noise spikes in regions which do not have real sources, producing the “Clean bias.” Real source flux is underestimated, presumably because “sidelobes” of the noise “sources” get subtracted from areas of real sources. The magnitude of the effect is rather variable and is not understood. There are two older tasks discussed in §5.3.6 which deal with the problem. However, it would be better to remove “weak, isolated” (presumably spurious) Clean components as Clean proceeds rather than only after the fact. One cannot do this at every Clean major cycle, since all components are likely to be weak and isolated initially. But it is a good idea to do it a few times while uv-plane based Cleans still have the ability to respond to the filtering. Note that this option may be used to remove negative “bowls” surrounding sources imaged with too little short-spacing data. However, it does not remove the bowl that sits on the source itself and so the final flux will be too low. You should consider the multi-scale Clean instead.

To have IMAGR filter Clean components set IMAGRPRM(8) 0. Then IMAGR will select only those Clean components having > abs(IMAGRPRM(8)) Jy within a radius of abs(IMAGRPRM(9)) cells of the component. Note that this rejects all areas of negative flux, unless IMAGRPRM(8)< 0, in which case the absolute value of the flux near the component is used. You can change these parameters with TELL, but only if IMAGRPRM(8) was non-zero to begin with. A copy of the input data has to be made for this option and it is only made if IMAGRPRM(8) is non-zero. If this option is selected, the output CC files will have been merged. Note that IMAGRPRM(8) should always be 0 for images of Q, U, and V Stokes parameters since negative brightnesses are valid. Filtering is done on restarts, when requested from the TV, on certain Cleaning failures, and near the exit. Clean is continued after this last filtering if IMAGRPRM(9)< 0, but usually terminates fairly quickly. When this option is available, an addition TV option will appear:


to exit TV, filter all Clean components, and then re-compute all fields using new residual data.

This is the only way to filter before the end of the current Clean. SDI modification of Clean in IMAGR

A modified Clean algorithm that attempts (often successfully) to suppress the striping and bumpiness in Cleans of extended sources has been developed by Steer, Dewdney and Ito (1984, Astron. & Astrophys. 137, 159). In the AIPS modification of the algorithm, Clean proceeds normally until the residual image becomes rather smooth. It then takes many components at once from all high-residual cells rather than trying to decide exactly which one cell is the highest. This algorithm attempts to cut the top off the plateau of emission found in the residual image(s) in a relatively uniform way. Unfortunately, it is very expensive to determine the correct weights to use for each pixel in this algorithm. The technique used by IMAGR does apply larger weights to isolated pixels and pixels at the edges of the “plateau” but these weights are still not quite large enough to avoid a tendency to make a slight rim around the plateau. The next cycle of SDI Clean does trim this down and the method converges well for the extended sources for which the algorithm was designed. IMAGR allows you to switch back and forth automatically between BGC and SDI depending on the contrast between the brightest and median residual pixel in the Clean windows. (SDI is used when the contrast is low.)

To allow IMAGR to use the SDI algorithm, specify IMAGRPRM(4) > 0. SDI Clean will be used when the fraction of pixels in the Clean windows exceeding half of the peak residual exceeds IMAGRPRM(4). IMAGRPRM(19) is used to limit the depth of an SDI Clean cycle. When this option is used, additional TV options appear:


to force the next Clean cycle to use SDI method.


to force the next Clean cycle to use Clark method.

These allow you to force the choice of SDI or BGC methods for the next Clean major cycle. After that, it reverts to selecting the method based on IMAGRPRM(4) and the histogram of residual values. Multi-scale modification of Clean in IMAGR

Clean has problems with extended sources because the point-component model is so far from the reality for them. Greisen experimented in the 1970s with modeling sources as Gaussians rather than points, but found that there are always point sources in the image which cannot be modeled sensibly with an extended component. (“Bull’s eyes” get painted around every point object.) Wakker and Schwarz (1998, Astron. & Astrophys. 200, 312) proposed a scheme in which a smoothed image and a difference image were Cleaned. This still used point-source models although the Clean beam used for restoring the smoothed-image components was extended. Cornwell and Holdaway (July 1999, Socorro imaging conference) described a scheme in which an image is Cleaned simultaneously at several scales.

A uv-based variation of this last algorithm is available in IMAGR. The multi-field capability is used to image for each of NFIELD fields, images at NGAUSS scales specified in the array WGAUSS in arcsec. The full-resolution image is convolved with a Gaussian of width WGAUSS(i) while a dirty beam appropriate to a component of that width is constructed. One of the WGAUSS must be zero if a point-source model is desired; a warning is issued if none of the resolutions is zero. OVERLAP = 2 mode is used. See EXPLAIN IMAGR for details of this new option. Users have found that WGAUSS values increasing by factors of ∘ -
  (10) are frequently optimal. The most important additional control parameter is IMAGRPRM(11) which down-weights higher scales to allow Clean to work on the higher-resolution images with roughly equal probability. FGAUSS is used to select the minimum brightness to be cleaned at each scale; higher values at higher scales are usually desired. Reasonable values of these three parameters will require running IMAGR to determine the point-source resolution and then to determine the peak brightnesses in each scale and the apparent noise levels after some Cleaning. The other available “knobs” for this algorithm may safely be left at zero.3 Spectral-index corrections

When using wide-band, multi-channel data to image continuum sources, serious effects are seen if the source intensities change as a function of frequency. If these changes can be modeled as spectral index images with or without “curvature,” then IMAGR will allow the spectral-index effects to be compensated during Cleaning. First image each spectral channel (or group of closely-spaced channels) separately. Combine them into a cube with FQUBE, transpose the cube with TRANS, and solve for spectral index images with SPIXR. To use these images, set IMAGRPRM(17) to a radius (> 0) in pixels of a smoothing area and put the image name parameters in the 3rd and 4th input image names. Note that this algorithm is expensive, but that it can be sped up with judicious use of the FQTOL parameter.

5.3.5 Data correction options in IMAGR

There are a number of effects which degrade the usual image deconvolution, but which are, optionally, handled differently by IMAGR. These corrections are primarily for observations made with widely spaced frequencies over fields comparable to the single-dish field of view. If you have such data and hope to achieve high dynamic range images, then these corrections are for you. Otherwise skip to the next section. Frequency-dependent primary-beam corrections

The primary-beam pattern of the individual telescopes in the interferometer scales with frequency. Therefore, each channel of multi-frequency observations of objects well away from the pointing center effectively observes a different sky. When a combined source model is produced, there will be residuals in the visibility data that cannot be Cleaned as the data does not correspond to a possible sky brightness distribution. If IMAGRPRM(1) is larger than 0, then a correction is made in the subtraction of Clean components from the uv data to remove the effects of the frequency dependence of the primary beam. If the array is known, i.e., if it is the old VLA, new EVLA, ATCA, GMRT, or MeerKAT, the known primary beam parameters of the average telescope in the array are used. Otherwise, the primary beam is assumed to be that of a uniformly illuminated disk of diameter IMAGRPRM(1) meters. This correction is made out to the 5% power point of the beam with a flat correction further out. Note: this correction is only for the relative primary beam to correct to a common frequency and does not correct for the primary beam pattern at this frequency. Note that this algorithm is expensive, but that it can be sped up with judicious use of the FQTOL parameter. It adds essentially no cost when doing the spectral-index corrections, however. Frequency-dependent correction for average spectral index

If the sources observed do not have a flat spectrum, then the source spectrum will have channel-dependent effects on the Cleaning of a similar nature to the primary beam effects described above. This problem does not depend on position in the field except, of course, that the spectral index usually varies across the field. Normally, however, it varies around -0.8 rather than about 0. To the degree that the structure in the field can be characterized by a single spectral index, the amplitudes of the data can be scaled to the average frequency. This is done, before imaging, by scaling the amplitudes of the uv data to the average frequency using a spectral index of IMAGRPRM(2). For optically thin synchrotron sources, this spectral index is typically between -0.6 and -1.0. This correction cannot remove the effects of variable spectral index but allows a single correction which should usually be better than no correction at all. Note that a much more expensive correction and more accurate may now be made (see above). Error in the assumed central frequency

If the frequency used to compute the u, v and, w terms is in error, there will be a mis-scaling of the image by the ratio of the correct frequency to that used. Since central frequencies are frequently computed on the basis of unrealistic models of the bandpass shape, the “average” frequency given in data headers is frequently in error. If IMAGRPRM(3) is larger than 0, it is assumed to be a frequency scaling factor for the u, v, and w that is to be applied before imaging. Again, this can only correct for some average error. Since individual antennas will have different bandpass shapes, no single factor can correct all of the error. Array mis-orientation effects

Images made with a coplanar array not oriented towards the instrumental zenith will have a distortion of the geometry which increases in severity away from the phase tracking center. For non-coplanar arrays, the image is distorted rather than just the geometry. VLA snapshots are misaligned coplanar arrays, whereas VLA synthesis images cannot be considered to have been made with a coplanar array. Images made with mis-aligned coplanar arrays can be corrected using task OHGEO to remove the effects of this misalignment. Since this correction requires the knowledge of the observing geometry, in particular, the average parallactic and zenith angles, IMAGR computes these values and leaves then as header keywords for OHGEO to use. Non-coplanar effects

IMAGR has a IMAGRPRM(4) option to attempt to correct for non-coplanar effects in imaging. If this worked, it would be very very slow. At this writing, it is not believed to work at all and is disabled in the code. See the explain information for further details. The DO3DIMAG option removes a good part of the non-coplanar effects by rotating the projected baselines to make each field tangent at its center. Units mismatch of residuals and Clean components

In principle, the units of the residuals are different from those of the restored components. Both are called Jy per beam area, but the beam areas differ; that of a dirty image is — in principle — zero. If the area of the central lobe of the dirty beam is similar to the restoring beam area, then this effect is negligible. Similarly, if the Clean has proceeded well into the noise then this difference is of little consequence. However, if there is significant flux left in the residual image, then this difference may be important. If IMAGRPRM(5)> 0, IMAGR will attempt to scale the residuals to the same units as the restored components. The principal difficulty is determining the effective area of the dirty beam. Operationally, this is done inside a box centered on the peak in the beam with half-width IMAGRPRM(6) in x and IMAGRPRM(7) in y. It may be better, in this regard, to use the default Clean beam and this option at this stage and change resolution and units later with CCRES; see §7.6.4.

5.3.6 Manipulating Clean components

The list of Clean components associated with a Clean image can be printed with:


to select the task and review its inputs.

> INDI n ; GETN ctn  C R

to select the Clean image, where n and ctn select its disk and catalog numbers.

> BCOUNT n1 ; ECOUNT n2  C R

to list Clean components from n1 to n2.

> XINC n3  C R

to list only every n3th component.


to route the list to the line printer, or use TRUE to route the display to your workstation window.

> GO  C R

to execute the task.

Some users of the CC file for self-calibration suggest that only the components down to the first negative, or down to some factor times the flux at the first negative, should be used. The justification for this advice is the assumption that negative components occur near the noise level. This is not always the case. They also occur to correct for previous over-subtraction or for an object which does not lie on a cell. In any case, PRTCC will display the first negative component if it is found during the printing (i.e., before or during the range printed). The task CCFND is designed solely to find the component number of the first negative and the number of the component having FACTOR times the component flux of that first negative. The total fluxes at these two positions in the file are also displayed.

You can plot the list of Clean components associated with a Clean image in various ways with TAPLT. For example, to plot the sum of the components as a function of component number enter:

> APARM 0 ; BPARM 0 ; CPARM 0  C R

to clear input parameters.

> APARM(6) 1; APARM(10) 1  C R

to have the component flux summed and plotted on the y axis.


to create the plot file.


to display the plot file on the laser printer.

TAPLT offers many options for plotting functions of table columns against each other. Enter EXPLAIN TAPLT  C R for details.

You can compare the source model contained in the CC file with the visibility data in a variety of ways. UVSUB allows you to subtract the components of some or all fields from the data, producing a residual visibility data set. OOSUB is similar, but allows for the frequency-dependent corrections performed in IMAGR and for limiting the components subtracted to those inside or outside of the primary beam. Of course, IMAGR’s workfile already contains these residuals with the CC files of all fields subtracted. Various display options can be used on these uv files; see §5.3.1. VPLOT, described in §9.4.3, will plot a CC model against visibility data, one baseline at a time, n baselines per page.

The algorithm used by all AIPS Cleans assigns to a component only a fraction (GAIN) of the current intensity at the location of that component. As a result, the list of components contains many which lie on the same pixels. CCMRG combines all components that lie on the same pixel. This can reduce the size of the list greatly and, hence, the time required for model computations in tasks such as CALIB (§5.4) and UVSUB. Do this with


to select the task and review its inputs.

> INDI n ; GETN ctn  C R

to select the Clean image, where n and ctn select its disk and catalog numbers.


to select the input version of the Clean components and to replace it with the compressed version.

> GO  C R

to execute the task.

Under a variety of conditions, the Clean component files produced by IMAGR will already be merged.

There should seldom be a need to edit Clean component files in detail. However, task TAFLG allows editing based on comparison of a function of one or two table columns with another function of another one or two columns. One interesting use for TAFLG would be to delete all components below some cutoff before running CCMRG. Enter EXPLAIN TAFLG  C R for details.

It has been found that Clean will eventually assign some components to noise spikes in regions which do not have real sources and that this produces the so-called “Clean bias” which causes the fluxes of the real sources to be underestimated. This is presumably because “sidelobes” of the noise “sources” get subtracted from areas of real sources, but the magnitude of the effect is rather variable and is not understood. There are two tasks which can help. CCEDT copies a CC file keeping only those components which occur in specified windows. Then it merges the file (like CCMRG) and discards all merged components of flux below a specified cutoff. Under some circumstances, such filtering of Clean components before self-calibration can be a more effective way of obtaining convergence of hybrid mapping (mostly for VLBI) than restricting Clean windows in IMAGR.

The second task, CCSEL, explicitly addresses the Clean bias problem. It sums the flux of all components within a specified distance of each component and then discards those components for which this sum is less than a specified threshold. The idea is to eliminate “weak isolated” components which are likely to be those on noise points. You should run CCMRG before using CCSEL since the compute time increases quadratically with the number of components. IMAGR’s internal algorithm for filtering is much more efficient.

5.3.7 Image-plane deconvolution methods

The previous sections have described the task IMAGR which implements Clean by subtracting model components in groups from the ungridded uv data and re-imaging. This can be rather expensive. If you have a significant number of visibilities contributing to a fairly small image, it may be faster to use an image-plane deconvolution method. The venerable APCLN implements the Clark Clean in the image plane. Clean components are found during “minor” iteration cycles by Cleaning the brightest parts of the residual image with a “beam patch” of limited size, just as in IMAGR. More precise Cleaning is achieved at the ends of “major” iteration cycles when the Fourier transform of the Clean components is computed, multiplied by the transform of the beam, transformed back to the image plane, and then subtracted from the dirty image. This method does a good job Cleaning the inner quarter of the image area, but artifacts of the Cleaning and aliasing of sidelobes do interesting things to the remaining 75% of the image. Make the dirty image using IMAGR and be sure to make it large enough to include all of the source in the inner quarter of the area. APCLN uses many of the now-familiar adverbs of IMAGR, including GAIN, FLUX, NBOXES, CLBOX, FACTOR, MINPATCH, MAXPIXEL, BMAJ, and more. APCLN recognizes only rectangular boxes and its DOTV option only displays the residual image with a pause for you to hit button D to end the Cleaning early. The input image and beam should have size an integer power of 2 and the reference pixel should be at Nx2, Ny2 + 1.

The subject of image deconvolution has been widely studied and many methods have been proposed for tackling it. Clean is renowned for yielding images that contain many artificial beam-sized lumps or stripes in smooth low-brightness regions. Point sources are a poor model for such regions. You should compare heavily Cleaned images with dirty, or lightly Cleaned, images to test that any features you will interpret physically have not been introduced by these Clean “instabilities.” The AIPS Clean tasks have an optional parameter PHAT that will add a small-amplitude δ-function to the peak of the dirty beam in an attempt to suppress these instabilities as described by Cornwell (Astron. & Astrophys. 121, 281 (1983).)

A modified Clean algorithm that attempts (often successfully) to suppress these instabilities has been developed by Steer, Dewdney and Ito (Astron. & Astrophys. 137, 159 (1984)). In this algorithm, Clean proceeds normally until the residual image becomes rather smooth. It then takes many components at once from all high-residual cells rather than trying to decide exactly which one cell is the highest. The algorithm is embodied in the well-tested AIPS task SDCLN, which is actually an enhanced version of APCLN. The source must be contained in the inner quarter of the image area as in that task. Type EXPLAIN SDCLN  C R for information. SDCLN gives excellent results on extended sources, but is exceptionally CPU-intensive.

The most widely used, best understood, and probably most successful alternative to Clean is the Maximum Entropy Method (“MEM”). This is implemented in AIPS by the task VTESS. This requires a dirty image and beam, such as those produced by IMAGR with NITER set to 0, each twice the (linear) size of the region of interest (as for APCLN and SDCLN). The deconvolution produces an all-positive image whose range of pixel values is as compressed as the data allow. The final VTESS image is therefore stabilized against Clean-like instabilities while providing some “super-scale” wherever the signal-to-noise ratio is high. VTESS can also deconvolve multiple images simultaneously; see below.

There are three main reasons to prefer MEM deconvolution over all of the Clean deconvolution methods:

  1. MEM can be much faster for images which have strong signals in many pixels. “Many” seems to be 5122 or so.
  2. MEM produces smoother reconstructions of extended emission than does Clean.
  3. MEM allows introduction of a priori information about the source in the form of a “default” image.

Because VTESS can produce excellent deconvolutions of extended sources in much less computation time than Clean, but requires careful control, we recommend studying the output of EXPLAIN VTESS  C R before using the task. The NOISE parameter is particularly important; some have claimed that VTESS requires this to be within 5% of the correct value in order to deconvolve fully without biasing the total flux. (Use IMEAN (§7.3) to estimate the true rms.) Chapters 8 and 15 of the NRAO Summer School on Synthesis Imaging in Radio Astronomy also provide useful general background.

MEM can be used for quantitative work on regions of good (> 10) signal-to-noise ratio, if the dirty image is convolved with a Clean beam prior to deconvolution. Use the AIPS task CONVL for this purpose. The images may also be post-convolved, and added to the residuals, within VTESS. In many cases, the images of extended sources produced by SDCLN and VTESS are functionally identical. VTESS usually converges in much less CPU time, however, at the expense of leaving significantly larger residual sidelobes close to bright compact (point-like) features. To get around this deficiency of VTESS, first use Clean to remove the peaks of bright point-like features, then run VTESS on the residual image produced by this restricted Clean. (The AIPS Clean tasks will output a residual image if you set BMAJ < 0.) The Clean components may be restored to the final image with tasks CCRES or RSTOR.

VTESS can also combine information from different types of data. For example, single-dish data can be used to constrain the imaging of interferometer data, or many pointings covering one large object can be processed together. VTESS takes up to 4087 pairs of images and beams, together with some specification of the primary beam for each, either a circular Gaussian model or the VLA primary beam, and performs a joint maximum entropy deconvolution to get an image of one field. The images must all be in the same coordinate system, and a noise level must be known for each. The time taken is approximately the time VTESS would take for one input map and beam, multiplied by the number of map/beam pairs.

VTESS cannot be used on images which are not intrinsically positive, such as images of the Stokes Q, U, and V parameters. UTESS is a version of VTESS designed to deconvolve polarization images, for which a positivity constraint cannot be applied. For further information type EXPLAIN UTESS  C R

Two further alternatives to Clean have been implemented in AIPS as experimental tasks. These are algorithms due to Gerchberg and Saxton (APGS) and van Cittert (APVC). Type EXPLAIN APGS  C R, EXPLAIN APVC  C R for further information on these tasks.