spec

Software for Diffraction

splot

macro for screen plot

SYNOPSIS

splot

splot y-col

splot x-col y-col [ num-pts ]

splot array [ x-col [ y-col [ num-pts ]]]

DESCRIPTION

(This document describes splot the macro, not splot the Python utility.)

The splot macro produces a screen plot of the current data. The macro has a number of configurable parameters, most set using the setplot macro.

With no arguments, splot plots the SCAN_D array using the counters specified in the PLOT_SEL[] array (which is configured with either the plotselect macro or the counters macro) versus the scan independent variable in column 0 of the SCAN_D array. The first through last data point of the most recent scan (as contained in the LDT global variable) are plotted.

A single argument y-col (that is not an array name) can specify which counters in SCAN_D to plot for the y-axis. The arguments can be counter numbers or counter mnemonics. The macros will automatically map the counters to the correct column in the SCAN_D array. If more than one counter is to be plotted, the counter names or numbers must be in one string. Individual counters can be separated by commas as in det,c3,c4 or a range of counters can given as 3:6, which would plot counters 3 through 6.

A column for the x-axis can be also specified as an additional argument x-col prior to the y-col argument. The value can be given as column number in SCAN_D, motor mnemonic of any motor included in the scan or H, K or L for reciprocal space scans or motor scans that involve geometry motors.

An optional num-pts third argument specifies the points in the array to be plotted, using conventional spec data-array syntax. For example, 30 or :30 would indicate the first point through the 30th point. The parameter 20:80 would plot points 20 through 80. An argument -50:-1 or -50: would plot the last 50 points of the array.

The splot macro can also plot row-wise two-dimensional arrays or row_wise one-dimensional arrays. Each row is considered a data point.

If the first argument is the name of a two-dimensional row-wise array and with no additional arguments, splot will plot the last column versus the first column using all the rows. Additional arguments specify the column for x with x-col, the column for y with y-col, then the number of points (or rows) with num-pts. As with plotting SCAN_D, the arguments for y-col and num-pts use spec's data array syntax. However, unlike the case for plotting SCAN_D, the x-col value must be specified if there is a y-col argument.

If the first argument is a one-dimensional row-wise array, the array elements will be plotted versus the array index number. Optional second and third arguments (x-col and y-col) are ignored. A fourth argument specifying which elements to include in the plot is recognized. In addition, the array can be specified with the columns to plot, as in splot arr[20:120]. The values created for the x-axis will be with respect to the index numbers of the full array, not the sub array.

EXAMPLES

In the following examples, SCAN_D contains data from a th2th scan on a four-circle instrument.

splot

Plots the scan data in SCAN_D. The counters selected via plotselect are plotted versus the primary scan independent variable in column 0, usually a motor position.

splot  det

As above, but plots only the counter channel det.

splot  det,c2

As above, but plots det and c2.

splot  th   det

Plots det versus the motor th.

splot  H  det  10:20

Plots det versus reciprocal coordinate H, but only points 10 through 20.

splot data

Plots the last column of the array data versus the first column.

splot data 0 1:4

Plots columns 1 through 4 of data versus the first column.

GLOBAL VARIABLES

SCAN_D[][]

Shared data array declared as:

SHARED_SCAN_D array SCAN_D[rows][cols]

where the number of rows corresponds to the number of points. Initially, rows is set to 4096, but the macros automatically increase the size as needed. The number of cols is set for each scan to accommodate all the configured counters and all the motors in the scan. If the scan involves motors associated with the diffractometer reciprocal space calculations, H, K and L are also saved for each scan point.

SHARED_SCAN_D is a macro defined as shared, by default. The SCAN_D array needs to be a shared-data array for the external splot utility to have access to the data if spec is not running in server mode.

SCAN_COLS[]
An associative array containing string labels for each column in SCAN_D.
PLOT_MOTS
The number of independent variables (motors) in SCAN_D columns.
PLOT_NUM
The number of dependent variables (counters) in SCAN_D columns.
PLOT_SEL[]
An associative array containing the counter mnemonics for the columns user to be plotted.
LDT
The row number in SCAN_D of the most recently added data point.