Last modified: 11 December 2024

How can I calculate the centroid of counts in a region?


The centroid is only calculated when the dmstat infile parameter is an image and centroid=yes. If you wish to use an event file as input, add an image binning filter to create an image on-the-fly:

unix% dmstat "acisf01838N002_evt2.fits[sky=circle(4072,4252,36)][bin sky=1]" centroid=yes
EVENTS_IMAGE(x, y)
    min:        0             @:        ( 4063 4218 )
    max:        85            @:        ( 4073 4246 )
cntrd[log] :    ( 35.978616181 34.095750477 )
cntrd[phys]:    ( 4070.9786162 4249.0957505 )
   good:        4053
   null:        1276

From top to bottom, the output reports the value and location (in physical coordinates) of the minimum and maximum pixel values, the location of the centroid of the pixel distribution in both logical and physical coordinate systems, the number of valid ("good") pixels, and the number of invalid (i.e. the value equals the Null/NaN value) pixels.

The help file has further details on how these values are calculated.