funcen(1)

πŸ’– funcen(1) β€” SAORD Documentation πŸ’–

okay so bestie, you found funcen, and honestly? she's iconic. this is the find centroid (for binary tables) girlie. let's get into it. πŸŽ€


✨ NAME ✨

funcen β€” find centroid (for binary tables) πŸ¦‹


🌸 SYNOPSIS 🌸

funcen [-i] [-n iter] [-t tol] [-v lev] <iname> <region>

πŸ’… OPTIONS πŸ’…

  • -i β€” use image filtering (default: event filtering) ✨
  • -n iter β€” max number of iterations (default: 0) πŸŒ€
  • -t tol β€” pixel tolerance distance (default: 1.0) πŸ“
  • -v [0,1,2,3] β€” output verbosity level (default: 0) πŸ—£οΈ

πŸ‘‘ DESCRIPTION πŸ‘‘

so like, funcen iteratively calculates the centroid position inside one or more regions of a Funtools table (FITS binary table or raw event file). it's giving glow-up energy: you start with an input table, an initial region spec, and an iteration count, and the program calculates the average x and y position within the region β€” then it takes that shiny new position and uses it as the region center for the next iteration. slay. πŸ’«

iteration terminates when either:

  1. the maximum number of iterations is reached, or
  2. the input tolerance distance is met for that region.

then it outputs a count of events in the final region, along with the pixel position value (and, where available, the WCS position). no cap. 🫢


🧚 the arguments, bestie

The first argument to the program specifies the Funtools table file to process. heads up though: since the file must be read repeatedly, a value of "stdin" is not permitted when the number of iterations is non-zero. use Funtools Bracket Notation to specify FITS extensions and filters. iykyk πŸ’…

The second required argument is the initial region descriptor. Multiple regions are permitted. however, compound regions (accelerators, variable argument regions, and regions connected via boolean algebra) are not permitted. Points and polygons also are illegal. these restrictions might be lifted in a future version, if warranted. (manifesting it ✨)


πŸŒ€ the -n (iteration number) switch

specifies the max number of iterations to perform. the default is 0, which means the program will simply count and display the number of events in the initial region(s). and ooh, plot twist: when iterations is 0, the data can be input via stdin. πŸŽ€

πŸ“ the -t (tolerance) switch

specifies a floating point tolerance value. if the distance between the current centroid position value and the last position values is less than this value, iteration terminates. default value is 1 pixel.

πŸ—£οΈ the -v (verbosity) switch

specifies the verbosity level of the output. default is 0, which results in a single line of output for each input region, consisting of the following values:

counts x y [ra dec coordsys]

The last 3 WCS values are output if WCS information is available in the data file header. so, for example:

[sh] funcen -n 0 snr.ev "cir 505 508 5"
915 505.00 508.00 345.284038 58.870920 j2000

[sh] funcen -n 3 snr.ev "cir 505 508 5"
1120 504.43 509.65 345.286480 58.874587 j2000

The first example simply counts the number of events in the initial region. The second example iterates the centroid calculation three times to determine a final "best" position. πŸ”₯

Higher levels of verbosity obviously imply more verbose output. At level 1, the output essentially contains the same information as level 0, but with keyword formatting:

[sh] funcen -v 1 -n 3 snr.ev "cir 505 508 5"
event_file:     snr.ev
initial_region: cir 505 508 5
tolerance:      1.0000
iterations:     1

events:         1120
x,y(physical):  504.43 509.65
ra,dec(j2000):  345.286480 58.874587
final_region1:  cir 504.43 509.65 5

Level 2 outputs results from intermediate calculations as well. πŸ’€ (she's thorough)


πŸ¦‹ event filtering vs image filtering

Ordinarily, region filtering is performed using analytic (event) filtering β€” i.e. that same style of filtering as is performed by fundisp and funtable. Use the -i switch to specify image filtering, i.e. the same style filtering as is performed by funcnts. so basically you can do a quick calculation of counts in regions, using either the analytic or image filtering method, by specifying the -n 0 and optional -i switches. 🌈

these two methods often give different results because of how boundary events are processed:

[sh] funcen  snr.ev "cir 505 508 5"
915 505.00 508.00 345.284038 58.870920 j2000

[sh] funcen -i snr.ev "cir 505 508 5"
798 505.00 508.00 345.284038 58.870920 j2000
See Region Boundaries for more information about how boundaries are calculated using these two methods. πŸ‘€

🫢 SEE ALSO 🫢

See funtools(7) for a list of Funtools help pages πŸ’œ


and that's the whole vibe check bestie, you're officially a centroid-finding main character πŸ’…βœ¨ this was version 1.4.5, dated April 14, 2011 β€” go forth and slay, periodt. πŸŽ€πŸ¦‹πŸ’–

πŸ“¦ where this page comes from