OpendTect User Documentation version 3.2
PrevNext

Mathematics

Name

Mathematics -- Attribute that returns the result of a user-defined mathematical expression

Description

The Mathematics attribute is a way to combine data from stored cubes and attributes into a new attribute. As with the other attributes, the mathematical expression is calculated at each location (Inl/Crl/Sample).

A mathematical expression is specified in the Formula text field with variables, constants, and/or recursive operators.

Variables in the expression must start with x0, followed by x1, x2, and so on.
Constants in the expression must start with c0, followed by c1, c2, and so on.
The results of the formula at a previous time can be called back with an expression THIS[-i] where i is the number of samples ....

Note: There is no limit in number of variables/constants used in an expression.

Parentheses ( ) can also be used and embedded. When the mathematical expression is completed, the variables should be defined by pressing Set. Then, the selection boxes for the variables x0, x1, etc. appear. By pushing Select, the stored cubes or attributes can be selected. Supported operators are:

+, -, *, /, ^, >, <, <=, >=, ==, !=, && (and), || (or), |xn |(absolute value).

Supported constants are:

pi (3.1415927), undef (The OpendTect undefined value: 1e+30)

Supported mathematical functions are:

sin(), cos(), tan(), ln(), log(), exp(), sqrt(), min(), max(), avg(), sum(), med(), var(), rand(v) and randg(std).

Where avg is the average, med is the median, and var is the variance of the input parameters. The input parameters in parentheses should be separated by a comma. In addition it is possible to make IF .. THEN .. ELSE constructions using separators ? (THEN) and : (ELSE).

The function rand(v) gives a random number from a uniform distribution between 0 and v. The function randg(std) generates a random number from a Gaussian (normal distribution) with standard deviation std and expectation 0.

Examples of expressions

In all these examples the individual variables can be replaced by expressions in parentheses ( ).



The image above shows that constants, c0 in this case, are also supported. Advantage of using constants c0, c1 etc. instead of using numbers is that these constants can be evaluated by pressing the "Evaluate Attribute" button after adding the attribute to the attribute set.
Example of a calculated attribute

Let's say you have one input cube, say 'Cube1' and one attribute already defined, Energy40, which is the Energy per sample calculated in a [-20,20] ms window around the current sample. Then, you could define 'Damped amplitude' as;

Additional possibilities in the mathematics attribute:

1- The input volume may be directly used at a different time than the time of the current sample: Let us assume that the current position is at time t0. Then x0(i) is the input volume designed by x0, but at the time t0 + (i)*dt where dt is the sampling rate. The integer "i" may be negative or positive.

Application: Using this feature, a centred differentiation (time domain) can be coded using the formula (x0[+1]-x0[-1])/(2*c0) where c0 is the sampling rate. Please note that for lateral shifts the reference shift attribute must still be used.

2- Recursive filters can be created using the syntax "THIS[-i]". The most general form of recursive equation is the following:

y[n] = a0*x[n] + a1*x[n-1] + a2*x[n-2] + ...
+ b1*y[n-1] + b2*y[n-2] + ...

where x[] is the input volume, y[] is the output volume and the a's and b's the coefficients. n is the current sample number.

In the mathematics attribute the current sample index "n" does not need to be specified. Therefore the equation above can be entered as:
c0*x0 + c1*x0[-1] + c2*x0[-2] + c3*THIS[-1] + c4*THIS[-2] + ...
where THIS[-1] stands for y[n-1] and THIS[-2] stands for y[n-2]

For each instance of THIS[-i] a starting value must be provided. In the development release 3.1.7 the starting value is the output value at the first sample of the cube or at the first sample of the display element (inline, crossline, random or 2D line). A mathematics attribute with THIS[-i] should not be applied to timeslices, horizons or picksets in this development release.

Indeed local computations around timeslices, horizons and picksets are not valid when using a recursive equation since this would need to integrate all values from a fixed time or depth to the current position. This restriction will be addressed in the incoming stable release 3.2 by providing an absolute time or depth to each starting value.

Two examples of low pass and high pass recursive filters are provided in the default attribute set "Evaluate attributes":
"Single pole low pass recursive filter" and "Single pole high pass recursive filter". Best results are achieved when providing an input of impedance or velocity type.

3- The phase rotation is an attribute available in the Evaluate attribute set and in the dGB Evaluate attribute set.

This attribute allows the user to apply a phase rotation of any angle to the data.



It applies the formula: x0*cos(c0*PI/180)+x1*sin(c0*PI/180)
where x0 is the seismic data
x1 is the Hilbert transform of the seismic data
c0 is the applied angle for the rotation

C0 is in degrees.
PrevHomeNext
Match DeltaUpPosition