regbounds(7)
๐ regbounds โ Region Boundaries ๐
okay bestie, welcome to regbounds(7), brought to you by the fine people at SAORD Documentation โจ this whole page is literally just about one thing: how region boundaries get handled, and it's giving extremely important energy so pay attention ๐ซถ
โจ SYNOPSIS โจ
This page describes how spatial region boundaries are handled. That's it, that's the whole vibe check. ๐ฆ
๐ธ DESCRIPTION ๐ธ
so the golden rule for spatial region filtering was first enunciated by Leon VanSpeybroeck back in 1986, and it is, no cap, iconic:
Each photon will be counted once, and no photon will be counted more than once.
periodt. ๐
This means we have to be careful about boundary conditions, like actually careful. For example, if a circle is contained in an annulus such that the inner radius of the annulus is the same as the radius of the circle, then photons on that boundary must always be assigned to one or the other region. That is, the number of photons in both regions must equal the sum of the number of photons in each region taken separately. math is math bestie ๐งฎโจ
With this in mind, the rules for determining whether a boundary image pixel or table row are assigned to a region are defined below. ๐
๐ Image boundaries โ radially-symmetric shapes (circle, annuli, ellipse) ๐
For image filtering, pixels whose center is inside the boundary are included. This also applies non-radially-symmetric shapes. ๐ When a pixel center is exactly on the boundary, the pixel assignment rule is:
- the outer boundary of a symmetric shape does not include such pixels ๐
- the inner boundary of a symmetric shape (annulus) includes such pixels ๐
In this way, an annulus with radius from 0 to 1, centered exactly on a pixel, includes the pixel on which it is centered, but none of its neighbors. slay ๐
These rules ensure that when defining concentric shapes, no pixels are omitted between concentric regions and no pixels are claimed by two regions. When applied to small symmetric shapes, the shape is less likely to be skewed, as would happen with non-radially-symmetric rules. These rules differ from the rules for box-like shapes, which are more likely to be positioned adjacent to one another. different strokes for different shapes fr fr ๐ฆ
๐ Image Boundaries: non-radially symmetric shapes (polygons, boxes) ๐
For image filtering, pixels whose center is inside the boundary are included. This also applies radially-symmetric shapes. When a pixel center is exactly on the boundary of a non-radially symmetric region, the pixel is included in the right or upper region, but not the left or lower region. This ensures that geometrically adjoining regions touch but don't overlap. no overlap, we don't do that here โ๐
๐ฆ Row Boundaries are Analytic ๐ฆ
When filtering table rows, the boundary rules are the same as for images, except that the calculation is not done on the center of a pixel (since table rows, especially X-ray events rows, often have discrete, floating point positions) but are calculated exactly. That is, an row is inside the boundary without regard to its integerized pixel value. For rows that are exactly on a region boundary, the above rules are applied to ensure that all rows are counted once and no row is counted more than once. the golden rule stays undefeated ๐โจ
Because row boundaries are calculated differently from image boundaries, certain programs will give different results when filtering the same region file. In particular, fundisp/funtable (which utilize analytic row filtering) perform differently from funcnts (which performs image filtering, even on tables). ๐ญ
๐ Image Boundaries vs. Row Boundaries: Practical Considerations ๐
You will sometimes notice a discrepancy between running funcnts on a binary table file and running fundisp on the same file with the same filter. For example, consider the following:
fundisp test1.fits"[box(4219,3887,6,6,0)]" โช wc
8893 320148 3752846
Since fundisp has a 2-line header, there are actually 8891 photons that pass the filter. But then run funtable and select only the rows that pass this filter, placing them in a new file:
./funtable test1.fits"[box(4219,3887,6,6,0)]" test2.fits
Now run funcnts using the original filter on the derived file:
./funcnts test2.fits "physical; box(4219,3887,6,6,0)"
[... lot of processed output ...]
# the following source and background components were used:
source region(s)
----------------
physical; box(4219,3887,6,6,0)
reg counts pixels
---- ------------ ---------
1 7847.000 36
There are 1044 rows (events) that pass the row filter in fundisp (or funtable) but fail to make it through funcnts. Why?? bestie I know you're wondering ๐
The reason can be traced to how analytic row filtering (fundisp, funtable) differs from integerized pixel filtering (funcnts, funimage). Consider the region:
box(4219,3887,6,6,0)
Analytically (i.e., using row filtering), positions will pass this filter successfully if:
4216 <= x <= 4222
3884 <= y <= 3890
For example, photons with position values of x=4216.4 or y=3884.08 will pass. โ
Integerized image filtering is different in that the pixels that will pass this filter have centers at:
x = 4217, 4218, 4219, 4220, 4221, 4222
y = 3885, 3886, 3887, 3888, 3889, 3890
Note that there are 6 pixels in each direction, as specified by the region. That means that positions will pass the filter successfully if:
4217 <= (int)x <= 4222
3885 <= (int)y <= 3890
Photons with position values of x=4216.4 or y=3884.08 will NOT pass. โ
Note that the position values are integerized, in effect, binned into image values. This means that x=4222.4 will pass this filter, but not the analytic filter above. We do this to maintain the design goal that either all counts in a pixel are included in an integerized filter, or else none are included. all or nothing, main character energy ๐
[It could be argued that the correct photon limits for floating point row data really should be:4216.5 <= x <= 4222.5 3884.5 <= y <= 3890.5since each pixel extends for.5on either side of the center. We chose to the maintain integerized algorithm for all image-style filtering so thatfuncntswould give the exact same results regardless of whether a table or a derived non-blocked binned image is used.]
๐ SEE ALSO ๐
See funtools(7) for a list of Funtools help pages ๐โจ
okay that's the whole page bestie!! ๐ this was version 1.4.5, dated April 14, 2011, and it's still out here doing the lord's work explaining why your counts don't match ๐ญ go forth and filter responsibly, ily, bye ๐๐ฆ๐ธ
๐ฆ where this page comes from
- debian bookworm: libfuntools-dev 1.4.8-1 ยท GPL
- debian trixie: libfuntools-dev 1.4.8-1.1+b2 ยท GPL
- ubuntu jammy: libfuntools-dev 1.4.8-1 ยท GPL
- ubuntu noble: libfuntools-dev 1.4.8-1.1build2 ยท GPL
- ubuntu questing: libfuntools-dev 1.4.8-2
- ubuntu resolute: libfuntools-dev 1.4.8-2build1 ยท GPL
- ubuntu stonking: libfuntools-dev 1.4.8-2build1 ยท GPL
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms