% Time-stamp: <1998-10-26 10:24:30 dsd> 
% MIT Directory: ~dsd/ASC/specs/ICD/
% CfA Directory: /dev/null
% File: ICD_PSF.tex
% Author: D. Davis
%
% (this header is ~dph/libidl/time-stamp-template.el)
% to auto-update the stamp in emacs, put this in your .emacs file:
%      (add-hook 'write-file-hooks 'time-stamp)
%====================================================================

\documentstyle[11pt]{article}
\input epsf.sty

%\usepackage[dvips]{graphics}
%\usepackage{epsf}

\textwidth=6.5in
\textheight=8.9in
\topmargin=-0.5in
\oddsidemargin=0in
\evensidemargin=0in

\newcommand{\putdraft}{\special{!userdict begin /bop-hook{gsave 200 30
translate 65 rotate /Times-Roman findfont 216 scalefont setfont 0 0
moveto 0.9 setgray (DRAFT) show grestore}def end}}
 

\newcommand{\Remark}[1]{\marginpar
   {\fbox{\parbox{1.7in}{\raggedright\scriptsize#1}}}}

\newcommand{\Putline}{
%  \advance\textwidth-26pt
  \rule{\the\textwidth}{1pt}
%  \advance\textwidth+26pt
  }

\newcommand{\Note}[1]{
\begin{changemargin}{0.25in}{0in}
\advance\textwidth-26pt
\parbox{\textwidth}{      % testing...
\hfill\Putline\newline
%\parbox{\textwidth}{\small\sf#1}\\
{\small\sf#1}\\            % testing...
\Putline\newline
}       % testing...
\advance\textwidth+26pt
\end{changemargin}
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \putstring{x}{y}{angle}{scale}{gray}{string}
% gray: 0=black, 1=white

\newcommand{\putstring}[6]{
\special{!userdict begin /bop-hook{gsave #1 #2 translate
#3 rotate /Times-Roman findfont #4 scalefont setfont
0 0 moveto #5 setgray (#6) show grestore}def end}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%    To change the margins of a document within the document,
%    modifying the parameters listed on page 163 will not work. They
%    can only be changed in the preamble of the document, i.e, before
%    the \begin{document} statement. To adjust the margins within a
%    document we define an environment which does it:
      \newenvironment{changemargin}[2]{\begin{list}{}{
         \setlength{\topsep}{0pt}\setlength{\leftmargin}{0pt}
         \setlength{\rightmargin}{0pt}
         \setlength{\listparindent}{\parindent}
         \setlength{\itemindent}{\parindent}
         \setlength{\parsep}{0pt plus 1pt}
         \addtolength{\leftmargin}{#1}\addtolength{\rightmargin}{#2}
         }\item }{\end{list}}
%    This environment takes two arguments, and will indent the left
%    and right margins by their values, respectively. Negative values
%    will cause the margins to be widened, so
%    \begin{changemargin}{-1cm}{-1cm} widens the left and right margins
%    by 1cm.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newcommand{\Header}[2]{
\pagestyle{myheadings}                   %%%%%%%%%%
\markboth{\bf \qquad #1 \hfill #2 \qquad}%%%%%%%%%%
         {\bf \qquad #1 \hfill #2 \qquad}%%%%%%%%%%
}

%%%%%%%%%%%%%%%%%%%%%% END dph useful macros %%%%%%%%%%--------------


%%%
%%% Look for occurrences of five pound characters: #####, to locate places
%%% where updates are necessary
%%%

%%%
%%% revision info
%%%
\newcommand{\Revision}{\mbox{\em%
%%%
%%% ##### Update the revision information
%%%
%Revision 0.0---11 Mar 1998 % my first draft, uncirculated
Revision 0.2   07 Oct 1997 % Comments incorperated
%Revision 1.0---02 Feb 1998 % reviewed, updated.
}}



\hyphenation{pipe-line}
\hyphenation{pipe-lines}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\Header{Data Product Interface Document: /}{\Revision}
\begin{document}

 \putstring{x}{y}{angle}{scale}{gray}{string}
% gray: 0=black, 1=white
\putstring{70}{40}{90}{40}{0.90}{D R A F T -DRAFT- D R A F T}
%%% ##### comment the following line out for actual releases
%\putdraft


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%
%%% title stuff, no need to change anything
%%%

\begin{titlepage}

\begin{changemargin}{-1in}{-1in}

  \begin{center}
    {\huge\bf AXAF Science Center}

    \vspace*{0.1in}
%    \leavevmode{\scalebox{0.17}{\includegraphics{asc_logo.eps}}}
    {\epsfxsize=3.2cm \leavevmode\epsfbox{asc_logo.eps}}
    \vspace*{0.1in}

    {\LARGE\bf PSF Library:}

    \vspace*{0.1in}
    {\LARGE\bf Data Product Interface Document:}
    \vspace*{0.2in}

    \Revision

  \end{center}

  \vfill

  \begin{tabular}{lll}
    Submitted: & \rule{3.5in}{0.01in} & \rule{0.75in}{0.01in} \\
    & David S. Davis & Date   \\
    & Grating Scientist, ASC Science Data Systems & \\[0.25in]
    Concurred: & \rule{3.5in}{0.01in} & \rule{0.75in}{0.01in} \\
    & David Huenemoerder & Date   \\
    & Grating Scientist, ASC Science Data Sytems & \\[0.25in]
    Concurred: & \rule{3.5in}{0.01in} & \rule{0.75in}{0.01in} \\
    & Panagoula Zografou & Date   \\
    & ASC Data Systems Group Leader, ASC Archives & \\[0.25in]
    Concurred: & \rule{3.5in}{0.01in} & \rule{0.75in}{0.01in} \\
    & Janet De Ponte & Date   \\
    & ASC Data Systems Group Leader, Level 1.5 Pipelines & \\[0.25in]
    Concurred: & \rule{3.5in}{0.01in} & \rule{0.75in}{0.01in} \\
    & Fred Seibel & Date   \\
    & Manager, ASC Data Systems & \\[0.25in]
    Concurred: & \rule{3.5in}{0.01in} & \rule{0.75in}{0.01in} \\
    & Martin Elvis & Date   \\
    & Manager, ASC Science Data Systems & \\[0.25in]
    Approved:  & \rule{3.5in}{0.01in} & \rule{0.75in}{0.01in} \\
    & Harvey Tananbaum & Date   \\
    & Director, ASC & \\
  \end{tabular}

\end{changemargin}

\end{titlepage}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%
%%% update info
%%%
\pagenumbering{roman}\setcounter{page}{2}

%%%
%%% ##### update as necessary
%%%

\begin{center}
\begin{tabular}{|c|c|c|p{2.5in}|} \hline
\multicolumn{4}{|c|}{}\\[1mm]
\multicolumn{4}{|c|}{\bf Document and Change Control Log}\\[3mm]\hline
{\bf Date} & {\bf Version} & {\bf Section} & {\bf Status} \\ \hline
06 Feb 98& 0.9& all&
Initial Draft \\\hline
%
\hline
%
\end{tabular}
\end{center}

\clearpage


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%
%%% table of contents, list of tables
%%%

\tableofcontents
\clearpage
\listoftables
\clearpage

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\pagenumbering{arabic}
\section{Introduction}

This document describes the interface to be employed in accessing 
the PSF Library products, according to the requirements stipulated in Applicable
Document TBD.%
%

\subsection{Purpose}

The purpose of this document is to define the Point Spread Function 
(generically referring to PSF) Library to be used in Level 2 processing,
as described in Applicable Document TBD (DS01). %
This consists of reading the task specific calibration data file and
returning the user specified product (e.g. PSF image, characteristic
size, psf fraction). 
%

\subsection{Scope}

This interface shall apply to all PSF-specific data products that need
the PSF Library and distributed to the ASC Data
Archive (see Applicable Documents TBD%) during the course of
the AXAF mission.

\subsection{Applicable Documents}
The Applicable Documents required for background and detail on
grating Level 1.5 products are as follows:
\begin{enumerate}
%
\item\label{appdoc:data-prod} 
  AXAF Data Products Guide\newline
  {\tt http://hea-www.harvard.edu/asclocal/sds/CDR2/dp.ps}
%
\item\label{appdoc:coord}
 AXAF Coordinate Systems\newline
    {\tt http://hea-www.harvard.edu/~jcm/asc/coords}
%
\item\label{appdoc:se03}
 ASC AMO-2400 (SE03) \newline
 ASC Data System Requirements (ASC.302.93.0008)
%
\item\label{appdoc:ds01}
 ASC AMO-2401 (DS01) \newline
 ASC Data System Software Design (ASC.500.93.0006)
%
\item\label{appdoc:fitsdef}
 NOST 100-1.1, Definition of the Flexible Image Transport System
                    (FITS)\newline
                    {\tt http://www.cv.nrao.edu/fits/}
%
\item\label{appdoc:fitsstd}
 HEASARC FITS Standards:\newline
{\tt http://legacy.gsfc.nasa.gov/docs/heasarc/ofwg/}\newline
{\tt docs/summary/ogip\_93\_001\_summary.html}
%
\item\label{appdoc:ascfits}
  ASC FITS File Designers' Guide\newline
  {\tt http:// TBD}
%
\item\label{appdoc:hrcicd}
 HRC Data Products Guide:\newline
 Level 1 to ASC Archive Interface Control Document\newline
 {\tt http:// TBD}
%
\item\label{appdoc:acisicd}
 ACIS Data Products Guide:\newline 
    Level 1 to ASC Archive Interface Control Document\newline
 {\tt http:// TBD}
%
\end{enumerate}

% synopsis for editing purposes...
%
%   1 appdoc:data-prod AXAF Data Products Guide
%   2 appdoc:coord     AXAF Coordinate Systems
%   3 appdoc:se03      ASC AMO-2400 (SE03)
%   4 appdoc:ds01      ASC AMO-2401 (DS01)
%   5 appdoc:fitsdef   NOST 100-1.1, Definition of the FITS
%   6 appdoc:fitsstd   HEASARC FITS Standards:
%   7 appdoc:ascfits   ASC FITS Designers' Guide
%   8 appdoc:hrcicd    HRC Data Products Guide:
%   9 appdoc:acisicd   ACIS Data Products Guide:



\subsection{Functional Description}

\subsubsection{Data Content Summary}

All PSF Library files shall
consist of data files conforming to the FITS format (Applicable
Document~\ref{appdoc:fitsdef}) and further conforming to HEASARC
standards (Applicable Document~\ref{appdoc:fitsstd}) and the ASC
conventions (Applicable Document~\ref{appdoc:ascfits}). These files
contain header keyword entries and binary table (BINTABLE) extensions.

\subsubsection{Source and Transfer Method}

PSF Library shall be created by the TBD as
described in Chapter TBD of Applicable Document TBD.%

\subsubsection{Recipients and Utilization}

The primary recipients of PSF Library, via distribution
from the archive, are AXAF observers, who will utilize these data
products for scientific data analysis. The ASC may also make use of
specific PSF Library data products for instrument calibration,
instrument and/or spacecraft monitoring and trends analysis, and
validation and verification of the Level 0, Level 1, and Level 1.5
software and of the data products themselves. 

\subsubsection{Pertinent Relationships with Other Interfaces}

Changes to the definition of HRC or ACIS Level 2 data products, as
described in Applicable Documents~\ref{appdoc:hrcicd}
and~\ref{appdoc:acisicd}, may affect the PSF data products
described in the current document.

\subsection{Assumptions and Constraints}

\subsection{Products Not Covered}

PSF products that are used for maintenance and diagnostic
purposes (those that are not supplied to the user for scientific data
analysis), or which are generic AXAF Level 2 products (those parts
of the product which are common to ACIS and HRC Level 1 products), are
not currently included within the interface defined by this document.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\clearpage
\section{Environment}

\subsection{Hardware Characteristics and Limitations}
All binary integers within PSF products are written in
``big-endian'' format, i.e. with their more significant bytes
preceding their less significant bytes. Within FITS keyword headers,
unsigned integer values are represented as positive decimal
quantities. 

Within FITS binary table extensions, it has been accepted that
unsigned $n$-byte integers whose most significant bit can be $1$ will
be described by the {\tt TSCAL} and {\tt TZERO} convention used by
{\tt cfitsio} subroutines.  {\em This convention will not be used for
  grating events}, since it is an ambiguous representation.
%

Certain products may contain double precision binary floating point
fields.  They are written in IEEE-754 format, using the ``big-endian''
convention, i.e. the sign bit and the high-order 7 bits of the
exponent are in the first byte, the 4 low-order bits of the exponent
and the 4 high-order bits of the mantissa and in the second byte, and
so on. Special values, e.g.\ NaN, shall not occur.



\subsection{Interface Medium and Characteristics}

PSF products shall be created on a UNIX file system.  While they
are being written, their FITS headers may contain invalid keyword
values (e.g. {\tt NAXIS2}, the number of binary table rows). Care must be
taken not to read or copy these files until they are complete.

\subsection{Failure Protection, Detection, and Recovery Features}

\subsubsection{Backup Requirements}

Once created, PSF products are transmitted to the ASC Archive
by TBD%
means. All further responsibility for the products rests with
the Archive.


\subsubsection{Security/Integrity Measures}

The keyword headers of all Level 2 products shall contain an
indication of their total byte length so that a file truncation can be
detected. The equivalent expression for the length of a Level 2 binary
table file is 
$$| L_{HDR} |_{2880} + | L_{THDR} |_{2880} + |x*y|_{2880},$$
where $L_{HDR}$ is the length of the keyword header (in bytes), $L_{THDR}$ is
the byte length of the binary table header, $x$ and $y$ are the values
of {\tt NAXIS1} and {\tt NAXIS2} within that header, and $|n|_{2880}$
means the $smallest\_multiple\_of\_2880 \ge n$.

\subsection{End-Of-File (or Medium) Conventions}

All Level 2 FITS products obey the conventions of Applicable
Document~\ref{appdoc:fitsdef}---headers are terminated by {\tt END}
keywords; the size of image arrays and binary tables is defined by the
{\tt NAXIS1} and {\tt NAXIS2} header keywords.

Any non-FITS file products will be {\tt ASCII} text, either
PostScript, or custom auxiliary tables.  Custom tables will be defined
herein.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\clearpage
\section{Access}

\subsection{Access Tools; Input/Output Protocol}

Since PSF Library products obey the formatting rules described in
Applicable Document~\ref{appdoc:fitsdef}, 
they may be accessed by any software that
conforms to those standards, including all versions of the FITSIO
libraries that support the BINTABLE extension. In addition, since they
adhere to HEASARC standards (Applicable Document~\ref{appdoc:fitsstd}), PSF
data product files are compatible with the input/output routines that
constitute the ASC data interface.

\subsection{Timing and Sequencing Characteristics}

The PSF Library will need to take into account differing levels of
aspect uncertainty and make available the ability to generate a
composite PSF based on the levels of aspect uncertainty. 

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\clearpage
\section{Detailed Interface Specifications}

\subsection{Labeling and Identification}

The data files in the PSF Library shall be
assigned external names as shown in Table~\ref{tab:dataproductfiles}.
The names obey the following convention (TBR):%
%

% For the PSF library the images will be HRMA images 
% and will be named 
% HRMA_energy_r_theta(RH)_phi(RH) (ASC Coords: Rev 3.2: HCS-1.2)

\begin{table}[h]
\begin{center}
\begin{tabular}{|ll|}\hline
  \multicolumn{1}{|l}{\bf Title}  & \multicolumn{1}{l|}{\bf File name}\\
  2d image data  & {\tt HRMA\_r\_$\theta_{HR}$\_$\phi_{HR}$.fits}\\\hline
%
\end{tabular}
\caption{PSF Data Product Files}
\label{tab:dataproductfiles}
\end{center}
\end{table}
Where r is the distance from the HRMA nodal point to the focus. 
The off-axis angle is specified by $\theta_{HR}$ and the
rotation about the aim point is $\phi_{HR}$ (see applicable document
2). This file will contain the PSF's for that position and all the 
energies as separate HDU's (Header Data Units) as described below. 
%

No additional non-instrument-specific data products are output by the PSF
processing pipeline.


\subsection{PSF Library structure Definition and Format}

All PSF Library data products shall consist of files in FITS format,
as defined in Applicable Document~\ref{appdoc:fitsdef}. The FITS file
shall for each $\theta_{HR}$ and $\phi_{HR}$
is comprised of a primary component and an extension component which
contains the data for the fitted function. This is followed by the
error component.  Each of these components is divided into two parts: a
header section and a data section. The length of each
section is a multiple of 2880 bytes. The header section is further
subdivided into 80-byte records containing only ASCII characters. The
PSF data files contain Binary Table extensions which will 
contain the parameters for the best fit functional form to the data.
The final format for this extention is TBD. The error file shall have
the same dimensions as the primary data array. The error calculated
here will be the statistical error (Poisson or Gaussian) along with 
any additional error terms which will be added in quadrature with the
statistical terms. The ETERMXX keyword will be added for each
additional error term added. XX shall be the number of the error term
starting at 01 and going to 99. 
The additional PSF images at the same r, $\theta_{HR}$ and $\phi_{HR}$
will follow the first image in order of accending energy as fits
extensions with additional files as described above. 

\subsubsection{2D-PSF Primary Header Keyword Description}

The primary header keywords are shown in
Table~\ref{tab:2dheaderkeywords} for the HRMA 2-Dimensional PSF
Library file. 

%
\begin{verbatim}
SIMPLE  =                    T / file does conform to FITS standard
BITPIX  =                    8 / number of bits per data pixel
NAXIS   =                    0 / number of data axes
EXTEND  =                    T / FITS dataset may contain extensions
COMMENT   FITS (Flexible Image Transport System) format defined in Astronomy and
COMMENT   Astrophysics Supplement Series v44/p363, v44/p371, v73/p359, v73/p365.
COMMENT   Contact the NASA Science Office of Standards and Technology for the
COMMENT   FITS Definition document #100 and other FITS information.
END
 
XTENSION='IMAGE'               /
BITPIX  =                   32 /
NAXIS   =                    2 /
NAXIS1  =                  512 /
NAXIS2  =                  512 /
CTYPE1  = 'X'                  / 
CTYPE2  = 'Y'                  /
CUNIT1  = 'PIXEL'              / virtual pixels
CUNIT2  = 'PIXEL'              / virtual pixels
CRPIX1  =                256.5 / X axis ref pixel
CRPIX2  =                256.5 / Y axis ref pixel
CRVAL1  =                256.5 / coord of x ref pixel
CRVAL2  =                256.5 / coord of y ref pixel
CDELT1  =                  1.0 / X axis increment
CDELT2  =                  1.0 / Y axis increment
TELESCOP= 'AXAF    '           /Satellite
INSTRUME= 'NONE    '           /Instrument
FILTER  = 'HETG    '           /Filter in place
HDUVERS = '1.0.0   '           /Version # of OGIP Definition
HDUCLASS= 'OGIP    '           /OGIP Defined
HDUOC   = 'CAL/GEN/92-020'     /Defining Document
HDUCLAS1= 'IMAGE   '           /This is an image
HDUCLAS2= 'PSF     '           /PSF Image
HDUCLAS3= 'THEORETICAL'        /PSF image is from MARX
HDUCLAS4= 'NET     '           /PSF image has no background
BACKGRND=                  0.0 / Background counts/pixel
ENERG_LO= '5       '           /       3
ENERG_HI= '5       '           /       3
SUMRCNTS=              776098. /       1
CHANMIN =                 -99.0/
CHANMAX =                 -99.0/
CHANTYPE= 'PI'                 /
CDTP0001= 'TASK    '           /Virtual data set
CCLS0001= 'BCF     '           /Basic Calibration file
CCNM0001= '2D_PSF  '           /This is a 2-d file
CDES0001= 'MARX    '           /File Generator
CBD10001= 'Energy(5)keV'       /Energy range for PSF
CBD20001= 'THETA(0)arcmin'     /Distance from optical axis for PSF
CBD30001= 'PHI(0.0)deg'        /Azimuthal angle for PSF

DATE-OBS= '1997-11-25'         / Creation date (CCYY-MM-DD) of FITS header
MISSION = 'AXAF    '           /Advanced X-ray Astrophysics Facility
DETNAME = 'NONE    '           /Detector Name
OBJECT  = 'PSF     '           /MARX PSF image
TITLE   = 'PSF     '           /MARX PSF image
GRATING = 'HETG    '           /Grating in use
GRATTYP = 'HEG     '           /Grating data
HRMA_AZ =              0.00000 /HRMA azimuth (Degrees)
HRMA_POL=              0.00000 /HRMA off axis angle (arcmin)
CREATOR = 'SAOsac  '           /
REVISION=                    0 /
DATACLAS= 'Simulated'          /
DEFOCUS =              0.00000 /
GDEFOCUS=              0.00000 /Defocus of the gratings (mm)
FOC_LEN =                    0 /       0
END
\end{verbatim}
\begin{center}
\label{tab:2dheaderkeywords}{Table~\ref{tab:2dheaderkeywords}}{Format
of 2-D FITS Header Keywords} 
\end{center}
%
\subsubsection{2-D PSF Fitted Function Table Parameters}
The final form for the function to be fit to the 2D PSF images
is still TBD. Table~\ref{tab:psfffkeywords} lists the keywords for 
two 2D Gaussian functions which are separable in X and Y. 


\begin{verbatim}
XTENSION= 'BINTABLE'    
BITPIX  =          8
NAXIS   =          2
NAXIS1  =         52
NAXIS2  =          6
PCOUNT  =          0
GCOUNT  =          1
TFIELDS =          9
EXTNAME = 'FUNCTION'
HDUCLASS= 'ASC     '
HDUCLAS1= 'FUNCTION'

FAXIS   =          4    / Here are the independent variables
FTYPE1  = 'X       '    / X: free running
FUNIT1  = 'mm      '
FLMIN1  =        0.0
FLMAX1  =      100.0
FTYPE2  = 'Y       '    / Y: free running
FUNIT2  = 'mm      '
FLMIN2  =        0.0
FLMAX2  =      100.0
FTYPE3  = 'Energy  '    / Energy: enumerated
FUNIT3  = 'keV     '
FAXIS3  =          2
FTYPE4  = 'Theta   '    / Off-axis angle: enumerated
FUNIT4  = 'arcmin  '
FAXIS4  =          3

TTYPE1  = 'Energy  '    / Column with Energy enumerated values
TUNIT1  = 'keV     '
TFORM1  = '1E      '
TTYPE2  = 'Theta   '    / Column with enumerated off-axis angle values
TUNIT2  = 'arcmin  '
TFORM2  = '1E      '
TTYPE3  = 'Csigma  '    / Core sigma
TUNIT3  = 'mm      '
TFORM3  = '1E      '
TTYPE4  = 'Campl   '    / Core amplitude
TUNIT4  = 'count   '
TFORM4  = '1E      '
TTYPE5  = 'HX0     '    / Halo X center
TUNIT5  = 'mm      '
TFORM5  = '1E      '
TTYPE6  = 'HY0     '    / Halo Y center
TUNIT6  = 'mm      '
TFORM6  = '1E      '
TTYPE7  = 'Hsigma  '    / Halo sigma
TUNIT7  = 'mm      '
TFORM7  = '1E      '
TTYPE8  = 'Hampl   '    / Halo amplitude
TUNIT8  = 'count   '
TFORM8  = '1E      '
TTYPE9  = 'TRW_ID  '    / Extraneous column
TFORM9  = '20A     '

DTYPE1  = 'CX0     '    / Constant CX0
DUNIT1  = 'mm      '
DVAL1   =        0.0
DTYPE2  = 'CY0     '    / Constant CY0
DUNIT2  = 'mm      '
DVAL2   =        0.0

COMMENT                 / Here are the internal function definitions
VTYPE1  = 'CX      '
VFUNC1  = 'Gauss (X, 1.0, CX0, Csigma)'
VTYPE2  = 'CY      '
VFUNC2  = 'Gauss (Y, 1.0, CY0, Csigma)'
VTYPE3  = 'HX      '
VFUNC3  = 'Gauss (X, 1.0, HX0, Hsigma)'
VTYPE4  = 'HY      '
VFUNC4  = 'Gauss (Y, 1.0, HY0, Hsigma)'

COMMENT                 / And this is the output function definition
FUNCTION= 'Campl * CX * CY + Hampl * HX * XY'
FUNCNAME= 'ACIS_PSF'
BUNIT   = '        '

COMMENT   For a circularly symmetric 2-D Gaussian one should
COMMENT   use the product of two 1-D Gaussians; the truly 2-D
COMMENT   Gaussian should have two independent variables and
COMMENT   6 parameters: ampl, x0, y0, sigmaj, sigmin, angle.

END


\end{verbatim}
\begin{center}
\label{tab:psfffkeywords}Table~\ref{tab:psfffkeywords} FITS Table for the Fitted Function
\end{center}
 


\subsubsection{2D-PSF Error Image Header Keyword Description}

All PSF data products shall have an associated 2D PSF error image. 
This error image shall consist of a 2-dimensional image with the
same dimensions as the input image. The error calculated shall be
the statistical error (Gaussian or Poisson) and any additional error
terms shall be added in quadrature with the statistical errors. 
Each error term shall add a ETERM keyword to identify the source
of the error terms. 

Table~\ref{tab:2derrheaderkeywords} shows the keywords for 
ACIS or HRC 2-Dimensional PSF Error file.
%
\begin{verbatim}
SIMPLE  =                    T / Written by IDL:  Tue Nov 25 15:27:41 1997
BITPIX  =                   32 /
NAXIS   =                    2 /
NAXIS1  =                  512 /
NAXIS2  =                  512 /
DATE-OBS= '1997-11-25'         / Creation date (CCYY-MM-DD) of FITS header
MISSION = 'AXAF    '           /Advanced X-ray Astrophysics Facility
TELESCOP= 'AXAF    '           /Satellite
INSTRUME= 'NONE    '           /Instrument
DETNAME = 'NONE    '           /Detector Name
FILTER  = 'HETG    '           /Filter in place
OBJECT  = 'PSF_ERROR'          /MARX PSF image
TITLE   = 'PSF_ERROR'          /MARX PSF image
GRATING = 'HETG    '           /Grating in use
GRATTYP = 'HEG     '           /Grating data
HRMA_AZ =              0.00000 /HRMA azimuth (Degrees)
HRMA_POL=              0.00000 /HRMA off axis angle (arcmin)
CREATOR = 'SAOsac  '           /
REVISION=                    0 /
DATACLAS= 'Simulated'          /
DEFOCUS =              0.00000 /
GDEFOCUS=              0.00000 /Defocus of the gratings (mm)
FOC_LEN =                    0 /       0
BACKGRND=              0.00000 /       1
ENERG_LO= '5       '           /       3
ENERG_HI= '5       '           /       3
SUMRCNTS=              776098. /       1
POISSERR =                   F /       1
SYS_ERR = 0.05                 /       1
ETERM01 = 'POISSON'            /       1
ETERM02 = '2nd error source'   /       1
HDUCLASS= 'OGIP    '           /OGIP Defined
HDUOC   = 'CAL/GEN/92-020'     /Defining Document
HDUVERS = '1.0.0   '           /Version # of OGIP Definition
HDUCLAS1= 'IMAGE   '           /This is an image
HDUCLAS2= 'PSF     '           /PSF Image
HDUCLAS3= 'THEORETICAL'        /PSF image is from MARX
HDUCLAS4= 'NET     '           /PSF image has no background
CDTP0001= 'TASK    '           /Virtual data set
CCLS0001= 'BCF     '           /Basic Calibration file
CCNM0001= '2D_PSF '            /This is a 2-d file
CDES0001= 'MARX    '           /File Generator
CBD10001= 'Energy(5)keV'       /Energy range for PSF
CBD20001= 'THETA(0)arcmin'     /Distance from optical axis for PSF
CBD30001= 'PHI(0.0)deg'        /Azimuthal angle for PSF
END
\end{verbatim}
\begin{center}
\label{tab:2derrheaderkeywords}Table~\ref{tab:2derrheaderkeywords}
Format of 2-D Error image FITS Header Keywords 
\end{center}


\subsubsection{1-D Primary Header Keyword Description}

Table~\ref{tab:1dheaderkeywords} describes a  1-D PSF file which is a FITS
primary header which is followed by a FITS binary table described in 
Table~\ref{tab:1dextheader}. 
The binary tables are further described by an extension header that
immediately follows the keyword header (since the primary data unit is
empty).  The format of a generic FITS binary table file is described
fully in Applicable Documents~\ref{appdoc:hrcicd}. 
and~\ref{appdoc:acisicd}. The error columns to be added to the 1-D PSF
data set are described in OGIP calibration memo CAL/GEN/92-003 and 
consist of statistical and systematic error terms. The error terms
from the 2-D PSF file shall be added in quadrature to determine the
error for the 1-D PSF file. 
%
\begin{verbatim}
SIMPLE  =                    T / file does conform to FITS standard
BITPIX  =                   16 / number of bits per data pixel
NAXIS   =                    0 / number of data axes
EXTEND  =                    T / FITS dataset may contain extensions
COMMENT   FITS (Flexible Image Transport System) format defined in Astronomy and
COMMENT   Astrophysics Supplement Series v44/p363, v44/p371, v73/p359, v73/p365.
COMMENT   Contact the NASA Science Office of Standards and Technology for the
COMMENT   FITS Definition document #100 and other FITS information.
MISSION = 'AXAF    '           /
TELESCOP= 'AXAF    '           /
INSTRUME= 'ACIS    '           / Predicted PSF image
GRATING = 'HETG    '           / High Energy Transmission
DETNAME = 'ACIS-S  '           /
DATAMODE= 'GRADED  '           /
READMODE= 'TIMED   '           /
INSTMODE= 'FPI     '           /
DATACLAS= 'SIMULATED'          /
OBSERVER= 'MARX    '           /
HUDCLASS= 'OGIP    '           /
GRATING = 'HETG    '           /
GRATTYPE= 'HEG     '           /
CREATOR = 'rdpsf   '           /
DATE    = 'Wed Jun 11 1997'    /
END
\end{verbatim}
\label{tab:1dheaderkeywords}Table~\ref{tab:1dheaderkeywords} Lists
Primary Header Keywords for 1-D PSF 

\subsubsection{1-D Extension Header Keyword Description}

%
\begin{verbatim}
XTENSION= 'BINTABLE'           / binary table extension
BITPIX  =                    8 / 8-bit bytes
NAXIS   =                    2 / 2-dimensional binary table
NAXIS1  =                   24 / width of table in bytes
NAXIS2  =                   63 / number of rows in table
PCOUNT  =                    0 / size of special data area
GCOUNT  =                    1 / one data group (required keyword)
TFIELDS =                    6 / number of fields in each row
TTYPE1  = 'RAD_LO  '           / label for field   1
TFORM1  = '1E      '           / data format of field: 4-byte REAL
TUNIT1  = 'ARCMIN  '           / physical unit of field
TTYPE2  = 'RAD_HI  '           / label for field   2
TFORM2  = '1E      '           / data format of field: 4-byte REAL
TUNIT2  = 'ARCMIN  '           / physical unit of field
TTYPE3  = 'ENERG_LO'           / label for field   3
TFORM3  = '1E      '           / data format of field: 4-byte REAL
TUNIT3  = 'KEV     '           / physical unit of field
TTYPE4  = 'ENERG_HI'           / label for field   4
TFORM4  = '1E      '           / data format of field: 4-byte REAL
TUNIT4  = 'KEV     '           / physical unit of field
TTYPE5  = '1DPSF   '           / label for field   5
TFORM5  = '1E      '           / data format of field: 4-byte REAL
TTYPE6  = 'AREA_WGT'           / label for field   6
TFORM6  = '1E      '           / data format of field: 4-byte REAL
TTYPE7  = 'STAT_MIN'           / label for field   6
TFORM7  = '1E      '           / data format of field: 4-byte REAL
TTYPE8  = 'STAT_MAX'           / label for field   6
TFORM8  = '1E      '           / data format of field: 4-byte REAL
TTYPE9  = 'SYS_MIN '           / label for field   6
TFORM9  = '1E      '           / data format of field: 4-byte REAL
TTYPE10 = 'SYS_MAX '           / label for field   6
TFORM10 = '1E      '           / data format of field: 4-byte REAL
EXTNAME = 'PROF_DISP_Al_1'     / name of this binary table extension
HDUCLASS= 'OGIP    '           / OGIP Defined
HDUOC   = 'CAL/GEN/92-020'     / Defining Document
HDUVERS = '1.0.0   '           / Version # of OGIP Definition
HDUCLAS1= 'RESPONSE'           / This is a bintable
HDUCLAS2= '1D-PSF  '           / PSF bintable
HDUCLAS3= 'THEORETICAL'        / PSF image is from MARX
HDUCLAS4= 'NET     '           / PSF image has no background
TELESCOP= 'AXAF    '           / Satellite
INSTRUME= 'HRMA    '           / Instrument
DETNAME = 'ACIS-S  '           /
DATAMODE= 'GRADED  '           /
READMODE= 'TIMED   '           /
INSTMODE= 'FPI     '           /
DATACLAS= 'SIMULATED'          /
OBSERVER= 'MARX    '           /
FILTER  = 'HETG    '           / Filter in place
GRATING = 'HETG    '           / Grating in use
GRATTYP = 'HEG     '           / Grating data
ORDER   =                    1 / Grating data
CDTP0001= 'TASK    '           / Virtual data set
CCLS0001= 'BCF     '           / Basic Calibration file
CCNM0001= '1D_PSF  '           / This is a 1-d file
CDES0001= 'MARX    '           / This is a 1-d file
BACKGRND=                  0.0 / Background rate cts/pix
XD_MAX  =               94.000 / Max dist X-disp for PSF
XD_MIN  =               32.000 / Min dist X-disp for PSF
ENERG_LO=                1.486 / Min energy for PSF
ENERG_HI=                1.486 / Max energy for PSF
SUMRCNTS=             154797.0 / Total counts in the image
SCALE   =                 13.5 / Ang/arcmin
CBD10001= 'Energy(1.486)keV'   / Energy range for PSF
CBD20001= 'THETA(0)arcmin'     / Distance from optical axis for PSF
CBD30001= 'PHI(0.0)deg'        / Azimuthal angle for PSF
END
\end{verbatim}
\label{tab:1dextheader} Table~\ref{tab:1dextheader}{ Lists the keywords for the
binary extention with the 1D PSF data.} 

%
\clearpage
%\subsection{PSF Summary File (do we need this?)}


%The PSF summary file will be a greyscale image of the PSF a
%azimuthally binned profile and an encircled energy plot. 



\end{document}
