

\documentclass[11pt]{article}

\usepackage{epsf}

\newcommand{\lam}{$\lambda$}
\newcommand{\cm}{cm$^{-3}$}
\newcommand{\ion}[2]{#1\,{\sc #2}}
\newcommand{\ecssa}{erg cm$^{-2}$ s$^{-1}$ sr$^{-1}$ \AA$^{-1}$} % erg/cm2/s/angstrom
\newcommand{\ecss}{erg cm$^{-2}$ s$^{-1}$ sr$^{-1}$} % erg/cm2/s/sr

\setlength{\oddsidemargin}{0cm}
\setlength{\evensidemargin}{0cm}
\setlength{\topmargin}{0cm}
\setlength{\textwidth}{16cm}
\setlength{\textheight}{23cm}
\setlength{\parindent}{0cm}
\setlength{\parskip}{0.1cm}
 

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

\begin{document}

\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. 13}
\vspace{3mm}
\hrule
\noindent Version 4 \hfill 17 March 2010
\vspace{2mm}
\hrule

\begin{centerpage}

\begin{center}
{\Large\bf Interpolating missing pixels in EIS data}\\
\mbox{}\\
\mbox{}\\
Peter Young\\
Naval Research Laboratory\\
4555 Overlook Ave SW\\
Washington, DC 20004\\
U.S.A.\\
\mbox{}\\
pyoung@ssd5.nrl.navy.mil
\end{center}

\end{centerpage}

\end{titlepage}

% \begin{center}
% \Large\textbf{Consequences of warm pixels on emission line fit parameters}\\
% \medskip
% \normalsize\textbf{Version 3, 3-Aug-2009}\\
% \medskip
% \normalsize\textbf{P.R. Young, NRL/GMU}
% \end{center}

\section{Introduction}

Processing EIS data with eis\_prep (EIS Software Note 1) leads to a
number of CCD pixels being flagged as `missing', i.e., the pixels are
not reliable for science analysis. There are several reasons for
flagging pixels:

\begin{enumerate}
\item the pixel is either a `hot' or  `warm' pixel (EIS Software Note
  6);
\item the pixel is saturated;
\item the pixel is at the location of a piece of dust on the detector;
\item the pixel is affected by a cosmic ray
\end{enumerate}

By far the most numerous of such bad pixels are the warm pixels which
after 3 years of the mission account for around 14\% of the
detector. Their numbers are steadily increasing and by 2013 around 30\% of the
detector pixels will be classed as warm pixels.

The present Software Note discusses whether missing pixels should be
ignored by scientists or whether an interpolation method should be
used to replace their values with realistic numbers. A specific
data-set is used and methods compared. The conclusion is
that interpolation is recommended and a specific interpolation method
is suggested.


\section{Data-set and fitting}\label{sect.data}

The procedure employed here is to consider a single EIS data-set that
was obtained early in the mission when there were few warm
pixels, and to perform calibrations with EIS\_PREP using different
warm pixel maps. The calibration performed with the default warm pixel
map is considered the reference point and we will look to see how line
fit parameters derived using the different warm pixel maps are affected.

The data-set chosen is from 2006 December 2 10:33 UT, and is a
$256\times 256$~arcsec$^2$ raster of an active region obtained in 15
wavelength windows. Although earlier rasters are available, these are
compromised by an offset in the wavelength scale.

The warm pixel map in the EIS database that is nearest in time to the
observation was obtained on 2006 December 6 and 1.2~\%\ of the CCDs'
pixels are flagged as warm in this map.

Two further sets of warm pixel maps were considered: the 2009 February 2 maps
in the Solarsoft distribution which have around 11~\%\ warm pixels;
and an artificial set of maps generated by the author that have 30~\%\
warm pixels. EIS\_PREP was forced to read these maps using the method
described in Appendix~\ref{app.wp}.

In order to investigate the effects of including interpolated data
points, we study the emission line fit parameters intensity, centroid
and width. These are derived using the routine EIS\_AUTO\_FIT which is
available in Solarsoft. This routine attempts to fit a Gaussian
profile to every spectrum in a 2D spatial array. The default behaviour of  EIS\_AUTO\_FIT is to
ignore any pixels flagged as missing by EIS\_PREP (warm pixels are one
class of missing data -- see discussion in the following section).

Two emission lines were considered: \ion{Fe}{xii} \lam195.12 and
\ion{Si}{vii} \lam275.35. The former is the strongest line observed by
EIS in most circumstances and generally yields a good quality line
profile at every spatial pixel. \ion{Si}{vii} \lam275.35 is formed in
the upper transition region where spatial structures are generally
more inhomogeneous, with steep intensity gradients often present. It
is a much weaker line than \ion{Fe}{xii} \lam195.12 and so low
intensity pixels can be noisy.


\section{Replacing missing data}\label{sect.interp}

EIS\_PREP identifies a number of pixels in the data-set as anomalous
and flags them as `missing'. These are saturated pixels, warm
pixels, hot pixels, cosmic rays, and pixels affected by dust. The
notation `missing' comes from the SOHO/CDS mission where such pixels
were intended to be ignored by the user as they represent bad data
points. For CDS the majority of missing pixels were due to cosmic
rays which were generally few in number (1--2~\%\ of detector
area). For EIS they are principally due to warm pixels which are
increasing in number with time and, after 2 years of the mission,
covered around 10~\%\ of the detector area.

For EIS it was recognised that sometimes it is necessary to
interpolate over missing pixels in order to produce attractive images
for outreach work, for example. For this purpose EIS\_PREP performs an
interpolation over missing pixels in the intensity array. Below we
discuss how this interpolation method works, and how an error bar can
be assigned to an interpolated pixel value. 

\subsection{Intensity}\label{sect.replace-intensity}

Calibrating a level-0 EIS FITS file with eis\_prep yields two level-1
FITS files: an intensity file and an error file. Pixels flagged as
missing are treated differently in the two files. In the error file
they are simply given a value of -100.  In the intensity file the
value is replaced with a value that is derived from neighbouring
pixels using an iterative procedure that is described here.

Initially the intensity array
contains values of -100 at the locations of the missing
pixels. The median of the array is computed for each exposure in the
array by considering a box of
size (1,3) pixels where the dimensions are (wavelength, solar-Y) for
narrow slit data. Three cases are possible for the missing pixel:


\begin{enumerate}
\item If both neighbours are not missing pixels (i.e., do not have a
  value of -100), then the missing pixel is replaced with the average
  of the two neighbours.
\item If one neighbour is a missing pixel, then the missing pixel is
  replaced with the value of the neighbouring pixel that is not
  missing.
\item If both neighbours are missing, then the missing pixel will
  retain its missing value.
\end{enumerate}

A new array is computed that is identical to the original array for
good pixels, but the missing pixel values are replaced as given above.

To proceed, the median of the new array is computed and remaining
missing pixels are replaced as above. This is repeated until all
missing pixels have been replaced

To see how the method works, it is best to consider an
example. Consider a set of seven pixel values in the detector-Y
direction:

\begin{verbatim}
Original data   534  530 -100 -100 -100  536  530
Iteration 1     534  530  530 -100  536  536  530
Iteration 2     534  530  530  533  536  536  530
\end{verbatim}

See how the value for pixel 4  actually ends up being replaced
by the average of the values for pixels 2 and 6, since the two
neighbours are missing.

As the number of warm pixels on the detector increases, there is an
increasing likelihood of long `strings' of missing values that will
require several iterations to remove. In such cases, the missing pixel
in the centre of the string will be replaced with a value derived from
pixels several pixels away on the detector.



\subsection{Errors}\label{sect.error}

In order to incorporate the interpolated intensity values into the line
fitting process, it is necessary to assign an error value to
them. The method here is simply to treat the interpolated intensity as
if it is a real intensity and to assign an error bar that is
consistent with that intensity. To do this we define the quantities

\begin{equation}\label{eq.g}
g=IA_{\rm eff}(\lambda)
\end{equation}

and

\begin{equation}\label{eq.h}
h=\sigma^2 \lambda A_{\rm eff}(\lambda)^2
\end{equation}

where $I$ is the intensity, $\sigma$ the intensity error, $A_{\rm
eff}(\lambda)$ the telescope effective area, and $\lambda$
wavelength. Because of the way $I$ and $\sigma$ are calculated by
EIS\_PREP, the quantities $g$ and $h$ are linearly related as can be
seen in the example shown in Fig.~\ref{fig.err-int}.

\begin{figure}[h]
\centerline{\epsfxsize=12cm\epsfbox{err_int_curve2.eps}}
\caption{Plots of $h$ vs. $g$ for a sub-set of full CCD data from 2007
  January 30 14:34~UT. The left panel shows the full range of the data
values, the right panel shows the same data but with the $g$ range
reduced by a factor 10.}
\label{fig.err-int}
\end{figure}


The prescription for deriving interpolated error values is thus

\begin{enumerate}
\item For the non-missing pixels in the data, evaluate $g$ and $h$ and
  fit a straight line to the $h$ vs. $g$ plot, to yield the fit
  parameters. (EIS\_INT\_ERR\_FIT)
\item With the interpolated intensity values, compute the corresponding
  $g$ values, and use the fit parameters to derive corresponding $h$
  values. These $h$ values are then converted to $\sigma$ values using
  Eq.~\ref{eq.h}. (EIS\_REPLACE\_ERRORS)
\end{enumerate}

The names of the IDL routines that perform these steps are
indicated. Note that, when deriving the fit parameters in Step 1, only
intensity values greater than 0 are included as the error values for
intensities $\le 0$ are derived only from the dark current noise and
have no photon noise contribution.

% To
% do this, we take the intensity, $I$, and error, $\sigma$, values for all of the good
% data, and plot $\sigma^2$ vs. $I$ (Fig.~\ref{fig.err-int}). The points
% fall on a straight line which we fit with the IDL poly\_fit
% function. The error values for the missing data are then derived as

% \begin{equation}
% \sigma^* = \sqrt{ a + b I^*}
% \end{equation}

% where $a$ and $b$ are the parameters from the fit function, and
% $I^*$ is the interpolated intensity value computed by
% EIS\_PREP (Sect.~\ref{sect.replace-intensity}).

% The Gaussian fitting routine EIS\_AUTO\_FIT has been modified to allow
% missing data to be replaced with interpolated data using the /INTERP\_MISS
% keyword, which computes the missing data errors using the method
% above. 

% Note that the method only works if intensity and error values are
% taken from a narrow range of wavelengths.


\section{Which is best? -- missing or interpolated?}\label{sect.miss-interp}

The routine EIS\_AUTO\_FIT in Solarsoft allows users to fit a single
Gaussian to an entire spatial array of spectra. Currently the default
for EIS\_AUTO\_FIT is to not include any missing pixels in the fitting
process. E.g., if the spectrum at a single spatial pixel has 16
pixels, and 3 of these pixels are missing, then the Gaussian will only
be fit to the remaining 13 pixels in the spectrum (we refer to this as
the \emph{Missing} method).  If we instead
include these three missing pixels by replacing their intensity and
error values with the interpolated values derived using the method
described in Sect.~\ref{sect.interp} (which we refer to as the
\emph{Interpolated} method) do we get better quality fits?

To answer this question we consider the 2006 December 2 data-set
described earlier. Since there were relatively few warm pixels in this
data-set, we find that around 60~\%\ of the spatial pixels have no
missing pixels in the spectrum for a particular data window (e.g., for
\ion{Fe}{xii} \lam195.12 it is 61.3~\%). We refer to spatial pixels
with no missing spectral pixels as \emph{good spatial pixels} and the
spectra as \emph{good spectra}.

If we then process the 2006 December 2 data-set with a different warm
pixel map (the 2009 Feburary 2, or 30~\%\ maps described in
Sect.~\ref{sect.data}) and fit the spectra again with EIS\_AUTO\_FIT
we can ask whether the new line fit parameters for the good spatial
pixels are consistent with the original line fit parameters. I.e., if
the original fitted intensity was $I_1\pm \sigma_1$ and the new fitted
intensity is $I_2\pm \sigma_2$, then we require

\begin{eqnarray}
  (I_2-I_1) + \sqrt{\sigma_1^2 + \sigma_2^2} & \ge &
  0 \label{eq.cond1} \\
  (I_2-I_1) - \sqrt{\sigma_1^2 + \sigma_2^2} & \le & 0 \label{eq.cond2}
\end{eqnarray}

and similarly for line velocity and line width.

Table~\ref{tbl.param-comp} shows the results for the \ion{Si}{vii}
\lam275.35 and \ion{Fe}{xii} \lam195.12 windows for the 2009 Feburary
2 and 30~\%\ warm pixel maps. The percentage indicates the percentage
of good spatial pixels for which the conditions given in
Eq.~\ref{eq.cond1},~\ref{eq.cond2} do \emph{not} hold. Results are shown for the
Missing and Interpolated methods.

The results shown in Table~\ref{tbl.param-comp} are very clear. \emph{By
interpolating the missing data points, we are better able to reproduce
the actual fit parameters.}

Why does interpolation work so well? The justification for the method
lies in the fact that the EIS spatial 
resolution is around 3 to 4 pixels in the Solar-Y direction. (Here by
spatial resolution we
mean the full width at half maximum of the instrument response to an
observed point source. This can be estimated for EIS by looking at transition
region brightenings.) Thus when considering two neighbouring pixels on
the detector, the signal in one pixel contains a significant component
from the spatial element corresponding to the neighbouring pixel. By
replacing  a missing pixel with the average value of the
neighbouring pixels, we are actually making  a reasonable
approximation to the value the pixel would have had.

% The image array from the 2006 December 2 data-set has $256\times256$
% spatial pixels. If we consider those spatial pixels that do not have
% any missing pixels in the spectrum, then these represent `perfect
% data', unaffected by detector artifacts. For each of these pixels, the
% line fits yield intensity, velocity and width values with $1~\sigma$
% error bars. 

% If we now consider the same data-set, but calibrated by EIS\_PREP
% using the 2009 Feburary 2 and 30~\%\ warm pixel maps, then we can fit
% the resulting data arrays and compare with the `perfect data' to see
% how the accuracy of the fit parameters have been degraded. Our basic
% check is whether the new fit parameters agree with the `perfect data'
% fit parameters within the $1~\sigma$
% error bars of the `perfect data' parameters.

% For both the 2009 Feburary 2 and 30~\%\ warm pixel maps, we fit the
% emission lines in two ways: either ignoring the missing data during
% the fit process (the 'Missing' method), or by interpolating the
% missing data (the `Interpolated' method). Table~\ref{tbl.param-comp}
% presents the percentage of pixels for which the new fit parameter is
% different from the `perfect data' fit parameter by more than
% $1~\sigma$, for the emission lines \ion{Fe}{xii} \lam195.12 and
% \ion{Si}{vii} \lam275.35.

% To clarify, if we consider the calibrated data obtained with the 2009
% Feb 02 warm pixel map then ignoring the missing pixels during the line
% fitting for \ion{Fe}{xii} \lam195.12 results in 11.99~\%\ of the
% pixels yielding intensities that are more than $1~\sigma$ different
% from the intensities derived from the `perfect data'.

% The results shown in Table~\ref{tbl.param-comp} are clear. By
% interpolating the missing data points, we are better able to reproduce
% the original fit parameters.

Two further questions to consider are: does the interpolation method
introduce systematic errors for certain types of data? and, is the
interpolation method used in  EIS\_PREP the best one to use? We address
these issues in the following sections.


% \begin{table}[h]
% \caption{2009 Feburary 2 warm pixel map.}
% \begin{center}
% \begin{tabular}{lllrrr}
% \noalign{\hrule}
% \noalign{\hrule}
% Line  & WP map & Method  & Intensity & Velocity & Width \\
% \noalign{\hrule}
% \ion{Fe}{xii} \lam195.12 &
% %%%%%%%%%%%%%%%%%%%%%%%%
% 2009 Feb 02 &Missing      & 11.99~\% & 15.23~\% & 16.85~\% \\
%            &&Interpolated &  1.24~\% & 1.07~\% & 1.00~\% \\
% \noalign{\smallskip}
% &30~\%\ map &Missing      & 40.15~\% & 49.50~\% & 49.70~\%\\
%            &&Interpolated &  8.12~\% & 8.90~\% & 8.34~\% \\
% \noalign{\medskip}
% \ion{Si}{vii} \lam275.35 & 
% %%%%%%%%%%%%%%%%%%%%%%%%
% 2009 Feb 02 &Missing      &  5.35~\% & 5.36~\% &5.51~\% \\
%            &&Interpolated &  3.58~\% & 3.57~\% &3.87~\% \\
% \noalign{\smallskip}
% &30~\%\ map &Missing      & 21.89~\% & 21.09~\% &22.33~\% \\
%            &&Interpolated &  6.84~\% & 7.11~\% & 7.96~\% \\
% \noalign{\hrule}
% \end{tabular}
% \end{center}
% \label{tbl.param-comp}
% \end{table}

\begin{table}[h]
\caption{Percentages of spatial pixels for which the new line fit
  parameters do not match the original line fit parameters.}
\begin{center}
\begin{tabular}{lllrrr}
\noalign{\hrule}
\noalign{\hrule}
Line  & WP map & Method  & Intensity & Velocity & Width \\
\noalign{\hrule}
\ion{Fe}{xii} \lam195.12 &
%%%%%%%%%%%%%%%%%%%%%%%%
2009 Feb 02 &Missing      &  5.00~\% & 6.73~\% & 7.90~\% \\
           &&Interpolated &  0.66~\% & 0.51~\% & 0.48~\% \\
\noalign{\smallskip}
&30~\%\ map &Missing      & 26.74~\% & 27.39~\% & 32.98~\%\\
           &&Interpolated &  4.27~\% & 4.55~\% & 4.04~\% \\
\noalign{\medskip}
\ion{Si}{vii} \lam275.35 & 
%%%%%%%%%%%%%%%%%%%%%%%%
2009 Feb 02 &Missing      &  1.96~\% & 1.54~\% &1.78~\% \\
           &&Interpolated &  0.73~\% & 1.24~\% &1.65~\% \\
\noalign{\smallskip}
&30~\%\ map &Missing      & 16.07~\% & 12.74~\% &13.54~\% \\
           &&Interpolated &  1.80~\% & 2.63~\% & 3.18~\% \\
\noalign{\hrule}
\end{tabular}
\end{center}
\label{tbl.param-comp}
\end{table}

\section{A closer look at the interpolation results}

Table~\ref{tbl.param-comp} gave the percentage of good spatial pixels
for which the fit parameters from data processed with the 2009
February 2 and 30~\%\ warm pixel maps showed a significant difference
compared to the good spectrum fits. The locations of the intensity ``bad
pixels'' are shown in Fig.~\ref{fig.interp-results} for \ion{Si}{vii}
\lam275.35 and \ion{Fe}{xii} \lam195.12. 

\begin{figure}[p]
\centerline{\epsfxsize=12cm\epsfbox{plot_si7_bad_image.eps}}
\centerline{\epsfxsize=12cm\epsfbox{plot_fe12_bad_image.eps}}
\caption{The panels above show negative intensity images from
  \ion{Si}{vii} \lam275.35 (upper) and \ion{Fe}{xii} \lam195.12
  (lower) from the 2006 December 2 data-set. Blue pixels denote those
  spatial pixels that fail the conditions given in Eqs.~\ref{eq.cond1}
and \ref{eq.cond2}.}
\label{fig.interp-results}
\end{figure}


For \ion{Si}{vii} \lam275.35 the bad pixels are mostly in dark areas
where the line profile is noisy and so are not a big problem. There
is, however, a group of bad pixels at the edge of the bright loop
footpoints around X=160, Y=150.

The situation is significantly worse for \ion{Fe}{xii} \lam195.12 with
a large number of bad pixels in the bright parts of the active
region. \emph{Scientific studies of these regions are likely to be
compromised.}  

What is causing these bad pixels?

In Fig.~\ref{fig.si7-bad-pix} we show line profiles for one of the bad
intensity pixels (indicated in the left panel) for \ion{Si}{vii}
\lam275.35. The middle panel shows 
the profile from the data-set processed with the correct warm pixel
map, and for which there are no missing pixels. The right panel shows
the profile from the data-set processed with the 30~\%\ warm pixel
map. The 11th spectral pixel is the brightest in the original data,
but it is flagged as missing in the re-processed file. The
interpolated intensity is signficantly below the original intensity
and this leads to a signficantly distorted fit. The original line
intensity was $554.6\pm 25.6$~\ecss, while the new intensity is
$470.9\pm 25.6$ -- a more than 2$\sigma$ discrepancy.

The reason why the interpolated intensity for the 11th pixel is so low
is that the upper neighbour in the Y-direction is missing. The
EIS\_PREP method then takes the intensity from the lower neighbour in
the Y-direction. The original intensities for these three pixels were
4562, 6217 and 8205~\ecssa. The average of the neighbours would have
yielded 6384~\ecssa, in good agreement with the actual intensity. But
because the upper neighbour is missing, the interpolated intensity is
set to 4562~\ecssa, significantly different from the actual intensity.



\begin{figure}[t]
\centerline{\epsfxsize=15cm\epsfbox{si7_bad_pixel.eps}}
\caption{An example of a discrepant pixel for \ion{Si}{vii}
  \lam275.35. The left panel shows an intensity image derived from the
original data. The blue pixels denote those for which the intensity
derived from data-set processed with the 30~\%\ warm pixel map is more
than 1$\sigma$ discrepant from the actual intensity. The pixel for
which the line profiles are displayed in the middle and right panels
is denoted by a star.  The middle panel show the spectrum for the
selected spatial pixel from the original data. The right panel shows
the spectrum for the data-set processed with the 30~\%\ warm pixel map
and
for which interpolation over the missing pixels has been
performed. For both panels the Gaussian fits to the data are shown
over-plotted.}
\label{fig.si7-bad-pix}
\end{figure}

An example bad pixel from the \ion{Fe}{xii} \lam195.12 data-set is
shown in Fig.~\ref{fig.fe12-bad-pix}. Here there initially seems very
little difference between the two spectra, however, there is a more
than 2$\sigma$ discrepancy in the fitted intensities from the two
spectra. The problem here lies principally in the high signal-to-noise
of the original data. In the centre of the line profile the pixels
have error bars of $<5$~\%, and so small changes to the intensities of
these pixels have a significant impact on the line fits.

Consider spectrum pixel 10. The intensities of this pixel and the two
nearest neighbours in the Y-direction are 46432, 50069 and
47814~\ecssa. Neither neighbour is missing, even in the 30~\%\ warm
pixel processed data, and the interpolated intensity is set to
47123. This is only 6~\%\ below the original intensity, but the
original error on this pixel was only 1.7~\%. Since three of the four
strongest pixels in the spectrum (pixels 8, 10 and 11) are flagged as
missing in the 30~\%\ warm pixel map processed data, these small but
significant changes to the line profile lead to significant changes
to the fit parameters.

\begin{figure}[t]
\centerline{\epsfxsize=15cm\epsfbox{fe12_bad_pixel.eps}}
\caption{A similar plot to Fig.~\ref{fig.si7-bad-pix}, but for
  \ion{Fe}{xii} \lam195.12.}
\label{fig.fe12-bad-pix}
\end{figure}

Both of these examples highlight limitations of the current
interpolation method. We now investigate whether an improved method
can be found.

\section{How good are different interpolation methods?}\label{sect.interp-methods}

The way in which the intensity of a missing pixel is replaced will
determine how accurate the new intensity will be. This can be checked
using the 2006 December 2 data-set. The intensity for an individual pixel
calibrated using the correct warm pixel map is $I\pm \sigma$, and the intensity
derived from an interpolation method is $I^*\pm \sigma^*$. If $I^*$ is
not consistent with $I$, taking into account the errors on both quantities
then we consider that the
interpolation method has failed to reproduce the correct intensity.
Table~\ref{tbl.interp-stats} shows the percentage of pixels for which
the interpolation method fails for 12 different interpolation
methods. The notation for describing the methods is as follows.
Consider a pixel with Y-index $i$. The neighbours are pixels $i\pm 1$;
the next-neighbours are $i\pm 2$, and the next-next-neighbours are
$i\pm 3$. Sometimes I refer to opposite pixels, e.g., the neighbour
and the opposite next-neighbour, which will be pixels $i+1$ and $i-2$,
or $i-1$ and $i+2$.

\begin{table}[h]
\caption{Interpolation methods for EIS data.}
\begin{center}
\begin{tabular}{lp{7cm}l}
\noalign{\hrule}
\noalign{\hrule}
Method & Description & \%\ of failures \\
\noalign{\hrule}
1  & Both neighbours & 3.1 \\
2  & One neighbour & 19.8 \\
3  & Both next-neighbours & 15.2 \\
4  & Both next-next-neighbours & 26.6 \\
5  & One neighbour and both next-neighbours & 12.5 \\
6  & Both neighbours and both next-neighbours &8.5 \\
7  & One next-neighbour & 37.1 \\
8  & One next-neighbour and both next-next-neighbours & 24.2 \\
9  & One neighbour and opposite next-neighbour & 11.7 \\
10 & One neighbour (2/3) and opposite next-neighbour (1/3) & 7.4 \\
11 & One neighbour and opposite next-next-neighbour & 20.8 \\
12 & One neighbour (7/9) and opposite next-next-neighbour (2/9) & 10.2 \\
\noalign{\hrule}
\end{tabular}
\end{center}
\label{tbl.interp-stats}
\end{table}

For the majority of occasions, EIS\_PREP uses methods 1 and 2 for
interpolating warm pixels. Method 1 is clearly the best method and
accurately reproduces the pixel intensity on most occasions. Method 2
is actually a rather poor method, and other methods involving a single
neighbouring pixel are superior (Methods 5, 9--12). In fact even an
average of next-neighbours (Method 3) is better.
In comparing Methods 9--12 we see that weighted averages of pixels are
superior to simple averages when combining pixels with different
separations from the central pixel. The particular weightings have
been chosen to maximise the number of interpolated pixels that lie
within the error bars.

When there are a large number of warm pixels, a
significant number only have one non-missing neighbour and
next-neighbour. E.g., pixels at the edge of the detector, or pixels at
the ends of a string of three or more missing pixels. For these
Method 2 is considered a preferable option to simply ignoring the
missing pixel. Method 7 could also be used if the nearest neighbour is
missing, but this has very poor accuracy.

In summary, we can identify a preferred hierarchy of methods for dealing
with missing pixels, depending on the status of the neighbours.

\begin{enumerate}
  \item If both neighbours are not missing, then replace missing pixel with
    their average (Method 1).
  \item If one of the neighbours is missing, then replace missing
    pixel with a weighted average of the non-missing neighbour and the
    opposite next-neighbour (Method 10).
  \item If one of the neighbours is missing, then replace missing
    pixel with a weighted average of the non-missing neighbour and the
    opposite next-next-neighbour (Method 12).
  \item If both neighbours are missing, then replace missing pixel
    with an average of the two next-neighbours (Method 3).
  \item If none of the above are possible but one neighbour is
    not missing, then replace missing pixel with the value of the
    non-missing neighbour (Method 2).
\end{enumerate}

The software implementation of these methods is described in
Appendix~\ref{app.software}. Note that some cases are not covered by
the above. E.g., for four consecutive 
missing pixels, the second and third pixels will remain missing. For
these the interpolation method is considered so uncertain that it is
best to leave the pixels as missing.


This hierarchy can be compared with the current interpolation method
employed by EIS\_PREP:

\begin{enumerate}
  \item If both neighbours are not missing, then replace missing pixel with
    their average (Method 1).
  \item If one neighbour is missing, then replace missing pixel with
    value from the non-missing neighbour (Method 2)
  \item If both neighbours are missing, then replace missing pixel
    with an average of the two next-neighbours (Method 3).
  \item If both neighbours and one next-neighbour are missing, then replace missing pixel
    with the value of the non-missing next-neighbour (Method 6).
  \item etc.
\end{enumerate}

The key difference is thus that Method 2 has second priority in this
scheme even
though it is significantly less accurate than Methods 10, 12 and 3.


The percentages in Table~\ref{tbl.interp-stats} tell us that the
different interpolation methods have different accuracies. This should
be reflected in the error estimates assigned to the missing pixels. If
we consider
the interpolated error, $\sigma^*$, derived from the method described
in Sect.~\ref{sect.error}, then we consider revising this to
$f_i\sigma^*$, where $i$ denotes one of the five interpolation
methods described above. I set $f_1=1.0$ since this method accurately
reproduces the pixel intensity. For the remaining four parameters, I
consider varying the parameters to see
which set gives the best agreement with the fit parameters of the
original data-set. 


The parameter space was explored by varying the parameters $f_{2-5}$
as follows: $f_2$ from 1.0 to 1.4; $f_3$ from $f_2$ to $f_2+0.4$;
$f_4$ from $f_4$ to $f_4+0.4$; and $f_5$ from $f_4$ to $f_4+0.4$. The
percentage failures in the sense of those listed in
Table~\ref{tbl.interp-stats} were checked for intensity, velocity and
line width. The best results were found for $f_2=f_3=1.2$ and
$f_4=f_5=1.3$. These values have been implemented in EIS\_REPLACE\_MISSING.

Running the same analysis as presented in Sect.~\ref{sect.miss-interp} and
Table~\ref{tbl.param-comp} yields the percentage failures given in
Table~\ref{tbl.param-comp2}. ``Interp 1'' indicates the original
interpolation method, while ``Interp 2'' is the new method. Small but
significant improvements are found for both emission lines and both warm pixel
maps. 

\begin{table}[h]
\caption{Percentages of spatial pixels for which the new line fit
  parameters do not match the original line fit parameters.}
\begin{center}
\begin{tabular}{lllrrr}
\noalign{\hrule}
\noalign{\hrule}
Line  & WP map & Method  & Intensity & Velocity & Width \\
\noalign{\hrule}
\ion{Fe}{xii} \lam195.12 &
%%%%%%%%%%%%%%%%%%%%%%%%
2009 Feb 02 &Interp 1      &  0.66~\% & 0.51~\% & 0.48~\% \\
           &&Interp 2      &  0.16~\% & 0.13~\% & 0.11~\% \\
\noalign{\smallskip}
&30~\%\ map &Interp 1      &  4.27~\% & 4.55~\% & 4.04~\% \\
           &&Interp 2      &  2.13~\% & 2.64~\% & 2.12~\% \\
\noalign{\medskip}
\ion{Si}{vii} \lam275.35 & 
%%%%%%%%%%%%%%%%%%%%%%%%
2009 Feb 02 &Interp 1     &  0.73~\% & 1.24~\% &1.65~\% \\
           &&Interp 2     &  0.58~\% & 1.08~\% &1.41~\% \\
\noalign{\smallskip}
&30~\%\ map &Interp 1     &  1.80~\% & 2.63~\% & 3.18~\% \\
           &&Interp 2     &  1.25~\% & 2.01~\% & 2.41~\% \\
\noalign{\hrule}
\end{tabular}
\end{center}
\label{tbl.param-comp2}
\end{table}

The locations of the bad pixels in the intensity maps for
\ion{Si}{vii} \lam275.35 and \ion{Fe}{xii} \lam195.12 are shown in
Fig.~\ref{fig.interp-results2} which should be compared to
Fig.~\ref{fig.interp-results}. Most of the bad pixels near the loop
footpoints in the \ion{Si}{vii} image have disappeared with the new
method, however a significant number of bad pixels are still found in
the \ion{Fe}{xii} image. 

Whether the \ion{Fe}{xii} line fit parameters derived from the
data-set processed with the 30~\%\ warm pixel maps are valid depends
on the scientific application. For example the large loop structures
extending to the south of the active region are relatively
unaffected. The bright `knots' of emission at the active region core,
however, have a large percentage of bad pixels and so there is a risk
of deriving incorrect results (e.g., density, emission measure) from
these regions. Despite this, it is remarkable that a data-set for which
30~\%\ of pixels do not yield any information about the Sun, it is
possible to re-create the original data so well.

\begin{figure}[p]
\centerline{\epsfxsize=12cm\epsfbox{plot_si7_bad_image_pry.eps}}
\centerline{\epsfxsize=12cm\epsfbox{plot_fe12_bad_image_pry.eps}}
\caption{The panels above show negative intensity images from
  \ion{Si}{vii} \lam275.35 (upper) and \ion{Fe}{xii} \lam195.12
  (lower) from the 2006 December 2 data-set. Blue pixels denote those
  spatial pixels that fail the conditions given in Eqs.~\ref{eq.cond1}
and \ref{eq.cond2}.}
\label{fig.interp-results2}
\end{figure}

% \begin{table}[h]
% \caption{}
% \begin{center}
% \begin{tabular}{llllll}
% \noalign{\hrule}
% Intensity & 2.76 & 2.60 & 2.77 & 2.78 & 2.61 \\
% Velocity  & 4.20 & 3.55 & 4.20 & 3.32 & 3.36 \\
% Width     & 3.74 & 3.04 & 3.74 & 2.76 & 2.91 \\
% \noalign{\medskip}
% 2         & 1.0  & 1.2  & 1.3  & 1.1  & 1.17 \\
% 3         & 1.0  & 1.4  & 1.6  & 1.2  & 1.33 \\
% 4         & 1.0  & 1.6  & 1.9  & 1.3 &  1.50 \\
% \noalign{\hrule}
% \end{tabular}
% \end{center}
% \label{tbl.error-comp}
% \end{table}



% \section{Problems with interpolation method}

% The main problem that arises with the current interpolation method is
% when there is steep gradient in intensity along the Y-axis, and two
% neighbouring pixels are missing. An example is shown in
% Fig.~\ref{fig.si7-bad-pixel}.

% The left panel shows an image from the fitted intensity array for the
% 2006 December 2 data-set using the original warm pixel map. Pixels
% coloured blue denote those spatial pixels for which the fitted
% intensity from the 30~\%\ warm pixel map data deviates from the
% original intensity by more than 1~$\sigma$. It is seen that a number
% of pixels lie where there is an intensity gradient along the slit. If
% we focus on the pixel marked in the left panel, X=164, Y=156, the
% middle panel shows the line profile that was fitted from the original
% data. The right panel shows the line profile that was fitted from the
% 30~\%\ warm pixel map data.

% With the 30~\%\ warm pixel map, the centre pixel in the line profile
% is missing for Y=155 and Y=156. The method for interpolating the
% intensity at Y=156 is simply to take the value at Y=157. Since there
% is an intensity gradient, this value is significantly above the actual
% intensity in this pixel, and gives a tall spike in the line profile
% (right panel). This significantly distorts the line fit parameters,
% giving a larger fitted intensity.

% This problem can be solved if the interpolation method recognises that
% simply taking the value of the neighbouring pixel is not as good as
% taking the average of two neighbouring pixels, and thus assigns a
% larger error bar to the interpolated value.



% \section{A modified interpolation method}

% In this section we consider a modified interpolation method that
% better deals with the intensity gradient situation described
% above. The error for interpolated pixels is revised to be

% \begin{equation}
%   \sigma^2 = \sigma_0^2 + (fI)^2
% \end{equation}

% where $\sigma_0$ is the error derived using the method described in
% Sect.~\ref{sect.error}, $I$ is the intensity at the interpolated pixel
% and $f$ takes the value of 0.04 or 0.11. The former is assumed if both
% neighbours are not missing, while the latter is used if either of the
% neighbours is missing, or if both neighbours are missing but both
% next-neighbours are not missing. For all other cases, the missing
% pixels are ignored in the fitting.

% The percentage of pixels in the intensity, velocity and line width
% maps that deviate from the 1$\sigma$ errors of the fits on the
% original data are given in Table~\ref{tbl.param-comp2}.

% \begin{table}[h]
% \caption{2009 Feburary 2 warm pixel map.}
% \begin{center}
% \begin{tabular}{lllrrr}
% \noalign{\hrule}
% \noalign{\hrule}
% Line  & WP map & Method  & Intensity & Velocity & Width \\
% \noalign{\hrule}
% \ion{Fe}{xii} \lam195.12 &
% %%%%%%%%%%%%%%%%%%%%%%%%
% 2009 Feb 02 &Missing      & 11.99~\% & 15.23~\% & 16.85~\% \\
%            &&Interpolated &  1.24~\% & 1.07~\% & 1.00~\% \\
% \noalign{\smallskip}
% &30~\%\ map &Missing      & 40.15~\% & 49.50~\% & 49.70~\%\\
%            &&Interpolated &  8.12~\% & 8.90~\% & 8.34~\% \\
% \noalign{\medskip}
% \ion{Si}{vii} \lam275.35 & 
% %%%%%%%%%%%%%%%%%%%%%%%%
% 2009 Feb 02 &Missing      &  5.35~\% & 5.36~\% &5.51~\% \\
%            &&Interpolated &  3.58~\% & 3.57~\% &3.87~\% \\
% \noalign{\smallskip}
% &30~\%\ map &Missing      & 21.89~\% & 21.09~\% &22.33~\% \\
%            &&Interpolated &  6.84~\% & 7.11~\% & 7.96~\% \\
% \noalign{\hrule}
% \end{tabular}
% \end{center}
% \label{tbl.param-comp2}
% \end{table}


% \section{Is it valid to use interpolated data for scientific
%   analysis?}

% At first glance, using interpolated data for scientific analysis seems
% equivalent to making up data points, and deriving physical quantities
% such as velocities, densities or emission measures from data arrays containing such
% data is not good science.

% The justification for the method lies in the fact that the EIS spatial
% resolution is around 3 to 4 pixels in the Solar-Y direction. (Here by
% spatial resolution we
% mean the full width at half maximum of the instrument response to an
% observed point source. This can be estimated for EIS by looking at transition
% region brightenings.) Thus when considering two neighbouring pixels on
% the detector, the signal in one pixel contains a significant component
% from the spatial element corresponding to the neighbouring pixel. By
% replacing  a missing pixel with the average value of the
% neighbouring pixels, we are actually making  a reasonable
% approximation to the value the pixel would have had.

% To see the effects of spatial resolution on data interpolation using a
% theoretical data-set, see Appendix~\ref{app.error}. The conclusion is
% that using nearest-neighbour averaging yields interpolated
% intensities that are, typically, within 7~\%\ and 3.5~\%\ (these are
% 1~$\sigma$ values) of the actual intensities for the cases of 3 pixel
% and 4 pixel resolutions, respectively.

% This issue can also be studied with actual EIS data. If we compare
% actual measured intensities with intensities derived from an average
% of neighbouring pixels, what does the distribution of differences look
% like? We consider the quantity:

% \begin{equation}
% d=(I-I_{\rm avg})/I_{\rm avg}.
% \end{equation}

% The left panel of Fig.~\ref{fig.diff-195} shows the results for the complete set
% of pixels in the \ion{Fe}{xii} \lam195.12 data window of the 2006
% December 2 data-set. The majority of points are clustered around 0,
% indicating $I_{\rm avg}$ is close to $I$, but there are long tails
% where there are large discrepancies. However, most of these actually
% correspond to pixels with large error bars (i.e., low intensities). In
% fact we find that for only 2.5~\%\ of the pixels does the averaged
% intensity lie outside of the 1$\sigma$ error bar on the measured
% intensity. 


% \begin{figure}[h]
% \centerline{\epsfxsize=12cm\epsfbox{plot_d_dec2_195.eps}}
% \caption{}
% \label{fig.diff-195}
% \end{figure}


% Our central concern is whether the interpolation method introduces
% errors for the missing pixels that are greater than the 'interpolated'
% errors described in Sect.~\ref{sect.error}. This is best studied by
% considering the very brightest pixels in a data array. These pixels
% have small photon statistics errors and so a comparison of
% interpolated intensities and actual intensities should reveal if the
% 'interpolation errors' are significant.

% In the right panel of Fig.~\ref{fig.diff-195} we plot the distribution of
% $d$-values for the 541 brightest pixels in the  \ion{Fe}{xii} \lam195.12 data window of the 2006
% December 2 data-set. These pixels have intensities $\ge$
% 50,000~\ecssa. The error bars assigned to these pixels by EIS\_PREP
% are, on average, 1.6~\%\ of the intensity values. The standard
% deviation of the $d$-distribution is 3.5~\%. It thus found that the
% 'interpolation errors' are actually greater than the photon statistics
% errors in this case. It is interesting to note the standard deviation
% of the $d$-distribution is very close to the percentage found in
% App.~\ref{app.error} for the case where a 4 pixel spatial resolution
% is assumed.

% If
% we consider only pixels with large intensities, then the distribution
% changes to that shown in the right panel of
% Fig.~\ref{fig.diff-195}. Here only pixels with an intensity $\ge
% 5\times 10^4$~\ecssa\ are used. The standard deviation of the
% distribution is 3.5~\%\ and we can compare this with the average value
% of $\sigma/I$ for the high intensity pixels, which is 1.6~\%. 

% The discussion above refers to a very specific case whereby we're
% comparing the intensity of a pixel with the average of the two
% neighbouring pixels. As the example in
% Sect.~\ref{sect.replace-intensity} showed, there are cases when
% one or both of the neighbouring pixels are themselves missing
% pixels. The interpolated intensity is then derived in a different
% way. We consider how the $d$-distribution changes when we use
% different methods of interpolation, each of which is currently
% implemented in EIS\_PREP. Four distributions are presented in
% Fig.~\ref{fig.d-comparison} which have been derived using the
% following interpolation methods:

% \begin{enumerate}
% \item Both neighbours are not missing. This is the case already
%   discussed and presented in Fig.~\ref{fig.diff-195}.
% \item The upper of the two neighbours is missing. The interpolated
%   value is then simply the value of the lower neighbour.
% \item The lower of the two neighbours is missing. The interpolated
%   value is then simply the value of the upper neighbour.
% \item Both neighbours are missing. The interpolated value is then the
%   average of the two next nearest neighbours.
% \end{enumerate}

% The dispersion in cases (2) and (3) remains fairly symmetric about
% zero, but is much greater than for case (1) begin 13~\%\ compared to
% 3.5~\%. For case (4) the dispersion is clearly asymmetric, with a mean
% of 11~\%\ and a standard deviation of 11~\%.

% \begin{figure}[h]
% \centerline{\epsfxsize=14cm\epsfbox{plot_d_comparison.eps}}
% \caption{}
% \label{fig.d-comparison}
% \end{figure}

% Two exceptions can be identified however:

% \begin{enumerate}
% \item If one of the neighbours is also missing, then the missing pixel
%   will be replaced with the value of the remaining neighbour. If the
%   intensity along the slit shows a strong gradient, then
%   'interpolated' value is not a good representation of the 'actual'
%   value. Strong gradients are typically seen in transition region
%   lines.
% \item If both of the neighbours are missing, then the interpolated value
%   is derived from pixels at least two pixels away. Such pixels will
%   have only a weak intensity component from the spatial element corresponding to
%   the missing pixel, and thus could be a poor approximation for the
%   missing pixel's 'actual' value.
% \end{enumerate}

% Going back to the case where both neighbouring pixels are not missing,
% does the error derived in Sect.~\ref{sect.error} correctly represent
% the error on the missing pixel?  Implicit in the calculation is the
% assumption that the missing pixel should be the average of the
% neighbouring pixels, yet clearly this is not the case in
% reality. Appendix~\ref{app.error} describes a simple simulation that
% aims to quantify the uncertainty in deriving the missing pixel
% intensity from the neighbouring pixels. 

% The uncertainty is found to depend  on the
% spatial resolution of the instrument. Assuming the point spread
% function is a Gaussian of FWHM $N$ pixels, then the uncertainty is
% around 7~\%\ for $N=3$, and 3.5~\%\ for $N=4$.



% \begin{table}[h]
% \caption{2009 Feburary 2 warm pixel map.}
% \begin{center}
% \begin{tabular}{llllll}
% \noalign{\hrule}
% \noalign{\hrule}
% Line  & Good pixels & Parameter  & $>1\sigma$ & $>2\sigma$ & $>3\sigma$ \\
% \noalign{\hrule}
% \ion{Fe}{xii} \lam195.12 &61.3~\% 
%   &Intensity & 1.24~\% & 0.32~\% & 0.11~\% \\
%  &&Velocity  & 1.07~\% & 0.27~\% & 0.10~\% \\
%  &&Width     & 1.00~\% & 0.26~\% & 0.12~\% \\
% \noalign{\medskip}   
% \ion{Si}{vii} \lam275.35 &61.0~\%
%   &Intensity & 3.58~\% & 2.80~\% & 2.73~\%\\
%  &&Velocity  & 3.57~\% & 2.74~\% & 2.65~\%\\
%  &&Width     & 3.87~\% & 2.83~\% & 2.72~\%\\
% \noalign{\hrule}
% \end{tabular}
% \end{center}
% \label{}
% \end{table}

% \begin{table}[h]
% \caption{Synthetic 30~\% warm pixel map.}
% \begin{center}
% \begin{tabular}{llllll}
% \noalign{\hrule}
% \noalign{\hrule}
% Line  & Good pixels & Parameter  & $>1\sigma$ & $>2\sigma$ & $>3\sigma$ \\
% \noalign{\hrule}
% \ion{Fe}{xii} \lam195.12 &61.3~\% 
%   &Intensity & 8.12~\% & 1.97~\% & 0.63~\% \\
%  &&Velocity  & 8.90~\% & 2.15~\% & 0.66~\% \\
%  &&Width     & 8.34~\% & 1.89~\% & 0.67~\% \\
% \noalign{\medskip}   
% \ion{Si}{vii} \lam275.35 &61.0~\%
%   &Intensity & 6.84~\% & 3.19~\% & 2.99~\%\\
%  &&Velocity  & 7.11~\% & 3.18~\% & 2.90~\%\\
%  &&Width     & 7.96~\% & 3.41~\% & 3.04~\%\\
% \noalign{\hrule}
% \end{tabular}
% \end{center}
% \label{}
% \end{table}

% \begin{figure}[h]
% \centerline{\epsfxsize=6.5in\epsfbox{si7_30_bad.eps}}
% \caption{The image is from the 2006 December 2 data-set and formed in
%   the \ion{Si}{vii} \lam275.35 line. It represents the fitted
%   intensity from the line using calibrated data with the correct warm
%   pixel maps. The blue pixels denote those pixels that are more than
%   1$\sigma$ discrepant in intensity after fitting profiles from the
%   data calibrated using the 30~\% warm pixel maps.}
% \label{fig.si7-int-blue}
% \end{figure}

% \section{When does the number of warm pixels severely restrict
%   science?}

% This will depend on the science to be accomplished. The best way to
% quantify the problem is to say, when are X~\%\ of the CCD pixels
% classed as bad?

% Of pixels flagged as missing, the dominant contribution is from warm
% pixels. If we set $f$ to the probability that a pixel is warm, then
% $f$ is simply the number of warm pixels on the detectors divided by
% the total number of pixels. A pixel is classed as bad if itself is
% missing, and at least one of its neighbours is missing. Therefore the
% probability, $P$, of a pixel being bad is 

% \begin{equation}
% P=f^3 + 2f^2(1-f)
% \end{equation}

% We find that for $\ge 5$~\%\ of pixels to be bad we need $f\ge 0.165$
% and for 10~\%\ of pixels to be bad we need $f\ge 0.238$.

\section{Recommendations}

% For the purpose of this document three types of pixel are identified
% on the EIS detector: a \textbf{good pixel} is one that is flagged as
% missing by EIS\_PREP; a \textbf{recoverable pixel} is one that is
% flagged as missing by EIS\_PREP, but its two neighbours in the
% detector-Y direction are not missing; and a \textbf{bad pixel} is one
% that is flagged as missing by EIS\_PREP and for which at least one of
% the neighbouring pixels in the detector-Y direction are also missing.


\begin{enumerate}
  \item Scientists should always use interpolated intensities and errors
    for missing pixels when analysing EIS data. Significant errors may
    result if missing 
    pixels are simply ignored, particularly as the number of warm
    pixels on the detector increases.
  \item The method for interpolating the intensity of missing pixels
    in EIS\_PREP should be modified to the method outlined in
    Sect.~\ref{sect.interp-methods}. 
  \item The error bars assigned to interpolated data points should be
    derived using the method described in Sect.~\ref{sect.error}, but
    modified according to how the interpolated intensity value was
    derived (Sect.~\ref{sect.interp-methods}).
  \item Accurate re-creation of line fit parameters appears to be
    possible even up to the case of 30~\%\ warm pixels. This
    corresponds to a lifetime of around 6 years considering the
    current rate of increase of warm pixels on the EIS detectors.
\end{enumerate}

\section{Software implementation}

The method for interpolating missing pixels outlined in
Sect.~\ref{sect.interp-methods} is implemented in the EIS software
through the routine EIS\_REPLACE\_MISSING. If the user has an existing
leve1-1 EIS FITS file with name `l1name', then the interpolation can
be performed by doing:

\begin{verbatim}
IDL> wd=eis_getwindata(l1name, 195.12)
IDL> eis_replace_missing, wd
\end{verbatim}

which will modify both the .INT and .ERR tags of the structure WD.

Alternatively, EIS\_REPLACE\_MISSING can be called through a keyword
to EIS\_GETWINDATA:

\begin{verbatim}
IDL> wd=eis_getwindata(l1name, 195.12, /refill)
\end{verbatim}

It is also possible to run EIS\_PREP using the new interpolation
method for missing pixels by setting the /REFILL keyword, e.g.,

\begin{verbatim}
IDL> eis_prep, l0name, /default, /save, /refill
\end{verbatim}

This will write out the level-1 FITS file with each window containing
interpolated data. Note that information on which pixels were flagged
as missing is
lost since the error file will no longer contain -100 values to mark
the location of missing pixels.

% \newpage
% \appendix

% \section{Do warm pixels contain information about the Sun?}

% We consider a data-set obtained on 2007 December 11 10:25 UT. This is
% a large format raster obtained on an active region over a period of
% five hours. If we take the window containing the \ion{He}{ii}
% \lam256.32 line then we find a strong warm pixel at pixel location
% (23,233) which is close to the centre of the emission
% line. Fig.~\ref{fig.he2-wp} shows the variation of the intensity at the
% warm pixel (Ypix=233) with time as the raster is built up. Also shown
% is the variation of the neighbouring pixel (Ypix=232) which is not a
% warm pixel. These plots show that the warm pixel signal is a sum of
% an instrumental signal that varies in amplitude with the orbital
% period of the spacecraft, and a solar signal.

% Can we extract the solar signal from the warm pixel, thus making the
% warm pixel useful?

% One possibility is if the variation of all the warm pixels' dark
% current values with the Hinode orbit is the same, and follows a
% function $f(t)$. The dark current in any warm pixel, $i$, is then
% $a_if(t)$. I.e., the warm pixel dark currents vary only in their
% amplitudes, $a_i$. The signal in a warm pixel is then

% \begin{equation}
% S_i=P+a_if(t)+d_i
% \end{equation}

% where $P$ is the CCD pedestal value (a constant across the detector),
% and $d_i$ is the solar signal in the pixel.

% By considering the brightest warm pixel on the detector we can
% determine $f(t)$, we then simply need to work out the amplitude of our
% warm pixel. This can be done by considering a single exposure and
% comparing the amplitude of the warm pixel with that of the of
% reference warm pixel. This determines...

% \begin{figure}[h]
% \centerline{\epsfxsize=12cm\epsfbox{dec11_he2_warm_pixel.eps}}
% \caption{}
% \label{fig.he2-wp}
% \end{figure}


% \section{A theoretical study of errors introduced through interpolation}\label{app.error}

% Here a synthetic data set is considered in order to investigate how
% interpolated data points compare with actual data points.

% Consider a column of 9 pixels that represent the emission from a
% 9~arcsec segment of the Sun. We imagine  that each pixel is
% independent of the other, so the intensity in one pixel has no
% correlation with the intensity in another pixel.

% We now consider observing this patch of Sun with an instrument that
% has a spatial resolution of $N$ pixels and has a point spread function
% that is a Gaussian.

% By randomly generating a set of intensities for the 9 pixels, we
% compute the observed intensities, $I$, for each pixel. For the middle 3
% pixels, we consider how well the average of the neighbour pixels,
% $I_{\rm avg}=(I_3+I_5)/2$, agrees with the observed intensity of the central
% pixel, $I_4$, through the quantity

% \begin{equation}
% d=(I_4 - I_{\rm avg}) / I_{\rm avg}
% \end{equation}

% Repeating this for 5000 different, randomly-generated intensities
% yields a distribution of $d$ values and Fig.~\ref{fig.theory} shows
% these distributions for Gaussian widths of 2, 3 and 4  pixels, where $d$ is
% represented as a percentage.

% \begin{figure}[h]
% \centerline{\epsfxsize=16cm\epsfbox{plot_theory_results.eps}}
% \caption{Results of the simulation for the three values of the FWHM of
% the Gaussian point spread function. $d$ is the difference between the
% central pixel intensity and the average of the neighbouring pixel
% intensities, divided by the average. In the plots it is represented as
% a percentage. The standard deviation of $d$, $\sigma$, is shown.}
% \label{fig.theory}
% \end{figure}

% As one expects, the higher the spatial resolution, the less the
% average of the neighbouring pixels represents the intensity of the
% middle pixel. For the case of a FWHM=4, the average intensity is found
% to be within 3.6~\%\ of the actual intensity most of the time, and so
% is a good representation of the central pixel's intensity. 

\newpage
\appendix

\section{Using different warm pixel maps in EIS\_PREP}\label{app.wp}

EIS\_PREP looks for warm pixel maps in the directory
\$EIS\_CAL\_DATA/wp which, for the Solarsoft distribution, is

\begin{verbatim}
$SSW/hinode/eis/data/cal/wp
\end{verbatim}

For the 2006 December 2 data-set considered in the present work, the
default warm pixel maps are from 2006 December 6 and are found in

\begin{verbatim}
$SSW/hinode/eis/data/cal/wp/2006-12-06
\end{verbatim}

In order to force EIS\_PREP to use a different set of warm pixel maps,
the directory Users/pyoung/cal/wp was created in the user's home
directory and, upon entering IDL, \$EIS\_CAL\_DATA was changed to:

\begin{verbatim}
IDL> setenv,'EIS_CAL_DATA=/Users/pyoung/cal'
\end{verbatim}

A new sub-directory was created under /wp called `2006-12-02'. The new
set of warm pixel maps was placed in here. Therefore, when EIS\_PREP
is run and looks for the set of maps closest in time to the
observation, it picks up the set in `2006-12-02'.


\section{Revised method for interpolating missing pixels}\label{app.software}

The revised method for interpolating missing pixel intensity values
was described in Sect.~\ref{sect.interp-methods}. To implement this
in software for the present work, no change was made to
EIS\_PREP. Instead, a new routine called EIS\_REPLACE\_MISSING was
written which takes the output structure from EIS\_GET\_WINDATA and
computes the revised intensity and error arrays. Because missing
pixels are flagged in the error array, it is straightforward to
identify all the missing pixels and recompute intensity values with
the new method.

Note that EIS\_REPLACE\_MISSING uses simple array operations to
compute the interpolated intensities and so is computationally fast. 

\end{document}
