NAME

xtdpixclip - Constructs histograms of counts per pixel from an Xtend event file and flags pixels that exceed user-specified thresholds within user-specified regions, and outputs the flagged pixels and events, and separately, the unflagged events

USAGE

xtdpixclip evtinfile outroot pmode

DESCRIPTION

Xtend data, even after standard screening, may suffer from pixels that have anomalously high counts due to non-source events, most often due to flickering pixels or cosmic-ray echo events. These pixels, hereafter referred to as anomalous pixels, should not be included in data analysis. Their exclusion should be propagated to the exposure map task (xaexpmap), which in turn informs corrections to the effective area (using the xaarfgen task). The xtdpixclip task identifies Xtend anomalous pixels inside of user-specified regions referred to as inclusion regions. A pixel is flagged as anomalous when the number of time-integrated counts is above a user-specified threshold for a given region. Only pixels inside of these inclusion regions are considered. Multiple regions may be specified, each with a corresponding count threshold. This task allows a user to, for example, specify one threshold for a source region and different thresholds for other, source-free regions. The task is typically run twice: once with 'pmode=histo' (this aids the user in selecting the thresholds by constructing distributions of number of pixels vs. counts per pixel), and again with 'pmode=apply', which applies the thresholds. After all anomalous pixels are flagged, the task generates a .fpix file which contains the flagged events in the EVENTS extension, and the list of flagged pixels in the PIXELS extension. The .fpix file can be used as input to the xaexpmap task, and the .expo file output from the latter task is input to the xaarfgen task. The xtdpixclip task also produces a "cleaned" event file that has all of the events from the anomalous pixels removed, and it is this event file that is used for subsequent science or other data analysis. The reason for anomalous numbers of counts in a pixel is not relevant for operation of this task, because selection of the thresholds is empirically based on the counts per pixel distribution. In many cases there will be a clear change in the shape of the distribution above a certain value of counts per pixel that deviates from that due to a celestial source. However, this may not always be the case, and the user must consider the trade-off between accepting some anomalous pixels vs. accepting some false positives. In such cases, an iterative approach can be pursued.

When xtdpixclip is operated with 'pmode=HISTO', the pixel groups inside the specified regions are sorted into uniform intervals of counts per pixel, producing a histogram of number of pixels vs. counts per pixel interval for each region. A FITS file is created with a name based on the 'outroot' parameter; e.g. if 'outroot=xa300036010xtd_p031100010_cl', the histogram file would be named "xa300036010xtd_p031100010_cl_xpc_hist.fits" (where xpc stands for xtdpixclip). This file contains an extension named HISTOGRAM, with columns for the lower boundary, upper boundary, and center of each counts-per-pixel bin (BINLO, BINHI, and BINCEN respectively). The columns REGION01, REGION02, etc. contain the arrays of number of pixels vs. counts per pixel interval. The number in these column names corresponds to the order of the inclusion region files as entered for the 'incregionfiles' parameter. For example, if 'incregionfiles=file1.reg,file2.reg' then column REGION01 will correspond to file1.reg and column REGION02 will correspond to file2.reg. The header of this extension contains keywords corresponding to each region column name whose value is the corresponding region file name. The data in this histogram file can be examined directly to determine a count rate threshold. Alternatively, plots of the region columns may be examined to determine a threshold visually. Simple versions of these plots are generated by this task in HISTO mode using fplot. These plots are created as .gif files and are also named based on the 'outroot' parameter; e.g. if 'outroot=xa300036010xtd_p031100010_cl', the histogram plot for the first region would be named "xa300036010xtd_p031100010_cl_xpc_reg01_hist.gif".

After determining an appropriate threshold for each region from running xtdpixclip in HISTO mode, the task should be run in 'pmode=APPLY' mode. This mode applies the thresholds to the pixels in each specified region, flagging anomalous pixels. Each event belonging to a flagged pixel ends up in the EVENTS extension of the output .fpix file. The .fpix file also has a PIXELS extension that lists all of the anomalous pixels by their DET coordinates. The .fpix file is named based on the 'outroot' parameter; e.g. 'outroot=xa300036010xtd_p031100010_cl' would produce a .fpix file named "xa300036010xtd_p031100010_cl_xpc_rmvpix.fpix" (where xpc stands for xtdpixclip). Additionally, this mode creates a cleaned event file if 'mkclean=yes'. This file is the complement of the .fpix file and is the list of events with all of the flagged events removed. This file is also named based on the 'outroot' parameter. For example, 'outroot=xa300036010xtd_p031100010_cl' would produce a cleaned events file called "xa300036010xtd_p031100010_cl_xpc_clnevt.fits".

The incregionfiles and excregionfiles parameters can also take a default value of "NONE". When using 'incregionfiles=NONE', a single, internally-generated inclusion region that covers the whole FoV of the image will be applied. If 'excregionfiles=NONE' then no exclusion regions will be applied at all. There is an exclusion region file provided in the HEADAS refdata directory called calsrc_XTD_det.reg. This file excludes the Xtend calibration sources. Users may consider using that exclusion region file if it is appropriate for their needs, but it will not be used unless specified.

Both modes ('pmode' set to HISTO or APPLY) make use of inclusion, and optionally, exclusion region files. These files must be formatted as SAO regions in detector coordinates. In APPLY mode the number of inclusion region files must match the number of threshold values in the 'thresholds' parameter. The input region files may contain multiple SAO regions. In the case of an inclusion region file having multiple regions, the threshold that corresponds to that file will be used for all regions in that file. Additionally, complicated regions that make use of multiple inclusion and exclusion regions in a single file may be used. Pixels that are inside of exclusion regions are completely ignored by the tool. This means that all events inside of an exclusion region will be listed in the cleaned events list if one is generated.

The user may specify a PI channel range by means of the energy bounds parameters 'emin' and 'emax' for the lower and upper boundary respectively (units are keV). Events outside of this range are not included in either the histogram nor the pixel flagging algorithm. Whatever energy range is used to flag anomalous pixels, the cleaned event file will have events with all energies removed from anomalous pixels. Likewise, all events that do not occur in anomalous pixels will be included in the cleaned event file, regardless of the values of 'emin' and 'emax'. The user may also specify a GTI file using the 'gtifile' parameter to filter the input event file. Events outside of the GTI are filtered out completely and are therefore not included in either the histogram nor the pixel flagging algorithm. These events will not appear in either the .fpix file nor the cleaned event file, because they are completely filtered out before those files are generated.

Note that the overlaps between the regions in different inclusion region files should be avoided if possible. If regions in two or more files overlap, the threshold for the first of the overlappling files, as ordered in 'incregionfiles', will be applied in the overlapping region or regions. Overlapping inclusion regions in the same region file get the same threshold. Exclusion regions in the 'excregionfiles' list take precedence over inclusion regions if an exclusion region in that list overlaps with an inclusion region. However, the treatment of exclusion regions overlapping with inclusion regions in the 'incregionfiles' list is more complex. In that case, an exclusion region over-rides all inclusion regions that precede it in the list.

PARAMETERS

evtinfile [filename]
Name of the input Xtend FITS event list. This would most commonly be the screened event file from the pipeline output.

outroot [string]
Root name for output files. Various suffixes are added to 'outroot' to create file names, based on the type of output file. Histogram data files are named 'outroot'_hist.fits, and histogram plots are named 'outroot'_hist.gif. The flagged pixel file name is 'outroot'_rmvpix.fpix, and the cleaned event file is 'outroot'_clnevt.fits.

pmode [string histo|apply]
Mode for the task to run. If set to "HISTO", histograms are generated of the number of pixels vs. counts per pixel for each region file provided by the 'incregionfiles' parameter. These histograms can be used to determine appropriate threshold values for flagging pixels as anomalous. If set to "APPLY", the thresholds specified by the user will be used to flag pixels as anomalous. An .fpix file will be generated containing all of the flagged events, as well as a list of the flagged pixels.

(emin = 0.0) [double]
Minimum energy [keV] an event must have to be considered for contributing to a histogram or to the cumulative counts per pixel that will be tested against the clipping thresholds. Events that are not from flagged pixels that have an energy below this value will still be saved to the cleaned events file if one is generated.

(emax = 12.0) [double]
Maximum energy [keV] an event may have to be considered for contributing to a histogram or to the cumulative counts per pixel that will be tested against the clipping thresholds. Events that are not from flagged pixels that have an energy above this value will be still be saved to the cleaned events file if one is generated. There are 4096 PI channels and 0.006 keV per PI channel; therefore the maximum allowed value of emax is 24.575 keV.

incregionfiles [filename NONE|file name]
Name (or list of names) of input inclusion region files. Pixels falling inside these regions will be considered for both histogram generation and the pixel clipping algorithm, depending on which mode of operation the task is run in. Events outside of these regions are ignored and will not be flagged as anomalous, therefore they will be passed on to the cleaned events file if one is generated. The regions must be in detector coordinates, and must be in SAO region format. There may be multiple regions per file, but the number of inclusion region files and number of thresholds must match. If "NONE" is used then a single inclusion region that covers the whole FoV of the detector will be internally generated and applied.

excregionfiles [filename NONE|file name]
Name (or list of names) of input exclusion region files. Pixels falling inside these regions will not be considered for making histograms ('pmode=HISTO'), nor for applying threshold cuts ('pmode=APPLY'). Events falling inside of these regions will not be marked as anomalous and therefore will be passed on to the cleaned events file if one is generated. The regions must be in detector coordinates, and must be in SAO region format. There may be multiple regions per file. If "NONE" is used then no exclusion regions will be applied.

thresholds = "1000" [string]
List of threshold values of counts per pixel for each inclusion region. There must be one threshold value for each inclusion region file. If multiple regions are included in a single file, the threshold corresponding to that file will be applied to all regions in that file. The values may be separated by spaces or commas.

(nhistbins = -1) [integer]
Number of bins in the generated histograms. If set to -1 the number of bins will be equal to the maximum number of counts. This means there will be one histogram bin per count increment.

(gtifile = "NONE") [filename NONE|file name]
The name of the input GTI file for filtering the input evtinfile. If a file name is provided, the filtered event file will also be saved and named based on the 'outroot' parameter; e.g. if 'outroot=xa300036010xtd_p031100010_cl', the filtered event file will be named 'xa300036010xtd_p031100010_cl_xpc_filtered.fits'. If set to "NONE" then all events in the input file are used.

(mkclean = yes) [boolean yes|no]
This parameter determines whether or not a cleaned events list is produced. This file does not include any events that occur in anomalous pixels, and is the complement of extension 1 of the .fpix file, and contains data from all of the pixels that were not flagged as anomalous.

(buffer = -1) [integer -1|0|N]
Rows to buffer (-1=auto, 0=none, N>0=number of rows).

(clobber = no) [boolean yes|no]
Overwrites the existing output file if set to yes.

(chatter = 1) [integer 0|1|2|3]
Chatter level for output. Set to 0 to suppress output, or to 1, 2, or 3 for increasing the chatter of the output.

(logfile = !DEFAULT) [string]
Log file name. If set to DEFAULT, uses the name of the task and, if preceded by "!", overwrites the file if it exists. If set to NONE, no log file is created.

(debug = no) [boolean yes|no]
Diagnostic output is printed to the screen if set to yes.

(history = yes) [boolean yes|no]
Records task parameters in HISTORY.

EXAMPLES

  1. Run xtdpixclip in 'histo' mode with three inclusion region files with one or more inclusion regions each, and a text file list of exclusion region files. This will produce the histogram file 'MY300036010_xpc_hist.fits' that contains the columns REGION01, REGION02, REGION03 corresponding to the inclusion region files box1.reg, circle1.reg, and box2.reg respectively. These columns will contain the number of pixels vs. the counts per pixel interval, which will also be plotted in the output files "MY300036010_xpc_reg01_hist.gif", "MY300036010_xpc_reg02_hist.gif", and "MY300036010_xpc_reg03_hist.gif"
    xtdpixclip evtinfile=xa300036010xtd_p031100010_cl.evt outroot=MY300036010 pmode=HISTO \
        incregionfiles="box1.reg,circle1.reg,box2.reg" excregionfiles="@exc_files.txt"
    
  2. Run xtdpixclip in 'apply' mode with the same three inclusion region files and list of exclusion regions as in the previous example, with three thresholds that are determined by the examining the results from the previous run in HISTO mode. A cleaned event list will also be generated because 'mkclean=yes' is set. This will produce two output files: MY300036010_xpc_rmvpix.fpix and MY300036010_xpc_clnevt.fits.
    xtdpixclip evtinfile=xa300036010xtd_p031100010_cl.evt outroot=MY300036010 pmode=APPLY \
        incregionfiles="box1.reg,box2.reg,circle1.reg" excregionfiles="@exc_files.txt" \
        thresholds="100.0 1250.0 200.0" mkclean=yes
    

SEE ALSO

xaexpmap, searchflickpix

LAST MODIFIED

August 25, 2025