%+
% Name:
% afterglow_spec_2.5.tex
%
% History:
% 2008 Feb 10, created (v1.0), Glenn E. Allen
% 2008 Feb 11, added cntthresh (v1.1), GEA
% 2008 Feb 12, added maskfile (v1.2), GEA
% 2008 Feb 13, added comments about interleaved mode (v1.3), GEA
% 2008 Jul 23, significantly revised (v1.4), GEA
% 2008 Jul 28, added SAMP_CYC (v1.5), GEA
% 2008 Jul 29, added regwidth (v1.6), GEA
% 2008 Jul 30, minor edits (v1.7), GEA
% 2008 Aug 13, changed a typo in the cntthresh default and min values
% (v1.8), GEA
% 2010 Aug 16, changed some things to \tt (v1.9), GEA
% 2011 Feb 10, added the hot-pixel algorithm, changed equations 10 and 13,
% added a footnote about the series used for equations 10 and 13, added
% the parameters nfpixreg and nfrepeat (v2.0), GEA
% 2011 Feb 21, added the color blue, made various minor changes (in blue),
% added the parameter tolerance, added a footnote for eqns. 9, tried to
% clarify the calculation of the fluence, added a formula for the
% standard deviation, specified the TIMEs and TIME_STOPs for hot pixels,
% added two new caveats and removed a caveat about TIME and TIME_STOP
% (v2.1), GEA
% 2011 Feb 24, changed eqn. 8 from P_{pre} to P_{post} (v2.2), GEA
% 2011 Mar 04, tried to clarify what constitutes a hot pixel (v2.3), GEA
% 2011 Mar 07, modified the computation of P_{\rm ref} to include the
% number of trials (v2.4), GEA
% 2011 Sep 12, added bad columns and streak events to the list of invalid
% pixels (v2.5), GEA
%-
\documentclass{article}
\usepackage{changebar}
\usepackage{cxo-memo-logo}
\usepackage[dvips]{graphics}
\usepackage{epsfig}
\usepackage{gea}
\usepackage{pstricks}
\newrgbcolor{blue}{0 0 1}
\newrgbcolor{red}{1 0 0}
\begin{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 1. Header
\memobasic{
Jonathan McDowell, SDS Group Leader }{
Glenn E.\ Allen, SDS }{
Afterglow and hot-pixel spec }{
2.5 }{
http://space.mit.edu/CXC/docs/docs.html\#aft }{
/nfs/cxc/h2/gea/sds/docs/memos/afterglow\_spec\_2.5.tex }
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 2. Tool name
\section{ Afterglows and Hot pixels }
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 3. Description
\subsection{ Description }
A cosmic-ray ``afterglow'' is produced when a large amount of charge is
deposited on a CCD by a cosmic ray. Most of the charge is clocked off of the
CCD in a single frame. However, a small amount can be captured in charge
traps that release the charge relatively slowly. As a result, a sequence of
events can appear in a single detector pixel over a few frames as the
trapped charge is released.
To date, two algorithms have been used by the CXC to identify cosmic-ray
afterglows. The first algorithm was implemented in the CIAO tool {\tt
acis\_detect\_afterglow} and used for pipeline processing from the summer of
2000 to the fall of 2004. This algorithm searches for occasions when events
are detected in two or more consecutive frames on the same CCD pixel. While
the events are flagged as potential cosmic-ray afterglows and excluded from
Level 2 event-data files, the corresponding pixels are not included in the
observation-specific bad-pixel file. This algorithm finds many afterglow
events, but at the expense of discarding X-ray events associated with real
astrophysical sources. The fraction of the source events that are discarded
depends on the brightness and variability of a source.
In an attempt to minimize the loss of source events, a second algorithm was
developed and implemented in the CIAO tool {\tt acis\_run\_hotpix}, which is
a script that executes the tools {\tt acis\_find\_hotpix}, {\tt
acis\_classify\-\_hotpix} and {\tt acis\_build\_badpix}. The second
algorithm searches for detector pixels that have an unusually large number
of events that occur over a short period of time. Suspicious pixels are
added to the observation-specific bad-pixel file only if the neighboring
pixels do not have a significant excess of events. This condition helps
insure that events associated with dithered sources are not discarded.
Events associated with afterglows are flagged and excluded from Level 2
event-data files. The newer algorithm has been used for pipeline processing
(and reprocessing) since the fall of 2004. While it is relatively gentle on
astrophysical sources, it does let some afterglows ``slip through the
cracks.'' The afterglow detection efficiency depends on the number of events
in the afterglow. The efficiency declines quickly as the number of events
in an afterglow drops below about eight.
This spec describes, in part, a third afterglow-detection algorithm, which
is implemented in the tool {\tt acis\_find\_afterglow}. Like the second
algorithm, it is designed to avoid discarding events associated with real
astrophysical sources. It is also designed to enhance the detection
efficiency for afterglows that have as few as four events. The principal
change between the second and third afterglow-detection algorithms is that
the third algorithm searches for afterglows using the events in a short,
sliding time window instead of using the events from the entire duration of
an observation. The algorithm searches in three dimensions instead of two.
Another change is that the algorithm is designed to try to prevent bright
sources in the field of view from reducing the afterglow detection
efficiency.
The latter change has also been incorporated into a new hot-pixel detection
algorithm, which is included here. Since the tool {\tt
acis\_find\_afterglow} includes both the afterglow and hot-pixel detection
algorithms, it supersedes the tools {\tt acis\_find\_hotpix} and {\tt
acis\_classify\_hotpix}. It also supersedes {\tt acis\_detect\_after\-glow}
because it is sensitive to afterglows with four or more events.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 4. Input
\subsection{ Input }
\begin{enumerate}
\item
A Level 1 event-data file (acis*evt1.fits)
\item
A Level 1 observation-specific bad-pixel file (acis*bpix1.fits)
\item
A Level 1 mask file (acis*msk1.fits)
\item
A Level 1 exposure statistics file (acis*stat1.fits)
\end{enumerate}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 5. Output
\subsection{ Output }
\begin{enumerate}
\item
An updated observation-specific bad-pixel file
\end{enumerate}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 6. Parameters
\subsection{ Parameters }
\begin{enumerate}
\item
{ \tt infile,s,a,"",,,"Name of input event-data file" }
\item
{ \tt outfile,s,a"",,,"Name of output bad-pixel file" }
\item
{ \tt badpixfile,s,a,"",,,"Name of input bad-pixel file" }
\item
{ \tt maskfile,s,a,"",,,"Name of input mask file" }
\item
{ \tt statfile,s,a,"",,,"Name of input exposure-statistics file" }
\item
{ \tt expnowindow,i,h,10,1,100,"Number of frames in the sliding time
window" }
\item
{ \tt probthresh,r,h,0.001,1.0e-10,0.1,"Minimum post-trials significance
of potential after\-glows (\eg, 1 sigma = 0.159, 90\% = 0.1, 2 sigma =
0.0228, 99\% = 0.01 and 3 sigma = \\ 0.00135)" }
\item
{ \tt cntthresh,i,h,4,2,10,"Minimum number of events in an afterglow" }
\item
{ \tt regwidth,i,h,7,3,255,"Size of reference region (\eg, 7~pixels
$\times$ 7~pixels)" }
\item
{ \tt nfpixreg,i,h,32,16,256,"Size of region used to calculate the
fluence" }
\item
{ \tt nfrepeat,i,h,10,1,30,"Number of iterations during the calculation
of the fluence" }
\item
{ \tt tolerance,r,h,1.0e-15,1.0e-16,1.0e-6,"Tolerance" }
\item
{ \tt clobber,b,h,"no",,,"Overwrite output file if it exists?" }
\item
{ \tt verbose,i,h,0,0,5,"Amount of messages produced (0=none, 5=a lot)" }
\item
{ \tt mode,s,h,"ql",,, }
\end{enumerate}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 7. Processing
\subsection{ Processing }
In the standard ACIS pipeline, the afterglow-detection algorithm is used
after the bias(es) has been searched for bad bias values, after the
bias-parity error file(s) has been searched for bad pixels and the ``FEP0''
problem, and before the event data is searched for hot pixels. The
afterglow and hot-pixel detection algorithms are summarized below.
Verify that the {\tt infile}, {\tt badpixfile}, {\tt maskfile}, and {\tt
statfile} exist.
%
If {\tt clobber=no}, then verify that the {\tt outfile} does not exist.
%
Verify that the {\tt infile} has {\tt READMODE=TIMED}. The afterglow and
hot-pixel detection algorithms are not appropriate for {\tt
READMODE=CONTINUOUS}.
%
Verify that the values of the parameters {\tt expnowindow}, {\tt
probthresh}, {\tt cntthresh}, {\tt regwidth}, {\tt nfpixreg}, {\tt
nfrepeat}, and {\tt tolerance} are in the valid ranges for these parameters.
%
Note that {\tt regwidth} must be an odd number.
%
The only valid values for the parameter {\tt nfpixreg} are 16, 32, 64, 128,
and 256, values for which a node can be sub-divided into an integer number
of equal-sized regions.
\subsubsection{ Afterglows }
\begin{enumerate}
\item
Exclude ``invalid'' pixels%
%
\footnote{Here an invalid pixel is one that has ${\tt SAMP\_CYC} = 0$ in
the {\tt maskfile}, {\red that has {\tt STATUS} bit 15 (streak) set in
the {\tt infile}, but only for the duration of the streak}, or that has
one or more of the following {\tt STATUS} bits set in the {\tt
badpixfile}.
\vspace*{1.0\baselineskip}
\hbox{
\hspace*{0.25in}
\begin{tabular}{cll}
Bit & Description & Notes \\ \hline
0 & bad pixel & \\
{\red 1} & {\red bad columns} & \\
2 & bias-parity error & only for the duration of the error \\
3 & bias = 4095 & \\
4 & bias = 4094 & \\
13 & FEP0 problem & only for the duration of the error \\
15 & afterglow & only for the hot-pixel algorithm and only for the
duration of the afterglow \\
16 & bad bias value & \\
\end{tabular}
}
\vspace*{1.0\baselineskip}
\noindent
%
Note that the {\tt STATUS} bits are numbered from 0 to 31. It is not
necessary to ignore pixels that have bias values of 4096 (\ie, are
missing data) because biases with such problems are adjusted on the
ground. If they are not adjusted, then all events on pixels with a
bias value of 4096 are discarded.}
%
from the search.
\item
To improve the performance of the algorithm, perform more than one pass
through the data. In the first pass, potential afterglow events are
identified as suspicious using a minimum set of criteria. Events $i$
and $j$ may be part of an afterglow if the following four conditions are
satisfied.
%
\begin{eqnarray}
{\tt CCD\_ID}_{i} & = & {\tt CCD\_ID}_{j} \label{eqn01}, \\
{\tt CHIPX}_{i} & = & {\tt CHIPX}_{j}, \\
{\tt CHIPY}_{i} & = & {\tt CHIPY}_{j},\ {\rm and} \\
|{\tt EXPNO}_{i} - {\tt EXPNO}_{j}| & \le & {\tt expnowindow}.
\label{eqn04}
\end{eqnarray}
\item
During a subsequent pass through the data, the $i$th, $(i+1)$th,
{\ldots}, $(i+n)$th events on a pixel are identified as an afterglow if
each consecutive pair of events in the set satisfies
equations~\ref{eqn01}--\ref{eqn04} and if
%
\begin{eqnarray}
N_{\rm evt}^{\rm aft} & \ge & {\tt cntthresh}, \\
P_{\rm post}^{\rm aft} & < & {\tt probthresh},\ {\rm and}
\label{eqn06} \\
P_{\rm post}^{\rm ref} & \ge & {\tt probthresh}, \label{eqn07}
\end{eqnarray}
%
where the post-trials probabilities%
%
\footnote{Equations~\ref{eqn09} and \ref{eqn09b} should be computed as
shown only if $N_{\rm trial} P_{\rm pre} \ge 0.693148$. Otherwise, if
$N_{\rm trial} P_{\rm pre} < 0.693148$, then use
%
\begin{equation}
P_{\rm post}
=
\frac{ N_{\rm trial} P_{\rm pre}}{1!} -
\frac{ N_{\rm trial} \left( N_{\rm trial} - 1 \right) P_{\rm pre}^{2}
}{2!} +
\frac{ N_{\rm trial} \left( N_{\rm trial} - 1 \right)
\left( N_{\rm trial} - 2 \right) P_{\rm pre}^{3} }{3!} - {\ldots} -
\frac{ N_{\rm trial} \left( N_{\rm trial} - 1 \right) {\ldots}
\left( N_{\rm trial} - 15 \right) P_{\rm pre}^{16} }{16!}
\label{eqn08}
\end{equation}
%
to avoid some concerns about numerical precision. Equation~\ref{eqn08}
has a relative precision of about $2 \times 10^{-16}$ or better. }
%
\begin{equation}
P_{\rm post}^{\rm aft}
=
1 -
\left(
1 - P_{\rm pre}^{\rm aft}
\right)^{N_{\rm trial}^{\rm aft}},
\label{eqn09}
\end{equation}
%
%
\begin{equation}
P_{\rm post}^{\rm ref}
=
1 -
\left(
1 - P_{\rm pre}^{\rm ref}
\right)^{N_{\rm trial}^{\rm ref}},
\label{eqn09b}
\end{equation}
%
the pre-trials probability $P_{\rm pre}^{\rm aft}$ is given by the series%
%
\footnote{Each term in the series is of the form $\mu^{n} / ( n! \exp
\mu )$. In practice, the series does not extend to infinity. The last
term is the one for which $n = N$, where $N$ is the smallest integer
that satisfies the relation
%
\begin{equation}
\frac{\mu^N}{N!} <
{\tt tolerance}
\left[
\frac{1}{2} \frac{\mu^{n_{\rm 0}}}{n_{0}!} +
\frac{\mu^{n_{\rm 1}}}{n_{1}!} + {\ldots} +
\frac{\mu^{N-1}}{(N-1)!}
\right].
\end{equation}
}
%
\begin{equation}
P_{\rm pre}^{\rm aft}
=
\left[
\frac{1}{2}
\frac{
\left( N_{\rm bgd}^{\rm aft} \right)^{N_{\rm evt}^{\rm aft}}
}{
N_{\rm evt}^{\rm aft}!
} +
\left(
\sum_{n=N_{\rm evt}^{\rm aft}+1}^{\infty}
\frac{\left( N_{\rm bgd}^{\rm aft} \right)^{n}}{n!}
\right)
\right]
e^{-N_{\rm bgd}^{\rm aft}},
\end{equation}
%
$N_{\rm evt}^{\rm aft}$ is the number of events in the potential
afterglow, the number of background events for the potential afterglow
%
\begin{equation}
N_{\rm bgd}^{\rm aft}
=
\frac{ F }{ {\tt SAMP\_CYC}_{\rm aft} }
\left(
\frac{
N_{\rm frame}^{\rm aft}
}{
N_{\rm frame}^{\rm tot}
}
\right),
\end{equation}
%
${\tt SAMP\_CYC}_{\rm aft}$ is the sample cycle for the pixel on which
the potential afterglow occurred,
%
$N_{\rm frame}^{\rm aft}$ is the number of valid frames%
%
\footnote{Here an invalid frame for a CCD is one that is not listed in
the {\tt statfile}. For {\tt TIMED} mode observations, frames with
${\tt EXPNO} < 3$ are invalid. Note that a frame does not have to
include an afterglow event to be included in $N_{\rm frame}^{\rm aft}$.
For example, if a pixel has afterglow events in frames 100, 101, 104,
107, 109, 113, and 119, and if all of the frames from 100 to 119 are
valid, then $N_{\rm frame}^{\rm aft} = 20$.}
%
in the afterglow,
%
$N_{\rm frame}^{\rm tot}$ is the total number of valid frames for the CCD,
%
the number of trials%
%
\footnote{This estimate is an upper limit on the number of trials. The
actual number of trials includes only the number of ``independent''
searches. Since adjacent windows in the sliding {\tt EXPNO} window
overlap, they are not independent. A lower limit on $N_{\rm trial}^{\rm
aft}$ can be obtained by calculating the number of nonoverlapping
windows. This value is smaller than equation~\ref{eqn11} by a factor of
about $({\tt expnowindow + 1})$. Since a precise value for $N_{\rm
trial}^{\rm aft}$ can be difficult to determine, equation~\ref{eqn11} is
used because it yields the most conservative (\ie, the largest) number
of trials. }
%
$N_{\rm trial}^{\rm aft}$ is estimated to be
%
\begin{equation}
N_{\rm trial}^{\rm aft}
=
\sum_{k}
N_{{\rm pix},k}^{\rm ccd}
\left( N_{{\rm frame},k}^{\rm tot} - {\tt expnowindow} - 1 \right),
\label{eqn11}
\end{equation}
%
$N_{{\rm pix},k}^{\rm ccd}$ is the number of valid pixels$^{1}$ for the
$k$th CCD (\ie\ $N_{{\rm pix},k}^{\rm ccd} = 1024 \times 1024$ less the
number of invalid pixels),
%
$N_{{\rm frame},k}^{\rm tot}$ is the total number of valid frames for
the $k$th CCD,
%
the number of trials $N_{\rm trial}^{\rm ref}$ is the number of
candidate afterglows that satisfy equations~\ref{eqn01}--\ref{eqn06},
%
the pre-trials probability $P_{\rm pre}^{\rm ref}$ that the
event fluence in the reference region is consistent with the event
fluence on the entire node (\ie, that the potential afterglow or hot
pixel is not part of a dithered source) is given by the series$^{3}$
%
\begin{equation}
P_{\rm pre}^{\rm ref}
=
\left\{
\begin{array}{ll}
\left[
\frac{1}{2}
\frac{\left( N_{\rm bgd}^{\rm ref} \right)^{N_{\rm evt}^{\rm
ref}}}{N_{\rm evt}^{\rm ref}!} +
\left(
\sum_{n=N_{\rm evt}^{\rm ref}+1}^{\infty}
\frac{\left( N_{\rm bgd}^{\rm ref} \right)^{n}}{n!}
\right)
\right]
e^{-N_{\rm bgd}^{\rm ref}},
& {\rm if}\ N_{\rm evt}^{\rm ref} > 0
\\
1
& {\rm if}\ N_{\rm evt}^{\rm ref} = 0
\end{array}
\right.
\label{eqn13}
\end{equation}
%
$N_{\rm evt}^{\rm ref}$ is the total the number of events in the
reference region,%
\footnote{$N_{\rm evt}^{\rm ref}$ does not include the events on the
central pixel of the region and the events that lie on a different node
from the central pixel (if the region overlaps more than one node).}
%
$N_{\rm bgd}^{\rm ref}$ is given by
%
\begin{equation}
N_{\rm bgd}^{\rm ref}
=
\frac{F}{{\tt SAMP\_CYC}_{\rm ref}}
N_{\rm pix}^{\rm ref},
\label{eqn15}
\end{equation}
%
${\tt SAMP\_CYC}_{\rm ref}$ is the sample cycle for the pixels in the
reference region,%
%
\footnote{ Equation~\ref{eqn15} is valid only if all of the valid pixels
in the reference region have the same sample cycle. If, for example,
the reference region contains subsets A and B with $N_{\rm pix,A}^{\rm
ref}$ and $N_{\rm pix,B}^{\rm ref}$ valid pixels and sample cycles ${\tt
SAMP\_CYC}_{\rm ref,A}$ and ${\tt SAMP\_CYC}_{\rm ref,B}$, respectively,
then equation~\ref{eqn15} becomes
%
\begin{equation}
N_{\rm bgd}^{\rm ref}
=
F
\left(
\frac{ N_{\rm pix,A}^{\rm ref} }{ {\tt SAMP\_CYC}_{\rm ref,A} } +
\frac{ N_{\rm pix,B}^{\rm ref} }{ {\tt SAMP\_CYC}_{\rm ref,B} }
\right).
\end{equation}
}
%
$N_{\rm pix}^{\rm ref}$ is the number of valid pixels%
%
\footnote{$N_{\rm pix}^{\rm ref}$ does not include the central pixel of
the region (\ie\ the pixel on which the potential afterglow occurred),
pixels that lie on a different node from the central pixel, and any
other invalid pixels.$^{1}$ }
%
in the {\tt regwidth}~pixel $\times$ {\tt regwidth}~pixel reference
region surrounding the pixel with the potential afterglow, and the
nominal background fluence $F$ is computed as follows.
%
\begin{enumerate}
\item
For each {\tt nfpixreg}~pixel $\times$ {\tt nfpixreg}~pixel region
$l$ of the node,
%
\begin{equation}
F_{l}
=
{\tt SAMP\_CYC}_{l}
\frac{
N_{\rm evt}^{l}
}{
N_{\rm pix}^{l}
},
\label{eqn17}
\end{equation}
%
where ${\tt SAMP\_CYC}_{l}$ is the sample cycle for region $l$,%
%
\footnote{Equation~\ref{eqn17} is valid only if all of the valid
pixels in the region have the same sample cycle. If, for example,
the region contains subsets A and B with $N_{\rm evt,A}^{l}$ and
$N_{\rm evt,B}^{l}$ events on $N_{\rm pix,A}^{l}$ and $N_{\rm
pix,B}^{l}$ valid pixels and sample cycles ${\tt SAMP\_CYC}_{l,{\rm
A}}$ and ${\tt SAMP\_CYC}_{l,{\rm B}}$, respectively, then
equation~\ref{eqn17} becomes
%
\begin{equation}
F_{l}
=
\frac{
{\tt SAMP\_CYC}_{l,{\rm A}} N_{\rm evt,A}^{l} +
{\tt SAMP\_CYC}_{l,{\rm B}} N_{\rm evt,B}^{l}
}{
N_{\rm pix,A}^{l} + N_{\rm pix,B}^{l}
}.
\end{equation}
}
%
$N_{\rm pix}^{l}$ is the total number of valid pixels$^{1}$ in the
region, and
%
$N_{\rm evt}^{l}$ is the total number of events on these pixels
during the entire observation.
%
\item
Select the regions where $F_{l}$ is greater than zero and less than
two times the mean value of the $F_{l}$s.
\item
Set $F_{\rm med}$ equal to the median of the values of $F_{l}$
selected in step (b).
\item
Set $F_{\sigma}$ equal to the standard deviation%
%
\footnote{Here,
%
\begin{equation}
F_{\sigma}
=
\left[
\frac{1}{N_{l}}
\sum_{l}
\left( F_{l} - F_{\rm med} \right)^{2}
\right]^{1/2},
\end{equation}
where $N_{l}$ is the number of regions in the sum.
}
%
of the values of $F_{l}$ selected in step (b).
\item
From the full set of values $F_{l}$ for the node, select those where
$F_{l}$ is greater than zero, is greater than or equal to $F_{\rm
med} - 2 F_{\sigma}$, and is less than $F_{\rm med} + 2 F_{\sigma}$.
%
\label{stepf}
\item
Set $F_{\rm med}$ equal to the median of the values of $F_{l}$
selected in step (e).
\item
Set $F_{\sigma}$ equal to the standard deviation$^{11}$ of the
values of $F_{l}$ selected in step (e).
\label{stepg}
\item
Repeat steps~\ref{stepf}--\ref{stepg} an additional ${\tt
nfrepeat}-1$ times (\ie\ these steps are performed a total of {\tt
nfrepeat} times).
\item
Set $F$ equal to the value of $F_{\rm med}$ from the last iteration
of step (f).
\end{enumerate}
%
\item
Each potential afterglow that satisfies the criteria in equations
\ref{eqn01}--\ref{eqn07} is written to the {\tt outfile} with
%
\begin{equation}
{\tt TIME}
=
{\tt TIME}_{\rm start} -
{\tt TIMEPIXR} \times {\tt TIMEDEL} -
{\tt FLSHTIME}
\end{equation}
%
and
%
\begin{equation}
{\tt TIME\_STOP}
=
{\tt TIME}_{\rm stop} +
(1 - {\tt TIMEPIXR}) \times {\tt TIMEDEL},
\end{equation}
%
where ${\tt TIME}_{\rm start}$ and ${\tt TIME}_{\rm stop}$ are the {\tt
TIME}s in the {\tt statfile} that are associated with the start and stop
{\tt EXPNO}s of the afterglow and {\tt TIMEDEL}, {\tt TIMEPIXR}, and
{\tt FLSHTIME} are keywords in the {\tt statfile}.
\item
The contents of the {\tt badpixfile} are also copied to the {\tt
outfile}.
\end{enumerate}
\subsubsection{ Hot pixels }
\begin{enumerate}
\item
Exclude ``invalid'' pixels$^{1}$
\item
If there are multiple events in an observation that have the same values
of the coordinates {\tt CCD\_ID}, {\tt CHIPX}, and {\tt CHIPY}, then the
pixel is identified as hot for the entire duration of an observation if
%
\begin{eqnarray}
P_{\rm post}^{\rm hot} & < & {\tt probthresh}\ {\rm and}
\label{eqn20}
\\
P_{\rm post}^{\rm ref} & \ge & {\tt probthresh},
\label{eqn21}
\end{eqnarray}
%
where the post-trials probability $P_{\rm post}^{\rm hot}$ is given by
%
\begin{equation}
P_{\rm post}^{\rm hot}
=
1 -
\left(
1 - P_{\rm pre}^{\rm hot}
\right)^{N_{\rm trial}^{\rm hot}},
\end{equation}
%
the pre-trials probability $P_{\rm pre}^{\rm hot}$ is given by the
series$^{3}$
%
\begin{equation}
P_{\rm pre}^{\rm hot}
=
\left[
\frac{1}{2}
\frac{
\left( N_{\rm bgd}^{\rm hot} \right)^{N_{\rm evt}^{\rm hot}}
}{
N_{\rm evt}^{\rm hot}!
} +
\left(
\sum_{n=N_{\rm evt}^{\rm hot}+1}^{\infty}
\frac{\left( N_{\rm bgd}^{\rm hot} \right)^{n}}{n!}
\right)
\right]
e^{-N_{\rm bgd}^{\rm hot}},
\end{equation}
%
$N_{\rm evt}^{\rm hot}$ is the total number of events on the potential
hot pixel for the observation,
%
\begin{equation}
N_{\rm bgd}^{\rm hot}
=
\frac{ F }{ {\tt SAMP\_CYC}_{\rm hot} },
\end{equation}
%
${\tt SAMP\_CYC}_{\rm hot}$ is the sample cycle for the potential hot
pixel,
%
the number of trials
%
\begin{equation}
N_{\rm trial}^{\rm hot}
=
\sum_{k}
N_{{\rm pix},k}^{\rm ccd},
\label{eqn25}
\end{equation}
%
$N_{{\rm pix},k}^{\rm ccd}$ is the number of valid pixels$^{1}$ for the
$k$th CCD (\ie\ $N_{{\rm pix},k}^{\rm ccd} = 1024 \times 1024$ less the
number of invalid pixels),
%
$P_{\rm post}^{\rm ref}$ is given by equation~\ref{eqn09b}, where
$N_{\rm trial}^{\rm ref}$ is the number of candidate hot pixels that
satisfy equation~\ref{eqn20} and
%
the probability $P_{\rm pre}^{\rm ref}$ that the event fluence in the
reference region is consistent with the event fluence on the entire node
is given by equation~\ref{eqn13}.
\item
Each potential hot pixel that satisfies the criteria in equations
\ref{eqn20} and \ref{eqn21} is written to the {\tt outfile} with
%
\begin{equation}
{\tt TIME}
=
{\tt TIME}_{\rm start} -
{\tt TIMEPIXR} \times {\tt TIMEDEL} -
{\tt FLSHTIME}
\end{equation}
%
and
%
\begin{equation}
{\tt TIME\_STOP}
=
{\tt TIME}_{\rm stop} +
(1 - {\tt TIMEPIXR}) \times {\tt TIMEDEL},
\end{equation}
%
where ${\tt TIME}_{\rm start}$ and ${\tt TIME}_{\rm stop}$ are the {\tt
TIME}s in the {\tt statfile} that are associated with the first and the
last valid {\tt EXPNO}s, respectively, for the CCD that contains the hot
pixel, and {\tt TIMEDEL}, {\tt TIMEPIXR}, and {\tt FLSHTIME} are
keywords in the {\tt statfile}.
\item
The contents of the {\tt badpixfile} are also copied to the {\tt
outfile}.
\end{enumerate}
Once the afterglow and hot-pixel detection algorithms have been used, the
tool {\tt acis\_build\_badpix} is used to mark the pixels adjacent to such
pixels as bad and the tool {\tt acis\_process\_events} is used to set the
appropriate {\tt STATUS} bit for events associated with afterglows (bit 16
of 0--31) and hot pixels (bit 4 of 0--31).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 8. Caveats
\subsection{ Caveats }
\begin{enumerate}
\item
Since the algorithms in this spec are designed to prevent the events
associated with bright sources from being discarded, it is not possible
to find afterglows or hot pixels associated with such sources.
\item
Since any given pixel can appear no more than once in a {\tt badpixfile}
and since the columns {\tt TIME} and {\tt TIME\_STOP} in a {\tt
badpixfile} are scalars, it is not possible to identify more than one
afterglow per pixel per observation.
\item
Although it may not be optimum to do so, the afterglow and hot-pixel
detection algorithms are applied separately to the primary and secondary
data for interleaved mode observations.
\item
The algorithms are not applied to the data for continuous-clocking mode
observations.
\item
The choices of default values for the parameters {\tt expnowindow}, {\tt
probthresh}, {\tt cntthresh}, {\tt regwidth}, {\tt nfpixreg}, {\tt
nfrepeat}, and {\tt tolerance} may not be optimum.
\end{enumerate}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 9. Finish
\end{document}