1funcombine(n) SAORD Documentation funcombine(n)
2
3
4
6 FunCombine: Combining Region and Table Filters
7
9 This document discusses the conventions for combining region and table
10 filters, especially with regards to the comma operator.
11
13 Comma Conventions
14
15 Filter specifications consist of a series of boolean expressions, sepa‐
16 rated by commas. These expressions can be table filters, spatial region
17 filters, or combinations thereof. Unfortunately, common usage requires
18 that the comma operator must act differently in different situations.
19 Therefore, while its use is intuitive in most cases, commas can be a
20 source of confusion.
21
22 According to long-standing usage in IRAF, when a comma separates two
23 table filters, it takes on the meaning of a boolean and. Thus:
24
25 foo.fits[pha==1,pi==2]
26
27 is equivalent to:
28
29 foo.fits[pha==1 && pi==2]
30
31 When a comma separates two spatial region filters, however, it has tra‐
32 ditionally taken on the meaning of a boolean or. Thus:
33
34 foo.fits[circle(10,10,3),ellipse(20,20,8,5)]
35
36 is equivalent to:
37
38 foo.fits[circle(10,10,3) ⎪⎪ ellipse(20,20,8,5)]
39
40 (except that in the former case, each region is given a unique id in
41 programs such as funcnts).
42
43 Region and table filters can be combined:
44
45 foo.fits[circle(10,10,3),pi=1:5]
46
47 or even:
48
49 foo.fits[pha==1&&circle(10,10,3),pi==2&&ellipse(20,20,8,5)]
50
51 In these cases, it is not obvious whether the command should utilize an
52 or or and operator. We therefore arbitrarily chose to implement the
53 following rule:
54
55 · if both expressions contain a region, the operator used is or.
56
57 · if one (or both) expression(s) does not contain a region, the oper‐
58 ator used is and.
59
60 This rule handles the cases of pure regions and pure column filters
61 properly. It unambiguously assigns the boolean and to all mixed cases.
62 Thus:
63
64 foo.fits[circle(10,10,3),pi=1:5]
65
66 and
67
68 foo.fits[pi=1:5,circle(10,10,3)]
69
70 both are equivalent to:
71
72 foo.fits[circle(10,10,3) && pi=1:5]
73
74 [NB: This arbitrary rule replaces the previous arbitrary rule (pre-fun‐
75 tools 1.2.3) which stated:
76
77 · if the 2nd expression contains a region, the operator used is or.
78
79 · if the 2nd expression does not contain a region, the operator used
80 is and.
81
82 In that scenario, the or operator was implied by:
83
84 pha==4,circle 5 5 1
85
86 while the and operator was implied by
87
88 circle 5 5 1,pha==4
89
90 Experience showed that this non-commutative treatment of the comma
91 operator was confusing and led to unexpected results.]
92
93 The comma rule must be considered provisional: comments and complaints
94 are welcome to help clarify the matter. Better still, we recommend that
95 the comma operator be avoided in such cases in favor of an explicit
96 boolean operator.
97
99 See funtools(n) for a list of Funtools help pages
100
101
102
103version 1.4.0 August 15, 2007 funcombine(n)