Expression filter
From Piki
The expression filter adds new features to a data unit based on an algebraic expression.
| Expression | |
| Name | Expression |
| Deployable | Yes |
| Static | Yes/No |
| Sample modifier | No |
| Feature modifier | Yes |
Contents |
Usage
The expression filter creates one or more new features from a set of algebraic expressions. Each expression is evaluated for each sample in the data unit. The expression filter can, among other things, be used to delay a feature, split a feature up or create compound features from other features.
An expression consists of numbers referenced features and operators.
Operators
The available operators are the following:
+, -, *, /, %, ^, <, >, >=, <=, !=, ==, &, |, <<, >>, 'int', 'sqrt'
Boolean expressions evaluate to 1 for True and 0 for False. The special numbers Pi, e and eps (epsilon) can also be used.
Referencing data
The source feature can be accessed through the letter ādā. Other features are accessed in one of three ways:
- By name within brackets.
- By relative position within curled brackets.
- By absolute position (counted from one) preceded by @.
Internally the two last methods are converted to the first one automatically.
To reference other samples than the current use a ':' followed by + or - an offset. Not using + or - is treated as an absolute sample number.
'int' is used to cast to integers. (2.7)int -> 2 '>>' is used as much greater than, a >> b is true if a is 100 times greater than b
Examples
| Task | Expression |
|---|---|
| Divide the selected column by 2 | d/2 |
| Delay the selected column samples one step (t-1) | {0:-1} |
| Advance the second column samples three steps (t+3) | @2:+3 |
| Divide the column Price and the column Area | [Price]/[Area] |
| Set all values > 100 to 10 in the selected column. | 10*(d>100) |
| Add the column Price1 and Price2 when Price3 equals 100. | ([Price1] + [Price2]) * ([Price3] == 100]) |
| Extract the second lowest digit of an integer number. | (d/10)int%10 |
| Calculate a hypotenuse using Pythagoras' theorem | ( ([A)^2) + ([B]^2) )sqrt |
Settings
The settings can be modified using the settings browser.
| Expression filter settings |
|---|
|
|
See also
- Filter - Article covering general filter principles.
- List of Filter components - List of all available filters.
- Data unit - Article explaining data units in detail.
- Data - Article explaining essential data concepts.
