FXTSoft v2.0 documentation
fxtimgmerge help
Command help for fxtimgmerge in the FXTSoft v2.0 release.
NAME
fxtimgmerge -- Merge multiple FXT images and exposure maps into one sky image
USAGE
fxtimgmerge img1.fits,img2.fits exp1.fits,exp2.fits merged_img.fits merged_exp.fits
fxtimgmerge imgfiles=@img.lst expfiles=@exp.lst outimg=merged_img.fits outexp=merged_exp.fits
fxtimgmerge imgfiles=@img.lst expfiles=@exp.lst outimg=merged_img.fits outexp=merged_exp.fits interp=nearest expmin=1.0
fxtimgmerge imgfiles=@img.lst expfiles=@exp.lst outimg=merged_img.fits outexp=merged_exp.fits outrateimg=merged_rate.fits
DESCRIPTION
The tool reads multiple FXT image and exposure-map pairs, builds a common sky WCS that covers all input pointings, reprojects each pair to that grid, and sums them into merged image and exposure products.
Input files may come from different observations and slightly different pointings. The output uses a common sky tangent-plane WCS derived from the input exposure headers; image and exposure arrays are each mapped to that grid.
All input exposure maps must use the same exposure-unit convention: time (seconds) or area-time (cm2 seconds). The accepted unit scale 1 is used and arrays are not converted. A missing or blank BUNIT is warned about and falls back to s. Mixed conventions, scaled units such as ks or m**2*s, and unsupported units are rejected before WCS/reprojection work or any output is written.
Input science images must contain integrated counts (BUNIT=count, counts, or a counts-per-pixel spelling). Background-subtracted net-count images are accepted under the same count-unit convention, including fractional or negative pixels. Missing image units are warned about and assumed to be counts; rates and exposure units are rejected. Every exposure map must explicitly contain the same VIGNAPP value, and each image/exposure pair must agree on any explicit OBS_ID, detector, mode, and filter metadata. Different pairs may carry DETNAM=FXTA and DETNAM=FXTB; the combined output then omits DETNAM because no single detector applies.
Equal array shapes do not imply equal sky pixels. When an image and its exposure map have different WCS, both are reprojected independently before expmin masking, so the threshold follows the exposure sky footprint. The merged header marks multiple inputs as OBS_ID=MERGED, spans the input time bounds, and sums exposure/ontime/livetime values when all inputs provide finite values.
Pixels with exposure smaller than expmin are masked in both the image and exposure map. Equal sky grids are masked before reprojection; when image and exposure WCS differ, both arrays are reprojected first and the threshold is applied on their common sky grid. This suppresses artificial bright lines or bright points caused by tiny exposure values near image edges.
PARAMETER SUMMARY
| Parameter | Default / values | Summary |
|---|---|---|
imgfiles | required | Input image files, comma-separated or @listfile |
expfiles | required | Input exposure map files, comma-separated or @listfile |
outimg | required | Output merged image FITS file |
outexp | required | Output merged exposure FITS file |
ra | -999.0 | Output image center RA in degrees; -999 = auto from inputs |
dec | -999.0 | Output image center Dec in degrees; -999 = auto from inputs |
xpix | 0 | Output image X dimension in pixels; 0 = auto from inputs |
ypix | 0 | Output image Y dimension in pixels; 0 = auto from inputs |
pixsize | 0.0 | Output pixel size in arcsec; 0 = use input file pixel scale |
padding | 5 | Extra padding pixels around merged sky footprint |
interp | bilinear | Compatibility setting; heterogeneous WCS grids use exact area-overlap reprojection |
outrateimg | NONE | Optional output merged count-rate FITS file; use NONE to skip |
expmin | 1.0 | Minimum exposure threshold in input exposure maps; pixels below it are ignored |
clobber | yes | Overwrite existing output files (yes/no) |
verbose | 1 | Logging verbosity: 0=warning/error, 1=normal info, 2=debug |
mode | ql | Query/learn mode |
PARAMETERS
imgfiles [string]
Input image files. Use a comma-separated list or @listfile. The order must match expfiles.
expfiles [string]
Input exposure-map files. The number and order must match imgfiles.
outimg [file name]
Output merged image FITS file.
outexp [file name]
Output merged exposure FITS file.
ra [float]
Output image center Right Ascension in degrees. Set to -999 (default) to auto-compute from the average of all input pointings.
dec [float]
Output image center Declination in degrees. Set to -999 (default) to auto-compute from the average of all input pointings.
xpix [integer]
Output image X dimension in pixels. Set to 0 (default) to auto-compute from the bounding box of all inputs.
ypix [integer]
Output image Y dimension in pixels. Set to 0 (default) to auto-compute from the bounding box of all inputs.
pixsize [float]
Output pixel size in arcseconds. Set to 0 (default) to inherit the pixel scale from the input files. When a positive value is given, both X and Y pixel scales are set to this value (square pixels).
outrateimg [file name]
Optional output merged count-rate FITS file. The file contains merged image / merged exposure. Use NONE to disable this output. Default: NONE.
padding [integer]
Optional extra border in pixels around the merged footprint. Only used when xpix/ypix are not specified. Default: 5.
interp [string]
Compatibility parameter retained for existing pfiles. Integer-aligned grids are copied exactly; heterogeneous WCS grids use exact area-overlap reprojection. Default: bilinear.
expmin [float]
Minimum exposure threshold in the input exposure maps. Pixels with exposure smaller than this value are ignored in both the merged image and the merged exposure map. Default: 1.0.
clobber [yes/no]
Overwrite existing output files. Default: yes.
EXAMPLES
> fxtimgmerge 1001.img,1002.img 1001.expo,1002.expo merged.img merged.expo
> fxtimgmerge imgfiles=@img.lst expfiles=@exp.lst outimg=merged.img outexp=merged.expo interp=nearest
> fxtimgmerge imgfiles=@img.lst expfiles=@exp.lst outimg=merged.img outexp=merged.expo interp=nearest expmin=1.0
> fxtimgmerge imgfiles=@img.lst expfiles=@exp.lst outimg=merged.img outexp=merged.expo outrateimg=merged_rate.fits expmin=1.0
> fxtimgmerge imgfiles=@img_ff.lst expfiles=@exp_ff.lst outimg=merged_ff.img outexp=merged_ff.expo padding=10 expmin=5.0
> fxtimgmerge imgfiles=@img.lst expfiles=@exp.lst outimg=merged.img outexp=merged.expo ra=180.5 dec=-12.3
> fxtimgmerge imgfiles=@img.lst expfiles=@exp.lst outimg=merged.img outexp=merged.expo ra=180.5 dec=-12.3 xpix=1024 ypix=1024
> fxtimgmerge imgfiles=@img.lst expfiles=@exp.lst outimg=merged.img outexp=merged.expo pixsize=4.8
OUTPUT
The tool produces two FITS images with a common WCS: a merged science image and a merged exposure map. HISTORY entries record the input files and main parameters.
The output header includes NMERGE for the number of merged inputs, MERGED = T, and HISTORY lines describing interp, padding, and expmin.
The three output paths must be distinct. A rate output is written only when outrateimg is not NONE, and its unit follows the exposure convention.
If outrateimg is set, the tool also writes a count-rate image. Its BUNIT is count/s for time exposure maps or count/(cm**2*s) for area-time exposure maps.
NOTES
1. This tool assumes all inputs are already sky images with valid celestial WCS.
Integer-aligned WCS grids are copied directly without resampling. Scale, rotation, tangent-point, or sub-pixel alignment differences require the Python reproject package. The tool stops with an error if that backend is unavailable.
2. Count images and exposure maps use different physical reprojection semantics. Count contributions preserve integrated counts, while exposure contributions preserve exposure per sky area and fractional footprint.
3. Very small exposure values near the border of exposure maps can produce artificial bright structures in image/exposure products. Use expmin to suppress them.
4. The implementation uses one common tangent-plane WCS. This is appropriate for modest sky coverage, but not intended for very large mosaics spanning many degrees.
LIMITATIONS
For very large merged areas, such as about 10 deg x 10 deg, the current implementation may become inaccurate or expensive because:
1. A single TAN projection is used for the whole mosaic, so geometric distortion grows away from the tangent point.
2. Memory and runtime scale with output image size and number of input pixels.
3. Automatic sizing first constructs the final celestial WCS, then projects every input image outer boundary through that same WCS to determine the output size and CRPIX; the projection axes therefore remain consistent at exact celestial poles.
4. Automatic sizing currently requires undistorted TAN inputs; specify xpix and ypix explicitly for SIP, PV, or other projections. Undistorted TAN reprojection uses the shared solid-angle-conserving path.
For mosaics approaching multi-degree scales, split the sky into smaller tiles and merge them separately.
Timing metadata follows OGIP R11: EXPOSURE, ONTIME and LIVETIME are seconds even when TIMEUNIT expresses TSTART/TSTOP in days. Only time coordinates receive the TIMEUNIT conversion during merging.
SEE ALSO
fxtexpogen, fxtarfgen
Manual page updated
2026-11-04