Combining Region and Table Filters

Usage

This document discusses the conventions for combining region and table filters, especially with regards to the comma operator.

Comma Conventions

Filter specifications consist of a series of boolean expressions, separated by commas. These expressions can be table filters, spatial region filters, or combinations thereof. Unfortunately, common usage requires that the comma operator must act differently in different situations. Therefore, while its use is intuitive in most cases, commas can be a source of confusion.

When a comma separates two table filters, it takes on the meaning of a boolean and. Thus:

  foo.fits[pha==1,pi==2]
is equivalent to:
  foo.fits[pha==1 && pi==2]
When a comma separates two region filters, it takes on the meaning of a boolean or. Thus:
  foo.fits[circle(10,10,3),ellipse(20,20,8,5)]
is equivalent to:
  foo.fits[circle(10,10,3) || ellipse(20,20,8,5)]
(except that in the former case, each region is given a unique id in programs such as funcnts).

Region and table filters can be combined:

  foo.fits[pha==1&&circle(10,10,3),pi==2&&ellipse(20,20,8,5)]
In this case, it is not obvious whether the command should utilize an or or and operator. In order to accommodate both possibilities, we arbitrarily (i.e., based on ease of implementation) adopt the following convention: Thus, the following expression implies the or operator:
  pha==4,circle 5 5 1
The following expression implies the and operator:
  circle 5 5 1,pha==4
This rule must be considered provisional: comments and complaints are welcome to help clarify the matter. Better still, we recommend that the comma operator be avoided in such cases in favor of an explicit boolean operator.
Index to the Funtools Help Pages
Last updated: April 11, 2001