FXTSoft v2.0 documentation
fxtregmaskfill help
Command help for fxtregmaskfill in the FXTSoft v2.0 release.
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
| Parameter | Default / values | Summary |
|---|---|---|
imgfile | required | Input 2D FITS image used as the mask grid and optional fill source |
srcfile | required | Input DS9 region file, FITS source table, or JSON source list |
maskout | required | Output source mask FITS file; 1=source/hole, 0=keep |
validmaskout | required | Output valid-analysis mask FITS file; 1=valid, 0=source/outside |
basemask | NONE | Optional input exposure/FOV mask; nonzero pixels are eligible for masks and fill |
maskscale | 1.0 | Multiplicative scale applied to source-region radii before mask construction |
fill | no | Write a filled image in addition to masks (yes/no) |
outfile | NONE | Filled output image; required when fill=yes |
method | constant | Fill method: constant, nan, dist, poisson, global, poly, or bilint |
fillvalue | 0.0 | Replacement value used when method=constant |
bkginner | 1.0 | Inner local-background radius scale for dist, poisson, and poly |
bkgouter | 2.5 | Outer local-background radius scale for dist, poisson, and poly |
randseed | 0 | Random seed for dist, poisson, and global; 0 uses a non-deterministic seed |
clobber | yes | Overwrite existing output files (yes/no) |
verbose | 1 | Logging verbosity: 0=warning/error, 1=normal info, 2=debug |
manifest | fxtregmaskfill_manifest.json | Output JSON manifest path, or NONE to skip |
mode | ql | Query/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-WCScircleandellipseregions, JSON records containingregion,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 as0. Required. - validmaskout
- Output valid-analysis mask FITS file. Pixels that are eligible for downstream image analysis are written as
1; source pixels and pixels outsidebasemaskare written as0. 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=yesto enableoutfile. Default:no. - outfile
- Filled image output path. Required when
fill=yes; ignored whenfill=no. - method
- Fill method. Accepted values are
constant,nan,dist,poisson,global,poly, andbilint. Default:constant. - fillvalue
- Constant replacement value for
method=constant. Default:0.0. - bkginner, bkgouter
- Local-background annulus scale factors for
dist,poisson, andpoly. The inner radius ismax(bkginner,1.0)times the source-region radius; the outer radius isbkgoutertimes 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 of0requests a non-deterministic seed. Default:0. - clobber
- Overwrite existing output files. Default:
yes.
FILL METHODS
| Method | Behavior | Background region |
|---|---|---|
constant | Replace masked pixels with fillvalue. | None |
nan | Replace masked pixels with IEEE NaN. | None |
dist | Sample replacement pixel values from the local background value distribution. | Local annulus from bkginner/bkgouter |
poisson | Draw replacement values from a Poisson distribution whose mean is the local-background mean. | Local annulus from bkginner/bkgouter |
global | Draw replacement values from a Poisson distribution whose mean is all valid non-source pixels. | All valid non-source pixels |
poly | Fit a local bi-quadratic surface to background pixels and evaluate the surface in the masked region. | Local annulus from bkginner/bkgouter |
bilint | Interpolate 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=pixelandFXTTOOL=fxtregmaskfill. - validmaskout
- Valid-analysis mask FITS image with
BUNIT=pixelandFXTTOOL=fxtregmaskfill. - outfile
- Filled image FITS file when
fill=yes. The input image header is preserved and fill metadata such asSRCFILL,RANDSEED,BKGINNER, andBKGOUTERis 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