
\documentclass[11pt]{article}

\usepackage[dvips]{graphicx}      %% FOR INCLUDING GRAPHICS
\usepackage{natbib}
\usepackage{epsf}

%% ----------------------------------------------------------------------
%% Add specials here
%% ----------------------------------------------------------------------

\def\ion#1#2{#1\,{\sc #2}\relax}  %% 

%% ----------------------------------------------------------------------
%% Modify: 
%%   Note number, version number and date
%%   Title
%%   Author and affiliation 
%% ----------------------------------------------------------------------

\setlength{\oddsidemargin}{0in}         %  1 inch (0 + 1) from left.
\setlength{\topmargin}{-0.5in}          %  1 inch (1.5 - 0.5) from top.
\setlength{\textwidth}{6.5in}           %  1 inch (8.5 - 1 - 6.5) from right.
\setlength{\textheight}{9in}            %  1 inch (11 - 1 - 9) from bottom.

\addtolength{\parskip}{0.5\baselineskip}

%  The environment centerpage centers text vertically on the page.  This is
%  useful within a titlepage environment.

\newenvironment{centerpage}{\mbox{} \protect\vspace*{\fill}}{
        \protect\vspace*{\fill} \mbox{} \protect\\ \mbox{}}

\newcommand{\lam}{$\lambda$}
\newcommand{\arcsec}{$^{\prime\prime}$}
\begin{document}                
%\bibliographystyle{plain}               % Define bibliography style.

\begin{titlepage}
\hrule
\noindent\textbf{EUV IMAGING SPECTROMETER}\\
\vspace{-0.7\baselineskip}\\
{\noindent\Huge\bf Hinode}
\vspace{2mm}
\hrule
\vspace{3mm}
\centerline{\bf EIS SOFTWARE NOTE No. 14}
\vspace{3mm}
\hrule
\noindent Version 3.0 \hfill 10 March 2011
\vspace{2mm}
\hrule

\begin{centerpage}

\begin{center}
{\Large\bf Bright point detection with EIS}\\
\mbox{}\\
\mbox{}\\
Peter Young\\
Naval Research Laboratory\\
4555 Overlook Ave SW\\
Washington, DC 20004\\
U.S.A.\\
\mbox{}\\
pyoung@ssd5.nrl.navy.mil\\
\mbox{}\\
\mbox{}\\
Khalid Al-Janabi\\
Mullard Space Science Laboratory\\
Holmbury St. Mary, Dorking\\
Surrey, RH5 6NT\\
U.K.\\
\mbox{}\\
kfj@mssl.ucl.ac.uk\\
\end{center}

\end{centerpage}

\end{titlepage}

%% ----------------------------------------------------------------------
%% The document!
%% ----------------------------------------------------------------------

\section{Overview}

This Software Note gives details on how the bright point trigger works
for EIS and gives a prescription for setting the parameter values for
a specific study.

In the text we will use the term \emph{hunter study} for the study
used to detect the bright point, and \emph{response study} for the
study that will be run once a bright point is detected.

\section{Basic principles}

The bright point trigger is enabled at the planning stage, i.e., when
the EIS CO is creating the plan. It is not fixed in the study
definition. The bright point trigger should only be enabled for
studies with the following properties:
%
\begin{itemize}
\item the study contains a single raster; and
\item the raster uses one of the narrow slits (1\arcsec\ or 2\arcsec).
\end{itemize}
%
Attempts to use the bright point trigger for other studies may lead to
errors!

The threshold parameters for the hunter study need to be carefully
calculated based on the exposure time, the emission line selected for
the hunting, and the slit being used. The CO should exercise extreme
caution in choosing a hunter study ``on the fly'' at the time of
planning. 

Suppose a hunter study raster is scheduled to run 10 times, and the
5th raster detects a bright point, then the 5th raster will be \emph{fully
completed} before the response study starts, i.e., the response study
does not start immediately after the bright point is detected.

If a hunter raster detects multiple bright points that exceed the
threshold parameters, then the response study will go to the brightest
bright point. 

Any study from the EIS database can be chosen as a response
study. Note that the response study is not like other studies when it
is placed on the timeline. The pointing can not be specified (not
surprisingly) but, more importantly, it is not possible to modify the
number of repeats of the study's raster(s).

For example, if the study HH\_Flare\_180x160\_v2 was chosen as the
response study, it will only be run once with a duration of
6~mins. It is not possible to request that it be run 20 times, for
example. This means that it is best to design an ad hoc study with the
required number of repeats to be used as the response study.


\section{Enabling the bright point trigger within the planning tool}\label{sect.params}

The hunter study should be placed on the EIS timeline in the same way
as a normal study, and the CO should select a pointing and choose a
number of repeats (if necessary).

The bright point trigger is enabled by first clicking on the raster
for which the trigger is to be enabled (it is listed in the part of
the planning tool GUI that lists 'ID:', 'Acronym:',  'Compression',
etc.).
Then the CO should click on the 'Trigger
Studies' tab near the bottom of the planning tool GUI, and then click
the 'Enable Bright Point Trigger' button.

The bright point trigger parameters then need to be set, by clicking
on 'Edit Properties...'. A new widget window will appear.

The set of parameters to be specified by the CO are:
%
\begin{description}
\item[Line] Specifies the `hunter line' to be used for finding BPs.
\item[Ymin] The number of threshold pixels in the wavelength direction.
\item[Xmin] The number of threshold pixels in the Y direction.
\item[Ythresh] The threshold for the wavelength direction.
\item[Xthresh] The threshold for the Y direction.
\end{description}
%
The values for these parameters should have been given to the CO in
the weekly planning schedule, otherwise they should be in the study
description. If the CO is creating a hunter study on the fly, then a
prescription for calculating the parameter values is given below.

\section{Prescription for setting parameter values}\label{sect.prescription}

The following gives a `quicklook' prescription for setting the BP trigger
parameter values. It is intended that scientists use this
prescription for quickly generating reasonable trigger parameters
without going into the full details of the BP trigger process.

For quiet Sun BP studies the user is recommended to always use the
\ion{Fe}{xii} \lam195.12 line as the hunter line. The data window
containing this line has the size $nw\times ny$ and the values of $nw$
and $ny$ can be determined from within eis\_mk\_plan by looking at the
raster properties.

The CCD pedestal value plays an important role in setting the bright
point thresholds -- see Sect.~\ref{sect.pedestal} for more details. A
pedestal value of 505~DN for the \ion{Fe}{xii} \lam195.12 data window is
assumed here.

The Ymin and Ythresh parameters will generally not be useful so the user is
suggested to set them to Ymin=1 and Ythresh=$505\times ny$.

For Xmin a value of 7 is suggested as this helps prevent SAA events
being identified as bright points. The threshold value Xthresh should be
set to:
%
\begin{equation}\label{eq.threshold}
{\rm Xthresh}= (nx \times 505) + (k \times D_{{\rm QS},\lambda})
\end{equation}
%
where $k$ is the brightness of the expected bright point relative to
the standard quiet Sun, and $D_{{\rm QS},\lambda}$ is the average quiet Sun DN value for
the chosen line. The value  $D_{{\rm QS},\lambda}$ can be obtained
from:
%
\begin{equation}\label{eq.dn}
D_{{\rm QS},\lambda}= 0.628 \, I_{\rm QS}  A_{\rm eff}(\lambda) \,S \, t_{\rm exp}
\end{equation}
%
$I_{\rm QS}$ is the average intensity of the line in quiet Sun conditions and
values for a number of lines are given in \citet{brooks09}. $A_{\rm
  eff}$ is the EIS effective area and can be obtained as follows:
%
\begin{verbatim}
IDL> print,eis_eff_area(195.12)
\end{verbatim}
%
for the case of \lam195.12. $S$ is the width of the EIS slit in arcsec
(this only applies to the 1\arcsec\ and 2\arcsec\
slits), and $t_{\rm exp}$ is the exposure time in seconds for the
hunter study which can be found in the raster properties.

The crucial parameter for identifying bright points is $k$. Tests
using a sample quiet Sun data-set suggest that $k=3$ will lead to a
fairly quick identification, within 1--2 rasters, say. A value of
$k=4$ may take a number of rasters before identification occurs. More
details are given in Sect.~\ref{sect.test}.


\section{The detection algorithm}

This section describes in detail how the BP detection algorithm works.

Firstly some definitions. The wavelength window for the hunter line has dimensions $nw \times
ny$ where $nw$ is the 
number of pixels in the wavelength dimension and $ny$ the number of
pixels in the Y direction. The DN value of a pixel $(i,j)$ in the
array is given by $D_{ij}$.

To prevent single pixels (e.g., cosmic rays, hot pixels) triggering a
false BP response the on board software allows the user to request
that more than one adjacent pixels lie above the bright point
threshold. This is where the Ymin and Xmin parameters
(Sect.~\ref{sect.params}) come in. Instead of a single pixel acting as
a trigger, these parameters allow a region of Ymin$\times$Xmin pixels to
be the trigger. How the trigger works in practice is explained below.

% \textbf{Step 1} The user specifies the following trigger parameters:

% \begin{description}
% \item[Ymin] The size of the group of pixels in W (wavelength)
% \item[NY] The size of the group of pixels in Y (wavelength)
% \item[LW] The threshold for the wavelength direction
% \item[LY] The threshold for the Y direction
% \end{description}

% A BP is only identified if NY adjacent pixels each lie above the LY
% threshold \emph{and} Ymin adjacent pixels each lie above the LW threshold.


\noindent\textbf{Step 1} The software performs the sum
%
\begin{equation}
P_j=\sum_i D_{ij}
\end{equation}
%
where $P$ will have $ny$ elements.

\noindent\textbf{Step 2} The software finds the pixel within $P$ with the
maximum intensity (denoted by $j_{\rm max}$). It then checks if Xmin
adjacent pixels that include $j_{\rm max}$ all lie above the threshold
value Xthresh. If yes, then the software moves on to the next step,
otherwise Step 2 is repeated but with the second most intense pixel
in $P$. If no pixel passes the threshold test, then the software
discards the exposure, moves on to the next one, and begins with Step
1.

\noindent\textbf{Step 3} If the exposure has passed the threshold test in Step
2, then the following vector is computed:
%
\begin{equation}
Q_i=\sum_j D_{ij}
\end{equation}
%
where $Q$ will have $nw$ elements.

\noindent\textbf{Step 4} The software finds the pixel within $Q$ with the
maximum intensity (denoted by $i_{\rm max}$). It then checks if Ymin
adjacent pixels that include $i_{\rm max}$ all lie above the threshold
value Ythresh. If yes, then the software moves on to the next step,
otherwise Step 4 is repeated but with the second most intense pixel
in $Q$. If no pixel passes the threshold test, then the software
discards the exposure, moves on to the next one, and begins with Step
1.

\noindent\textbf{Step 5} If $D(i_{\rm max},j_{\rm max})$ is larger than the
$D(i_{\rm max},j_{\rm max})$  value for any previous exposure in the raster,
then the pixel position becomes the new bright point
position. Otherwise the old position is retained.

\noindent\textbf{Step 6} After the raster is completed, if a pixel has been
identified as a bright point, then the location of that pixel (in
solar-X and solar-Y) will be passed on to the response study.


A key point to note is that, upon finding a bright point, the software
will not immediately jump to the response study. The hunter study
raster must be completely finished before the response study begins.

\section{CCD pedestal values}\label{sect.pedestal}

A significant contribution to the threshold values comes from the CCD
pedestal. To see this, consider the case where $nw=16$, $ny=512$,
and \ion{Fe}{xii}
\lam195.12 is used as the trigger line. 

The CCD pedestal for the CCD quadrant containing \lam195.12 is about
505~DN. Constructing the vector $P$ results in the elements of $P$
having \emph{minimum} values of $16\times 505=8080$~DN. Therefore the
threshold Xthresh must be larger than this.

For the vector $Q$, the elements will have minimum values of
$512\times 505=258,650$~DN, so the threshold LX must be larger than
this. 



\section{Testing with real data}\label{sect.test}

The quiet Sun was monitored over a 3 day period during 2008 January
22-25 as part of HOP 59. The study cam\_qs\_2as\_context was run at approximately
50~min intervals over this time, yielding 74 rasters in all. The
rasters covered an area of 180\arcsec\ x 360\arcsec\ and were obtained with the 2\arcsec\ slit
and 30s exposures.

Using the prescription outlined in Sect.~\ref{sect.prescription}, the
set of rasters from HOP 59 was tested to determine how many of them
resulted in a bright point being identified using the \ion{Fe}{xii}
\lam195.12 line. The results are
summarized in Table~\ref{tbl.test} for six different values of $k$.

\begin{table}[h]
\caption{BP detection results.}
\begin{center}
\begin{tabular}{lllllll}
\noalign{\hrule}
\noalign{\smallskip}
\noalign{\hrule}
\noalign{\smallskip}
%% table headings here
 & $k=3$ & $k=3.5$ & $k=4$ & $k=4.5$ & $k=5$ & $k=6$ \\
\noalign{\hrule}
\noalign{\smallskip}
%% table entries here
No. of rasters with BPs & 72/74 & 67/74 & 62/74 & 54/74 & 41/74 & 23/74\\
Average no. of BPs in raster & 13.9 & 8.5 & 5.1 & 3.2 & 1.9 & 0.9 \\
Longest run without a detection & 2 & 5 & 7 & 7 & 7 & 15\\
\noalign{\hrule}
\end{tabular}
\end{center}
\label{tbl.test}
\end{table}

Setting $k=3$ results in a BP being detected for most of the rasters
thus seems to be a good option if you simply want to find the
brightest region in the hunter study's field of view. If your science
requires study of a particularly bright BP then setting high values of
$k$ will be necessary.


\section{Study design considerations}

The scientist should first determine if the hunter study data will be
scientifically useful. If not then a very basic hunter study can be
used which will consume very little of the EIS data volume. For
example, since BPs typically extend over 5--20 pixels in solar-X and Y
then it is not necessary to sample a continuous range in X. E.g., the
slit can jump 4\arcsec\ between positions. Also since only the hunter line
is needed for the trigger, the study can only contain this
line. Finally, since only the core of the emission line is going to
trigger a BP response, then the wavelength window can be set to 16 or
even just 8 pixels. 

As an example, consider a raster area of 360\arcsec x 512\arcsec, exposure times of
30s and the 2\arcsec\ slit. Choosing just one line with a 16 pixel window, a
4\arcsec\ step size, and DPCM compression leads to a data volume of
4.9~Mbits and a raster cadence of 50~mins (data rate 1.6~kbits/s).

When creating a response study, scientists should define the number of
rasters they want in the study definition. E.g., if the scientist
considers that 20 rasters are required to obtain the time evolution of
the bright point then he/she should set the number of repeats in the
study definition (at the eis\_mk\_study stage). \emph{The number of
  repeats can not be adjusted at the planning stage.}

\section{Test of BP trigger (2010 June)}

During the EIS planning week of 2010 June 19-26 the EIS BP trigger was
tested on board for the first time. The hunter study, BP\_HUNTER1 (ID:
422), was defined to cover an area 456\arcsec\ $\times$ 512\arcsec\
using the 2\arcsec\ slit, taking only the \ion{Fe}{xii} \lam195.12
line. The exposure time was 20~s, and the window size for \lam195.12
was 16 pixels. The raster duration was 88~mins and the predicted data
volume was 12.2~Mbit.

The response study, BP\_RESPONSE1\_2RASTER (ID: 421), has a raster
that covers
100\arcsec\ $\times$ 128\arcsec\ with the 2\arcsec\ slit and returns
13 emission lines with an exposure time of 20~s. The study definition
requires the raster to run twice and the study duration (to run two rasters)
is 39~min, and the data volume is 27~Mbit.

For the first test on June 20 the detection parameters were set
according to the prescription set in
Sect.~\ref{sect.prescription}. For the following two tests on June 24
and 25 the threshold for detection was modified such that the bright
point was required to be only a factor 2 bright than average quiet
Sun.

All three runs of BP\_HUNTER1 resulted in a response with the response
study successfully covering a bright point. Some comments on the
results:

\begin{enumerate}
\item The detection raster crossed South Atlantic Anomaly (SAA)
events  a couple of times and this did 
not have an adverse effect on the on-board processing. The detection 
algorithm guards that were put in place to avoid false triggers in 
response to “cosmic ray hits” therefore functioned as desired. 
\item Unlike the ground testing, the flight response raster wasn’t located 
(pointed) dead-centre around the BP. Generally speaking and accounting 
for worse case, the event is off centre by around 6” in the X-direction 
(west shift) and 8” in the Y-direction (South shift). This is for BPs 
detected very close to the Sun centre. The closer to the Sun centre, the 
bigger the drift. The most likely cause of this problem is satellite
(or instrument) jitter during the observation, thus when the EIS
scanning mechanism returned to the location of the bright point, the
instrument was no longer pointed in exactly the right place.
\item For the first two bright points, the bright point remained very
  similar in appearance between the hunter study image and response
  study image. For the third bright point a significant change in
  shape occurred.
\end{enumerate}

% \section{Summary and recommendations}

% \begin{itemize}
% \item SAA events can trigger the BP response for weak and medium
%     strength emission lines. Quiet Sun signals in these lines are not
%     strong enough to enable higher thresholds to be set.
% \item \ion{Fe}{xii} \lam195.12 is probably the safest line to use.
% \item The test data-set suggests that, for the 2'' slit and 30s
%   exposure times, threshold criteria of NX=2, NY=7 and L=2000 will
%   lead to a BP being detected on timescales of 1--10 hours. Increasing
%   L to 3000 leads to timescales of 5--50 hours.
% \item Threshold values do not directly scale with exposure time because of the
%   CCD pedestal (which is about 500 DN). 
% \end{itemize}

\section{Alternative use of the BP trigger: active region loop
  footpoints}

The BP trigger is not just restricted to quiet Sun bright points, and
it can be used to automatically identify any bright, compact feature. An
example is active region loop footpoints which, when observed in a
cool line such as \ion{Fe}{viii} \lam185.21, show fairly compact,
``spiky'' structures. A study called \verb|Hunter_loop_fe8| (Study ID:
445) was designed to hunt for bright loop footpoints. It takes only
the \ion{Fe}{viii} \lam185.21 line with an 8 pixel wide window, and
covers a spatial area of 452\arcsec\ $\times$ 512\arcsec\ using the
2\arcsec\ slit with 4\arcsec\ jumps in 23~mins. The data volume is
only 3.3~Mbits.

\verb|Hunter_loop_fe8| was run on 2011 August 30 at 01:41~UT, and the
left panel of Fig.~\ref{fig.hunter-loop} shows the image from the
raster. The response study was \verb|Cool_loop_response|, and the
\ion{Fe}{viii} \lam185.21 image from the first raster of this study,
obtained at 02:04~UT, is shown in the right panel of
Fig.~\ref{fig.hunter-loop}. As can be seen, the BP trigger did an
excellent job of finding the brightest loop footpoint in the active
region. 


\begin{figure}[h]
\centerline{\epsfxsize=13cm\epsfbox{plot_20110830_images.eps}}
\caption{The left panel shows the \ion{Fe}{viii} \lam185.21 intensity
  image from the Hunter\_loop\_fe8 ``hunter'' study. The right
  panel shows the \lam185.21 image from the Cool\_loop\_response
  response study. The box on the left panel shows the region observed
  with the response study.}
\label{fig.hunter-loop}
\end{figure}

The trigger parameters were determined by analyzing an earlier
observation of loop footpoints, where it was found that a value 980~DN
(integrated intensity over the \ion{Fe}{viii} line in a 10~s exposure
assuming the 2\arcsec\ slit) would be a suitable value for a
moderately bright footpoint. The pedestal level for the band
containing the \ion{Fe}{viii} line is about 560~DN, therefore the
Xthresh value was set at $(560\times 8)+980=5460$~DN. The Xmin and
Ymin values were set to the same as those for the quiet Sun hunter
study, and Ythresh was set to $560 \times 512=286\,720$~DN


\begin{thebibliography}{}

\bibitem[Brooks et al.(2009)]{brooks09}
  Brooks, D. H., Warren, H. P., Williams, D. R., \& Watanabe, T. 2009,
  ApJ, 705, 1522

\end{thebibliography}


\end{document}
