EP-FXT Science Data Center / Users Guide v2.0 · 2026-11-04

FXTSoft v2.0 documentation

fxtregmaskfill help

Command help for fxtregmaskfill in the FXTSoft v2.0 release.

← Back to Command Reference

NAME

fxtregmaskfill -- Build region masks and optionally fill masked regions in FXT image products.

USAGE

fxtregmaskfill imgfile=counts.fits srcfile=sources.reg maskout=source_mask.fits validmaskout=valid_mask.fits
fxtregmaskfill imgfile=counts.fits srcfile=sources.reg maskout=source_mask.fits validmaskout=valid_mask.fits fill=yes method=poisson outfile=filled_counts.fits randseed=123
fxtregmaskfill imgfile=counts.fits srcfile=sources.json basemask=expo_mask.fits maskout=source_mask.fits validmaskout=valid_mask.fits maskscale=1.5

DESCRIPTION

fxtregmaskfill creates source or exclusion masks from image-coordinate or WCS-aware sky-coordinate regions and writes masks on the same pixel grid as the input image. It accepts DS9 region files, fxtsrcdet-style FITS source tables, or JSON source lists.

The task always writes a source mask and a valid-analysis mask. If fill=yes, it also writes a filled image in which masked pixels are replaced by a constant value, NaN, or a background-based estimate. The background-based fill modes are intended for diffuse-emission image workflows where point sources or compact regions should be removed before smoothing, contouring, or binning.

The source mask uses 1 for masked or hole pixels and 0 elsewhere. The valid mask uses 1 for pixels inside the optional base mask and outside all source regions, and 0 for masked or invalid pixels.

PARAMETER SUMMARY

ParameterDefault / valuesSummary
imgfilerequiredInput 2D FITS image used as the mask grid and optional fill source
srcfilerequiredInput DS9 region file, FITS source table, or JSON source list
maskoutrequiredOutput source mask FITS file; 1=source/hole, 0=keep
validmaskoutrequiredOutput valid-analysis mask FITS file; 1=valid, 0=source/outside
basemaskNONEOptional input exposure/FOV mask; nonzero pixels are eligible for masks and fill
maskscale1.0Multiplicative scale applied to source-region radii before mask construction
fillnoWrite a filled image in addition to masks (yes/no)
outfileNONEFilled output image; required when fill=yes
methodconstantFill method: constant, nan, dist, poisson, global, poly, or bilint
fillvalue0.0Replacement value used when method=constant
bkginner1.0Inner local-background radius scale for dist, poisson, and poly
bkgouter2.5Outer local-background radius scale for dist, poisson, and poly
randseed0Random seed for dist, poisson, and global; 0 uses a non-deterministic seed
clobberyesOverwrite existing output files (yes/no)
verbose1Logging verbosity: 0=warning/error, 1=normal info, 2=debug
manifestfxtregmaskfill_manifest.jsonOutput JSON manifest path, or NONE to skip
modeqlQuery/learn mode

PARAMETERS

imgfile
Input FITS image. The first 2D image HDU is used. Its dimensions define the output mask and filled-image grid. Required.
srcfile
Source-region input. Supported forms are DS9 image, physical, or celestial-WCS circle and ellipse regions, JSON records containing region, srcregion, shape, or equivalent coordinate fields, and FITS source tables with usable source center and radius/ellipse columns.
maskout
Output source mask FITS file. Masked source or hole pixels are written as 1; unmasked pixels are written as 0. Required.
validmaskout
Output valid-analysis mask FITS file. Pixels that are eligible for downstream image analysis are written as 1; source pixels and pixels outside basemask are written as 0. Required.
basemask
Optional base mask FITS image. Nonzero pixels are eligible. If supplied, it must have the same shape as imgfile. Default: NONE.
maskscale
Scale factor applied to every source radius before the mask is built. For ellipses, both semi-axes are scaled and the position angle is unchanged. Default: 1.0.
fill
Whether to write a filled image. Use fill=yes to enable outfile. Default: no.
outfile
Filled image output path. Required when fill=yes; ignored when fill=no.
method
Fill method. Accepted values are constant, nan, dist, poisson, global, poly, and bilint. Default: constant.
fillvalue
Constant replacement value for method=constant. Default: 0.0.
bkginner, bkgouter
Local-background annulus scale factors for dist, poisson, and poly. The inner radius is max(bkginner,1.0) times the source-region radius; the outer radius is bkgouter times the source-region radius. Default: bkginner=1.0, bkgouter=2.5.
randseed
Random seed for stochastic fill modes. Any nonzero integer gives repeatable output within fxtregmaskfill. A value of 0 requests a non-deterministic seed. Default: 0.
clobber
Overwrite existing output files. Default: yes.

FILL METHODS

MethodBehaviorBackground region
constantReplace masked pixels with fillvalue.None
nanReplace masked pixels with IEEE NaN.None
distSample replacement pixel values from the local background value distribution.Local annulus from bkginner/bkgouter
poissonDraw replacement values from a Poisson distribution whose mean is the local-background mean.Local annulus from bkginner/bkgouter
globalDraw replacement values from a Poisson distribution whose mean is all valid non-source pixels.All valid non-source pixels
polyFit a local bi-quadratic surface to background pixels and evaluate the surface in the masked region.Local annulus from bkginner/bkgouter
bilintInterpolate from nearest non-source pixels along the diagonal directions, with horizontal/vertical interpolation fallback when needed.Nearest valid neighboring pixels

INPUT REGION DETAILS

DS9 region files may use image or physical pixel coordinates directly. Celestial coordinates such as fk5, icrs, j2000, galactic, and ecliptic are accepted when imgfile has a valid celestial WCS; otherwise the task stops rather than treating sky coordinates as pixels. Supported region shapes are circle(x,y,r) and ellipse(x,y,r1,r2,angle). Excluded DS9 regions are not supported for source masks.

For these supported celestial circles and ellipses, a headerless row with sexagesimal-colon or explicit h/d position units is interpreted as FK5/J2000 per shape. An explicit coordinate directive takes precedence. Bare numeric positions remain pixel/physical; inferred celestial sizes require explicit angular units, and mixed pixel/sky position tokens in one shape are rejected. This compatibility does not add excluded regions or general CIAO boolean syntax.

JSON input may contain a top-level sources or regions list, or may itself be a list. Each list entry must be an object. Records may reference a region file with srcregion, region_file, or regfile; may contain an inline region string; or may provide shape with coordinate fields.

FITS source-table input is intended for fxtsrcdet-style tables. The task looks for source center columns such as X, X_REF, X_PEAK and Y, Y_REF, Y_PEAK, and radius or ellipse columns such as ELL_MAJOR, ELL_MINOR, R, R_SRC, or PSF_SIZE.

OUTPUTS

maskout
Source mask FITS image with BUNIT=pixel and FXTTOOL=fxtregmaskfill.
validmaskout
Valid-analysis mask FITS image with BUNIT=pixel and FXTTOOL=fxtregmaskfill.
outfile
Filled image FITS file when fill=yes. The input image header is preserved and fill metadata such as SRCFILL, RANDSEED, BKGINNER, and BKGOUTER is recorded where applicable.

EXAMPLES

fxtregmaskfill imgfile=a3186_soft_counts.fits srcfile=a3186_soft_src.reg \
  maskout=a3186_source_mask.fits validmaskout=a3186_valid_mask.fits

fxtregmaskfill imgfile=a3186_soft_counts.fits srcfile=a3186_soft_src.reg \
  maskout=a3186_source_mask.fits validmaskout=a3186_valid_mask.fits \
  fill=yes method=poisson outfile=a3186_soft_filled.fits randseed=123

fxtregmaskfill imgfile=counts.fits srcfile=sources.json basemask=expo_valid.fits \
  maskout=source_mask.fits validmaskout=valid_mask.fits \
  fill=yes method=poly outfile=poly_filled.fits bkginner=1.0 bkgouter=3.0

NOTES

The dmfilth-like methods are independent implementations aligned to public CIAO dmfilth behavior and FXT black-box validation. No CIAO or XMM-SAS source code is included in this task. Stochastic methods use the fxtregmaskfill NumPy random stream, so a fixed randseed is repeatable within this task but is not expected to produce byte-identical random fills to CIAO.

The older command name fxtsrcmaskfill is a compatibility alias. New workflows should call fxtregmaskfill.

SEE ALSO

fxtsrcdet, CIAO dmfilth

Manual page updated

2026-11-04