Adding Columns Adding Columns

Occasionally, it is desirable to create a new column of data based on the existing columns, or create a completely new column of data. This can be performed with the command:


where the available options are:

     -COLUMN, C(1), C(2), ..... C(n)

     -INPUT, CS, X(1), Y(1), X(2), Y(2), .....

     -COMBINE, CS(1), F(1), CS(2), F(2), .....

     -NORM, CS, NCOL

     -RMS, CS(1), CS(2), .....

     -POWER, P_N, P_C, CS(1), F(1), CS(2), F(2), .....

     -DERIVATIVE, CS(1), CS(2)

     -INTEGRAL, CS(1), CS(2)

     -FILTER, R_TYPE CS(1), CS(2), RL(1), RU(1), ... RL(n), RU(n)


The first two options create completely new columns. The -COLUMN option allows the user to simply input a column of data. Here, the number of values input must be the same as the number of rows of the existing columns. A good source of this data may be from SET_VARIABLE -COLUMN. On the other hand, the -INPUT option allows more flexibility in the number of points input. Here, CS is the column selector of an existing column which is "like" the X values. For instance, if the X values are times, then CS should be the column selector for event number. MOSES will fit a spline to the input data and then create the new column by interpolating a value from the spline for every value of CS(i).

The remainder of the options create a column based on the values of the existing ones. The -COMBINE option will combine two or more columns of data, using the factors specified. For instance,


will make the new column the difference of columns of 1 and 2. Here, CS selects the column, and F is the combine factor. To find the norm of two or more columns, the -NORM option is used. CS again selects the column, and NCOL is the number of columns to consider, including the first one. The command:


will find the norm of columns 3, 4 and 5. The -RMS option is similar to -NORM, except that here, one specified the columns to be combined directly. factor. The -POWER option is a generalization of the above. Here, P_C is the power each column is raised before summing and P_N is the power to which the sum will be raised; e.g.

     ADD_COLUMN NEW -POWER .5 2 3 1 4 1 5 1

Gives the same result as the -NORM example and

     ADD_COLUMN NEW -POWER 1 1 3 3

Gives the same result as the -COMBINE example.

The -DERIVATIVE and -INTEGRAL adds new columns which are the derivative or integral of column CS(2) with respect to column CS(1), and the -LN and -EXP options add columns which are the natural log and the exponential of the original column.

The -FILTER option filters a column of temporal data using a Fourier Transform. Here, R_TYPE defines the type of ranges to be input, FREQUENCY for angular frequency, or PERIOD for periods. MOSES will then compute the Fourier Transform of the function with domain in column CS(1) and range in column CS(2). After the transform, all values within any of the ranges defined will be discarded and an inverse transform will be computed for the new column. For example,


will produce a new column named NEW from the old curve defined by columns 1 and 4. Here, column 1 is TIME or EVENT. All of the contribution from periods between 0 and 30 will be discarded to form the new function.

The -SMOOTH option creates a new column by smoothing an old one, but here, a Savitzky-Golay filter accomplishes the smoothing. CS defines the column to be smoothed, and NL, NR, and M define the smoother. NL is the number of points to the left, NR is the number of points to the right and ORDER is the order of polynomial used in constructing the filter. The defaults are 8 for NL and NR and 4 for ORDER. Since this algorithm does not use Fourier analysis, it can be used to smooth spectral or FFT data.