
\documentclass[11pt]{article}

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

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

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

%% ----------------------------------------------------------------------
%% 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{}}

\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. 10}
\vspace{3mm}
\hrule
\noindent Version 1 \hfill  6 January 2010
\vspace{2mm}
\hrule

\begin{centerpage}

\begin{center}
{\Large\bf CCD Dark Current and Bias}\\
\mbox{}\\
\mbox{}\\
Paul Bryans \\ 
Naval Research Laboratory\\
Code 7670\\
Washington, DC 20375, USA\\
\mbox{}\\
\verb+pbryans@ssd5.nrl.navy.mil+\\
\mbox{}\\
\end{center}

\end{centerpage}

\end{titlepage}

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

\section{Overview}

The following document provides an overview of issues related to the CCD dark
current and CCD bias (or pedestal) that are present on the readout from the EIS
detectors. We discuss the procedure used by \verb+eis_prep+ to remove the dark
current, and highlight the resulting issues of which the user should be aware.

The dark current is seen to vary both in time and with position on the detector;
the distribution of the dark current about its average has increased over time,
and there is variation in the dark current level with wavelength and slit
position.  However, \verb+eis_prep+ treats the dark current value as constant
over the detector, introducing error to the spectrum.  The purpose of this
document is to evaluate the effects of treating the dark current as a constant,
and quantify their impact on data analysis.


\section{Bias and Dark Current Subtraction}

The raw data spectra are found to sit on a background of around 500 DN that
arises principally from the CCD bias (or pedestal), and secondly from the CCD
dark current.  The default method of subtracting the bias and dark current
employed by \verb+eis_prep+ is to determine the background level from the
science data themself.  The exact method of estimating this value is dependent
on whether the observation used wavelength windows or a full CCD spectrum;
further details are given in Section~\ref{section:eisprep}. In either case, once
determined, the background level is assumed to be constant over the data
window.  This constant background value is subtracted from the spectra by
\verb+eis_prep+.

One failing of subtracting such a constant bias and dark current is that it can
result in pixels with negative DN values. The default mode for \verb+eis_prep+
sets pixels with zero or negative DN values to be missing data. This is because
it is not possible to assign a photon noise error to the data points.  However,
particularly for full CCD spectra observing regions of low emission, the number
of pixels with negative DN values can be significant. By setting the
\verb+/retain+ keyword in \verb+eis_prep+, pixels with zero or negative DN
values will not be flagged as missing. The errors for these pixels will be set
to the dark current error estimate.


\section{Test Data}

For the tests performed here, we have used the data from dark frame calibration
exposures.  These exposures are run periodically with the shutter closed for the
purpose of identifying warm and hot pixels (see Section~\ref{section:warm
hot}).  With the warm and hot pixels removed, these exposures result in a
measure of the bias and dark current.

The full CCD height measures 1024 rows while the slit measures 512 CCD rows. The
middle 512 rows of the CCDs were used at the beginning of the mission until
January 2008 when the change was made to read-out the full CCD height. The dark
frame exposures are for the middle 512 rows until 18th January 2008. From the
19th January 2008 onwards the dark frame exposures are for the full CCD height
(split into rows 1--512 and rows 512-1023 rows; row 0 is not read out). The
bottom rows are read using EIS study \verb+regcal071+ and the top rows are read
using EIS study \verb+regcal072+.

Dark frame exposures are generally taken once per week.  Here, we have sampled
both top and bottom pixel maps in 6 month intervals  from February 2007 to
August 2009. Data are read out in four channels for every exposure, with each
detector split into two wavelength windows.  The pedestal is not constant over
the four read-out channels. We have applied  \verb+eis_prep+ using the
\verb+/noabs+ keyword to each of the files listed above.  This results in the
removal of warm and hot pixels, and the subtraction of a constant bias plus dark
current estimate.  The value of this background level is estimated separately
for each read-out channel.


\section{Temporal Variations}

There has been some degradation in the constancy of the dark current over the
{\it Hinode} mission thus far. Figure~\ref{fig:temporal variation} shows
histograms of the  intensity from the dark frame exposures for the datasets on
2007 Feb 21 and 2009 Aug 15 (the earliest and latest of the files sampled here).
The figure shows a Gaussian distribution fitted to the dark current intensities.
The standard deviation of these fits is 2.5 and 3.0 for the 2007 Feb 21 and 2009
Aug 15 exposures, respectively.

\begin{figure*}[t!]
\centerline{%
  \includegraphics[clip,scale=0.5]{figures/time.eps}}
  \caption{Histograms showing the spread of the dark current values
  over the detector, with Gaussian fits superimposed on the data.
  The black curve shows dark current values from the 21 February 2007
  exposure and the red curve shows dark current values from the 
  15 August 2009 exposure.}
\label{fig:temporal variation}
\end{figure*}

In addition to the increase in dark current standard deviation, the wavelength
and spatial variations have also become more pronounced over the mission's
lifetime.  This is expanded upon in the following sections.


\section{Wavelength Variations}

Figure~\ref{fig:wavelength} shows the dark exposure results, for the short
wavelength and long wavelength detectors, as a function of wavelength after
averaging over the 512 spatial pixels of the slit.  We show only the bottom CCD
pixels; a similar variation with wavelength is seen in the top CCD pixels.

\begin{figure*}[t!]
\centerline{%
  \subfigure{\includegraphics[clip,scale=0.5]{figures/wvl_short.eps}}
  \subfigure{\includegraphics[clip,scale=0.5]{figures/wvl_long.eps}}}
  \caption{The variation of the dark current with wavelength, averaged
  over the slit height, for the 21 August 2007 dark frame exposure.
  The left panel shows the short wavelength detector and the right 
  shows the long wavelength detector.}
\label{fig:wavelength}
\end{figure*}

There is a variation in the dark current value with wavelength in all four
detector sections.  The short wavelength quadrants of the short and long
wavelength  detectors show an increasing trend of the dark current with
wavelength, while the long wavelength quadrants of the short and long
wavelength  detectors show an decreasing trend of the dark current with
wavelength.

There are also areas of the detector showing small intensity peaks. We find that
these peaks in intensity correspond to the wavelengths of the strongest emission
lines detected by EIS.   It would appear that the CCD pixels are displaying a
residual `burn in' at the locations of the strongest emission lines. However, if
this were the case, one would expect these peaks in intensity  to increase with
time while in fact they are not evident in all dark frame exposures.
Figure~\ref{fig:peaks} shows examples of the dark current in the region of the
\ion{He}{ii}~256~\AA\ and \ion{Fe}{xii}~195~\AA\ lines, each for 3 dark current
exposures. Only the 21 August 2007 exposure shows a peak at the wavelength of
the \ion{He}{ii} line. The 23 February 2008 exposure shows a  peak at the
wavelength of the \ion{Fe}{xii} line, while the 21 August 2007 exposure shows a
peak that is offset by 1--2~\AA, and the 21 February 2007 exposure shows no
indication of increased intensity at this wavelength. It may be the case that
some residual light is making its way onto the detector even while the shutter
is closed in certain instances. Further work is required to determine if this is
so.

\begin{figure*}[t!]
\centerline{%
  \subfigure{\includegraphics[clip,scale=0.5]{figures/he_ii_256.eps}}
  \subfigure{\includegraphics[clip,scale=0.5]{figures/fe_xii_195.eps}}}
  \caption{Dark current values at the wavelengths of the strong emission
  lines \ion{He}{ii}~256~\AA\ (left panel) and \ion{Fe}{xii}~195~\AA\
  (right panel).  The black curve shows data from a dark frame exposure
  on 21 February 2007, the blue curve shows data from 
  21 August 2007, and the red curve shows data from
  23 February 2008.}
\label{fig:peaks}
\end{figure*}


\section{Spatial Variations}

Dark exposure maps are returned in arrays of 512 spatial pixels (along the slit)
and 1024 wavelength pixels.  Figure~\ref{fig:slit variation} shows the variation
of the dark current with slit position after averaging over the wavelength
window.   The black curve is from a dark frame exposure near the beginning of the
mission (21 February 2007) and the red curve is from a dark frame exposure on 15
August 2009. No significant variation was found between the four wavelength
windows; we show only the long wavelength channel of the long wavelength detector
in Figure~\ref{fig:slit variation} as representative of all channels.

\begin{figure*}[t!]
\centerline{%
  \includegraphics[clip,scale=0.5]{figures/height.eps}}
  \caption{The variation of the dark current with slit height, after
  averaging over wavelength.
  The black curve shows data from a dark frame exposure
  on 21 February 2007 and the red curve shows data from 
  15 August 2009.}
\label{fig:slit variation}
\end{figure*}

There is an overall increasing trend of the dark current with slit height for
both the top and bottom pixels.  Furthermore, there is a sharp rise in the dark
current over the first $\sim$30 pixels. That this same rise is evident in both
the top and bottom pixels suggests it is due to the CCD bias or dark current
rather than the detector.

In the bottom rows there is a region of reduced intensity around
pixel 100.  This dip is seen on all four wavelength quadrants of the
bottom  section of the detector.  However, there is no equivalent intensity
variation on the top section of the detector.  This suggests that the dip in
intensity is not due to the bias or dark current, but is a feature of the CCD
pixels at this location on the detector.

The upward trend of the dark current with slit height, the sharp rise in dark
current below pixel 30, and the dip in dark current around pixel 100 are evident
in all the dark frame exposures sampled here. There has been a steady increase
in the slope of the dark current with slit height over time.  This can be seen
by comparing the black and red curves in Figure~\ref{fig:slit variation}.


\section{Impact on Data Analysis}

The most important aspect of the \verb+eis_prep+ routine of which the user
should be aware when analyzing data is the way in which it deals with pixels
with negative counts after subtraction of the background. The default action is
to flag any such pixels as missing. However, for full CCD observations of low
emission regions (e.g., off disk, coronal holes, etc.) this can result in many
pixels being incorrectly flagged as missing due to the background level being
simplified to a constant over the entire detector. As can be seen in
Figure~\ref{fig:wavelength}, the background
level is lowest at the wavelength extremes of the detectors. If the
\verb+/retain+ keyword is set in \verb+eis_prep+ then pixels with zero or
negative DN values will not be flagged as missing.

To show the importance of this on observation, we have selected a full CCD
exposure at the north polar hole: file  \verb+eis_l0_20071116_072624.fits.gz+.
Figure~\ref{fig:obs} shows the counts in DN from
averaging all 7 pixels in the Solar-X direction and the top 50 pixels (of the
full 512) in the Solar-Y direction: the area of the raster farthest from the
limb and so lowest in emission. The black curve shows the average counts
resulting from the default action of \verb+eis_prep+ (i.e., pixels with negative
DN values are flagged as missing) while the red curve shows the counts when  the
\verb+/retain+ keyword is set (i.e., pixels with negative DN values are
retained).

\begin{figure*}[t!]
\centerline{%
  \subfigure{\includegraphics[clip,scale=0.5]{figures/obs_dn_short.eps}}
  \subfigure{\includegraphics[clip,scale=0.5]{figures/obs_dn_long.eps}}}
  \caption{Spectra from an observation off the north pole.
  The short wavelength detector is shown on the left panel and the
  long wavelength detector is shown on the right panel.
  The red curves indicate the results from eis\_prep with the
  default setting and the black curves indicate the results when
  the /retain keyword is set.}
\label{fig:obs}
\end{figure*}

If DN is converted to intensity, the effects of fluctuation in the dark current
are amplified where the effective area is low.  This happens at the  wavelength
extremes of the detectors. Figure~\ref{fig:obs int} 
shows the same observations as above, but with DN converted to intensity. 
The importance of using \verb+/retain+ is clearly demonstrated.  One can also
notice that the fluctuations in the background level (e.g., the troughs
$\sim247$ and  $\sim251$~\AA) are amplified where the effective area of the
detector is lowest.

\begin{figure*}[t!]
\centerline{%
  \subfigure{\includegraphics[clip,scale=0.5]{figures/obs_int_short.eps}}
  \subfigure{\includegraphics[clip,scale=0.5]{figures/obs_int_long.eps}}}
  \caption{As Figure~\protect\ref{fig:obs} but showing the spectra in units
  of intensity rather than DN.}
\label{fig:obs int}
\end{figure*}



\end{document}
