8.5 Display and manipulation of data cubes

8.5.1 Building and dismantling data cubes

Many spectral-line display and analysis functions make sense only on 3-dimensional (or more) images. In particular, image creation functions may create one image per spectral channel while spectral analysis requires the images to be ordered with the spectral axis first (most rapidly varying). To combine a number of n-dimensional images into an n- or n + 1-dimensional image, use the task MCUBE. This task requires the images to have some one physical axis whose value varies between the input images in a manner consistent with a regular axis and it is that axis which is extended to make the “cube.” If the output image specified already exists, then the input maps are inserted in the output image in the appropriate places. This allows the n- or n + 1-dimensional output image to be built up a bit at a time and allows replacement of portions of the image with a corrected n-dimensional image. Type EXPLAIN MCUBE  C R to receive a variety of hints and suggestions for using this rather general program. As an example, to put 31 frequency channel images into one cube, type:

> TASK MCUBE’ ; INP  C R

to review the inputs.

> INNA ’N315’  C R

to select the source.

> INCL ’IIM001’  C R

to select the input image class for all images.

> INSEQ 1 ; IN2SE 31 ; IN3SE 1  C R

to set the first and last image and the step in the task’s loop over input sequence number. The task handles any missing images gently.

> AXREF 1 ; AX2REF 31  C R

to set the pixel coordinate of the first and last image on the third axis in the cube.

> NPOINTS 31  C R

to set the total number of points on the third axis.

> OUTN    C R

to use the default OUTNAME.

> OUTCL ’LMFCUB’  C R

to specify, in OUTCLASS, the order of axes.

> GO  C R

to run MCUBE.

MCUBE will scale each image plane so that it is on the same brightness scale as represented by the Clean beam in the header.

Later on, you might want to replace some of these images by Cleaned images. E.g., assume that you have Cleaned channels 10 through 20, one at a time. These images got the class ICL001. It is a good idea to give them sequence numbers that are the same as the channel numbers, thus 10 to 20. Putting them in the existing cube (make a backup copy with SUBIM if you are nervous) can then be done as follows:

> TASK MCUBE’ ; INP  C R

to review the inputs.

> INNA ’N315’ ; INCLA ’ICL001’  C R

to select the clean images.

> INSE 10 ; IN2SE 20 ; IN3SE 1  C R

to set the first and last image and the step in the loop.

> OUTN ’N315’ ; OUTCL ’LMFCUB’  C R

to select the existing cube.

> OUTSE 1  C R

> GO  C R

to run MCUBE.

IMAGR with its DOTV option allows you to Clean each channel with its own numbers of iterations and its own interactively set Cleaning boxes. There are new options to create boxes automatically on each image plane and an option to control whether the boxes for channel n are carried over to channel n + 1.

MCUBE can build a cube out of a set of images that do not have a suitable axis for image building. This can be a set of images that have all the same axis parameters (e.g., identical images except for date) or they can be images at, for example, an arbitrary set of frequencies. Set DOCONCAT = 2 to force MCUBE to make a SEQ.NUM. axis or, if there are different frequencies, an FQID axis with accompanying FQ table. The original coordinate values on an axis that differs from image to image are recorded in the history file and, for frequencies, also in the FQ table. Task FQUBE does this operation more naturally and can combine two cubes each of which already has an FQID axis.

Most programs work on cubes. However, you may find it convenient, on occasion, to work with single image planes. To separate the channels from the cube, use task SUBIM typing, for example:

> TASK SUBIM’ ; INP  C R

to review the inputs.

> INNA ’N315’ ; INCL ’LMFCUB’ ; INSE 1  C R

to select the cube.

> OUTN ’N315’ ; OUTCL ’IMAGE’  C R

to give it an output name and class.

> BLC 0 ; TRC 0  C R

to select full planes.

> DOWAIT TRUE  C R

to run in synchronous mode.

> FOR J=10:20 ; BLC(3)=J ; TRC(3)=J ; PRIN J ; OUTSE J ; GO ; END

This runs the program 11 times, taking planes 10 through 20 and creating separate images for them. To put the images back into the cube after they have been modified, use MCUBE.

8.5.2 Transposing the cube

The task TRANS will transpose the cube, ordering the axes in any way you specify. Typically, one transposes images of spectral channels into spectra at image pixels for both display and analysis purposes. Thus:

> TASK TRANS’ ; INP  C R

to review the inputs.

> INCLASS ’LMFCUB’  C R

to select the untransposed cube.

> TRANSC ’-312’  C R

to make new axis order -3, 1, 2 in terms of the old axis order (e.g., RA, Dec, Freq becomes Vel (opposite sign of Freq), RA, Dec).

> OUTCL ’VLMCUB’  C R

to give it an outclass reflecting the axis order.

> BLC 0 ; TRC 0  C R

to transpose the whole cube.

> GO  C R

to run the program.

Numerous tasks such as IMLIN, XSUM, PLCUB, and XMOM act on the first axis and, typically, make sense only when that axis is frequency/velocity. Note that such x-axis analysis may also be useful in other cases, including angular and time x coordinates.

8.5.3 Modifying the image header

On occasion you may feel the need to modify or add to the information in the image header. For example, to add an alternate velocity description for the frequency axis of a cube, type:

> INDISK n ; GETN ctn  C R

to select the image.

> AXTYPE ’OPTHEL’  C R

to specify optical-convention velocities relative to the Sun.

> AXREF 16  C R

to specify the velocity reference pixel (channel 16 is the center of the band in our example).

> AXVAL 5.E6  C R

the velocity at the reference pixel in m/s.

> RESTF 1420.4E6, 5752  C R

to specify the line rest frequency in Hz (1420405752 Hz).

> ALTDEF  C R

to add the information to the header.

> ALTSW  C R

to switch between frequency and velocity information in axis labeling, IMHEADER, etc.

The VLA now provides the velocity information to FILLM, making this operation unnecessary in many cases.

Observers may find the Galactic coordinates of their sources to be of interest. To switch the header between Celestial and Galactic coordinates, type:

> CELGAL  C R

to go to galactic coordinates.

> CELGAL  C R

to go back to celestial coordinates.

You may change many of the parameters in the image header and may fetch for use by the POPS language all header parameters. The verb PUTHEAD changes a header parameter and GETHEAD gets that parameter. Type EXPLAIN GETHEAD  C R for the details, including a list of recognized keywords, and EXPLAIN PUTHEAD  C R for the more restricted list of values which you may change in the header. For example, to move a header parameter from one image to another:

> KEYWORD keyword  C R

to specify one of the fully allowed keywords.

> GETN n ; GETHEAD  C R

to get the header value from image n.

> GETN m ; PUTHEAD  C R

to put it in the header of image m.

8.5.4 Displaying the cube

The easiest way to look at the cube is by using TVMOVIE. This verb loads portions of planes of a cube into the TV memory, and displays them in sequence at a variable frame rate. Type:

> INDISK n ; GETN ctn  C R

to select the cube.

> INP TVMOVIE  C R

to review the inputs; use defaults for a start.

> TVMOVIE  C R

to load the images and start the movie.

Now follow the instructions on your screen on how to change the transfer function, change speed, look at single frames, etc. Having terminated the movie (button D), you may restart it with

> REMOVIE  C R

to resume the movie.

With the default adverbs, TVMOVIE will zoom the display so that a single frame fills the display area. If you are using a workstation, this may seriously limit the maximum possible frame rate. To use a smaller zoom factor and smaller display area, enter:

> DOCENTER TRUE  C R

to enable the option.

> FACTOR m  C R

to use a zoom factor of m.

> REMOVIE  C R

to rerun the movie.

Note that you may set these adverbs before the initial TVMOVIE command as well. If your cube has more than 3 axes with multiple pixels, TVMOVIE can display all planes if DOALL = 1.

TVMOVIE uses an image ordering on the screen designed to improve the performance of movies on “real” TV devices. To use a more pleasing ordering (left to right, top to bottom) that is nearly as efficient on workstations, use the TVCUBE verb instead. The verb REMOVIE works on these displays as well. One of the reasons to use TVCUBE is to capture a full TV plane’s worth of channels and print them on a PostScript printer. The first step is to get TVCUBE to put the desired channels in one TV image plane. Set TBLC(3) and TTRC(3) to select those planes you want and set TVCHAN = 2 (or the highest TV plane allowed on your system) to force all the images into one TV image. Stop the move with button D, display the full TV memory (use the F2 button), adjust the enhancement (and color) of the display, and then run task TVCPS. If your images are too large for one channel, use TVCHAN = 1 and run TVCPS once for each channel.


PIC

Figure 8.1: Contour images of spectral channels from a cube generated by AIPS task KNTR. Data on NGC6503 were provided by Don Wells from observations made with the VLA on 12 April 1983.


Another way to see multiple image planes on a single page is with the task KNTR, which plots a page of contour and/or grey-scale drawings for each plane. This task allows you to include “star” positions and even an outline of the clean beam. A KNTR plot of neutral hydrogen emission from NGC6503 is shown in Figure 8.1.


PIC

Figure 8.2: Display generated by transposing a data cube into 132 (right ascension, velocity, declination) order and then displaying the central declination position-velocity planes with AIPS verb TVCUBE. The TV display was then captured by AIPS task TVCPS for printing on PostScript printers. Data on NGC6503 were provided by Don Wells from observations made with the VLA on 12 April 1983.


It can be very informative to transpose the cube to look at position-velocity planes instead of position-position planes. A TVCUBE display of the NGC6503 data cube transposed to 132 (position-velocity-position) order and then captured with TVCPS is shown in Figure 8.2.

Finally, it is useful to look at the cube as a set of spectra. Use TRANS to transpose to 312 order (or -312, 321, and the like). The task XPLOT displays the spectra on the graphics display selecting only those with a sufficiently strong line signal (set by adverb FLUX) and ignoring those with really strong fluxes (controlled with PIXVAL). This can get rather tedious and it is easy to get lost in your cube. The task PLCUB, illustrated in Figure 8.3, allows you to see numerous spectra at one time plotted in correct orientation with respect to their position coordinate. It is necessary to experiment with the adverbs for PLCUB, especially YINC, ZINC, PIXRANGE, and the like, to get a good plot. Use the TV with DOTV TRUE  C R to save trees.


PIC

Figure 8.3: Display generated by transposing a data cube into 312 order (velocity, right ascension, declination) and then displaying selected spectra on a regular grid in the angular coordinates with AIPS task PLCUB. Data on NGC6503 were provided by Don Wells from observations made with the VLA on 12 April 1983.


In general, other display programs work on one plane at a time. Therefore, you must specify which plane in the cube you want to see. For example, if you want to do TVALL on channel 16, which is on pixel 16 of the third axis, you type:

> TBLC 0 0 16 ; TVALL  C R

Note that adverbs TBLC and TTRC are used for TV displays while BLC and TRC are used for image operations.