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 "acisf01838N001_evt2.fits[sky=circle(4072,4252,36)][bin sky=1]" centroid=yes EVENTS_IMAGE(x, y) min: 0 @: ( 4072 4216 ) max: 77 @: ( 4070 4251 ) cntrd[log] : ( 34.7667075 35.927113107 ) cntrd[phys]: ( 4069.7667075 4250.9271131 ) sigma_cntrd: ( 65.305691356 67.893006882 ) 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.