Transformations

NOTE: Some of these operations generate new sets, if you run out of sets use Edit/Set operations (described below) to kill unneeded sets. Also, the scaling of the world coordinate system may be inappropriate for the results of many of these operations. Use the Status popup to determine the appropriate scaling factors to use in "Define world" (above), or use "Autoscale..." (in View/Autoscale above). Most functions operate on active sets only.


Evaluate expressions

Evaluates a formula defined in infix fashion.

Select the set on which the formula will operate, (set must be active, use File/Status to find the current state of sets). If you desire the result be loaded to a new set rather than overwriting the set used for computations, use the panel cycle denoted `Result to' to inform ACE/gr you'd like the result placed in a new set (if there is one). A new set is created only if a single set is selected from step 1. If `All sets' are selected then the results will overwrite all active sets.

Enter the formula, the syntax is:

(x,y,a,b,c,d)=

where (x,y,a,b,c,d) are defined as the x and y of the currently selected set and a,b,c,d are scratch arrays that can be used to perform operations between sets. Case is ignored, so X=COS(X) is correct.

Click on Accept when you are satisfied with everything.

Variables:

Functions:

Note: See pars.yacc for the yacc grammer.

Examples:

y=-y

y=x*cos(2*x*PI/100)+sqr(x)

x=(index>10)*(x-5)+(index<=10)*x

If the index of the current point is greater than 10 then x=x-5 else x=x. Conditionals evaluate to 0 if false, anything else is true.

a=y

Store y of the current set into scratch array "a" you may now select another set and perform the operation y=somefunctionof(a)

Restrictions:


Load values

Load a sequence to (x,y) or (a,b,c,d).


Histogram

Compute a frequency histogram.

Select the set.

Enter the width of a bin (all bin widths are the same).

Enter the minimum and maximum values of the portion of the data you wish histoed (sic). Note that Xmin and Xmax refer to the RANGE (or Y) of the set, not the domain (or X).

Press Accept to compute the histogram.


Fourier

Compute the Discrete Fourier transform.

Select the set

Select the type of data window, the default is the rectangular window in which case the data is tranformed unmodified. The data windows are defined as follows:

None
Use the default rectangular window
Triangular
1.0 - |(i-0.5*(N-1))/(0.5*(N-1))|
Hanning
0.5 * [1-cos(2*pi*i/(N-1))]
Welch
1-((i-0.5*(N-1))/(0.5*(N+1)))^2
Hamming
0.54-0.46*cos(2*pi*i/(N-1))
Blackman
0.42-0.5*cos(2*pi*i/(N-1))+0.08*cos(4*pi*i/(N-1))
Parzen
1.0 - |(i-0.5*(N-1))/(0.5*(N+1))|

Select the form of the output, magnitude (spectrum), phase, or the coefficients. The spectrum is computed by sqrt(x*x + y*y) where x, y are the coefficients computed by the DFT or FFT. Only N/2 values (representing frequencies 0 to PI) are loaded to the resulting set.

If the magnitude or phase is selected, then the next item, `X = `, determines what values should be loaded to X. The index runs from 0 to n/2, the frequency is the cyclical ith fourier frequency, the period is the reciprocal of the frequency with the period of the 0th fourier frequency plotted at T+delt, where T is the total length of the data and delt is the sampling interval.

Select transform or inverse transform.

Select real or complex data.

If real is selected, then the data to be transformed is assumed to be in Y, X is assumed equally spaced and is ignored. If complex is selected then the real part is assumed to be in X and the imaginary part in Y.

Press DFT (for small data sets whose length is not a power of 2) - or FFT (for data sets whose length is a power of 2).

Click on Window only to generated a windowed version of the data in a new set.

NOTE: Small for the DFT is < 1000 points. The DFT is O(N**2) and can be quite time consuming to compute for large N.


Running averages

Compute a running average, median, minimum, maximum, or standard deviation.

Select the method.

Select the set.

Set the length of the running method in the text item marked Length, it must be less than the set length.

Click on Accept.


Regression

Perform linear or polynomial regression.

Select the set.

Select the degree of fit.

Select fitted curve or residuals to load.

Press the button marked "Regress".

A set is loaded (if there is one) with the resulting curve and a summary of the statistical results are written to the Result popup.


Differences

Numerical differentiation.

Select the set.

Select the method - one of forward, backward, or centered difference. Assumes unevenly spaced data, increasing in X.

Click on Accept.

A set is loaded (if there is one) with the resulting curve.


Seasonal differences

Difference a set by a given lag.

Select the set.

Enter the value for the lag. Assumptions are evenly spaced data, increasing in X.

Press the button marked Accept.

Use Pick to use the mouse to select the set by clicking near a point in the set as displayed in the drawing area.

A set is loaded (if there is one) with the resulting curve.


Integration

Numerical integration.

Select the set.

Select the form of the results, the item marked cumulative sum will construct a set composed of the current value of the integral at a given X. Sum only reports just the value on the next line. Assumes unevenly spaced data, increasing in X.

Press the button marked Integrate.

A set is loaded (if there is one) with the resulting curve if cumulative sum is chosen.


X-corr

Cross/auto-correlation

Select both sets (use the same set if autocorrelation is desired).

Select the lag, N/3 is a reasonable value (your mileage may vary).

Select bias - generally this will not make any difference for large data sets with lags << the length of the set, I was just curious. The difference is division by N (biased) or N-lag (unbiased). A set is loaded (if there is one) with the resulting curve.


Spline

Compute a spline fit to a set

Select the set.

Select the starting value of X for the fitted curve.

Select the ending value of X.

Select the number of samples. The spline curve will be evaluated at X+i*(MaxX - MinX)/Nsteps for each i in (0, Nsteps-1).

Press "Spline"

A set is loaded (if there is one) with the resulting curve.

Notes: The code to compute the spline is a literal translation of the code in FMM.


Sample

Sample a set pointwise or by a logical expression.

Select the set.

Select the type of sample, either Start/step or Logical expression. If Start/step is selected then enter the starting index to begin the sample.

Select the number of points to skip between samples in Step. If Logical expression is selected, enter the expression in the text item denoted Expr:. Values of the expression not equal to zero are interpreted as TRUE, and the point is accepted. Any expression evaluating to zero will result in the point being ignored.


Digital filter

Apply a digital filter to a set.

Select the set to be filtered

Select the set with the filter weights.


Linear convolution

Perform convolution of 2 sets.


Load and evaluate

Evaluate parametric functions.

Enter the functions to be used to define X and Y.

Select the independant variable (x,y,a,b,c,d).

Enter the start, stop and the number of points items.

Press the button Apply to evaluate the functions and load the result to a new set.


Geometric transformations

Apply rotations, scaling, and translations to a set.

Select the order in which to apply the transformations.

Press the button Apply to perform the transformation.

Restrictions: Only the set X and Y are transformed, additional vectors attached to a set, such as error bars, are not transformed.