\documentclass[11pt]{article}

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

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

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

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

\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. 9}
\vspace{3mm}
\hrule
\noindent Version VERSION 1.1 \hfill 3 July 2010
\vspace{2mm}
\hrule

\begin{centerpage}

\begin{center}
{\Large\bf EIS POINTING}\\
\mbox{}\\
\mbox{}\\
John Mariska\\ 
Code 7673\\ 
Naval Research Laboratory\\
Washington, DC 20375\\
USA\\ 
\mbox{}\\
\verb+John.Mariska@nrl.navy.mil+\\
\mbox{}\\
\end{center}

\end{centerpage}

\end{titlepage}

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

\section{Overview}

Each EIS FITS file contains pointing information, both in the
headers and for each exposure as columns in the binary tables.
Actual pointing details for a particular FITS file are provided
by methods for the EIS\_DATA object. Because both spacecraft
pointing data and a full understanding of the offsets between EIS
and the spacecraft are required, accurately computing these
quantities has been challenging. The purpose of this document is
to outline in detail the information that goes into computing the
pointing numbers.

\section{Computing Solar Locations from EIS and Hinode data}

Pointing information is used in two places in the EIS software.
In the planning software, knowledge of all the offsets that
define the relationship between the spacecraft pointing and EIS
pointing is necessary to translate the selected $x$ and $y$
positions on the Sun into fine mirror positions and start
positions along the slit. In the FITS file generation software,
spacecraft pointing information is combined with the same offset
information to calculate the location on the Sun of each position
along an EIS slit for each exposure. This information is then
used to determine keyword values in the FITS headers. In an ideal
world these two tasks should use the same offset information to
go from planned solar location to instrument pointing parameters
and from returned instrument pointing parameters and spacecraft
pointing data to actual solar location. In practice, this has not
been the case for all EIS FITS files. Note that all pointing
values refer to data in the \ion{He}{II} 256~\AA\ line.
Additional corrections in solar $y$-positions are necessary for
other wavelengths.

Reconstructing the solar location of any EIS exposure requires
spacecraft attitude information, the EIS fine mirror position at
the time of the exposure, and the offsets in $x$ and $y$ between
the spacecraft pointing and EIS.

\subsection{Hinode AOCS Data}

Pointing information from the Hinode Attitude and Orbit Control
System (AOCS) is provided in the HK2 housekeeping data packets.
The combination of the UFSS and gyro data results in three
parameters provided in the HK2 files at each
PACKET\_EDITION\_TIME:
\begin{description}
\item[HK2\_ATT\_X] N/S position, with larger numbers
  increasingly south
\item[HK2\_ATT\_Y] E/W position, with larger numbers
  increasingly east
\item[HK2\_ATT\_Z] Rotation around $Z$
\end{description}

Data in the files are provided at 2~s intervals. The EIS data
reformatting system produces HK2 FITS files, which are located in
\$HINODE/eis/status/YYYY/MM/DD directories at ISAS and NRL. The
24-bit words for each quantity require a little manipulation to
recover the position in arcsec. A second set of HK2 FITS files,
which are in a more convenient format are also available. These
are located in \$HINODE/cmn/HK2/YYYY\_MM directories at ISAS and
NRL. The IDL function hinode\_get\_att.pro uses these files to
return the the times and the associated $X$ and $Y$ attitude
information converted to arcsec and corrected so that standard
solar sign conventions apply. Note, however, that HK2\_ATT\_X
refers to the N/S direction and HK2\_ATT\_Y refers to the E/W
direction. Each EIS FITS file contains columns in the binary
table listing the HK2\_ATT\_X (YCEN\_TI1) and HK2\_ATT\_Y
(XCEN\_TI1) values at the start time for each exposure. These
numbers have the correct solar sign convention.

A slightly different system for computing the pointing was used
early in the mission---up until 2006 December 4. Calling EIS\_MKFITS or 
EIS\_FIX\_POINTING with /noaocs will invoke software for 
generating files using the earlier algorithm (see the CONSTRUCT\_XYPOS
method in the EIS\_SPCD object for details). However, this 
software has not been extensively debugged. Pointing information in
files created before 2006 December 4 should be viewed with some
caution.

How accurate are the positions provided in the HK2 files? Firm
numbers are difficult to find. Once a set of offsets is agreed
upon for EIS, it should be possible to compare EIS rasters with
EIT images and obtain an observational picture of this value.

While the location on the Sun may be uncertain, fluctuations
around that location can be measured with considerable accuracy.
The UFSS signals have random noise with a $3\sigma$ value of only
0.3 arcsec. Thus, this data can be used to compute the spacecraft
jitter as observations are made and corrections can then be made
when the data are processed. As discussed below, the EIS\_DATA
object methods that return pointing information treat the
spacecraft $x$- and $y$-pointing data differently, but jitter in both directions
is possible to extract using these methods. Note that the
UFSS signal does not include the EIS-induced jitter, which is
significantly larger. The EIS jitter is similar to that observed
with XRT, and John Mariska has revised the routine XRT\_JITTER to
compute the expected EIS jitter. The routine EIS\_JITTER is in
the EIS SSW distribution. The usefullness of EIS\_JITTER is
discussed further in \S\ref{eis_jitter}.

\subsection{EIS Coarse and Fine Mirror Positions and Slit Windows}

The EIS potential field of view is defined in the $y$-direction
by the 1024 arcsec slit height and in the $x$-direction by the
available range of the coarse and fine mirror mechanisms. Coarse
mirror motion is provided by a ball screw and linear bearing
arrangement, which can move in step sizes of approximately 0.30
arcsec on the Sun. This mechanism has a range of more than $\pm
2750$ steps, leading to a range on the Sun of $\pm 825$ arcsec.
During instrument development, the intention was to use this
capability to offset EIS from the spacecraft pointing allowing
studies of different regions than SOT might be interested in. In
practice, however, the mechanism has only been used once on 2007
Jan 22 to bring the center of the EIS field of view closer to the
center of the SOT field of view. At this time, it is does not
appear likely that the coarse mirror position will be changed
again. Home position for this mirror is defined as the position
it was located at early in the mission and has a value of 43703L.
The position after the move is 47659L, and the $x$-position shift
that resulted has been determined to be 130 arcsec.

The EIS fine mirror mechanism uses a piezoelectric transducer
(PZT) actuator and a flex-pivot arrangement to tilt the mirror,
changing the solar position on the slit. This mechanism moves the
mirror in 0.1248 arcsec steps (which need to be multiplied by two
to get the image motion on the Sun) to position one of the EIS
slits anywhere in the available field of view and to raster the
Sun. The nominal useful range of the mirror is from 600 to 3000.
Thus the center of the potential EIS field of view in $x$ is at
position 1800. The center of the potential EIS field of view in
$y$ is position 512 on each slit. Increasing numbers for the fine
mirror position move the slit east on the Sun. All offsets from
the spacecraft (and from XRT and SOT) are relative to the center
of the potential EIS field of view at a fine mirror position of
1800 and a slit location of 512.

\subsection{EIS Offsets}

Offsets between the center of the potential EIS field of view and
the Hinode pointing were measured early in the mission and after
the coarse mirror move on 2007 Jan 22. The approach taken in the
EIS FITS file generation software is to use the values from early
in the mission and then apply a second offset based on the new
position determined after the coarse mirror move. For FITS files
generated up until (TBD), this second correction only changes the
solar $x$-offset. The solar $y$-offset also changed when the
coarse mirror was moved. This may account for some disagreements
between pointing in the EIS FITS file headers and pointing
determined from comparing EIS rasters with data from other
spacecraft.

The $x$- and $y$-offset values carried in the cal\_response.txt
file are $-129.6$ and $-36.3$, respectively. Correcting for the
coarse mirror move, adds 130.0 arcsec to the $x$-offset value,
resulting in a new $x$-offset of $+0.4$ arcsec. The planning
software was updated after the coarse mirror move and now uses
$x$- and $y$-offset values of 0.0 and 50.0, respectively.
Assuming a different sign convention, the $x$-offset values agree
and the $y$-offset values differ by 13.7 arcsec. This was an 
inconsistency between the pointing
information used by the planning software and that used by the
FITS file generation and reading software. This inconsistency was 
corrected in (TBD) July 2010.

There is also an offset between the 1 arcsec slit and the 2
arcsec slit. The 2 arcsec slit image center lies 8 arcsec west of
the position of the centers of the 1 arcsec slit and the 40
arcsec slot. This is accounted for in the planning software and also,
as of 25 Feb 2010, in the FITS file generation software.

\subsection{Computing Pointing for EIS FITS Files}

Table~\ref{table:pointing_data} summarizes the parameters that go
into computing the EIS pointing for the FITS headers and for
returning pointing information when the appropriate EIS\_DATA,
EIS\_CAL, and EIS\_SPCD
object methods are called. In principle, roll information is also
needed to compute the pointing, and the equations used in the
EIS\_SPCD object methods include terms for that correction. In
practice, these numbers do not appear to be important and the
basic pointing equations for each EIS exposure as currently
implemented simplify to
\begin{equation}
x = \mathit{att_x} + \mathit{off_x} + (\mathit{fm_h} -
\mathit{fm_{pos}}) \cdot 2 \cdot \mathit{fm_{ss}} +
(\mathit{cm_{pos}} - \mathit{cm_h}) \cdot cm_{ss}
\end{equation}
and
\begin{equation}
y_i = \mathit{att_y}[0] + \mathit{off_y} - y_h +
\mathit{y_{start}} + i\ ,
\end{equation}
where $\mathit{fm_{pos}}$ is the position of the fine mirror for
the exposure, $\mathit{cm_{pos}}$ is the position of the coarse
mirror for the exposure, $\mathit{y_{start}}$ is the pixel value
of the lowest $y$-pixel in the exposure window, and $i$ indexes
the pixels in the window along the slit from the start value.

\begin{table}
\centering
\caption{Pointing Data\label{table:pointing_data}}
\begin{tabular}{lll}
\hline
Name & Meaning & Units\\
\hline
\multicolumn{3}{l}{Data from Hinode HK2 files}\\
$\mathit{hk_{time}}$ & Time of AOCS measurement & s since 1-Jan-2000 UT\\
$\mathit{att_x}$ & 
Hinode $x$-position & Solar coordinates arcsec N/S direction\\
$\mathit{att_y}$ & Hinode $y$-position & Solar coordinages arcsec E/W
direction\\
& \\
\multicolumn{3}{l}{Data from
  \$SSW/hinode/eis/response/cal\_response.txt}\\
$\mathit{fm_{ss}}$ & EIS fine mirror step size & 0.1248 arcsec\\
$\mathit{fm_h}$ & EIS fine mirror home position & 1800\\
$\mathit{cm_{ss}}$ & EIS coarse mirror step size & 0.032862 arcsec\\
$\mathit{cm_h}$ & EIS coarse mirror home position & 43703L\\
& \\
$y_h$ & Reference position for EIS slits & CCD $y$-pixel 512\\
& \\
$\mathit{off_x}$ & $x$-offset from Hinode pointing to ref\_x & $-129.6$\\
$\mathit{off_y}$ & $y$-offset from Hinode pointing to reg\_y & $-36.3$\\
& \\
\multicolumn{3}{l}{Data from other sources}\\
$\mathit{slit_{off}}$ & Offset between 1 and 2 arcsec slits &
  2 arcsec slit is 8 arcsec west\\
\hline
\end{tabular}
\end{table}

In the solar $x$-position calculation, the value of the
spacecraft $x$-position at the beginning of each exposure is used.
The EIS\_DATA object method that returns the solar $y$-positions
along the $y$-direction of the exposure window, however, uses
just the spacecraft solar $y$-position for the first exposure.
This means that the spacecraft $x$-jitter (and tracking) is already included in
the $x$-positions, but that additional processing is needed to
plot the effect of the spacecraft $y$-jitter on the sequence of
exposures. Note that this is a very small effect, and the
$y$-jitter information is available in the EIS\_DATA object through 
the GETYCEN method which returns the spacecraft $y$ as a function 
of time.

The $\mathit{att_x}$ and $\mathit{att_y}$ values are available
every 2 s during the exposure. In the EIS FITS generation
software, the spacecraft pointing information is interpolated to
the exposure start time. Thus, as the spacecraft pointing
fluctuates this should be reflected in the positions recorded in
the FITS file. Since EIS exposure times are usually much longer
than 2 s, the recorded position could be different from some kind
of a mean position computed over the length of the exposure.
Hinode spacecraft pointing data suggest that the jitter over an
exposure will be 2−-3 arcsec at most.

Key pointing information about each EIS raster or sit-and-stare
observation is contained in the FITS headers. These values are
important for establishing the location of the EIS observation on
the Sun to facilitate approximate alignment with images from
other data sources. Table~\ref{table:fits_keywords} lists the
important FITS header keywords for pointing. While all the
pointing information in the headers should be recoverable from
the detailed data in the file itself, it is important that the
numbers be useful without the file having to be read.

\begin{table}
\centering
\caption{FITS Pointing-Associated Header
  Keywords\label{table:fits_keywords}}
\begin{tabular}{ll}
\hline
Keyword & Meaning\\
\hline
DATE\_OBS & Start date and time of first exposure\\
& \\
XCEN & Center of the raster in solar $x$\\
YCEN & Center of the raster in solar $y$\\
& \\
CRPIX1 & Reference pixel in solar $x$ (currently listed as 1)\\
CRPIX2 & Reference pixel in solar $y$ (currently listed as 512)\\
CRVAL1 & Solar coordinate value of CRPIX1\\
CRVAL2 & Solar coordiante value of CRPIX2\\
& \\
CDELT1 & Pixel size in solar $x$ (depends on slit and scan step size)\\
CDELT2 & Pixel size in solar $y$ (equivalent to the $y$-step size
in arcsec)\\
& \\
FOVX & Field of view in solar $x$ in arcsec\\
FOVY & Field of view in solar $y$ in arcsec\\
\hline
\end{tabular}
\end{table}

For any given observation, Hinode is either at a fixed pointing
with the Sun rotating beneath the EIS slit, or using rotation
compensation with the spacecraft location being automatically
adjusted to follow the same solar location. When rotation
compensation is used---normally the case---this means that as a
sequence of exposures takes place the coordinates that define the
boundaries of the region to be observed are changing. The
pointing data in the FITS file contain the instantaneous solar
position at the time the exposure was initiated. Since a time is
available in the file for each exposure, everything inside the
file is internally consistent. The FITS headers, however, do not
include the time of each exposure, and thus the pointing keywords
should be tied to a time that is also provided in the header. The
best time to use is the one contained in the DATE\_OBS
keyword—the start time of the raster. This means that all the
pointing data in the FITS headers need to be positions at that
time.

The XCEN and YCEN keywords were previously computed by taking the
median of the pointing values for all the exposures. This helped
take care of the problem of computing the center of a raster with
many missing exposures, but it was not clear what time to
associate with the positions. A better approach, implemented since
25 Feb 210, is to let
the first exposure in the observation define the SW boundary of
the box that the raster defines on the Sun (EIS scans from west
to east), and then use the difference in fine mirror steps
between that exposure and the last exposure in the raster and the
height of the observing window in $y$ to define the NE boundary
of the box at the same time. With this data, the center of the raster
box at the time specified by DATE\_OBS is computed and XCEN
and YCEN would be consistent with DATE\_OBS. The same data is
also be used to compute the remaining pointing quantities in the
header, assuring that they are all consistent. Note that XCEN and
YCEN are the position of the center of the raster, but at
time DATE\_OBS.

In the FITS standard, the keywords CRPIXn, CRVALn, and CRDELTn
define a coordinate system reference pixel, the coordinate system
value at the reference pixel, and the coordinate increment along
each coordinate axis. These values should be consistent with the
values in the XCEN and YCEN keywords, and in practice often use
the XCEN and YCEN location as the reference value. The other
common choice is one corner of the raster image. There is
generally a simple relationship between these keywords and XCEN
and YCEN. For example, if the location of SW corner of the image
is used (first exposure, bottom of $y$-window), then, assuming all
the exposures are in a raster,
\begin{equation}
\textrm{XCEN} = \textrm{CRVAL1} + \textrm{CDELT1} * [(nexp +
  1)/2 - \textrm{CRPIX1}]
\end{equation}
and a similar expression for YCEN. Note that in the FITS
standard, numbering of pixels in an image starts at 1.

Previously In EIS FITS files, CDELT1 and CDELT2 had the correct
absolute values. CRVAL1 and CRVAL2 contained the Hinode spacecraft
pointing at the time of the first exposure, and CRPIX1 and CRPIX2
were 1 and 512, respectively. 
%Thus, for EIS, the relationship
%between these values and XCEN and YCEN must include offset
%information between the spacecraft pointing and the EIS pointing.
%Some of the IDL mapping software attempts to check for
%consistency between these keywords and the XCEN and YCEN
%keywords, leading to an inability of the software to handle EIS
%FITS files.

Currently (as of 25 Feb 2010) these quantities are set so that
CRPIX1 and CRPIX2 are 1 and 1, CRVAL1 and CRVAL2 are set 
to the coordinates of the SW corner of the EIS raster, i.e., use the
first exposure information, and CDELT1 is set to the negative of the
spatial step size in solar $x$ between exposures (or the slit
width for a sit-and-stare observation) and CDELT2 to 1.0. The
negative value indicates that increasing exposures move the
coordinates to the east. Selecting the information from the first
exposure assures that the positions are correct for the time in
the DATE\_OBS keyword.

The FOVX and FOVY keywords could contain either the field-of-view
of the EIS raster as planned or as executed. If data loss takes
place, or an observation is terminated early for some reason,
those values could differ. Though the actual observed values may
be the best choice, currently the planned size of the raster is 
written to the FITS header.

The pointing information described above is accesible through
EIS\_DATA methods. XPOS gives the $x$ coordinate for each 
slit position (including jitter and tracking) and YPOS gives the 
position for each pixel in $y$, in this case the jitter is not included
as explained above. Somewhat counterintuitively, the XCEN and
YCEN methods do {\bf not} return the raster center coordinates but 
rather the home position of the fine mirror in $x$, including 
telescope tracking and jitter, and the middle of the physical 
slit in $y$ including jitter. The XCEN and YCEN values at the center of 
the raster described above can be recovered by calling the 
GETINFO method, GETINFO('XCEN') or GETINFO('YCEN') or computed 
from the algorithm given above.

\subsection{Comparison of EIS Rasters with EIT Images}

Harry Warren has done a careful coalignment of an EIS raster
observed in \ion{He}{II}
256~\AA\\ (eis\_l0\_20071211\_002416.fits.gz) with EIT
\ion{He}{II} 304~\AA\ images taken at a nearby time. Using the
current EIS offset values, the XCEN and YCEN values in the FITS
file, and assuming that the XCEN and YCEN positions are for the
time of the middle of the raster, he finds that agreement with
the EIT pointing data requires that offsets in solar x- and
y-positions of 5.3 and $-24.0$ need to be added to the values in
the FITS header to agree with the EIT data. If instead we modify
the XCEN and YCEN values to be the coordinates of the center of
the raster at the time in DATE\_OBS, then the corrections are
$-0.6$ and $-24.0$. Including the proposed $-13.7$ arcsec
correction that is required to make the XCEN and YCEN values
consistent with the planning software reduces the difference 10.3
arcsec. If \ion{Fe}{XII} data are used instead the required
offsets are within about an arcsec of these numbers, if the
offset between the EIS CCDs is taken into account.

\section{EIS Pointing Fluctuations\label{eis_jitter}}

Hinode undergoes temperature fluctuations as it orbits the earth.
These produce small changes in the relationship between the EIS
solar pointing and the solar pointing defined by the spacecraft
Sun sensors. Early in the mission, comparisons of EIS slot images
with XRT images showed that to first order EIS and XRT had the
same orbital pointing fluctuations, and some EIS data users began
to use the routine XRT\_JITTER to account for pointing
fluctuations in EIS data files. Since XRT data were not always
available, this resulted in interpolations occasionally having to
be made to fill time gaps in the time series used by XRT\_JITTER.
To remove that problem, John Mariska created a new procedure,
EIS\_JITTER, to use EIS time series along with the XRT jitter
information to produce correction array for the EIS pointing.

While EIS\_JITTER does provide a useful first estimate of the
pointing variations in a series of EIS observations, it is not
perfect. Figure~\ref{fig:jitter} highlights the differences. The
top panels show the EIS pointing fluctuations computed by
co-aligning a 24~hr set of EIS slot images. The bottom panels
show the output of EIS\_JITTER. To first order, the general
orbital variations are captured by EIS\_JITTER. Occasional larger
changes, however, are missed.

\begin{figure}
\centering
\includegraphics[width=6.5in]{jitter}
\caption{EIS pointing variations over a 24~hr period. The top two
  panels show pointing variations determined by co-aligning the
  EIS slot data. The bottom two panels show the output of
  EIS\_JITTER\label{fig:jitter}}
\end{figure}

\end{document}
