Next Previous Up Contents
Next: Referencing Column Values
Up: Top
Previous: Parameter Suffixes

## 10 Algebraic Expression Syntax

Many of the STILTS commands allow you to use algebraic expressions based on table columns when doing things like making row selections, defining new columns, selecting values to plot or match, and so on. In these cases you are defining an expression which has a value in each row as a function of the values in the existing columns in that row. This is a powerful feature which permits you to manipulate and select table data in very flexible ways. The syntax for entering these expressions is explained in this section.

What you write are actually expressions in the Java language, which are compiled into Java bytecode before evaluation. However, this does not mean that you need to be a Java programmer to write them. The syntax is pretty similar to C, but even if you've never programmed in C most simple things, and many complicated ones, are quite intutitive.

The following explanation gives some guidance and examples for writing these expressions. Unfortunately a complete tutorial on writing Java expressions is beyond the scope of this document, but it should provide enough information for even a novice to write useful expressions.

The expressions that you can write are basically any function of all the column values which apply to a given row; the function result can then be used where STILTS needs a per-row value, for instance to define a new column. If the built-in operators and functions are not sufficient, or it's unwieldy to express your function in one line of code, it is possible to add new functions by writing your own classes - see Section 10.8.3.

Note that since these algebraic expressions often contain spaces, you may need to enclose them in single or double quotes so that they don't get confused with other parts of the command string.

Note: if Java is running in an environment with certain security restrictions (a security manager which does not permit creation of custom class loaders) then algebraic expressions won't work at all. It's not particularly likely that security restrictions will be in place if you are running from the command line though.

- 10.1 Referencing Column Values
- 10.2 Referencing Parameter Values
- 10.3 Special Tokens
- 10.4 Null Values
- 10.5 Operators
- 10.6 Functions

- 10.6.1 Arithmetic
- 10.6.2 Arrays
- 10.6.3 Conversions
- 10.6.4 CoordsDegrees
- 10.6.5 CoordsRadians
- 10.6.6 Coverage
- 10.6.7 Distances
- 10.6.8 Fluxes
- 10.6.9 Formats
- 10.6.10 Gaia
- 10.6.11 KCorrections
- 10.6.12 Lists
- 10.6.13 Maths
- 10.6.14 Shapes
- 10.6.15 Sky
- 10.6.16 Strings
- 10.6.17 Tilings
- 10.6.18 Times
- 10.6.19 TrigDegrees
- 10.6.20 URLs

- 10.7 Examples
- 10.8 Advanced Topics

- 10.8.1 Expression evaluation
- 10.8.2 Instance Methods
- 10.8.3 Adding User-Defined Functions

Next Previous Up Contents
Next: Referencing Column Values
Up: Top
Previous: Parameter Suffixes

STILTS - Starlink Tables Infrastructure Library Tool Set
Starlink User Note256
STILTS web page: http://www.starlink.ac.uk/stilts/
Author email: m.b.taylor@bristol.ac.uk
Mailing list: topcat-user@jiscmail.ac.uk