Index: trunk/ppTranslate/documentation/ICD/Makefile
===================================================================
--- trunk/ppTranslate/documentation/ICD/Makefile	(revision 34506)
+++ trunk/ppTranslate/documentation/ICD/Makefile	(revision 34506)
@@ -0,0 +1,15 @@
+SOURCE=PSDC-940-005
+
+RM=/bin/rm -f
+
+all:
+	latex $(SOURCE).tex
+	latex $(SOURCE).tex
+	dvipdf PSDC-940-005.dvi
+	@echo
+	@echo
+	@echo "IPP-MOPS documentation in pdf format has been succesfully built"
+	@echo 
+
+clean:
+	$(RM) *.aux *.dvi *.out *.pdf *.toc *.log *~
Index: trunk/ppTranslate/documentation/ICD/PSDC-940-005.tex
===================================================================
--- trunk/ppTranslate/documentation/ICD/PSDC-940-005.tex	(revision 34506)
+++ trunk/ppTranslate/documentation/ICD/PSDC-940-005.tex	(revision 34506)
@@ -0,0 +1,901 @@
+%%% $Id: PSDC-940-005.tex,v 1.9 2011/04/18 23:17:36 schastel Exp $
+\documentclass[panstarrs,spec]{panstarrs}
+\usepackage{nonfloat}
+
+\newcommand{\sccomment}[1]{%
+  \textcolor{green}{SC: #1}}
+
+% basic document variables
+\title{IPP-MOPS ICD}
+\subtitle{Pan-STARRS IPP-MOPS ICD for PS-1}
+\shorttitle{IPP-MOPS ICD}
+\author{Eugene Magnier, Larry Denneau, Jr., Robert Jedicke}
+\audience{Pan-STARRS PMO}
+\group{Pan-STARRS IPP \& MOPS}
+\project{Pan-STARRS PS-1}
+\organization{Institute for Astronomy}
+\version{03}
+\docnumber{PSDC-940-005}
+
+\begin{document}
+\maketitle
+\sloppy
+
+\RevisionsStart
+% version  Date            Description
+03 & 2012 Oct 04 & \texttt{PS1\_DV3}: Fitted trails, new parameters\\ 
+\hline
+02 & 2011 Apr 19 & Synchronization with "ICD Lite" wiki page \\ 
+\hline
+01 & 2010 Oct 27 & New CMF Parameters \\ 
+\hline
+00 & 2006 Mar 01 & Initial version \\ \hline
+\RevisionsEnd
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
+
+\DocumentsInternal
+PSDC-230-001 & PS-1 Design Reference Mission \\ \hline
+PSDC-430-011 & Pan-STARRS PS-1 IPP System/Subsystem Design Description \\ \hline
+PSDC-510-001 & Pan-STARRS PS-1 MOPS System Concept Definition \\ \hline
+PSDC-530-003 & Pan-STARRS PS-1 MOPS Software Design Description \\ \hline
+\DocumentsExternal
+\DocumentsEnd
+
+\tableofcontents
+\pagebreak 
+\pagenumbering{arabic}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
+
+\section{Scope}
+
+\subsection{Identification}
+
+This document defines the interface between the Image Processing
+Pipeline (IPP) and Moving Object Processing System (MOPS) for the
+Panoramic Survey Telescope and Rapid Response System (Pan-STARRS)
+for the prototype telescope PS-1, and is a System-level controlled
+specification/design description document in the official Pan-STARRS
+engineering specification tree.
+
+\subsection{System Overview}
+
+The Institute for Astronomy at the University of Hawai`i is developing
+a large optical synoptic survey telescope system, the Panoramic Survey
+Telescope and Rapid Response System (Pan-STARRS). The science goals,
+priorities, top-level concept of operations with associated
+operational requirements, and system performance drivers with
+associated system performance requirements are described in the
+Pan-STARRS Science Goals Statement (SGS).  As described in this
+document, The system conceptual design for Pan-STARRS utilizes an
+array of four 1.8m telescopes each with a 7 degree$^2$ field of view,
+giving the system an \'etendue larger than all existing survey
+instruments combined (defined as the product of the collecting area
+$A$ multiplied by the field-of-view solid angle $\Omega$).  Each
+telescope will be equipped with a 1 billion pixel CCD camera with low
+noise and rapid read-out, and the data will be reduced in near real
+time to produce both cumulative static sky and difference images from
+which transient, moving, and variable objects can be
+detected. Pan-STARRS will be able to survey up to $\approx 6,000$
+degree$^{2}$ per night to a detection limit of approximately 24$^{th}$
+magnitude.  This unique combination of sensitivity and sky coverage
+will open up many new possibilities in time domain astronomy including
+a major goal of surveying the Potentially Hazardous Object (PHO)
+population down to a diameter of $\approx 300$ meters.  In addition,
+the Pan-STARRS data will be used to investigate a broad range of
+astronomical problems of extreme current interest concerning the Solar
+System, the Galaxy, and the Cosmos at large.  A prototype single
+telescope system, PS-1, is being developed as a preliminary step
+before construction of the complete four telescope system.
+
+\begin{tabular}{ll}
+  Project sponsor:&	AFRL, United States Air Force \\
+  Acquirer:       &	University of Hawaii Institute for Astronomy \\
+  User: 	  &	Astronomical community \\
+  Developer:      &	University of Hawaii Institute for Astronomy, participating \\
+  &       institutions, and associated subcontractors	
+\end{tabular}
+
+\subsection{Document Overview}
+
+This document identifies the interface between the IPP and MOPS
+subsystems of the Pan-STARRS PS-1 Telescope.
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
+
+\DocumentsInternalSection
+PSDC-230-001  &   PS-1 Design Reference Mission \\ \hline
+PSDC-230-002  &   PS-1 System Concept Definition \\ \hline
+\DocumentsExternalSection
+POSIX Standard & Open Group Based Specifications Issue 6, IEEE Std 1003.1, 2003 \\
+FITS Standard & Definition of the Flexible Image Transport System (FITS),
+March 29, 1999, NOST 100-2.0 \\
+\DocumentsEnd
+
+\section{Interface Overview}
+
+\subsection{Pan-STARRS Software Interfaces}
+
+The Pan-STARRS PS-1 Telescope system has multiple
+subsystem-to-subsystem interfaces, illustrated in
+Figure~\ref{fig:overview}.  The subsystem-to-subsystem interfaces are
+each documented in separate documents.  The interface numbers refer to
+the Pan-STARRS Document Control numbering scheme for the interface
+documents.  All Interface Control Documents are numbered
+PSDC-940-XXX-VV, while all Interface Requirements Specifications are
+numbered PSDC-930-XXX-VV, where XXX is the number listed above and VV
+is a document version number.  Table~\ref{tab:overview} lists the
+organizational structure of all Pan-STARRS interfaces, giving the
+corresponding interface number listed in Figure~\ref{fig:overview},
+the group of data being transferred (the assembly), the method in
+which the data is formatted (packing), and the data transfer method
+(protocol).
+
+\begin{figure}
+  \begin{center}
+    \epsfig{file=figures/PSSWIF.eps}
+    \caption{Overview of Pan-STARRS Software Interfaces.}
+    \label{fig:overview}
+  \end{center}
+\end{figure}
+
+This document discusses the software interface between IPP and MOPS.
+IPP must send transient detection descriptions to the MOPS; MOPS
+must be able to query the IPP regarding whether a particular (RA,
+Dec) pair could have been detected in a particular focal plane array (FPA).  This document
+defines the data to be transferred between IPP and MOPS and the
+mechanisms to be used for that interchange.  These interfaces are
+identified as \#005 in Figure~\ref{fig:overview}.  The Interfaces
+addressed by this document are marked in the table.
+
+\begin{table}
+  \begin{center}
+    \caption{Pan-STARRS Interface Data Organization}
+    \label{tab:overview}
+    \begin{tabular}{|l|l|l|l|}
+      \hline
+      {\bf Interface \#} & {\bf Assembly} & {\bf Packaging} & {\bf Protocol} \\ \hline
+      001.2 & Telescope Commands     & EOST Command Language      & Command Socket \\
+      002.2 & Camera Commands        & Conductor Command Language & Command Socket \\
+      002.3 & Camera Status          & ???                        & Shared Name Space \\
+      002.4 & IQ Images              & FITS Images                & Data Store \\
+      003.2 & GPC Images \& Metadata & FITS Images \& Headers     & Data Store \\
+      \hline
+      004.2 & OTIS Metadata          & FITS Tables                & Data Store \\
+      004.3 & ISP Images \& Metadata & FITS Images \& Headers     & Data Store \\
+      004.4 & Reference Star Catalog & FITS Tables                & Data Store \\
+      004.5 & Focal Plane Layout     & FITS Tables                & Data Store \\
+      \hline
+      005.2 & Detections             & FITS Tables                & Data Store \\
+      005.3 & Test Positions         & FITS Tables                & Data Store \\
+      006.2 & Detections             & FITS Tables                & Data Store \\
+      006.3 & Metadata               & FITS Tables                & Data Store \\
+      006.4 & Images                 & FITS Tables                & Data Store \\
+      007.2 & Orbits \& Detections   & FITS Tables                & Data Store \\
+      008.2 & Detections             & FITS Tables                & Data Store \\
+      008.3 & Metadata               & FITS Tables                & Data Store \\
+      008.4 & Images                 & FITS Tables                & Data Store \\
+      \hline
+    \end{tabular}
+  \end{center}
+\end{table}
+
+Layers of network communications are often classified using the
+\htmladdnormallink{OSI Reference
+  Model}{http://en.wikipedia.org/wiki/OSI_reference_model}.  When addressing
+network connectivity between subsystem interfaces, this
+Interface Control Document is primarily concerned with two highest
+layers of the interface communication: the presentation layer, or how
+the data is packaged, and the application layer, or the high-level details of the
+data contents.  The lower layers of the network communication in the OSI model
+are addressed briefly below.
+
+The leased line between the IPP and MOPS is currently expected to have a practical
+maximum sustainable throughput of 50Mbits/s, since the systems will be connected
+through the University of Hawaii ITS network.  Higher and lower bit rates are available,
+and the cost diffferences are quite significant.
+
+\subsubsection{Physical Layer}
+
+MOPS and IPP will each be connected to local inbound and outbound hardware
+interfaces at rates of no less than 1Gbit/sec using fiber or twisted pair
+and onboard NICs where possible.
+
+\subsubsection{Data Link Layer}
+
+The endpoints of the route between IPP and MOPS will be Gigabit
+Ethernet with normal (1500 byte) max. transmission units (MTU).
+
+\subsubsection{Network Layer}
+
+Internet Protocol v4 will be used.  Data Store's HTTP
+server will have an IP address visible (routable) to IPP.
+
+\subsubsection{Transport Layer}
+
+TCP will be used on top of IPv4.
+
+\subsubsection{Session Layer}
+
+IPP-MOPS communication will take place entirely via the Data Store
+mechanism.
+
+\subsubsection{Presentation Layer}
+
+All data exchanged between IPP and MOPS will be in the form of FITS
+Tables and FITS images.
+
+The primary header will not contain any information beyond that
+written automatically by cfitsio, and is present only for compliance
+with the FITS standard.
+
+Though efforts have been made to avoid this from occurring, where
+header keyword names are longer than the usual 8 character maximum,
+the HIERARCH convention will be used.
+
+\subsection{IPP-MOPS Exchange}
+
+MOPS requires from the IPP a stream of transient detections and their
+FPA metadata obtained from processing of difference images acquired by
+the PS-1 camera.  IPP is additionally required by MOPS to be able to
+indicate whether a set of detections (with RA, Dec, flux, length,
+orientation, etc.) on a previously acquired FPA was detectable by the
+PS-1 telescope.
+
+\subsubsection{Conventions}
+
+\begin{enumerate}
+\item Celestial coordinates are in ICRS;
+\item Magnitudes are AB magnitudes (flux zero point is 3631 Jy);
+\item Unless otherwise noted, error values are statistical only, and
+  include no contribution by systematic errors.
+\end{enumerate}
+
+\subsubsection{Transient Detection and Metadata Exchange}
+
+Transient detections and their metadata are assembled nightly into
+FITS files, one file per FPA.  IPP will submit outgoing data into the
+IPP-MOPS outbound datastore.  Metadata for the detections belonging to
+a FPA will be described in the file's FITS headers, and detection data
+will be listed in a subsequent FITS BINTABLE table in the same file.
+
+Each column in the FITS table shall correspond to a detection attribute.
+The data type of a FITS column shall be chosen to represent the attribute
+without loss of information.
+
+The FITS table will include all detections within an exposure.
+
+Duplicates from overlapping skycells will have been filtered out by
+IPP, with the measurements from the source closest to the centre of a
+skycell included (and all others discarded).
+
+\subsubsection{Detectability}
+
+MOPS will need to query the IPP periodically to inquire whether a
+particular elongated trailed detection specified by a ($RA_0$,
+$Dec_0$, $Time_0$, $RA_1$, $Dec_1$, $Time_1$) tuple was detectable by
+the PS-1 telescope.  This query is important in evaluating
+``non-detections,'' or failures of MOPS to locate predicted detections
+of a known object, and for accurate simulation of detections of
+synthetic objects that are injected into the MOPS pipeline to measure
+efficiency.
+
+MOPS will assemble a list of (RA, Dec, Time) tuples in a single FITS
+file and submit them to the MOPS-IPP outgoing datastore.  Later MOPS
+will poll the IPP datastore for results of this query.  If results of
+a query do not appear after a pre-configured timeout, an operator is
+notified.
+
+\subsubsection{Table Description Files}
+
+FITS tables generated by IPP or MOPS shall be described by table
+description files.  These files shall be controlled by CVS, with the
+authoritative versions of these files being the ones contained in
+Appendix A of this document. FITS header data units (HDUs) which do
+not conform to the corresponding table description files shall be
+rejected by the receiver, and the ingest software shall notify an
+operator about the error.
+
+In addition to the required keywords specified in the FITS standard
+for a BINTABLE extension, each FITS HDU shall have the following
+keywords:
+
+\begin{itemize}
+\item{EXTNAME} - Giving a unique name for the metadata table. Such a
+  name shall contain only the characters a-z, and ``\_''.
+\item{CMFVERSION} - A string specifying the version of the table
+  description file for this table.
+\end{itemize}
+
+The format of the metadata tables is described in the following sections.
+
+\subsubsection{Fields in Table Description Files}
+
+The IPP software generating the FITS tables may change. Parameters,
+i.e. columns in FITS tables, may also be added requiring changes both
+in ICD and in software. To keep track of such changes, a Version will
+be assigned to each keyword in the tables descriptions.
+
+To improve the readability, we will use the following conventions for
+the Version:
+\begin{itemize}
+\item X+ (where X is a software version) Means that the keyword
+  appears from software version X until the current version.
+\item X (not used): Means that the keyword appears in FITS file only
+  in software version X.
+\item Version 0 (zero) is the version in the preliminary ICD (Version
+  00 of this document). Some keywords (e.g. RA\_SIG) appear only in
+  the preliminary ICD. They were renamed in software version 1.
+% \item X-Y (not used): Means that the keyword appears from software
+%   version X until the software version Y. \sccomment{commented for future}
+\end{itemize}
+
+\subsubsection{ICD/Software Versions}
+
+\begin{tabular}{|c|c|c|c|l|}
+  \hline
+  Version & ICD Version & Software Version & Software Tag & Comment \\
+  \hline
+  0 & 00 & 0 & n/a & Preliminary ICD. No sw tag \\
+  1 & 01 & 1 & 20100823 & First software release \\
+  2 & 01 & 2 & 20101029 & "V2" software version \\
+  3 & 02 & 2 & 20110406 & Deletion of "ICD lite" wiki page \\
+  \hline
+\end{tabular}
+
+\subsubsection{Transfer via Data Store}
+
+The FITS files containing metadata shall be tranferred using the protocol 
+described in [Data Store doc]. There will be one instance of a datastore 
+within IPP that will be used to submit transient detections and results 
+of detectability queries to MOPS, and
+another instance residing within MOPS to submit detectability requests to the IPP.
+
+During a datastore transaction, the ``sender'' places a file into the datastore with a unique
+transfer ID. The ``receiver'' must regularly poll the datastore to
+detect new FITS files. The receiver then downloads each file from a URL
+provided by the Data Store interface. The receiver is responsible for
+managing which files it has already downloaded. Files remain in
+the datastore for a preset period of time and then are deleted without
+warning. If a file transfer fails, the receiver may retry the transfer,
+If a retry fails, the failure must be resolved by operator intervention.
+
+The data transfers will have the following parameters:
+
+\begin{table}[htbp]
+  \begin{center}
+    \caption{Data transfer parameters}
+    \begin{tabular}{|l|l|l|}
+      \hline
+      \hline
+      {\bf Parameter} & {\bf IPP to MOPS} & {\bf MOPS to IPP} \\ 
+      \hline
+      Dump interval & Per FPA & Per FPA \\
+      Max polling Interval & 60s & 60s \\
+      File Lifetime & 30 days & 10 days \\
+      Datastore location & IPP & MOPS \\ \hline
+    \end{tabular}
+  \end{center}
+\end{table}
+
+\subsection{Transient Detection List}
+
+IPP will submit all transient detections per FPA and their associated
+metadata in a single FITS file.  The metadata will be placed in FITS
+header data unit (HDU) key-value pairs, and the detection attributes
+will be placed in the associated FITS table following the header.  All
+time-dependent table values shall be provided at the midpoint of the
+exposure.
+
+In addition to the required BINTABLE extension header keywords
+described above, the FITS header shall include the keywords shown in
+table \ref{trans-keywords}.  The subsequent FITS table, with EXTNAME
+of \code{MOPS_TRANSIENT_DETECTIONS}, shall include columns whose
+definitions are listed in table \ref{trans-table}.
+
+% \begin{table}[htbp]
+%   \begin{center}
+{\centering%
+    \tabcaption{IPP-MOPS Transient Detection Keywords\label{trans-keywords}}
+    \begin{longtable}{|lcp{0.5in}p{3in}|}
+      \hline \hline {\bf FITS Keyword}
+      & \parbox{0.5in}{\textbf{Version}}
+      & {\bf Precision} & {\bf Description}\\
+      \hline \hline
+      \multicolumn{4}{|l|}{\null\hspace{10mm}\textbf{Version Information}}\\
+      \hline
+      SWSOURCE & 1+ & string & source of software (e.g., "60eb6cdc-a59c-4636-a4e0-dba66a9721fd")\\
+      SWVERSN & 1+ & string & version of software (e.g., "trunk/ppMops@24658")\\
+      HIERARCH\_CMFVERSION & 2+ & char(7) & Either PS1\_DV1 or PS1\_DV2 \\
+      TABLEVER & 0+ & - & \emph{Obsolete}. Replaced by SWSOURCE, SWVERSN\footnote{This entry should be removed in ICD version 04}\\
+      \hline
+      \multicolumn{4}{|l|}{\null\hspace{10mm}\textbf{Provenance Information}}\\
+      \hline
+      EXP\_NAME & 1+ & string & Exposure name (e.g., "o1234g5678")\\
+      EXP\_ID & 1+ & S64 & Exposure identifier \\
+      CHIP\_ID & 1+ & S64 & Chip stage identifier \\
+      CAM\_ID & 1+ & S64 & Camera stage identifier \\
+      FAKE\_ID & 1+ & S64 & Fake stage identifier \\
+      WARP\_ID  & 1+ & S64 & Warp stage identifier \\
+      DIFF\_ID & 1+ & S64 & Diff stage identifier \\
+      DIFF\_POS & 1+ & boolean & Sense of subtraction; T for forward, F for backward\\
+      FPA\_ID & 0 & char(20)- & \emph{Obsolete}. IPP-assigned identifier that
+      can be used to trace back to
+      this FPA\footnote{This entry should be removed in ICD version 04} \\
+      \hline
+      \multicolumn{4}{|l|}{\null\hspace{10mm}\textbf{Exposure Details}}\\
+      \hline MJD-OBS & 0+
+      & F64 & midpoint time of the exposure as a MJD and day fraction \\
+      RA & 0+
+      & {\tiny HH:MM:SS.SSS} & field center RA at exposure midpoint, string \\
+      DEC & 0+ &
+      {\tiny sDD:MM:SS}& (s is + or -) field center declination at exposure midpoint, string \\
+      EXPTIME & 0+
+      & F64 & exposure time in seconds \\
+      ROTANGLE & 0+
+      & F64 & image rotation of the y-axis in degrees, from local N toward E \\
+      FILTER & 0+ & char(3) & effective filter used for the exposure,
+      one of g, r, i, z, y, B, V, w
+      appended with '.00000'\\
+      AIRMASS & 0+ & F64
+      & airmass at exposure midpoint \\
+      OBSCODE & 0+ & char(5) & MPC three-character observatory code \\
+      TEL\_ALT & 0+ & F64 & telescope altitude at exposure midpoint, in degrees \\
+      TEL\_AZ & 0+ & F64 & telescope azimuth at exposure midpoint, in degrees \\
+      SEEING & 1+ & F32 & Measured seeing at diff stage, arcsec \\
+      MAGZP & 1+ & F32 & Magnitude zero point \\
+      MAGZPERR & 1+ & F32 & Error in magnitude zero point \\
+      ASTRORMS & 1+ & F32 & RMS of astrometric fit, arcsec \\
+      LIMITMAG & 0 & F64- & \emph{Obsolete}. limiting magnitude of detections for this FPA\footnote{This entry should be removed in ICD version 04}\\
+      % % \multicolumn{4}{l}{\sccomment{Removed?}} \\
+      % \hline
+      % DE1 through DE10 & 0 & F64 & detection efficiency coefficients \\
+      % % \multicolumn{4}{l}{\sccomment{Removed?}} \\
+      % \hline
+      % \hline
+      % \hline
+    \end{longtable}
+%   \end{center}
+% \end{table}
+}
+
+% \begin{table}[htbp]
+%   \begin{center}
+{\centering
+    \tabcaption{IPP-MOPS Transient Detection Table Columns\label{trans-table}}
+    \begin{longtable}{|lclp{3.5in}|}
+      \hline \hline
+      {\bf Column} & \textbf{Version} & {\bf Precision} & {\bf Description} \\
+      \hline
+      RA\_DEG & 0 & F64 & \emph{Obsolete}. Detection center 
+      coordinates in degrees\footnote{This entry should be removed in ICD version 04}\\
+      RA & 1+ & F64 & detection center coordinates in degrees\\
+      \hline
+      RA\_SIG & 0 & F64 & \emph{Obsolete}. Error in the detection center, in 
+      degrees\footnote{This entry should be removed in ICD version 04}\\
+      RA\_ERR & 1+ & F64 & error in the detection center, in degrees \\
+      \hline
+      DEC\_DEG & 0 & F64 & \emph{Obsolete}. Detection center coordinates in 
+      degrees\footnote{This entry should be removed in ICD version 04} \\
+      DEC & 1+  & F64 & detection center coordinates in degrees \\
+      \hline
+      DEC\_SIG & 0 & F64 & error in the detection center, in degrees \\
+      DEC\_ERR & 1+ & F64 & error in the detection center, in degrees \\
+      \hline
+      MAG & 1+ & F32 & Magnitude \\
+      \hline
+      MAG\_ERR & 1+ & F32 & Magnitude error \\
+      \hline
+      FLUX & 0 & F64 & flux \\
+      \hline
+      FLUX\_SIG & 0 & F64 & error in the flux value \\
+      \hline
+      STARPSF & 0 & F64 & probability that the PSF matches a starlike PSF \\
+      \hline
+      ANG & 0 & F64 & detection's elongation angle in degrees, local N toward E \\
+      \hline
+      ANG\_SIG & 0 & F64 & error in the angle, in degrees \\
+      \hline
+      LEN & 0 & F64 & elongation length of the detection in degrees \\
+      \hline
+      LEN\_SIG & 0 & F64 & error in the length, in degrees \\
+      \hline
+      PSF\_CHI2 & 1+ & F32 & $\chi^2$ of PSF fit \\
+      \hline
+      PSF\_DOF & 1+ & S32 & Degrees of freedom of PSF fit \\
+      \hline
+      CR\_SIGNIFICANCE & 1+ & F32 & Significance of CR\sccomment{CR?} \\
+      \hline
+      EXT\_SIGNIFICANCE & 1+ & F32 & Significance of extendedness \\
+      \hline
+      PSF\_MAJOR & 1+ & F32 & PSF major axis (pixels) \\
+      \hline
+      PSF\_MINOR & 1+ & F32 & PSF minor axis (pixels) \\
+      \hline
+      PSF\_THETA & 1+ & F32 & PSF position angle (deg on chip) \\
+      \hline
+      PSF\_QUALITY & 1+ & F32 & PSF quality factor \\
+      \hline
+      PSF\_NPIX & 1+ & S32 & Number of pixels in PSF \\
+      \hline
+      MOMENTS\_XX & 1+ & F32 & xx moment \\
+      \hline
+      MOMENTS\_XY & 1+ & F32 & xy moment \\
+      \hline
+      MOMENTS\_YY & 1+ & F32 & yy moment \\
+      \hline
+      FLAGS & 1+ & U32 & Detection bit flags \\
+      \sccomment{Bits should be detailed in ICD?} \\
+      \hline
+      DIFF\_SKYFILE\_ID & 1+ & S64 & Identifier for diff skyfile \\
+      \hline
+      N\_POS & 1+ & S32 & Number of positive pixels \\
+      \hline
+      F\_POS & 1+ & F32 & Fraction of positive pixels \\
+      \hline
+      RATIO\_BAD & 1+ & F32 & Ratio of positive pixels to negative \\
+      \hline
+      RATIO\_MASK & 1+ & F32 & Ratio of positive pixels to masked \\
+      \hline
+      RATIO\_ALL & 1+ & F32 & Ratio of positive pixels to all \\
+      \hline
+      IPP\_IDET & 2+ & U32 & IPP detection identifier index \\
+      \hline
+      PSF\_INST\_FLUX & 2+ & F32 & PSF fit instrumental magnitude \\
+      \hline
+      PSF\_INST\_FLUX\_SIG & 2+ & F32 & Sigma of PSF instrumental magnitude \\
+      \hline
+      AP\_MAG & 2+ & F32 & magnitude in standard aperture \\
+      \hline
+      AP\_MAG\_RAW & 2+ & F32 & magnitude in real aperture \\
+      \hline
+      AP\_MAG\_RADIUS & 2+ & F32 & radius used for aperture mags \\
+      \hline
+      AP\_FLUX & 2+ & F32 & instrumental flux in standard aperture \\
+      \multicolumn{4}{l}{\sccomment{Was it FLUX in version 0?}} \\
+      \hline
+      AP\_FLUX\_SIG & 2+ & F32 & aperture flux error \\
+      \multicolumn{4}{l}{\sccomment{FLUX\_SIG in version 0?}} \\
+      \hline
+      PEAK\_FLUX\_AS\_MAG & 2+ & F32 & Peak flux expressed as magnitude \\
+      \hline
+      CAL\_PSF\_MAG & 2+ & F32 & PSF Magnitude using supplied calibration \\
+      \hline
+      CAL\_PSF\_MAG\_SIG & 2+ & F32 & measured scatter of zero point calibration \\
+      \hline
+      SKY & 2+ & F32 & Sky level \\
+      \hline
+      SKY\_SIGMA & 2+ & F32 & Sigma of sky level \\
+      \hline
+      PSF\_QF\_PERFECT & 2+ & F32 & PSF coverage/quality factor (poor) \\
+      \hline
+      MOMENTS\_R1 & 2+ & F32 & first radial moment \\
+      \hline
+      MOMENTS\_RH & 2+ & F32 & half radial moment \\
+      \hline
+      KRON\_FLUX & 2+ & F32 & Kron Flux (in 2.5 R1) \\
+      \hline
+      KRON\_FLUX\_ERR & 2+ & F32 & Kron Flux Error \\
+      \hline
+      KRON\_FLUX\_INNER & 2+ & F32 & Kron Flux (in 1.0 R1) \\
+      \hline
+      KRON\_FLUX\_OUTER & 2+ & F32 & Kron Flux (in 4.0 R1) \\
+      \hline
+      DIFF\_R\_P & 2+ & F32 & distance to positive match source \\
+      \hline
+      DIFF\_SN\_P & 2+ & F32 & signal-to-noise of pos match src \\
+      \hline
+      DIFF\_R\_M & 2+ & F32 & distance to negative match source \\
+      \hline
+      DIFF\_SN\_M & 2+ & F32 & signal-to-noise of neg match src \\
+      \hline
+      FLAGS2 & 2+ & U32 & psphot analysis flags (group 2) \\
+      \sccomment{Bits should be detailed in ICD?} \\
+      \hline
+      N\_FRAMES & 2+ & U16 & Number of frames overlapping source center \\
+      \hline
+      PADDING & 2+ & S16 & padding \\
+      \hline
+    \end{longtable}
+%   \end{center}
+% \end{table}
+}
+
+\sccomment{I didn't change anything from this point till the end}
+
+\subsection{MOPS Detectability Query}
+
+MOPS will query the IPP regarding the detectability of hypothetical
+elongated detections specified using ($RA_0$, $Dec_0$, $Time_0$,
+$RA_1$, $Dec_1$, $Time_1$) tuples by submitting all information
+required to construct a FPA PSF at the time of the detections.  It is
+the responsibility of MOPS to generate and manage unique query IDs.
+
+All MOPS detectability queries will occur with respect to an already-ingested
+FPA transient detection list.  The query being asked by MOPS is essentially
+whether a particular trail in an acquired FPA image was masked for any
+reason and to what degree.  Thus the originating IPP FPA\_ID is required.
+
+MOPS will simulate elongated (``trailed'') PSFs, relevant for
+fast-moving objects.  Since some or all of a trail may be masked, MOPS
+will for all detections provide starting and ending RA and Dec.  For
+most detections these two positions will be nearly coincident,
+appearing as a circular point-source PSF, but for fast-moving objects
+these positions may differ by many pixels in the FPA.
+
+In addition to the required BINTABLE extension header keywords
+described above, the FITS header for the detectability query shall
+include the following required keywords shown in table
+\ref{detquery-keywords}.  The subsequent FITS table, with EXTNAME of
+\code{MOPS_DETECTABILITY_QUERY}, shall include columns whose
+definitions are listed in table \ref{detquery-table}.
+
+% \begin{table}[htbp]
+% \begin{center}
+{\centering%
+\small
+    \tabcaption{MOPS-IPP Detectability Query Keywords\label{detquery-keywords}}
+\begin{tabular}{lll}
+\hline
+\hline
+{\bf Column}            & {\bf Precision} & {\bf Description} \\
+\hline
+QUERY\_ID  & char(20) & MOPS query ID for this batch query \\
+FPA\_ID    & char(20) & original FPA\_ID used at ingest \\
+MJD-OBS    & F64 & starting time of the exposure, MJD \\
+FILTER     & char(3) & effective filter used for the exposure as a string, allowed values of g, r, i, z, y, B, V, w \\
+OBSCODE    & char(3) & site identifier (MPC observatory code) \\
+\end{tabular}
+}
+% \end{center}
+% \end{table}
+
+
+% \begin{table}[htbp]
+% \begin{center}
+{\centering%
+\small
+\tabcaption{MOPS-IPP Detectability Query Table Columns\label{detquery-table}}
+\begin{tabular}{lll}
+\hline
+\hline
+{\bf Column}            & {\bf Precision} & {\bf Description} \\
+\hline
+ROWNUM      & char(20) & identifier for this row in the table \\
+RA1\_DEG    & F64 & coordinate at the start of exposure, in degrees \\
+DEC1\_DEG   & F64 & coordinate at the start of exposure, in degrees \\
+RA2\_DEG    & F64 & coordinate at the end of exposure, in degrees \\
+DEC2\_DEG   & F64 & coordinate at the end of exposure, in degrees \\
+MAG         & F64 & apparent magnitude \\
+\end{tabular}
+}
+% \end{center}
+% \end{table}
+
+\subsection{IPP Detectability Response}
+
+IPP will return a table listing the submitted query detections and a
+pair of values $(N, f)$ indicating the number of pixels relevant to the detection's PSF
+and a fraction of pixels detectable by IPP.
+
+For infrequent cases where a trail may completely traverse a masked area (due to chip gap, streak removal, or similar), the response may be erroneous or incomplete.  This error and its effects will be studied during PS-1 operations.
+
+In addition to the required BINTABLE extension header keywords
+described above, the FITS header for the detectability response shall include
+the following required keywords shown in table \ref{detresponse-keywords}.
+The subsequent FITS table, with EXTNAME of \code{MOPS_DETECTABILITY_RESPONSE}, shall include 
+columns whose definitions are listed in table \ref{detresponse-table}.
+
+{\centering%
+% \begin{table}[htbp]
+% \begin{center}
+\small
+\tabcaption{MOPS-IPP Detectability Response Keywords\label{detresponse-keywords}}
+\begin{tabular}{lll}
+\hline
+\hline
+{\bf Column}            & {\bf Precision} & {\bf Description} \\
+\hline
+QUERY\_ID   & char(20)    & originating MOPS query ID \\
+FPA\_ID     & char(20)    & IPP FPA ID used in detectability request \\
+\end{tabular}
+}
+% \end{center}
+% \end{table}
+
+% \begin{table}[htbp]
+% \begin{center}
+{\centering%
+\small
+\tabcaption{MOPS-IPP Detectability Response Table Columns\label{detresponse-table}}
+\begin{tabular}{lll}
+\hline
+\hline
+{\bf Column}            & {\bf Precision} & {\bf Description} \\
+\hline
+ROWNUM      & char(20) & matching rownum from original request \\
+DETECT\_N   & U32 & number of pixels used in the hypothetical PSF for the query detection \\
+DETECT\_F   & F64 & detectability, indicating the fraction of PSF pixels detectable by IPP \\
+\end{tabular}
+}
+% \end{center}
+% \end{table}
+
+\pagebreak
+\appendix
+
+\section{Appendix}
+
+\subsection{IPP to MOPS}
+
+\begin{table}[htbp]
+\begin{center}
+\small
+\caption{IPP-MOPS FITS Table Description Files\label{table-types-ipp-mops}}
+\begin{tabular}{lll}
+\hline
+\hline
+{\bf Table Name}            & {\bf EXTNAME} & {\bf Description} \\
+\hline
+Transient Detections        & \code{MOPS_TRANSIENT_DETECTIONS} & list of transient detections for an FPA \\
+Detectability Query Result  & \code{MOPS_DETECTABILITY_RESPONSE} & table of detectability values in response to query\\
+\end{tabular}
+\end{center}
+\end{table}
+
+\subsection{MOPS to IPP}
+
+\begin{table}[htbp]
+\begin{center}
+\small
+\caption{MOPS-IPP FITS Table Description Files\label{table-types-mops-ipp}}
+\begin{tabular}{lll}
+\hline
+\hline
+{\bf Table Name}            & {\bf EXTNAME} & {\bf Description} \\
+\hline
+Detectability Query         & \code{MOPS_DETECTABILITY_QUERY} & table of detectability query tuples (RA, Dec, FPA) \\
+\end{tabular}
+\end{center}
+\end{table}
+
+\subsection{Acronyms}
+
+\begin{table}[htbp]
+\begin{center}
+\small
+\caption{Acronyms used in this document\label{table-acronyms}}
+\begin{tabular}{ll}
+\hline
+\hline
+{\bf Acronym}            & {\bf Definition} \\
+\hline
+MOPS     & Pan-STARRS Moving Object Processing System \\
+IPP      & Pan-STARRS Image Processing Pipeline \\
+FPA      & Focal plane array \\
+MPC      & Center for Astrophysics Minor Planet Center \\
+\hline
+\end{tabular}
+\end{center}
+\end{table}
+
+\subsection{Limitations}
+\label{sec-limitations}
+
+\begin{itemize}
+\item The IPP is not yet calculating detection efficiencies (it is
+  still being developed). Further, it is not yet clear how to merge
+  the detection efficiency measurements for different skycells. Until
+  these issues are resolved, the detection efficiency values will be
+  fake (Expected fields: DE\_MAGnn (F32): Magnitude (calibrated) for
+  detection efficiency; DE\_EFFnn (F32): Detection efficiency (0..1)).
+\item ANGLE, ANGLE\_SIG, LENGTH, LENGTH\_SIG removed; these can be
+  calculated from the moment;
+\item FLUX, FLUX\_SIG renamed MAG, MAG\_ERR since IPP writes
+  magnitudes;
+\item FLAGS added to allow additional weeding out of bad detections;
+\item DIFF\_SKYFILE\_ID added to allow trace back to IPP diff skyfile,
+  for postage stamps;
+\item STARPSF renamed EXT\_SIGNIFICANCE to be more clear
+\end{itemize}
+
+\subsection{Example}
+\label{sec-example}
+
+\begin{verbatim}
+XTENSION= 'BINTABLE'           / binary table extension
+BITPIX  =                    8 / 8-bit bytes
+NAXIS   =                    2 / 2-dimensional binary table
+NAXIS1  =                  120 / width of table in bytes
+NAXIS2  =                42032 / number of rows in table
+PCOUNT  =                    0 / size of special data area
+GCOUNT  =                    1 / one data group (required keyword)
+TFIELDS =                   25 / number of fields in each row
+TTYPE1  = 'RA      '           / label for field   1
+TFORM1  = '1D      '           / data format of field: 8-byte DOUBLE
+TTYPE2  = 'RA_ERR  '           / label for field   2
+TFORM2  = '1D      '           / data format of field: 8-byte DOUBLE
+TTYPE3  = 'DEC     '           / label for field   3
+TFORM3  = '1D      '           / data format of field: 8-byte DOUBLE
+TTYPE4  = 'DEC_ERR '           / label for field   4
+TFORM4  = '1D      '           / data format of field: 8-byte DOUBLE
+TTYPE5  = 'MAG     '           / label for field   5
+TFORM5  = '1E      '           / data format of field: 4-byte REAL
+TTYPE6  = 'MAG_ERR '           / label for field   6
+TFORM6  = '1E      '           / data format of field: 4-byte REAL
+TTYPE7  = 'PSF_CHI2'           / label for field   7
+TFORM7  = '1E      '           / data format of field: 4-byte REAL
+TTYPE8  = 'PSF_DOF '           / label for field   8
+TFORM8  = '1J      '           / data format of field: 4-byte INTEGER
+TTYPE9  = 'CR_SIGNIFICANCE'    / label for field   9
+TFORM9  = '1E      '           / data format of field: 4-byte REAL
+TTYPE10 = 'EXT_SIGNIFICANCE'   / label for field  10
+TFORM10 = '1E      '           / data format of field: 4-byte REAL
+TTYPE11 = 'PSF_MAJOR'          / label for field  11
+TFORM11 = '1E      '           / data format of field: 4-byte REAL
+TTYPE12 = 'PSF_MINOR'          / label for field  12
+TFORM12 = '1E      '           / data format of field: 4-byte REAL
+TTYPE13 = 'PSF_THETA'          / label for field  13
+TFORM13 = '1E      '           / data format of field: 4-byte REAL
+TTYPE14 = 'PSF_QUALITY'        / label for field  14
+TFORM14 = '1E      '           / data format of field: 4-byte REAL
+TTYPE15 = 'PSF_NPIX'           / label for field  15
+TFORM15 = '1J      '           / data format of field: 4-byte INTEGER
+TTYPE16 = 'MOMENTS_XX'         / label for field  16
+TFORM16 = '1E      '           / data format of field: 4-byte REAL
+TTYPE17 = 'MOMENTS_XY'         / label for field  17
+TFORM17 = '1E      '           / data format of field: 4-byte REAL
+TTYPE18 = 'MOMENTS_YY'         / label for field  18
+TFORM18 = '1E      '           / data format of field: 4-byte REAL
+TTYPE19 = 'N_POS   '           / label for field  19
+TFORM19 = '1J      '           / data format of field: 4-byte INTEGER
+TTYPE20 = 'F_POS   '           / label for field  20
+TFORM20 = '1E      '           / data format of field: 4-byte REAL
+TTYPE21 = 'RATIO_BAD'          / label for field  21
+TFORM21 = '1E      '           / data format of field: 4-byte REAL
+TTYPE22 = 'RATIO_MASK'         / label for field  22
+TFORM22 = '1E      '           / data format of field: 4-byte REAL
+TTYPE23 = 'RATIO_ALL'          / label for field  23
+TFORM23 = '1E      '           / data format of field: 4-byte REAL
+TTYPE24 = 'FLAGS   '           / label for field  24
+TFORM24 = '1J      '           / data format of field: 4-byte INTEGER
+TZERO24 =           2147483648 / offset for unsigned integers
+TSCAL24 =                    1 / data are not scaled
+TTYPE25 = 'DIFF_SKYFILE_ID'    / label for field  25
+TFORM25 = '1K      '           / data format of field: 8-byte INTEGER
+SWSOURCE= '60eb6cdc-a59c-4636-a4e0-dba66a9721fd' / Software source
+SWVERSN = 'branches/pap_mops/ppMops@25227' / Software version
+HISTORY ppMops at 2009-09-02T03:48:46.695783
+HISTORY psLib version: branches/pap_mops/psLib@25227
+HISTORY psLib source: 60eb6cdc-a59c-4636-a4e0-dba66a9721fd
+HISTORY ppMops version: branches/pap_mops/ppMops@25227
+HISTORY ppMops source: 60eb6cdc-a59c-4636-a4e0-dba66a9721fd
+EXP_NAME= 'o4995g0129o'        / Exposure name
+EXP_ID  =                77164 / Exposure identifier
+CHIP_ID =                24019 / Chip stage identifier
+CAM_ID  =                17726 / Cam stage identifier
+FAKE_ID =                10227 / Fake stage identifier
+WARP_ID =                 8842 / Warp stage identifier
+DIFF_ID =                19219 / Diff stage identifier
+DIFF_POS=                    F / Positive subtraction?
+MJD-OBS =     54995.4740598313 / MJD of exposure midpoint
+RA      = '18:25:01.988'       / Right Ascension of boresight
+DEC     = '-17:20:40.069'      / Declination of boresight
+TEL_ALT =            51.951873 / Telescope altitude
+TEL_AZ  =           179.483883 / Telescope azimuth
+EXPTIME =                  38. / Exposure time (sec)
+ROTANGLE=             333.1039 / Rotator position angle
+FILTER  = 'r.00000 '           / Filter name
+AIRMASS =                1.269 / Airmass of exposure
+OBSCODE = 'F51     '           / IAU Observatory code
+SEEING  =             1.678401 / Mean seeing
+MAGZP   =             28.65226 / Magnitude zero point
+MAGZPERR=             0.353063 / Error in magnitude zero point
+ASTRORMS=            0.3111496 / RMS of astrometric fit
+EXTNAME = 'MOPS_TRANSIENT_DETECTIONS'
+\end{verbatim}
+
+
+\end{document}
+
