Prism 6.0 User's Guide

Working With Visualizers

The window that contains the data being printed or displayed is called a visualizer. Figure 5-3 shows a visualizer for a 3-dimensional array.

Figure 5-3 Visualizer for a 3-Dimensional Array

Graphic

The visualizer consists of two parts: the data navigator and the display window. There are also File and Options pulldown menus.

The data navigator shows which portion of the data is being displayed, and provides a quick method for moving through the data. The appearance of the data navigator depends on the number of dimensions in the data. It is described in more detail in " Using the Display Window in a Visualizer".

The display window is the main part of the visualizer. It shows the data, using a representation that you can choose from the Options menu. The default is text: that is, the data is displayed as numbers or characters. Figure 5-3 is a text visualizer. The display window is described in more detail in " Using the Options Menu".

The File menu lets you save, update, or cancel the visualizer; see " Using the File Menu" for more information. The Options menu, among other things, lets you change the way values are represented; see Section " Using the Options Menu".

Using the Data Navigator in a Visualizer

The data navigator helps you move through the data being visualized. It has different appearances, depending on the number of dimensions in your data. If your data is a single scalar value, there is no data navigator.

For 1-dimensional arrays and parallel variables, the data navigator is the scroll bar to the right of the data. The number to the right of the buttons for the File and Options menus indicates the coordinate of the first element that is displayed. The elevator in the scroll bar indicates the position of the displayed data relative to the entire data set.

For 2-dimensional data, the data navigator is a rectangle in the shape of the data, with the axes numbered. The white box inside the rectangle indicates the position of the displayed data relative to the entire data set. You can either drag the box or click at a spot in the rectangle. The box moves to that spot, and the data displayed in the display window changes.

For 3-dimensional data, the data navigator consists of a rectangle and a slider, each of which you can operate independently. The value to the right of the slider indicates the coordinate of the third dimension. Changing the position of the bar along the slider changes which 2-dimensional plane is displayed out of the 3-dimensional data.

For data with more than three dimensions, the data navigator adds a slider for each additional dimension.

Changing the Axes

You can change the way the visualizer lays out your data by changing the numbers that label the axes. Click in the box surrounding the number; it is highlighted, and an I-beam appears. You can then type in the new number of the axis; you don't have to delete the old number. The other axis number automatically changes; for example, if you change axis 1 to 2, axis 2 automatically changes to become axis 1.

Using the Display Window in a Visualizer

The display window shows the data being visualized.

In addition to using the data navigator to move through the data, you can drag the data itself relative to the display window by holding down the left mouse button; this provides finer control over the display of the data.

To find out the coordinates and value of a specific data element, click on it while pressing the Shift key. Its coordinates are displayed in parentheses, and its value is displayed beneath them. If you have set a context for the visualizer, you also see whether the element is active or inactive (see " Using the Options Menu"). Drag the mouse with the Shift key pressed, and you see the coordinates, value, and context of each data element over which the mouse pointer passes.

You can resize the visualizer to display more (or less) data either horizontally or vertically.

Using the File Menu

Click on File to pull down the File menu.

Choose Update from this menu to update the display window for this variable, using the value(s) at the current program location. See " Updating and Closing the Visualizer" for more information on updating a visualizer.

Choose Save or Save As to save the visualizer's values to a file. See " Saving the Values of a Variable" for more information.

Choose Diff or Diff With to compare the visualizer's values with values stored in a file. See " Comparing the Data" for more information.

Choose Snapshot to create a copy of the visualizer, which you can use to compare with later updates.

Choose Close to cancel the visualizer.

Using the Options Menu

Click on Options to pull down the Options menu. See Figure 5-4.

Figure 5-4 Options Menu in a Visualizer

Graphic

Choosing the Representation

Choose Representation from the Options menu to display another menu that gives the choices for how the values are represented in the display window. The choices are described below. You can control aspects of the way these visualizers appear by changing their parameters, as described later in this section.

Figure 5-5 Histogram Visualizer

Graphic

For complex numbers, Prism uses the modulus.

Figure 5-6 Dither Visualizer

Graphic

For complex numbers, Prism uses the modulus.

Figure 5-7 Threshold Visualizer

Graphic

For complex numbers, Prism uses the modulus.

Figure 5-8 1-Dimensional Graph Visualizer

Graphic

Figure 5-9 Surface Visualizer

Graphic


Note -

If there are large values in the top rows of the data, they may be drawn off the top of the screen. To see these values, flip the axes as described earlier in this section, so that the top row appears in the left column.


Figure 5-10 Vector Visualizer

Graphic

Setting Parameters

Choose Parameters from the Options menu to display a dialog box in which you can change various defaults that Prism uses in setting up the display window; see Figure 5-11. If a parameter is grayed out or missing, it does not apply to the current representation.

Figure 5-11 Visualization Parameters Dialog Box

Graphic

The parameters (for all representations except the histogram representation) are:

For the text representation, the field width specifies the number of characters in each column. If a number is too large for the field width you specify, dots are printed instead of the number.

For dither, threshold, colormap, and vector representations, the field width specifies how wide (in pixels) the representation of each data element is to be. By default, dither, threshold, and colormap visualizers are scaled to fit the display window. Note, however, that for dither visualizers, the gray shading may be more noticeable with a smaller field width.

For the graph representation, the field width specifies the horizontal spacing between elements.

For the surface representation, it specifies the spacing of elements along both directions of the plane.

set $d_precision = 11

sets the default precision for doubles to 11 significant digits.

For graph, surface, and vector representations, these parameters represent the bottom and top of the range that is to be represented. Values below the minimum are shown as the minimum; values above the maximum are shown as the maximum.

By default Prism uses the entire range of values for all these representations.

The parameters for the histogram representation are:

If you specify a different minimum or maximum, values below the minimum or above the maximum are not displayed in the histogram, but are counted as outliers instead; the number of outliers is displayed above the histogram.

Displaying a Ruler

Choose Ruler from the Options menu to toggle the display of a ruler around the data in the display window. The ruler is helpful in showing which elements are being displayed. Figure 5-12 shows a 3-dimensional threshold visualizer with the ruler displayed.

In the surface representation, the ruler cannot indicate the coordinates of elements in the vertical axis, since they change depending on the height of each element. However, you can press the Shift key and left-click to display the coordinates and value of an element.

Figure 5-12 Threshold Visualizer With a Ruler

Graphic

Displaying Statistics

Choose Statistics from the Options menu to display a window containing statistics and other information about the variable being visualized. The window contains:

Figure 5-13 gives an example of the Statistics window.

Figure 5-13 Statistics for a Visualizer

Graphic

For complex numbers, Prism uses the modulus.

Using the Set Context Dialog Box

Choose Set Context from the Options menu to display a dialog box in which you can specify which elements of the variable are to be considered active and which are to be considered inactive. Active and inactive elements are treated differently in visualizers:

Figure 5-14 shows the Set Context dialog box.

Figure 5-14 Set Context Dialog Box

Graphic

By default, all elements of the variable are active; this is the meaning of the everywhere keyword in the text-entry box. To change this default, you can either edit the text in the text-entry box directly or click on the Where button to display a menu. The choices in the menu are everywhere and other:

In the text-entry box, you can enter any valid expression that will evaluate to true or false for each element of the variable.

The context you specify for printing does not affect the program's context; it just affects the way the elements of the variable are displayed in the visualizer.

See "Setting the Context" above for more information on context. See " Writing Expressions in Prism" for more information on writing expressions in Prism.

Click on Apply to set the context you specified. Click on Cancel or press the Esc key to close the dialog box without setting the context.

Changing the Radix

Choose Radix from the Options menu to change the radix used in the text representation of a value.

Choosing Radix pulls down a submenu with four selections: Decimal, Hex, Octal, and Binary. Choosing one of these changes the value to the specified radix. Prism continues to use this radix if the visualizer is updated.

By default, Prism displays values in decimal. You can change this default via the set $radix command; see " Changing the Default Radix". You can also override it for a specific print or display command; see " Printing and Displaying From the Command Window".

Updating and Closing the Visualizer

If you created a visualizer by issuing a display command, it automatically updates every time the program stops execution.

If you created the visualizer by issuing a print command, its display window is grayed out when the program resumes execution and the values in the window are outdated. To update the values, choose Update from the visualizer's File menu.

To close the visualizer, choose Close from the File menu, or press the Esc key.