6.5 Graphics displays of your data

In the dim dark past, Tektronix invented some nice graphical display devices and an inconvenient but functional way to talk to them. This communication language became so embedded in software that workstation vendors now provide X-Windows windows that understand it. AIPS also arose from this dim dark past and once upon a time talked to those lovely green screens. To retain the graphics capability, we now provide a TEKSRV server which will provide a Tektronix-like graphics screen on which certain AIPS tasks and verbs plot. When AIPS starts up on workstations, it brings up a window called TEKSRV. Leave this window in its iconic state; it is only a marker for the presence of the server. The first time you write to TEKSRV, it will create and open a window called TEKSRV (Tek) in which the plot is done. You can re-size this window within some limits and the plot will automatically re-size itself. When the workstation cursor is in the Tek window, it changes to a diagonal arrow pointer. When an AIPS task or verb tries to read from the Tek window, this pointer becomes a plus sign. You should position the pointer to the desired location without touching the keyboard or the mouse buttons. When the pointer is exactly where you want it, press any mouse button or any key (except RETURN) to return the pointer position to the program. Note that the functions using the graphics display are not quite as friendly as those on the TV. This is due to the inability to erase a piece of a plot without erasing all of it. You can erase the full screen with TKERASE, which will keep the window from redrawing a big plot on every expose event. In recent years, we have found unfortunately that cursor reading from Tektronix emulation screens can be unreliable. Therefore, every TK function described below also has a TV version, described in a previous subsection. The TV has many other advantages over the Tektronix emulator and now is nearly as fast. The verb STARTTV will restart this server if it has, for some reason, exited.

6.5.1 Plotting data and setting values with the graphics display

TKPL interprets AIPS plot files to the graphics window or device. The graphics screen can be used to read back data values and set adverbs, much like the TV:

> TKXY  C R

to read the graphics cursor position, setting adverb PIXXY; requires a contour or comparable image to be shown on the screen.

> TKXY ; IMVAL  C R

to read the graphics cursor position and return the image value and coordinates of the selected position.

> TKPOS  C R

to read the graphics cursor position and return the image coordinates of the selected position.

> TKWIN  C R

to read the graphics cursor position twice, first setting BLC and then setting TRC.

> TKBOX(i)  C R

to read the graphics cursor position twice, first setting the lower left and then the upper right of Clean box i.

> TKNBOXS(n)  C R

to set NBOXES to n and then set all n Clean boxes using the graphics cursor.

All of these verbs require a graphics display of a plot file produced by CNTR, PCNTR, GREYS, or SL2PL. The window procedures don’t make much sense with a slice plot, but they will work.

6.5.2 Slice files and the graphics display

In Chapter 8 we discuss the computation and use of “slices,” one-dimensional profiles interpolated along any line in an image plane. Once a slice has been computed, it may be plotted by TKSLICE on the graphics display. A second slice may be plotted on top of the first with TKASLICE. The graphics display is used to prepare initial guesses for SLFIT, which fits Gaussians to slices. The verbs involved are:

> TKVAL  C R

to return the flux level pointed at by the graphics cursor.

> NGAUS n ; TKSET  C R

to set the number of Gaussians to be fitted to n and then to prepare an initial guess at the parameters by pointing at the peaks and half width points on a graphics plot of the slice.

> TK1SET j  C R

to revise the initial guess for the jth Gaussian.

> TKGUESS  C R

to plot the initial guess of the model on the graphics device, erasing any previous plot.

> TKAGUESS  C R

to add a plot of the initial guess of the model to the current slice plot on the graphics device.

> TKMODEL  C R

to plot the fit model on the graphics device, erasing any previous plot.

> TKAMODEL  C R

to add a plot of the fit model to the current slice plot on the graphics device.

> TKRESID  C R

to plot the data minus the fit model on the graphics device, erasing any previous plot.

> TKARESID  C R

to add a plot of the residuals (data minus model) to the current slice plot on the graphics device.

The units for the slice model parameters are fairly problematic, so we recommend using these graphical input and output functions. At least, they all have the same strange ideas. See §6.4.8 for the verbs that allow this same processing using the TV display.

6.5.3 Data analysis with the graphics display

There is a set of related tasks for analysis of data cubes transposed so that the first axis is the one on which baselines or Gaussians are to be fit. In the case of a spectral-line cube, the image would be transposed so that velocity is the first axis. It is a good idea to use XPLOT first to get an idea of what the profiles really look like. It uses a flux cutoff to determine which profiles to display and prompts you for permission to continue after each plot. XBASL is used to remove nth-order polynomial baselines from each spectrum. It has a batch mode of operation and an interactive mode which uses the graphics display to plot each spectrum and to accept guidance on which channels to use in determining the baselines. XBASL can be asked to write images of the baseline parameters. Unfortunately, this task requires you to do the full cube in a single execution, which is rather an endurance contest.