funcombine(7)

πŸŽ€ NAME πŸŽ€

FunCombine β€” combining region and table filters, bestie πŸ’–

(It's a section 7 page from the SAORD Documentation set, so it's lore, not a command you run. πŸ¦‹)


✨ SYNOPSIS ✨

Okay so this whole doc is about the conventions for combining region and table filters β€” and like, especially about the comma operator, which is the messy little diva of the whole situation. πŸ’…


πŸ’œ DESCRIPTION πŸ’œ

🌸 Comma Conventions 🌸

So a filter specification is just a series of boolean expressions, separated by commas. Those expressions can be table filters, spatial region filters, or a mix of both. The problem? Common usage basically demands that the comma operator act differently in different situations. So even though it feels intuitive most of the time, commas are lowkey a source of confusion. 😭

Per long-standing usage in IRAF, when a comma separates two table filters, it means a boolean and. So:

foo.fits[pha==1,pi==2]

is equivalent to:

foo.fits[pha==1 && pi==2]

But when a comma separates two spatial region filters? Traditionally it's meant a boolean or. So:

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 πŸ‘‘)

And you can mix them, obviously:

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 those cases it is not obvious whether the command should use or or and. So they just arbitrarily chose this rule, and honestly? iconic of them:

  • if both expressions contain a region, the operator used is or.
  • if one (or both) expression(s) does not contain a region, the operator used is and.

This rule handles the pure-region and pure-column-filter cases properly, and it unambiguously assigns the boolean and to all the mixed cases. So:

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 replaced the previous arbitrary rule (pre-funtools 1.2.3), which said: - if the 2nd expression contains a region, the operator used is or. - if the 2nd expression does not contain a region, the operator used is and. 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. πŸ’€

Also, real talk: the comma rule must be considered provisional β€” comments and complaints are welcome to help clarify the matter. And better still? They recommend you just avoid the comma operator in these cases in favor of an explicit boolean operator. Periodt. ✨


πŸ‘€ SEE ALSO πŸ‘€

See funtools(7) for a list of Funtools help pages πŸ¦‹


k that's the whole page, mwah πŸ’‹ β€” this was version 1.4.5, dated April 14, 2011, brought to you by the SAORD Documentation gang, and yes it's still funcombine(7) at heart πŸŽ€βœ¨