XMM-Newton SAS Home Page
XMM-Newton Science Analysis System


selectlib (selectlib-4.77) [xmmsas_20230412_1735-21.0.0]

Boolean operators and functions

Table filtering requires the specification of a single boolean expression which must evaluate to either true or false for all rows of the table. Rows are selected if the expression evaluates to true, otherwise they are not selected. The notion of a valid boolean expression is identical to the one in the programming languages C/C++ and Fortran: An expression is comprised of a sequence of sub-expressions combined with the logical operators && (and) and || (or). Sub-expressions are constructed from table column names (the equivalent of variable names in C/C++/Fortran), boolean operators, and symbolic or numeric constants or other arithmetic expressions. The following table lists the available operators which can be used in their C/C++ or Fortran form:
description C/C++ form Fortran form
equal == .eq.
not equal != .ne.
less than < .lt.
less than or equal <= .le.
greater than > .gt.
greater than or equal >= .ge.
or || .or.
and && .and.
logical negation ! .not.
inclusion test in (see below)

Operator precedences are as in C/C++ and parentheses may be used as necessary to group sub-expressions. Case is insignificant, i.e., .and., .AND., and .aNd. are all valid specifications for the logical and-operator. The C/C++ forms and Fortran forms can be mixed within a single expression.

In addition to the above operators, a limited set of boolean functions is available as well. These take a number of arguments and return either true or false. The following table lists the available boolean functions:

function name meaning comment
ifthenelse(expr1, expr2, expr3) if expr1 is true value of construct is value of expr2, otherwise value of expr3 all three arguments must be boolean expressions
near(val1,val2,tol) true if $\frac{\vert{\tt val1}-{\tt val2}\vert}%
{\vert{\tt val1}\vert}<= {\tt tol}$  
point(...), line(...), $\ldots$ point-in-figure test see below
gti(...), mask(...), region(...) value-in-GTI/point in region tests see below
selected() or selected selection status test see below

XMM-Newton SOC -- 2023-04-16