
\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. 15}
\vspace{3mm}
\hrule
\noindent Version 2.3 \hfill 8 July 2011
\vspace{2mm}
\hrule

\begin{centerpage}

\begin{center}
{\Large\bf Deriving densities, column depths and filling factors from Hinode/EIS data}\\
\mbox{}\\
\mbox{}\\
Peter Young\\
George Mason University\\
4400 University Drive\\
Fairfax, VA 22030\\
U.S.A.\\
\mbox{}\\
pyoung9@gmu.edu
\mbox{}\\
\end{center}

\end{centerpage}

\end{titlepage}

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

\section{Overview}

The EIS instrument has access to some of the best coronal density
diagnostics that allow good density estimates to be made from
individual spatial pixels, thus enabling the creation of density maps.
From a density map, a map of plasma column depths can then be produced
which can then be used to estimate the plasma filling factor.
This document describes methods and software
for performing this work with EIS data.

The software described requires that the CHIANTI database
\citep{dere97,dere09} is part of your Solarsoft
distribution. 

\section{Basics of density diagnostics}\label{sect.basics}

\begin{figure}[!b]
\centerline{\epsfxsize=9cm\epsfbox{mg7_ratio_plot.eps}}
\caption{Predicted variation of the \ion{Mg}{vii}
  \lam280.75/\lam278.39 ratio with density, computed from the CHIANTI
  database.} 
\label{fig.mg7}
\end{figure}

A \emph{density diagnostic} is pair of emission lines emitted from the same
ion for which the ratio of
emissivities is sensitive to the electron
density. Fig.~\ref{fig.mg7} shows the variation of the emissivity
ratio for a pair of \ion{Mg}{vii} lines commonly used in EIS data
analysis. The emissivity is a 
theoretical quantity that represents the energy released through
radiation from a
particular emission line from a unit volume of plasma.
For this work the emissivities are computed using
the CHIANTI atomic database and, in particular, the
EMISS\_CALC procedure in CHIANTI.

The detailed reasons for why particular line ratios are sensitive to density are
beyond the scope of this document, and so interested readers are
referred to \citet{dere81} and \citet{mariska92}.

Most coronal lines are optically thin and so the measured line
intensity is directly proportional to the emissivity, which means that
the measured intensity ratio can be
converted to a density using the emissivity ratio plot 
 (such as that shown in Fig.~\ref{fig.mg7}).  The software described in the
present work assumes that the observed lines are optically thin.

One point to note is that care must be taken as to whether intensities
are given in energy or photon units. For example, the ratio shown in
Fig.~\ref{fig.mg7} would have to be multiplied by 278.39/280.75=0.992
to obtain the ratio in photon units. If two lines are far apart in
wavelength, for example the \ion{Fe}{x} \lam257.26/\lam184.54 ratio,
then this factor can be large.  The routines described in this
document assume that the data have been calibrated by EIS\_PREP in
units of erg~cm$^{-2}$~s$^{-1}$~sr$^{-1}$~\AA$^{-1}$ (this is the
default option for EIS\_PREP). Theoretical line ratios are computed
with CHIANTI in energy units.


\section{Software summary}

The basic steps to deriving a density map are given in the table
below. The \verb|eis_auto_fit| routine is described in EIS Software
Note \#16, and the other routines are described in more detail
below. 

\begin{table}[h]
\begin{center}
\begin{tabular}{lp{7cm}p{7cm}}
\noalign{\hrule}
\noalign{\smallskip}
\noalign{\hrule}
\noalign{\smallskip}
%% table headings here
 & Step & IDL code\\
\noalign{\hrule}
\noalign{\smallskip}
%% table entries here
1 & Fit Gaussians to the ratio's numerator and denominator lines
  & \verb|eis_auto_fit, windata1, fit1|\hfill \verb|eis_auto_fit, windata2, fit2|\\
2 & Obtain theoretical ratio variation from CHIANTI 
  & \verb|ratio=eis_chianti_dens_ratio()| \\
3 & Derive density and column depth map
  & \verb|dens=eis_density(fit1,fit2,ratio)| \\
\noalign{\hrule}
\end{tabular}
\end{center}
\label{}
\end{table}

\section{Gaussian fitting and line blending}

The first step in the process is to perform Gaussian fitting to the
emission lines. The software described here assumes that the routine
\verb|eis_auto_fit| has been used.

Before proceeding to derive densities, it is very important that the
user be aware of any blending issues that affect the lines to be
used. Not only is blending with other species important, but also self
blending. Consider for example the \ion{Fe}{xii} line found at 186.88~\AA\ in
the EIS spectrum. This line actually consists of two \ion{Fe}{xii}
transitions with laboratory wavelengths of 186.85 and 186.89~\AA. The
general recommendation is to fit the observed feature with a single
Gaussian. When we come to derive a density using this line (usually
relative to \ion{Fe}{xii} \lam195.12) it is very important that the atomic model
includes both of the \lam186.85 and \lam186.89 transitions, otherwise the
derived densities will be in error. 

For inexperienced users it is best to either consult existing EIS
papers that use density diagnostic lines, or contact someone on the
EIS team if you are unsure of blending issues for your lines. It is
also useful to be aware of typical densities for coronal structures:
quiet Sun is typically about $10^{8.5}$~cm$^{-3}$, coronal holes about
$10^{8-8.5}$~cm$^{-3}$; the outer regions of active regions about
$10^9$~cm$^{-3}$; active  
region cores about $10^{9.5-10}$~cm$^{-3}$. Densities above $10^{10}$~cm$^{-3}$ will
mostly be caused by flaring. Therefore if you are analyzing a quiet
Sun data-set but are finding densities of $10^{9.5}$~cm$^{-3}$, say, then it may
indicate that blending is a problem for your lines. 

\section{Available software}\label{sect.software}

After performing Gaussian fits to the two emission lines of the
density diagnostic, there are two steps for deriving a density
array. The first is to extract the theoretical variation of the line
ratio with density, and this is performed with the routine
\verb|eis_chianti_dens_ratio.pro|: 
%
\begin{verbatim}
IDL> ratio=eis_chianti_dens_ratio()
\end{verbatim}
%
You will be asked to choose a particular line ratio from a menu. If your ratio is not listed it will be necessary to specify the precise transitions involved in the ratio -– see Appendix~\ref{app1}.

The theoretical ratio is automatically calculated using the latest
version of the CHIANTI atomic database present in the user's Solarsoft
distribution. 
The output \verb|ratio| is an IDL structure containing the ratio value
as a function of density as well as related information. 

Once \verb|ratio| has been created the two Gaussian fit structures can
be used to create a density map. The call is: 
%
\begin{verbatim}
IDL> dens=eis_density(fit1, fit2, ratio)
\end{verbatim}
%
where \verb|fit1| is the fit structure for the denominator line and
\verb|fit2| is the fit structure for the numerator line. The choice of
the denominator and numerator line needs to match the choice
made with the routine \verb|eis_chianti_dens_ratio|. If the fit
structures contain more than one line (i.e., they are the output from a
multi-Gaussian fit), then it is necessary to specify which line to
use. E.g.,
%
\begin{verbatim}
IDL> dens=eis_density(fit1, fit2, ratio, line1=0, line2=1)
\end{verbatim}
%
which specifies the line with index 0 is to be used for the
denominator line, and the line with index 1 as the numerator line.

An important point to note is that the density sensitive line pair
will often have a significant wavelength separation, which means there
will be a spatial offset in the Y-direction between the images formed from the two
lines. (The offset is due to a tilt of the grating relative to the
detector.) The offset, although usually small, can have a significant
impact on the derived densities \citep{young09}. The routine
\verb|eis_density.pro| \emph{automatically} corrects the intensity arrays for
the Y-offset.

The output \verb|dens| is an IDL structure with the following tags:
%
\begin{description}
\item[LDENS] Logarithm (to base 10) of the electron number density
  (units: cm$^{-3}$).
\item[DENS] The electron number density
  (units: cm$^{-3}$).
\item[LO] Logarithm (to base 10) of the lower limit to the electron number density
  (units: cm$^{-3}$), based on the 1-$\sigma$ error bars on the input
  line intensities.
\item[HI] Logarithm (to base 10) of the upper limit to the electron number density
  (units: cm$^{-3}$), based on the 1-$\sigma$ error bars on the input
  line intensities.
\item[RATIO] The intensity ratio of the two density sensitive lines.
\item[COLDEPTH] The column depth (units: cm) of the emitting plasma.
\item[COLDEPTH\_ERR] The error on the column depth (units: cm).
\item[ARCSEC] Scalar to be used for converting cm to arcsec (for
  column depth).
\item[MISING] The numerical value for missing pixels in the data arrays.
\end{description}

\begin{figure}[h]
\centerline{\epsfxsize=14cm\epsfbox{plot_dens.eps}}
\caption{The left panel shows a  \ion{Fe}{xiii}
(\lam203.79+\lam203.83)/\lam202.04 density map from an EIS raster
  obtained on 2007 January 20 22:32~UT. The right panel shows a slice
  through the density map at X-pixel=13. Each density measurement is
  shown by a cross for which the vertical axis denotes the uncertainty
of the measurement.}
\label{fig.plot-dens}
\end{figure}


Figure~\ref{fig.plot-dens} shows a density map derived from a raster
from 2007 January 20 22:32~UT using the \ion{Fe}{xiii}
(\lam203.79+\lam203.83)/\lam202.04 ratio, together with a slice
through the data at X-pixel=13. The error bars on the density come
from the 1$\sigma$ error bars on the line intensities computed by
\verb|eis_auto_fit|. A density slice such as this can be plotted using

\begin{verbatim}
IDL> eis_dens_slice, dens, xpix=13
\end{verbatim}




\section{Column depths}

The routine \verb|eis_density| automatically creates an array of
column depths (stored in the tag \verb|coldepth|) in addition to
densities. This section explains how the column depth is
computed. There are two methods available: the emission measure (EM)
method and the isothermal method. The
default is the EM method.   
To see how the methods work, consider the expression for relating an
observed line intensity, $I$,  to atomic and physical parameters: 
%
\begin{equation}
4\pi I = 0.83 \int G(T,N_{\rm e}) N_{\rm e}^2 {\rm d}h
\end{equation}
%
where $G(T,N_{\rm e})$ is the contribution function which contains atomic parameters for the
emission line (see the CHIANTI user guide for more details about this
function), $N_{\rm e}$ is the electron number density, and $h$ is the column
depth. 

\subsection{Emission measure method}\label{sect.col-em}

This method is based on that of \citet{pottasch63}. The contribution
function is generally a sharply peaked function with a width (in
$\log\,T$) of about 0.30 dex. The Pottasch method approximates the
shape of $G$
by a step function such that: 
%
\begin{equation}
G(T)= \left\{ \begin{array}{ll}
        G_0 & \log\,T_{\rm max}-0.15 \le \log\,T \le \log\,T_{\rm
          max}+0.15 \\
        0  & {\rm otherwise} \end{array} \right.
\end{equation}
%
The expression for the line intensity is then written as
%
\begin{equation}
4\pi I = 0.83 \,G_0 \int N_{\rm e}^2 {\rm d}h
\end{equation}
%
The quantity $\int N_{\rm e}^2 {\rm d}h$ is the emission measure that
applies at the $T_{\rm max}$ of the ion.

We now assume that the density is constant in the region where the ion
is formed (note that when we derived the density in the first place we
made this assumption). We thus have
%
\begin{equation}\label{eq.em-coldepth}
4\pi I = 0.83 G_0  N_{\rm e}^2 h
\end{equation}
%
i.e., a direct relation between the observed line intensity, the
electron density and the column depth. The quantity $G_0$ contains purely
atomic parameters and \verb|eis_density| calls the CHIANTI routine \verb|integral_calc| to
compute it.

$h$ can be computed with either the numerator or the denominator line,
or  both lines together (it can be seen that
Eq.~\ref{eq.em-coldepth} holds for a linear combination of emission
line intensities), and in fact the latter option is implemented in the
\verb|eis_density| code.  This has an advantage as the contribution
function for the sum of the numerator and denominator lines generally
has a small density sensitivity, and so the $G_0$ value is weakly
dependent on density. In the \verb|eis_density| code, the $G_0$ values
for each spatial pixel
are computed for the densities that apply at those pixels.


\subsection{Isothermal method}

This method assumes that the plasma emitting the density diagnostic
lines is an isothermal plasma and that the temperature is the
temperature of maximum ionization of the plasma. This approximation
actually yields a lower limit to the column depth. Since the density
is also assumed constant then the expression for the line intensity
becomes 
%
\begin{equation}
4\pi I = 0.83 G(T_{\rm max},N_{\rm e}) N_{\rm e}^2 h
\end{equation}
%
and so the line intensity is again directly related to the electron
density and column depth. 

As for the EM method, $h$ is computed by \verb|eis_density| by summing
the numerator and denominator intensities, and summing the $G$ values.

\subsection{Method comparison}

Using the example data-set from 2007 January 20 22:32~UT (see also
Figure~\ref{fig.plot-dens}), the column depths computed from the EM
and isothermal methods are plotted in Figure~\ref{fig.coldepth}. This
demonstrates that the isothermal column depth is smaller than the EM
column depth. The ratio varies between 1.4 and 1.7 across the plot.

Converting to arcseconds, the smallest and largest column depths from the EM
method are 10 and 80 arcseconds, respectively.


\begin{figure}[t]
\centerline{\epsfxsize=12cm\epsfbox{plot_coldepth.eps}}
\caption{Column depths deduced from the \ion{Fe}{xiii}
(\lam203.79+\lam203.83)/\lam202.04 ratio of the 2007 January 20
22:32~UT data-set are shown. The values represented by the black line have
been computed with the EM method; the blue line shows values computed
with the isothermal method.}
\label{fig.coldepth}
\end{figure}

\subsection{Column depth uncertainty}

If atomic data uncertainties are ignored, then the column depth
uncertainty can be derived from the intensity and density
uncertainties. The application of the density uncertainty is not
straightforward, however, because the relationship between the
theoretical intensity ratio variation and density is not linear. This
means that the error on the measured intensity ratio does not
translate to a standard error on the density. For example, if we
consider the \ion{Fe}{xiii} \lam203.828/\lam202.044 ratio, then using
the atomic data from version 6 of CHIANTI shows that an observed ratio
of $1.9\pm 0.3$ corresponds to a density of  $\log\,(N_{\rm
  e}/{\rm cm}^{-3})=9.65^{+0.14}_{-0.13}$, or $N_{\rm
  e}=4.47^{+1.70}_{-1.16}\times 10^9$~cm$^{-3}$. The ratio in this
case was chosen to lie in the center of the ratio sensitivity
curve. Choosing a ratio close to the bottom of the sensitivity curve,
$0.6\pm 0.3$, gives more asymmetric errors for $\log\,N_{\rm e}$, although
for $N_{\rm e}$ they become more symmetric: $\log\,(N_{\rm
  e}/{\rm cm}^{-3})=8.99^{+0.19}_{-0.30}$, or $N_{\rm
  e}=9.77^{+5.33}_{-4.87}\times 10^8$~cm$^{-3}$. For ratios at the top
of the sensitivity curve, e.g., $2.7\pm 0.3$, the $N_{\rm e}$ errors
become strongly asymmetric, but the $\log\,N_{\rm e}$ errors less so:  $\log\,(N_{\rm
  e}/{\rm cm}^{-3})=10.08^{+0.27}_{-0.19}$, and $N_{\rm
  e}=1.20^{+1.04}_{-0.42}\times 10^{10}$~cm$^{-3}$.

Generally density diagnostics will be applied when the observed ratios
are close to the region of maximum sensitivity of the ratio. Since the
$\log\,N_{\rm e}$ errors are closer to being symmetric in this case,
then we will construct a standard error by simply averaging the upper
and lower limits on $\log\,N_{\rm e}$. For example, for the \ion{Fe}{xiii} ratio
value of $1.9\pm 0.3$, the standard error on $\log\,N_{\rm e}$ is
taken as $\pm 0.135$. It is this error that is then propagated to
determine the column depth uncertainity.

Considering the emission measure method for deriving the column depth
(Eq.~\ref{eq.em-coldepth}) and writing $n$ for $\log\,N_{\rm e}$, and
$k=4\pi/0.83G_0$ we have
%
\begin{equation}
h={kI \over 10^{2n}} = k I e^{an}
\end{equation}
%
where $a=-2\ln 10=-4.605$. Using standard propagation of error
techniques \citep[e.g., Sect. 3.2 of][]{bevington}, the uncertainty on
$h$ is given by
%
\begin{equation}
\sigma_h^2 = \sigma_I^2 \left({h \over I}\right)^2 + \sigma_n^2 {a^2h^2}
\end{equation}
%
This is the formula that is implemented in \verb|eis_density.pro|.



\section{The filling factor}

The filling factor of a plasma is the fraction of a volume that is
contributing to the observed emission. Consider the case of a spherical
volume that is resolved by the observing instrument such that the
diameter is 10 pixels (=10\arcsec). Consider the spatial pixel at the
center of the observed circle of emission. After performing the
density calculation with \verb|eis_density| you find a column depth of
$5\times 10^8$~cm at this pixel. This corresponds to about
7\arcsec. This then implies that only 7 of the 10\arcsec\ path length through the
diameter of the sphere is actually emitting the density diagnostic
lines. Therefore the filling factor is 0.7.

The key point is that computing the filling factor \emph{requires}
that the user make some assumption about the emitting
volume. Typically the assumption may be that the emitting volume is a
sphere (for a bright point, for example), or a cylinder (for a loop).


\begin{thebibliography}{}

\bibitem[Bevington \& Robinson(2003)]{bevington}
  Bevington, P. R., \& Robinson, D. K. 2003,
  Data Reduction and Error Analysis for the Phyiscal Sciences, 3rd
  Ed., McGraw-Hill (New York)

\bibitem[Dere \& Mason(1981)]{dere81}
  Dere, K. P., \& Mason, H. E. 1981,
  in Solar Active Regions, ed., F. Q. Orrall, (Boulder: Colorado
  Associated Univ. Press), 129

\bibitem[Dere et al.(1997)]{dere97}
   Dere, K. P., Landi, E., Mason, H. E., Monsignori-Fossi, B. C., \& 
   Young, P. R. 1997,
   A\&AS, 125, 149

\bibitem[Dere et al.(2009)]{dere09}
  Dere K. P., Landi E., Young P. R., et al. 2009,
  A\&A, 498, 915

\bibitem[Mariska(1992)]{mariska92}
Mariska, J. T. 1992,
  The Solar Transition Region, CUP

\bibitem[Pottasch(1963)]{pottasch63}
  Pottasch, S. R. 1963,
  ApJ, 137, 945

\bibitem[Young et al.(2009)]{young09}
   Young, P. R., Watanabe, T., Hara, H., \& Mariska, J. T. 2009,
   A\&A, 495, 587

\end{thebibliography}


\newpage

\appendix

\section{How to specify a new line ratio in
  eis\_chianti\_density\_ratio}\label{app1}

The routine \verb|eis_chianti_density_ratio| comes pre-loaded with a
set of the most common EIS density diagnostics. If a diagnostic not on
this list is needed, then the following procedure needs to be
performed.

Consider the case of the \ion{Ni}{xvi} \lam194.02/\lam185.23 ratio
which lies in the EIS SW waveband, but is not listed by
\verb|eis_chianti_density_ratio|. For each atomic model within
CHIANTI, a particular transition is identified by a unique index
number. For the \lam185.23 and \lam194.02 these indices are 66 and 81,
respectively. To specify these  diagnostic lines to
\verb|eis_chianti_density_ratio|, the call is:
%
\begin{verbatim}
IDL> ratio=eis_chianti_dens_ratio('ni_16',66,81)
\end{verbatim}
%
How are the indices obtained?  This is done with the following commands:
%
\begin{verbatim}
IDL> em=emiss_calc(28,16)     ;  28 - Ni, 16 - XVI
IDL> em1=emiss_select(em,wra=[185,186],sel=sel)
\end{verbatim}
%
A widget will appear asking you to select a line in the specified
wavelength range. The line `185.230' is the correct one. The number
contained in the output \verb|sel| is the CHIANTI index of this
line. Repeating this step for the 194.02 line gives the second index.

For blended lines an array of indices is input. E.g., [81,82].

\section{Document modification history}

\noindent\emph{Version 2.3}: Added Sect.~\ref{sect.basics}.

\noindent\emph{Version 2.2}: Added to the list of tags of the \verb|dens|
output (Sect.~\ref{sect.software}); modified Sect.~\ref{sect.col-em}
following implementation of density dependence of $G_0$ within
\verb|eis_density|. 

\end{document}
