"Fossies" - the Fresh Open Source Software Archive

Member "SAOImageDS9/funtools/doc/combo.html" (13 Nov 2019, 3413 Bytes) of package /linux/misc/ds9.8.1.tar.gz:


Caution: In this restricted "Fossies" environment the current HTML page may not be correctly presentated and may have some non-functional links. You can here alternatively try to browse the pure source code or just view or download the uninterpreted raw source code. If the rendering is insufficient you may try to find and view the page on the ds9.8.1.tar.gz project site itself.

FunCombine: Combining Region and Table Filters

Summary

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.

According to long-standing usage in IRAF, 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 spatial region filters, however, it has traditionally taken 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[circle(10,10,3),pi=1:5]
or even:
  foo.fits[pha==1&&circle(10,10,3),pi==2&&ellipse(20,20,8,5)]
In these cases, it is not obvious whether the command should utilize an or or and operator. We therefore arbitrarily chose to implement the following rule: This rule handles the cases of pure regions and pure column filters properly. It unambiguously assigns the boolean and to all mixed cases. Thus:
  foo.fits[circle(10,10,3),pi=1:5]
and
  foo.fits[pi=1:5,circle(10,10,3)]
both are equivalent to:
  foo.fits[circle(10,10,3) && pi=1:5]

[NB: This arbitrary rule replaces the previous arbitrary rule (pre-funtools 1.2.3) which stated:

In that scenario, the or operator was implied by:
  pha==4,circle 5 5 1
while the and operator was implied by
  circle 5 5 1,pha==4
Experience showed that this non-commutative treatment of the comma operator was confusing and led to unexpected results.]

The comma 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.

Go to Funtools Help Index

Last updated: November 16, 2005