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

FXTSoft v2.0 documentation

fxtimage help

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

← Back to Command Reference

NAME

fxtimage -- FXT image-product helper for event binning, exposure thresholding, OoT subtraction, generic arithmetic, smoothing, and RGB preview generation.

USAGE

fxtimage mode=bin evtfile=evt.fits outfile=counts.fits emin=0.4 emax=7.0

fxtimage mode=bin evtfile=evt.fits outfile=sky.fits ra=123.4 dec=-45.6 pixsize=2.5

fxtimage mode=rate imgfile=counts.fits expfile=expo.fits outfile=rate.fits expfrac=0.15 maskfile=mask.fits

fxtimage mode=oot imgfile=counts.fits ootfile=oot.fits outfile=suboot.fits scale=0.0023

fxtimage mode=add imgfile=A.fits imgfile2=B.fits outfile=sum.fits (A+B=sum)

fxtimage mode=sub imgfile=counts_suboot.fits imgfile2=particle_bkg.fits outfile=net_counts.fits (counts_suboot - particle_bkg = net_counts)

fxtimage mode=mul imgfile=A.fits imgfile2=B.fits outfile=product.fits ascale=2 bscale=0.5

fxtimage mode=div imgfile=A.fits imgfile2=B.fits outfile=ratio.fits

fxtimage mode=smooth imgfile=rate.fits outfile=rate_smooth.fits method=gauss sigma=2

fxtimage mode=rgb redfile=soft.fits greenfile=mid.fits bluefile=hard.fits outfile=rgb.png

DESCRIPTION

fxtimage bins screened event files into images and provides image arithmetic, exposure correction, OoT subtraction, smoothing, and RGB displays. It accepts screened events or existing FITS images; event screening must be completed first, for example with xselect.

Generic image arithmetic is available with mode=add, sub, mul, and div. For images A and B, the result is C=(ascale*A) operator (bscale*B). Arithmetic is evaluated in float64 and written as float32. Generic inputs must have the same shape; there is no implicit re-projection. When grids differ, explicitly reproject an input before calling this task. For celestial WCS, every integer pixel centre is checked to 1e-6 pixel. The mode=oot path is the exception: it retains counts-preserving alignment and the legacy OOTSCAL semantics.

Only add/sub convert B to A units before bscale when both inputs declare BUNIT. mul/div do not convert numeric values between units; they only derive the output unit. With outunit=AUTO, add/sub retain A's unit, while AUTO mul/div remove BUNIT when unit derivation is unavailable or the derived unit is unscaled dimensionless. Scaled dimensionless units such as ks/s are retained so that their scale factor is not lost. outunit=NONE removes the output label. An explicit outunit is a label-only BUNIT override and never rescales the numeric result.

Generic arithmetic records ARITHOP, SCALEA, SCALEB, B2AFACT, FXTARITH, and WCSALIGN in provenance, plus BUNITA and/or BUNITB when the corresponding input declares BUNIT. B2AFACT records the B-to-A conversion factor; when it is not 1, FXTARITH and HISTORY include that factor. BSCALE and BZERO are FITS reserved pixel-scaling keywords, not fxtimage parameter fields; OoT output does not write generic arithmetic fields. Division by zero or a non-finite denominator writes NaN; DIVZERO counts finite zero denominators only.

mode=rate continues to apply its configured threshold, default 15%, exposure mask, and rate image in one operation, replacing the usual ftstat + bc + fimgtrim + farith chain. The generic div (mode=div) is not a replacement for mode=rate; for example, pass a net-count image from mode=sub to mode=rate with its exposure map.

Generated FITS products carry ORIGIN='IHEP/CAS' and valid CHECKSUM/DATASUM in every HDU. Existing CREATOR and HISTORY processing records are retained.

EXTENDED-SOURCE WORKFLOW

The labels below distinguish two compatible routes. method1 is the verified FXTSoft 2.0 route. method2 is the original HEASoft/FTOOLS route. Both routes operate on screened event files and explicit exposure products.

method1

The complete FXTSoft 2.0 route below starts from a screened event file. It uses fxtimage for image extraction, OoT and particle-map subtraction, and the final exposure threshold/rate products:

fxtimage mode=bin evtfile=fxta-clean.fits \
    outfile=fxta-0.4-7.0-cts.fits emin=0.4 emax=7.0 clobber=yes
fxtexpogen evtfile=fxta-clean.fits mkffile=../hk/mkf.fits \
    outfile=fxta-0.4-7.0-exp.fits edgecovermask=1
fxtootest evtfile=fxta-clean.fits outfile=fxta-oot.fits \
    attfile=../../auxil/att.fits
fxtimage mode=bin evtfile=fxta-oot.fits \
    outfile=fxta-0.4-7.0-oot.fits emin=0.4 emax=7.0 clobber=yes
fxtimage mode=oot imgfile=fxta-0.4-7.0-cts.fits \
    ootfile=fxta-0.4-7.0-oot.fits outfile=fxta-0.4-7.0-suboot.fits \
    scale=0.0023 clobber=yes
fxtbkggen infile=fxta_fsa.pi outfile=fxta_bkg.pi
fxtbkgmap infile=fxta_bkg.pi \
    expfile=fxta-0.4-7.0-exp-without_vign.fits \
    outfile=fxta-0.4-7.0-particle.fits emin=0.4 emax=7.0
fxtimage mode=sub imgfile=fxta-0.4-7.0-suboot.fits \
    imgfile2=fxta-0.4-7.0-particle.fits outfile=fxta-0.4-7.0-net.fits \
    ascale=1 bscale=1 outunit=AUTO clobber=yes
fxtimage mode=rate imgfile=fxta-0.4-7.0-net.fits \
    expfile=fxta-0.4-7.0-exp.fits outfile=fxta-0.4-7.0-rate.fits \
    expfrac=0.15 outcounts=fxta-0.4-7.0-thresh.fits \
    outexp=fxta-0.4-7.0-expthresh.fits \
    maskfile=fxta-0.4-7.0-mask.fits clobber=yes

fxtimage only performs arithmetic subtraction using an existing particle map; it does not replace fxtbkggen/fxtbkgmap particle spectrum/map modeling. The rate command is the final step: mode=rate receives the net-count image after mode=sub and produces the thresholded counts, thresholded exposure, mask, and rate map in one operation. If both background corrections are intentionally skipped, a raw count image may be used instead. On a common grid, generic mode=sub with bscale=0.0023 is numerically equivalent to the OoT subtraction, but mode=oot is preferred because it preserves OoT-specific provenance and alignment semantics. OoT and particle subtraction precede vignetting correction.

For smoothing and RGB display, the corresponding FXTSoft 2.0 operations are:

fxtimage mode=smooth imgfile=fxta-0.4-7.0-rate.fits \
    outfile=fxta-0.4-7.0-rate-smooth.fits method=gauss sigma=2 clobber=yes
fxtimage mode=rgb redfile=evt_soft.im greenfile=evt_mid.im \
    bluefile=evt_hard.im outfile=rgb.png clobber=yes

For mosaics, count or net-count images and exposure maps are merged separately before division. fxtimage does not replace fxtimgmerge for cross-observation common-WCS construction, reprojection, and merging:

fxtimgmerge imgfiles=@counts.lst expfiles=@exposure.lst \
    outimg=merged_counts.fits outexp=merged_exposure.fits \
    outrateimg=merged_rate.fits

method2

The original route extracts and thresholds an image with the standard FTOOLS commands:

ftcopy "fxta-clean.fits[eng=0.4:7.0][bin x=0.5:600.5,y=0.5:600.5]" fxta-0.4-7.0-cts.fits clobber=yes
fxtexpogen evtfile=fxta-clean.fits mkffile=../hk/mkf.fits outfile=fxta-0.4-7.0-exp.fits edgecovermask=1
exp=`ftstat fxta-0.4-7.0-exp.fits | grep "maximum" | awk '{print $3}'`
locut=`echo "0.15*$exp" | bc -l`
fimgtrim fxta-0.4-7.0-exp.fits $locut INDEF 0 INDEF fxta-0.4-7.0-expthresh.fits clobber=yes
farith fxta-0.4-7.0-expthresh.fits fxta-0.4-7.0-expthresh.fits fxta-0.4-7.0-mask.fits DIV clobber=yes
fimgtrim fxta-0.4-7.0-mask.fits 0 INDEF 0 INDEF fxta-0.4-7.0-mask.fits clobber=yes
farith fxta-0.4-7.0-cts.fits fxta-0.4-7.0-mask.fits fxta-0.4-7.0-thresh.fits MUL clobber=yes
farith fxta-0.4-7.0-thresh.fits fxta-0.4-7.0-expthresh.fits fxta-0.4-7.0-rate.fits DIV clobber=yes
fimgtrim fxta-0.4-7.0-rate.fits 0 INDEF 0 INDEF fxta-0.4-7.0-rate.fits clobber=yes

For OoT correction, the original route retains fxtootest, ftcopy, and ftimgcalc. Use the same SKY bin edges as the count image so that the subtraction inputs have identical image geometry:

fxtootest evtfile=fxta-clean.fits outfile=fxta-oot.fits attfile=../../auxil/att.fits
ftcopy "fxta-oot.fits[eng=0.4:7.0][bin x=0.5:600.5,y=0.5:600.5]" fxta-0.4-7.0-oot.fits clobber=yes
ftimgcalc fxta-0.4-7.0-suboot.fits 'A-0.0023*B' a=fxta-0.4-7.0-cts.fits b=fxta-0.4-7.0-oot.fits clobber=yes

fxtbkggen/fxtbkgmap generate the particle spectrum and particle map, using the non-vignetted exposure map for the conversion. Subtract that map with the traditional arithmetic before vignetting correction:

fxtbkggen infile=fxta_fsa.pi outfile=fxta_bkg.pi
fxtbkgmap infile=fxta_bkg.pi expfile=fxta-0.4-7.0-exp-without_vign.fits outfile=fxta-0.4-7.0-particle.fits emin=0.4 emax=7.0
ftimgcalc fxta-0.4-7.0-net.fits 'A-B' a=fxta-0.4-7.0-suboot.fits b=fxta-0.4-7.0-particle.fits clobber=yes

For display smoothing, the original route retains the HEASoft tasks fgauss, fboxcar, and fadapt. Its RGB display remains:

ds9 -rgb -red evt_soft.im -green evt_mid.im -blue evt_hard.im

For cross-observation mosaics, the original route uses the CIAO reproject_image_grid task and combines count or net-count images separately from exposure maps before division.

PARAMETER SUMMARY

ParameterDefault / valuesSummary
modebinOperation mode: bin, rate, oot, smooth, rgb, add, sub, mul, or div
evtfilerequiredInput event FITS file for mode=bin
imgfilerequiredInput image FITS file for mode=rate, oot, smooth, add, sub, mul, or div
imgfile2 Second input image FITS file for mode=add, sub, mul, or div
expfilerequiredInput exposure map for mode=rate
ootfilerequiredInput OoT image for mode=oot
redfilerequiredInput red-channel image for mode=rgb
greenfilerequiredInput green-channel image for mode=rgb
bluefilerequiredInput blue-channel image for mode=rgb
outfilerequiredOutput file
emin Minimum energy in keV for mode=bin
emax Maximum energy in keV for mode=bin
xcolXEvent X column for mode=bin
ycolYEvent Y column for mode=bin
energycolautoENG, ENERGY, or PI; auto selects in that order
xmin0.5Minimum X bin edge for mode=bin
xmax600.5Maximum X bin edge for mode=bin
ymin0.5Minimum Y bin edge for mode=bin
ymax600.5Maximum Y bin edge for mode=bin
binsize1.0Image bin size for mode=bin; bounds must span an integer number of bins
ra Optional output TAN center right ascension in degrees; provide together with dec
dec Optional output TAN center declination in degrees; valid range is -90 to 90
pixsize Output TAN projection scale in arcsec before binsize; inferred from event WCS when blank
outcountsNONEOptional thresholded counts output for mode=rate
outexpNONEOptional thresholded exposure output for mode=rate
maskfileNONEOptional exposure mask output for mode=rate
expfrac0.15Exposure cut as fraction of max exposure for mode=rate
expmin Absolute minimum exposure for mode=rate
scale0.0023Scale factor for mode=oot
ascale1.0Scale factor applied to imgfile for generic arithmetic
bscale1.0Scale factor applied to imgfile2 for generic arithmetic
outunitAUTOOutput BUNIT policy: AUTO, NONE, or an explicit BUNIT label
methodgaussSmoothing method: gauss or box
sigma2.0Gaussian sigma for mode=smooth
boxsize3Boxcar size for mode=smooth
vmin RGB lower display cut
vmax RGB upper display cut
clobberyesOverwrite existing output files (yes/no)
verbose1Logging verbosity: 0=warning/error, 1=normal info, 2=debug

PARAMETERS

mode [string] Operation mode: bin, rate, oot, smooth, rgb, add, sub, mul, or div.

evtfile [file name] Input event FITS file for mode=bin.

imgfile [file name] Input FITS image for mode=rate, mode=oot, mode=smooth, mode=add, mode=sub, mode=mul, and mode=div.

imgfile2 [file name] Second FITS image for generic mode=add, mode=sub, mode=mul, or mode=div.

expfile [file name] Exposure map for mode=rate.

For mode=rate, the expfile BUNIT must be a unit scale 1 equivalent to s or cm**2 * s. A missing or blank BUNIT is treated as seconds with a warning and a rate-output HISTORY entry; scaled or unsupported units are rejected. Rate output BUNIT is count/s for seconds or count/(cm**2*s) for area-time exposure.

ootfile [file name] OoT image for mode=oot.

redfile, greenfile, bluefile [file name] Input channel images for mode=rgb.

outfile [file name] Output FITS or PNG file.

emin, emax [float] Energy limits in keV for mode=bin. For ENG or ENERGY, use the closed energy range [emin, emax], matching the HEASoft table filter. For PI, the task queries the input-specific CALDB E2PI table and selects its explicit PI values. A raw CHANNEL column is not treated as calibrated energy; run fxtpical first.

xcol, ycol [string] Event coordinate columns for mode=bin. Defaults: X and Y.

energycol [string] Select ENG, ENERGY, or PI. With auto, the task selects those columns in that order. Default: auto.

xmin, xmax, ymin, ymax, binsize [float] Image binning range and bin size for mode=bin. Spatial bounds are left-closed and right-open: [xmin, xmax) and [ymin, ymax). Each span must be an integer multiple of binsize; otherwise the task rejects the request. Defaults match a 600 by 600 SKY image.

ra, dec, pixsize [float] Optional event-to-image reprojection controls. When ra and dec are supplied together, event RA/DEC (or the selected X/Y columns through their table WCS) are projected once onto a TAN grid centered at that sky position. Angular RA/DEC column and table-WCS units convertible to degrees are accepted. pixsize is the pre-binning scale in arcsec and is inferred from the event WCS when omitted. The requested center is the center of the output image; the final pixel scale is pixsize * binsize. If ra/dec are omitted, the existing X/Y binning path is unchanged. This command writes the image; use fxtobsmerge products=reproject to persist event coordinates for repeated energy-band imaging.

outcounts, outexp, maskfile [file name] Optional thresholded counts, thresholded exposure, and mask outputs for mode=rate.

expfrac [float] Exposure cut as a fraction of maximum exposure for mode=rate. Default: 0.15.

expmin [float] Optional absolute exposure floor for mode=rate.

scale [float] Scale factor in output = imgfile - scale * ootfile. Default: 0.0023.

ascale, bscale [float] Generic arithmetic coefficients in C=(ascale*A) operator (bscale*B). Defaults: ascale=1.0 and bscale=1.0. Both must be finite.

outunit [string] Output unit policy for generic arithmetic. AUTO retains A for add/sub and derives the product or quotient for mul/div; if derivation is unavailable or the derived unit is unscaled dimensionless, the label is removed. A scaled dimensionless result retains its unit expression. NONE removes the label. An explicit BUNIT value changes only the output label and does not rescale numeric values. For add/sub only, when both inputs declare BUNIT, B is converted to A units before bscale.

method [gauss|box], sigma, boxsize Smoothing controls for mode=smooth.

vmin, vmax [float] Optional display cuts for RGB PNG output.

clobber [yes/no] Overwrite existing output files. Default: yes.