IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 2176


Ignore:
Timestamp:
Oct 19, 2004, 10:17:36 PM (22 years ago)
Author:
eugene
Message:

continuing major revisions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/doc/design/ippSDRS.tex

    r2172 r2176  
    1 %%% $Id: ippSDRS.tex,v 1.8 2004-10-19 03:28:04 eugene Exp $
     1%%% $Id: ippSDRS.tex,v 1.9 2004-10-20 08:17:36 eugene Exp $
    22\documentclass[panstarrs]{panstarrs}
    33
     
    369369Database) are also shown.
    370370
     371%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     372
    371373\section{System Design : Architectural Components}
    372374
     
    723725
    724726\begin{itemize}
     727\item AP Database database tables
     728\item AP Database database engine
    725729\item AP Database servers
    726730\item AP Database client APIs
    727 \item AP Database storage hardware
    728 \item AP Database database engine
    729 \item AP Database database tables
    730731\end{itemize}
    731732
     
    735736contents of these tables are outlined in
    736737Appendix~\ref{APDBTableContents}.  Below, we discuss how these tables
    737 are used by the AP Database software.  Three of the tables are not
    738 simple tables but instead are divided into many subtables, each of
    739 which represents a portion of the sky.  These subtables may also be
    740 distributed across different computers to distribute the processing
    741 load.
    742 
    743 The table of Images lists all of the images which provided the data in
    744 the AP Database.  In general, these images correspond to the Chips.
    745 This table includes sufficient astrometric parameters to represent the
    746 coordinates of the detections to a sufficient accuracy.
    747 
    748 The Images in the image table group are stored in the Image table
    749 which contains the (center? 0,0 pixel?) of the chip.  A specific
    750 coordinate can be specified to a single Image region table.  However,
    751 it is frequently useful to determine all regions which a specific
    752 image overlaps.  The Image Overlaps tables contains a list of the
    753 image regions which are overlapped by each image.
    754 
    755 The Objects table group (divided by region) stores the average
    756 parameters for each astronomical object.  Certain details of this
    757 table have not yet been specified.  In particular, objects with
     738are used by the AP Database software.  Several of the tables are not
     739just simple tables in the database but are instead divided into many
     740subtables, each of which represents a portion of the sky.  These
     741subtables may also be distributed across different computers to
     742distribute the processing load.
     743
     744The {\tt Images} table group lists all of the images which provided
     745the data in the AP Database.  These tables are subdivided by region.
     746In general, the images listed in this table correspond to the Chips.
     747This group of tables includes sufficient astrometric parameters to
     748represent the coordinates of the detections to a sufficient accuracy.
     749
     750The specific subtable of {\tt Images} which contains a given image is
     751that one which contains the center pixel \tbr{or 0,0 pixel} of that
     752image.  An additional table group, {\tt Image Overlaps} (with the same
     753subtable organization as the {\tt Images} subtables), lists images
     754which overlap that specific subtable.  Thus, given a particular
     755coordinate, in order to find that images which overlap that
     756coordinate, it is necessary to load the images in the {\tt Images}
     757subtable which includes that coordinate, and all images in the {\tt
     758ImageOverlaps} table for that coordinate.
     759
     760The {\tt Objects} table group (also divided by region) stores the
     761average parameters for each astronomical object.  Certain details of
     762this table have not yet been specified.  In particular, objects with
    758763significant parallax and/or proper motion may potentially be stored in
    759 a distinct table.  Solar system objects, to the extent average
    760 properties are maintained, are certainly stored in a separate table.
    761 A related table, also divided in the same regions, is the Average
    762 Magnitudes table.  In this table, there are multiple rows per average
     764a distinct table.  Solar system object identifications, to the extent
     765average properties are maintained in the AP Database, will certainly
     766be stored in a separate table. 
     767
     768A related table, also divided in the same regions, is the {\tt Average
     769Magnitudes} table.  In this table, there are multiple rows per average
    763770object, one for each of the primary filters of interest for which
    764 photometric averaging is performed.
    765 
    766 The Detections table stores all of the measurements of astronomical
    767 objects on specific images.  \tbd{is this table divided into P2, P4S,
    768 P4D tables?  3$\sigma$ objects vs 5$\sigma$ objects?  We don't want to
    769 store all detections in a single table, I think}.
    770 
    771 The Non-detections table stores information about detection failures
    772 for each object.  If an image is added to the database which overlaps
    773 an object but the object is not detected, an entry is made in this
    774 table.  In fact, this table may store only the most recent
     771photometric averaging is performed.  This organization makes the
     772number of primary (averaged) filters a configurable value.
     773
     774The {\tt Matched Detections} table stores all of the measurements of
     775astronomical objects on specific images.  This table includes all
     776detections associated with the average {\tt Objects}.  As discussed
     777below, bright objects (above a configuration-specified signal-to-noise
     778level) are assigned an object even if only one detection has been
     779found at that position.  Faint orphaned objects are not added to this
     780list or the list of objects.  The different types of detections (P2,
     781P4$\Delta$, P4$\Sigma$) are distinguished by their photometry codes.
     782\tbr{This is only valid if the AP Database does not store different
     783quantities for these types of detections}
     784
     785The {\tt Orphaned Detections} table stores the detections which have
     786not been correlated with an existing object.  This table is only
     787populated for objects below a configuration-specified signal-to-noise
     788limit.  Otherwise, even orphaned detections are assigned an object and
     789added to the {\tt Matched Detections} table.
     790
     791The {\tt Non-detections} table stores information about detection
     792failures for each object.  If an image is added to the database which
     793overlaps an object but the object is not detected, an entry is made in
     794this table.  In practice, this table may store only the most recent
    775795non-detection and the total number, or a similar reduced set of
    776796non-detection statistics.
    777797
    778 The table of regions is used to subdivide the tables of images,
    779 objects, and detections.  The AP Database divides the sky into a
    780 hierarchy of regions (portions of the sky) each of which is in turn
    781 sub-divided into smaller portions.  These three tables are the three
    782 largest in terms of both data volume and number of rows.  Since nearly
     798The {\tt Regions} table is used to subdivide the tables of images,
     799objects, and detections, etc, as discussed above.  The AP Database
     800divides the sky into a hierarchy of regions (portions of the sky) each
     801of which is in turn sub-divided into smaller portions.  Since nearly
    783802all interactions with the AP Database performed by the IPP are limited
    784803in spatial coverage, subdividing the tables allows a specific
    785804interaction to search only a small subset of the data.  The table of
    786805images is the smallest of the three; the table of detections is likely
    787 to be the largest.  As a result, the images tables will be subdivided
    788 at a shallow hierarchical level, while the objects and detections are
    789 subdivided on deeper (more finely sampled) levels.  The region table
    790 defines the sky regions and specifies if the region corresponds to an
    791 image table, and object table, and/or a detection table.  It also
    792 specified which regions in the next level of the hierarchy are
     806to be the largest.  As a result, the {\tt Images} table group will be
     807subdivided at a shallow hierarchical level, while the {\tt Objects}
     808and {\tt Detections} are subdivided on deeper (more finely sampled)
     809levels.  The {\tt Regions} table defines the boundaries of the sky
     810regions and specifies if the region corresponds to an {\tt Images}
     811table, an {\tt Objects} table, and/or a {\tt Detections} table.  It
     812also specifies which regions in the next level of the hierarchy are
    793813contained by the region, and which parent region it belongs to.  In
    794814addition to improving the spatial access to the image, object, and
    795 detection data, the region table allows for the multiple computers to
    796 serve the database tables.  The region file specifies the machine
     815detection data, the {\tt Regions} table allows for multiple computers
     816to serve the database tables.  The region file specifies the machine
    797817which stores the specific table.  Figure~\ref{ABDBRegions} illustrates
    798 this subdivision of the sky and the association between different
    799 levels of the hierarchy with different subtables.
    800 
    801 The Filters table identifies all of the physical filters (specific,
    802 named pieces of glass) known to the system.  A related table,
    803 photcodes, defines relationships between specific photometry systems.
    804 A system may consist of a detector, telescope, and specific filter, or
    805 it may be a derived photometry system. \tbd{distinguish between
    806 reference, average, and detection photcodes}.
     818schamatically the subdivision of the sky and the association between
     819different levels of the hierarchy with different subtables.
     820
     821The {\tt Filters} table identifies all of the physical filters
     822(specific, named pieces of glass) known to the system.  A related
     823table, {\tt Photcodes}, defines relationships between specific
     824photometry systems.  A system may consist of a detector, telescope,
     825and specific filter, or it may be a derived photometry system.  The
     826{\tt Database Machines} table identifies all of the computers
     827available to the AP Database.
    807828
    808829\begin{table}
     
    814835{\bf Table Name} & {\bf Description} \\
    815836\hline
    816 Region Table       & spatial distribution of tables \\
    817 Images             & The images that have objects in the DB. \\
    818 Image Overlaps     & Image regions which are touched by specific images. \\
    819 Objects            & The objects --- average properties of multiple detections of the same object. \\
    820 Average Magnitudes & Average photometry in multiple filters \\
    821 Detections         & Detections of sources in an image. \\
    822 Non-Detections     & Non-detections of objects in an image. \\
    823 Filters            & Filters understood by the system. \\
    824 Photcodes          & Transformations between different photometric systems \\
    825 Database Machines  & computers used to store the tables \\
     837Images              & The images that have objects in the DB. \\
     838Image Overlaps      & Image regions which are touched by specific images. \\
     839Objects             & The objects --- average properties of multiple detections of the same object. \\
     840Average Magnitudes  & Average photometry in multiple filters \\
     841Matched Detections  & Detections of sources in an image identified with an Object. \\
     842Orphaned Detections & Detections of sources in an image not identified with an Object. \\
     843Non-detections      & Non-detections of objects in an image. \\
     844Region Table        & spatial distribution of tables \\
     845Filters             & Filters understood by the system. \\
     846Photcodes           & Transformations between different photometric systems \\
     847Database Machines   & computers used to store the tables \\
     848% Zero Points       & Transformations between different photometric systems \\
     849% Distortion Models & Transformations between different photometric systems \\
    826850\hline
    827851\end{tabular}
     
    852876the sky is defined by the Region table.  Each machine has a
    853877corresponding AP Database server which runs on that machine to
    854 interact with the tables available on that machine.  A client chooses
    855 one of the machines and sends its query or data to be inserted to that
    856 machine.  The server then uses the region table to determine which
    857 machines contain the relevant portion of the sky.  The data to be
    858 inserted is divided into corresponding region chunks and sent to the
    859 appropriate servers.  In the case of queries, the queries are
    860 redirected to the appropriate server(s).  The original server may
    861 collect the results and return them to the original client.
    862 
    863 \subsubsection{AP DB Operations}
    864 
    865 \begin{itemize}
    866 \item addstar
    867 \item delstar
    868 \item relphot
    869 \item uniphot
    870 \item mosastro
    871 \item distortion
    872 \end{itemize}
     878interact with the tables available on that machine.  Two possible
     879interaction models are considered. 
     880
     881{\bf Option A:} A client chooses one of the machines and sends its
     882query or data to be inserted to that machine.  The server then uses
     883the region table to determine which machines contain the relevant
     884portion of the sky.  The data to be inserted is divided into
     885corresponding region chunks and sent to the appropriate servers.  In
     886the case of queries, the queries are redirected to the appropriate
     887server(s).  The original server may collect the results and return
     888them to the original client.
     889
     890{\bf Option B:} The client downloads the region table and performs the
     891division of the data into appropriate subsets.  The subsets are then
     892sent to the corresponding servers by the client. 
     893
     894The differences between these models is small.  The first option may
     895make the code more testable, placing all of the logic in the servers
     896and making each server symmetric.  The smaller tables (ie, Region,
     897Filters, etc) could either be downloaded from a single server or
     898replicated to all AP DB servers.
     899
     900\subsubsection{AP Database engine}
     901
     902The backend database engine for the AP Database stores the tables and
     903provides them to the servers on demand.  The AP Database will use a
     904\code{mysql} database engine for the function.
     905
     906\subsubsection{AP DB Client operations}
     907
     908The AP Database client interactions consist of a collection of basic
     909queries of the database, along with more complex operations to perform
     910particular tasks.  \tbd{queries are not yet listed; provide list from
     911  DVO}.  The complex operations are listed below.
     912
     913\paragraph{Insert Image \& Detection Set (addstar)}
     914
     915One of the most basic operations needed by the AP Database is to
     916insert a collection of detections derived from a specific image, and
     917add the definition of that image to the database.  This operation is
     918critical in terms of the processing throughput.  After the detections
     919have been assigned to the appropriate regions, they are matched
     920against all objects in the {\tt Objects} table.  Matches are performed
     921only on the basis of positional coincidence, using a matching radius
     922which may depend on the image astrometry errors, or may be a fixed
     923distance.  Any matched detections are added to the {\tt Matched
     924Detections} table.  Any unmatched detections brighter than the Faint
     925Detection cut-off are specified as a new {\tt Object} and also added
     926to the {\tt Matched Detections} table.  Any faint unmatched detections
     927are added to the {\tt Orphaned Detections} table.  This division is
     928important because it lets us automatically associate new detections
     929with existing bright objects and limits the I/O volume required to
     930make the detections.  In general, there will be many few {\tt Objects}
     931than {\tt Detections}, and there will be fewer bright orphans than
     932faint orphans.
     933
     934\paragraph{Insert Reference Objects (addrefs)}
     935
     936This operation is very similar to the previous one.  A collection of
     937reference objects are added to the database as a collection of
     938detections.  The reference photometry should in general be given its
     939own photometry code.  The reference data is different from the image
     940detection set because the associated image information is not
     941included.  Thus, no corresponding images are added to the database.
     942
     943\paragraph{Determine Relative Photometry in region (relphot)}
     944
     945This operation uses the overlaps of images and multiple observations
     946of the same objects to determine the relative photometry zero-points
     947for a collection of images.  This is a task which would be run much
     948more infrequently than the object insertion tasks. 
     949
     950\paragraph{Determine Consistent Photometry Zero Points (uniphot)}
     951
     952This operation uses the time history of relative photometry zero
     953points for images and the spatial overlap information to determine a
     954best set of image zero points which have a specific time scale for the
     955atmospheric stability.
     956
     957\paragraph{Determine Distortion Model (mosastro)}
     958
     959This operation uses the reference and image detections to determine an
     960optical distortion model for the camera.  ñ
    873961
    874962\begin{table}
     
    11571245\subsection{Scheduler}
    11581246
     1247\begin{figure}
     1248\begin{center}
     1249\resizebox{6in}{!}{\includegraphics{pics/Scheduler}}
     1250\caption{ \label{Scheduler} IPP Scheduler}
     1251\end{center}
     1252\end{figure}
     1253
    11591254The IPP is responsible for a variety of analysis tasks: processing of
    11601255the science images through several stages; routine assessment of the
     
    11721267The IPP Scheduler acts as an intermediary between several components
    11731268of the IPP and also between the IPP and external agents such as OTIS
    1174 and the users who must monitor the behavior of the IPP.
     1269and the users who must monitor the behavior of the IPP.  The IPP
     1270Scheduler may be viewed as the central brain of the IPP.
     1271Figure~\ref{Scheduler} illustrates the design of the IPP Scheduler.
     1272
     1273The IPP Scheduler performs two types of actions.  'Tasks' are
     1274long-running programs which are executed by the Controller.  These are
     1275not only background tasks, but are distributed computing tasks.
     1276Examples of these include the science analysis tasks (eg, Phase 1, 2,
     12773, 4), the Calibration construction tasks, and data copy tasks (such
     1278as copying images and metadata from the summit system).  'Tests' are
     1279short-running programs which are used to decide which tasks should be
     1280run.  Tests should be designed to return immediately ($< 100 ms$) and
     1281are not run in the background; the Scheduler will block until the test
     1282is complete.  The IPP Scheduler daemon, which runs continuously,
     1283performs tests (eg, queries of the IPP Metadata Database, queries of
     1284OTIS, checks of the IPP hardware status, etc).  Based on these tests,
     1285the daemon defines appropriate tasks and sends them to the Controller.
     1286When tasks are completed, their results may be used by the Scheduler
     1287to update the external systems (update the Metadata Database), or the
     1288tasks themselves may send their results directly to the Metadata
     1289Database or other subsystems.  Based on the successful completion (or
     1290not!) of the tasks, and the new state of entries in the Metadata
     1291Database, the Scheduler can define new tasks.
    11751292
    11761293The IPP Scheduler sends commands to the IPP Controller for execution.
     
    11861303Controller does not need to have any information about the details of
    11871304the tasks which it executes, while the IPP Scheduler does not need to
    1188 have detailed information about the available computer hardware.
     1305monitor the computer hardware.
    11891306
    11901307Communication between the IPP Scheduler and the IPP Controller is
     
    12661383The analysis stages are written as UNIX commands, which may be
    12671384executed by the IPP Controller, or may be executed individually by
    1268 hand.  This aspect makes testing of the complete analysis system much
     1385hand.  This option makes testing of the complete analysis system much
    12691386easier because the individual analysis stages may be tested
    1270 independently of each other and the IPP infrastructure. 
    1271 
    1272 In keeping with this design model, the analysis stages have several
    1273 methods for accepting and returning the input and output data.  All of
    1274 the analysis stages load an analysis recipe file, which defines the
    1275 details of the analysis.  This includes the location of the data
    1276 sources (from the metadata, from the image headers, from other
    1277 external files, or supplied directly), and which steps to employ.  For
    1278 example, in the discussion of the Phase 2 analysis below, the recipe
    1279 file may specify {\em if} a bias subtraction should be applied, {\em
    1280 where} to find the overscan region and {\em which} bias image, if any,
    1281 to apply. 
    1282 
    1283 \tbd{further discussion of the recipe / configuration files?}
    1284 
     1387independently of each other and the IPP infrastructure.
     1388
     1389As part of this design model, the analysis stages have several methods
     1390for accepting and returning the input and output data and for defining
     1391optional choices in the analysis.  All of the analysis stages load an
     1392analysis recipe, which defines the details of that analysis.  The
     1393recipe includes the location of the data sources (from the metadata,
     1394from the image headers, from other external files, or supplied
     1395directly), which steps to employ, and how to assign optional
     1396parameters.  For example, in the discussion of the Phase 2 analysis
     1397below, the recipe file may specify {\em if} a bias subtraction should
     1398be applied, {\em where} to find the overscan region and {\em which}
     1399bias image, {\em if any}, to apply. 
     1400
     1401The recipe is loaded as part of the runtime configuration information
     1402loaded when the analysis script starts.  We define four levels of
     1403runtime configuration information.  The {\tt site} configuration
     1404defines values specific to the particular installation of the
     1405software.  For example, the name of the machine which hosts the
     1406Metadata Database or a default path for data files could be part of
     1407the {\tt site} configuration.  Multiple installations or versions of
     1408the IPP software would need to have separate {\tt site} configuration
     1409entries.  For example, a version of the IPP installed at the IfA would
     1410use a different computer for the Image Server from the live IPP
     1411installation running on the Pan-STARRS cluster.  The {\tt base}
     1412configuration defines general data sources which may be needed by any
     1413portion of the IPP.  The list of known telescope or filters might be
     1414an example.  The {\tt camera} configuration consists of information
     1415which defines the parameters relevant to the camera known by the IPP.
     1416For example, the default layout of the detectors or the names of
     1417specific header keyword values would be defined for each camera in a
     1418camera-specific configuration collection.  Finally, each analysis
     1419script loads its own recipe.  The location of this configuration
     1420information may be a collection of configuration files available on
     1421disk or some subset of the information may be stored in the Metadata
     1422Database.  The source of these configuration entries can be overridden
     1423when the script is executed, and individual configuration values may
     1424also be specified on the command line.  Examples of the recipe and
     1425other runtime configuration options are given in
     1426Appendix~\ref{RuntimeConfig}.
    12851427
    12861428%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     
    13901532\item Form OT kernel
    13911533\item Convolve detrend images with the OT kernel
     1534\item Bias/dark/overscan subtraction
    13921535\item Mask bad pixels
    1393 \item Mask diffraction spikes and optical ghosts
    1394 \item Bias/dark/overscan subtraction
    13951536\item Trim overscan
    13961537\item Non-linearity correction
    13971538\item Flat-field
     1539\item Mask diffraction spikes and optical ghosts
    13981540\item Subtract sky
     1541\item Find and photometer objects in the image
    13991542\item Identify CRs by morphology
    14001543\item Determine PSF model
    1401 \item Find and photometer objects in the image
    1402 \item Improved astrometry
     1544\item Improve astrometry
    14031545\item Extract Bright object postage stamps
    14041546\end{itemize}
    1405 
    1406 Several of the steps are explained in detail below.
    1407 
    1408 \subsubsection{Form OT Kernel}
    1409 
    1410 Certain detrend images are convolved by the OT kernel, so that they
    1411 accurately represent the detrend images appropriate for the object
    1412 images, which have been shifted using OT.  The detrend images which
    1413 must be convolved include: the flat-field and the
    1414 high-spatial-frequency fringe images. The appropriate kernel for each
    1415 cell of an OTA must be determined from the guide star history,
    1416 extracted from the IPP Metadata Database\footnote{or image header}.
    1417 If the OT kernel is not available, but the image metadata notes that
    1418 it should be, the convolution is skipped, with a warning.
    1419 
    1420 The first module for Phase 2 forms the OT kernel from the list of
    1421 pixel shifts made during the exposure.  This involves decoding the
    1422 metadata and converting it to a data type that can be used to convolve
    1423 by.  The output is the OT convolution kernel.
    1424 
    1425 \subsubsection{Convolve detrend images}
    1426 
    1427 This module convolves the detrend images with the OT convolution kernel
    1428 so that they can be used to detrend the object image.  The inputs
    1429 are:
    1430 \begin{itemize}
    1431 \item The OT convolution kernel --- from the previous module;
    1432 \item The appropriate dark frame --- from the IPP Pixel Server;
    1433 \item The appropriate flat-field --- from the IPP Pixel Server;
    1434 \item The appropriate fringe frame(s) --- from the IPP Pixel Server; and
    1435 \item The appropriate static bad pixel mask --- from the IPP Pixel Server.
    1436 \end{itemize}
    1437 
    1438 The module convolves each of the dark frame, flat-field, and the fringe
    1439 frame(s) by the OT convolution kernel.  Specific flags in the static
    1440 bad pixel mask are grown by the outline of the OT convolution kernel
    1441 (see Section \ref{ap:masks}).  The output results are:
    1442 \begin{itemize}
    1443 \item The convolved flat-field;
    1444 \item The convolved fringe frame(s); and
    1445 \item The updated pixel mask.
    1446 \end{itemize}
    1447 Each of these will be used for a later module.  The convolution method
    1448 depends on the size and structure of the OT kernel.  If the kernel is
    1449 small ($< 5x5$ pixels), direct convolution may be employed.  If the
    1450 kernel is large, but may be decomposed using Gaussians, then it may be
    1451 convolved using a decomposition method.
     1547The steps are explained in detail below.
     1548
     1549\subsubsection{Load Images}
     1550
     1551The Phase 2 analysis must load the science image to be analysed into
     1552memory, as well as the corresponding metadata (either from the image
     1553header and/or from the IPP Metadata Database).  It must use the
     1554metadata for the image, along with information from the processing
     1555recipe, to determine the appropriate detrend images to be used for
     1556this analysis.  The Metadata Database stores the information necessary
     1557to associate a specific science image with one of the registered
     1558master detrend images for each type.  These images are also loaded by
     1559the Phase 2 analysis (note that the design of Phase 2 may perform the
     1560actual loading of pixels in blocks or groups to minimize the memory
     1561impact).
     1562
     1563\subsubsection{Form OT Kernel \& Convolve with Detrend Images}
     1564
     1565Science images which have been obtained with Orthogonal-Transfer
     1566Guiding have had thier pixel response smoothed by the image correction
     1567motion.  For these images, some of the detrend images need to be
     1568convolved by the same OT kernel, so that they accurately represent the
     1569effective pixel response.  The detrend images which must be convolved
     1570include: the flat-field image, the high-spatial-frequency fringe
     1571images, and dark images, if they are used. The appropriate kernel for
     1572each cell of an OTA must be determined from the guide star history,
     1573extracted from the IPP Metadata Database or from the image header.  If
     1574the OT kernel is not available, but the image metadata notes that it
     1575should be, the convolution is skipped, with a warning.
     1576
     1577The convolution method depends on the size and structure of the OT
     1578kernel.  If the kernel is small ($< 5x5$ pixels), direct convolution
     1579may be employed.  If the kernel is large, but may be decomposed using
     1580Gaussians, then it may be convolved using a decomposition method.
     1581
     1582The module convolves each of the dark frame, flat-field, and the
     1583fringe frame(s) by the OT convolution kernel.  Specific flags in the
     1584static bad pixel mask are also grown by the outline of the OT
     1585convolution kernel (see Section \ref{ap:masks}).
    14521586
    14531587\subsubsection{Bias Correction / Overscan Subtraction}
    14541588
    1455 This module corrects the object exposures for the electronic pedestal
    1456 introduced by the readout electronics.  The inputs are:
    1457 \begin{itemize}
    1458 \item The object image --- from the IPP Pixel Server;
    1459 \item The pixel mask --- from the previous module;
    1460 \item The overscan and physical detector regions --- from the
    1461 Metadata; and
    1462 \item Detector characteristics (gain, read noise) --- from the
    1463 Metadata.
    1464 \end{itemize}
    1465 
    1466 The overscan is averaged (either in bulk, or individually by rows) or
    1467 fit with a polynomial, and the result is subtracted from the image.
    1468 Overscan rows having a standard deviation which exceeds a threshold of
    1469 twice (configurable) the detector read noise should be masked.  Pixels
    1470 saturated in the A/D converter should also be masked, and these
    1471 regions grown by an additional pixel to counter CCD ``blooming''.  The
    1472 output is:
    1473 \begin{itemize}
    1474 \item The overscan-subtracted object image; and
    1475 \item The updated pixel mask.
    1476 \end{itemize}
    1477 These will be used for a subsequent module.
    1478 
    1479 \subsubsection{Trim}
    1480 
    1481 This module trims the object image and each of the calibration frames to
    1482 remove the outer edge which was affected by the OT during the
    1483 exposure.  The inputs, each from previous modules, are:
    1484 \begin{itemize}
    1485 \item The overscan-subtracted object image;
    1486 \item The corresponding pixel mask;
    1487 \item The convolved flat-field;
    1488 \item The convolved fringe frame(s); and
    1489 \item The dimension of the OT convolution kernel in each direction.
    1490 \end{itemize}
    1491 
    1492 Each of the input frames (object image, flat-field, fringe frame(s)
    1493 and pixel mask) are trimmed by the extent of the OT convolution kernel
    1494 in each direction ($+x$, $-x$, $+y$, $-y$).  The outputs are trimmed
    1495 images for each of the input images, which will be used in later
    1496 modules.
    1497 
    1498 \subsubsection{Non-Linearity Correction}
    1499 
    1500 This module corrects images for non-linearity in the detector.  The
    1501 inputs are:
    1502 \begin{itemize}
    1503 \item The trimmed object image --- from a previous module; and
    1504 \item The detector non-linearity correction coefficient(s) --- from
    1505 the Metadata.
    1506 \end{itemize}
    1507 
    1508 The module corrects the flux in each pixel for non-linearity by applying
    1509 a polynomial correction, with the specified coefficients.  The output
    1510 is the corrected object image, which is used for a later module.
    1511 
    1512 \subsubsection{Flat field}
    1513 
    1514 This module corrects the object image for variations in sensitivity over
    1515 the image.  The inputs are:
    1516 \begin{itemize}
    1517 \item The object image corrected for non-linearity;
    1518 \item The corresponding pixel mask; and
    1519 \item The convolved, trimmed flat-field.
    1520 \end{itemize}
    1521 Each of these comes from a previous module.
    1522 
    1523 The module divides the object image by the flat-field, masking pixels
    1524 that are non-positive in the flat-field.  The outputs are:
    1525 \begin{itemize}
    1526 \item The flattened object image; and
    1527 \item The updated pixel mask.
    1528 \end{itemize}
    1529 Both of these will be used in later modules.
    1530 
    1531 \subsubsection{Subtract sky}
    1532 
    1533 This module subtracts the sky background from the object image.  The
    1534 inputs are:
    1535 \begin{itemize}
    1536 \item The object image --- from the previous module;
    1537 \item The list of objects on the image --- from the object database; and
    1538 \item The convolved, trimmed fringe frame(s) --- from a previous module.
    1539 \end{itemize}
    1540 
    1541 The module masks (though {\em not} in the ``official'' pixel mask) all
    1542 objects on the image using the astrometric solution from the
    1543 boresight, and fits for the sky background, consisting of a polynomial
    1544 to model the continuum, and the fringe frame(s) to model the fringes
    1545 from sky emission lines.  If the concentration of objects in the image
    1546 is too high to reliably fit the sky background, the background
    1547 solution from an exposure close in time and airmass to the current
    1548 object image is used.  The output is the sky-subtracted object image,
    1549 which is used for the next module.
    1550 
    1551 \subsubsection{Identify CRs by morphology}
    1552 
    1553 This module identifies cosmic rays (or other hot pixels missed in the
    1554 static bad pixel mask) on the basis of their morphology.  The inputs
    1555 are:
    1556 \begin{itemize}
    1557 \item The object image; and
    1558 \item The corresponding pixel mask.
    1559 \end{itemize}
    1560 Both of these come from a previous module.
    1561 
    1562 The module identifies CRs, the pixels of which are masked in the pixel
    1563 mask.  The pixels flagged as CRs are then grown by an additional pixel
    1564 in each direction.  Masked pixels are interpolated over.  The outputs
    1565 are the updated pixel mask, which is sent to the IPP pixel server for
    1566 use in Phase 3, and is also used for the next module; and the object image,
    1567 which is sent to the IPP Pixel Server.
    1568 
    1569 \subsubsection{Detect and Measure objects}
    1570 
    1571 This module finds objects on the object image.  The inputs are:
    1572 \begin{itemize}
    1573 \item The sky-subtracted object image; and
    1574 \item The corresponding pixel mask.
    1575 \end{itemize}
    1576 Both of these come from a previous module.
    1577 
    1578 The module identifies objects on the image, which will be later used to
    1579 register images from different focal planes.  The output is the
    1580 catalog of objects (see Appendix~\ref{ap:catalogs}) identified on
    1581 the image, which is sent to the metadata database, associated with the
    1582 object image.
    1583 
    1584 Object catalogs from Phase 2 shall consist of at least the
    1585 following elements for each object:
    1586 \begin{itemize}
    1587 \item Object centre, with corresponding errors;
    1588 \item Object magnitude, with corresponding error;
    1589 \item Object isophotal magnitude, with corresponding error;
    1590 \item Object FWHM;
    1591 \item Object elliptical axis lengths; and
    1592 \item Object position angle for ellipse.
    1593 \end{itemize}
    1594 
    1595 Though further details may be required for catalogs in Phase 4,
    1596 the above details are minimum requirements for Phase 2 catalogs.
    1597 
    1598 \subsubsection{Bright object postage stamps}
    1599 
    1600 This module saves postage stamps of bright objects, so that extra care
    1601 with regard to astrometry and photometry can be taken with them at a
    1602 later stage.  The inputs, each from a previous module, are:
    1603 \begin{itemize}
    1604 \item The sky-subtracted object image;
    1605 \item The corresponding pixel mask; and
    1606 \item The catalog of objects.
    1607 \end{itemize}
    1608 
    1609 The module makes postage stamps of all objects brighter than a given
    1610 instrumental magnitude, along with corresponding pixel masks.  The
    1611 outputs are these postage stamps and pixel masks, which are sent to
    1612 the IPP Pixel Server.
    1613 
    1614 \subsubsection{Pixel Masks}
    1615 \label{ap:masks}
    1616 
    1617 This section describes the requirements on Bad Pixel Masks (BPMs).
    1618 These will consist of bit masks for each pixel.  For Phase 2, flags
     1589The image bias must be subtracted. Since different detectors behave in
     1590different ways, several options for modelling the bias are available.
     1591The bias is measured from the image overscan region.  The bias
     1592subtraction method must be capable of subtracting a single constant
     1593from the complete image, or to subtract a 1-D bias which varies as a
     1594function along the overscan.  The function used to represent the
     1595overscan region may be a spline or a chebychev polynomial derived from
     1596the data values along the overscan.  The values used to determine both
     1597the single constant or the inputs to the spline and polynomial fits
     1598are derived from groups of pixels on the basis of one of several
     1599statistics, including the sample and robust mean, median, and modes.
     1600In the case of a single constant, all of the overscan pixel values are
     1601used in the calculation of this statistic.  In the case of the 1-D
     1602functional representation, the input values to the fit must represent
     1603the coordinate along the overscan, with the statistic derived from the
     1604pixels in the perpendicular direction at each location.
     1605Sigma-clipping on the input data values must be an option.
     1606
     1607\subparagraph{Flag bad and saturated pixels}
     1608
     1609A static bad pixel mask is used to identify pixels which are known to
     1610be bad in the camera.  This mask is then processed with the science
     1611image. Bad pixels which are charge traps are grown by the extent of
     1612the OT convolution kernel.  Bad pixels above a charge trap (i.e.\ bad
     1613colums) must not be grown, since they were not affected by pixel
     1614shifting, but only became bad at read-out.
     1615
     1616Pixels which are saturated in the A/D converter, or with a signal
     1617level at which the response is excessively non-linear, must also be
     1618masked, and this area must be grown by an additional pixel to mask
     1619excess charge spillover.
     1620
     1621The bad pixel mask is carried with the science images.  Different bits
     1622are set to identify different reasons for masking the pixel.  Flags
    16191623are required for at least each of the following pixel attributes:
     1624
    16201625\begin{itemize}
    16211626\item The pixel is a charge trap;
     
    16281633\end{itemize}
    16291634
    1630 Of these, only masks for the charge traps need to be grown by the
    1631 extent of the OT convolution kernel.  For other pixel types,
    1632 orthogonal transfer of the flux in this pixel will not (necessarily)
    1633 affect the flux in neighbouring pixels
    1634 
    1635 \subsubsection{Phase 2 Metadata}
    1636 
    1637 The following metadata associated with the images are required for
    1638 Phase 2 operation:
    1639 \begin{itemize}
    1640 \item The orthogonal transfer (OT) image shifts made during the
    1641 exposure --- in order to create a convolution kernel;
    1642 \item Time of observation --- for selecting the appropriate detrend
    1643 images;
    1644 \item Filter --- for selecting the appropriate detrend images;
    1645 \item Telescope identification --- for selecting the appropriate
    1646 detrend images;
    1647 \item Exposure time --- for the photometric calibration;
    1648 \item Detector gain --- for calculating photometric errors and
    1649 determining the quality of the overscan;
    1650 \item Detector read noise --- for calculating photometric errors and
    1651 determining the quality of the overscan;
    1652 \end{itemize}
    1653 
    1654 \subsubsection{Notes}
    1655 
    1656 \tbd{how long are processed images kept?}
    1657 
    1658 \tbd{what subsystem deletes processed images?}
     1635\subsubsection{Trim}
     1636
     1637The image is trimmed to remove the non-imaging pixels, such as the
     1638overscan and any pre-scan pixels, along with those pixels near the
     1639edges that have been compromised due to OT operation.  The definition
     1640of the imaging area of the detector is determined from the camera
     1641configuration data or from the metadata associated with the image,
     1642with the choice a user-configurable option.
     1643
     1644The input science and mask frames are trimmed by the extent of the OT
     1645convolution kernel in each direction ($+x$, $-x$, $+y$, $-y$).  Within
     1646the PSLib image handling functions, the trim function is a virtual
     1647operation which simply marks the boundaries of the trimmed image but
     1648does not remove the corresponding memory.  This allows the later
     1649corrections to work with untrimmed correction images and still apply
     1650the correct pixels.  At the end of Phase 2, the only the trimmed
     1651portions of the output images are written out to disk.
     1652
     1653\subsubsection{Non-Linearity Correction}
     1654
     1655If required, the science image (after bias correction) must be
     1656corrected for the effects of non-linearity through a provided
     1657polynomial fit to the pixel data values or a numeric lookup table as a
     1658function of pixel flux.  The choice to apply the correction must be
     1659set by the analysis recipe.
     1660
     1661\subsubsection{Flat field Correction}
     1662
     1663The object image (after bias correction and non-linearity correction)
     1664must be corrected for sensitivity variations as a function of
     1665position, dividing by a flat-field image.  The mask is also modified
     1666for zero-valued pixels in the flat-field image.
     1667
     1668\subsubsection{Sky \& Fringe subtraction}
     1669
     1670After the science image has been flat-fielded, the flux contribution
     1671of the sky (from both continuum emission and the line emission that
     1672causes fringing) must be subtracted from the image.  The subtraction
     1673needs to remove background (technically, foreground) variations which
     1674are not celestial but generated in the atmosphere or by more localized
     1675scattering.  This background should include the contribution from the
     1676zodiacal light.  This background subtraction does not address the
     1677artifacts generated by bright stars: bleeding columns, ghosts, or
     1678other localized reflection effects.  This process also produces a
     1679superbinned image of the background map which may be used as a
     1680debugging diagnostic.
     1681
     1682This analysis step temporarily masks objects on the image using the
     1683astrometric solution from the boresight and fits for the sky
     1684background, consisting of a polynomial to model the continuum, and the
     1685fringe frame(s) to model the fringes from sky emission lines.  If the
     1686concentration of objects in the image is too high to reliably fit the
     1687sky background, the background solution from an exposure close in time
     1688and airmass to the current object image is used.  The output is the
     1689sky-subtracted object image.
     1690
     1691\subsubsection{Detect and Measure objects}
     1692
     1693After the image have been processed by the preceeding steps, the Phase
     16942 analysis performs a basic object detection analysis.  Objects on the
     1695flat-fielded object image are found, and general parameters are
     1696measured.  Object detection is performed at several stages by the IPP,
     1697with different object parameters measured in each case.
     1698Table~\ref{APdetections} gives a list of the different detection
     1699stages and the object parameters measured for those stages.  For the
     1700Phase 2 analysis, the object parameters are: the object centroid and
     1701the position covarience matrix, the instrumental PSF magnitude and
     1702error, local background level and error, a measurement of the
     1703star-galaxy separation, and a measurement of the object shape
     1704($\sigma_x, \sigma_y, \theta$).  The detection threshold must be
     1705configurable, and be a function of the average background flux or the
     1706image noise map.  Minimal object classification must be performed to
     1707distinguish objects which are consistent with a single PSF, objects
     1708which are inconsistent, and objects which are saturated.  The
     1709resulting collection of detected objects are saved in the AP Database
     1710along with the relevant image metadata (\ie filter, exposure time,
     1711etc).  In addition, this process constructs a model of the
     1712point-spread-function (PSF) as a function of position in the image.
     1713This PSF model is saved as part of the image metadata.
     1714
     1715\subsubsection{Identify CRs by morphology}
     1716
     1717Charged particles in the detector frequently cause features which do
     1718not have the morphology of astronomical objects.  In a well-sampled
     1719image, these may be easily identified by the sharpness of the image.
     1720In a near critically-sampled image, these `cosmic rays' may be
     1721indistinguishable from stellar objects.  This analysis step makes
     1722morphological identification of cosmic rays if the imaging data is
     1723sufficiently well sampled.  The identified cosmic rays are masked with
     1724a configurable growth factor so that additional pixels beyond the
     1725detected pixels in the feature are also masked.
     1726
     1727\subsubsection{Perform Astrometry}
     1728
     1729The detected objects are matched with known astrometric reference
     1730objects, using reference object coordinates which have been adjusted
     1731for proper motion.  The matches are then used to improve the
     1732astrometric parameters for the individual OTAs.  The OTA astrometric
     1733parameters which are determined may include terms up to 3rd order in
     1734position, though the terms which are actually fitted are
     1735user-configurable.  The Cell astrometric parameters are not allowed to
     1736vary at this stage.  The fit must be robust, rejecting outlier matches
     1737(either stars with poorly determined proper motion or spurious
     1738matches).  The resulting astrometric solution is consistent across the
     1739OTA field to within \tbr{0.2 arcsec}.
     1740
     1741\subsubsection{Perform Photometry}
     1742
     1743If possible (if a local photometry reference exists), the Phase 2
     1744analysis determines a photometry zero point for each image.  To do
     1745this, it extracts the appropriate reference objects (from the AP
     1746Database) and matches the stars between the two samples.  The
     1747zero-point is derived on the basis of a static atmospheric absorption
     1748model (eg, linear airmass slope).
     1749
     1750\subsubsection{Bright object postage stamps}
     1751
     1752The IPP must have the capability of extracting regions surrounding a
     1753specified subset of objects from the flattened images.  These postage
     1754stamp images must be saved for additional use by client science
     1755pipelines.  The identification of these objects must be on the basis
     1756of a set of rules applied to the object's magnitude and position.  The
     1757postage stamps are not restricted in shape to simple rectangles, but
     1758may represent more complex regions.  They are written to the Image
     1759Server.  The outputs are these postage stamps and pixel masks, which
     1760are sent to the IPP Pixel Server.
    16591761
    16601762\begin{figure}
     
    16831785\item photometric solution based on comparison to photometric
    16841786  standards
     1787\item FPA-wide PSF analysis
    16851788\end{itemize}
    16861789
     
    16891792assumption of a static distortion and by the accuracy of the
    16901793astrometric reference.  In the phase 3 analysis, the astrometric
    1691 solutions of the $N$ FPA images are improved by...
    1692 
    1693 For image combination in phase 4, should we use relative astrometry to
    1694 map N-1 images to 1, or are we sufficiently accurate to use absolute
    1695 astrometry to map N images to the sky-cells?
     1794solutions of the complete FPA images are improved by combining the
     1795astrometry for all chips.  The astrometry model consists of a
     1796projection of the celestial coordinates to the telescope boresite
     1797center, followed by a rotation to the average rotation of the FPA and
     1798adjustment for the central plate scale.  The free parameters in this
     1799stage are the boresite coordiates ($R_o, D_o$), the field rotation
     1800($\theta_o$) and the plate scale ($\rho_o$), and are fitted in Phase
     18011.  These tangent plane coordinates are then distorted by the optical
     1802distortion model, consisting of $N^{\rm th}$ order polynomials in two
     1803dimensions.  Finally, the focal plane coordinates are mapped to the
     1804individual chip coordinates, including the chip position and rotation,
     1805as well as possible higher order terms representing warping of the
     1806individual detectors.  A first pass at the chip positions is
     1807calculated in Phase 2, while the complete set of parameters is fitted
     1808as a whole during Phase 3.  The fitting process is determined in a
     1809robust and stable way by fitting the gradient of the distortion as a
     1810function of field position, removing the degeneracy of the distortion
     1811coefficients on the chip position parameters.
    16961812
    16971813In the Phase 2 analysis, the background is determined based only on
     
    16991815structures are normally correlated on the scale of the FPA, so an
    17001816improved background solution can be determined by combining the
    1701 information from many chips.  \tbd{is the background correlated
    1702 between FPAs?}
    1703 
    1704 Phase 3 photometric improvement
     1817information from many chips.  A high-order polynomial model of the
     1818background may be used and subtracted from all chips. 
     1819
     1820The Phase 3 photometric improvement is made by comparing the
     1821photometered objects from Phase 2 with the corresponding objects in a
     1822local reference catalog.  This analysis may only be performed if a
     1823local reference is available.  Note that improved relative photometry
     1824calculations may be performed in the absense of a reference catalog on
     1825the basis of image overlaps in the AP Database {\em after} the
     1826detections have been added to the Database.  Such a relative
     1827photometry analysis is outside the scope of Phase 3 and will likely be
     1828performed as an independent analysis process.  Given the presence of a
     1829local photometry reference, the zero point variations across the field
     1830may be measured, and possibly modelled.  If the zero-point variations
     1831are excessive, then the image is marked as non-photometric by the
     1832analysis.
    17051833
    17061834In the Phase 4 analysis, the $N$ FPA images are optimally combined to
     
    17241852\subsubsection{Overview}
    17251853
    1726 Phase 4 processing within the Pan-STARRS image processing pipeline is
    1727 the image combination stage of processing for a science image.  It
    1728 operates on each sky cell that has overlapping imaging data from the
    1729 exposure(s) being processed, and produces a set of clean, combined
    1730 images of the sky.  It also subtracts the current static sky image to
    1731 generate a difference image, which it uses to identify transient
    1732 objects.  These are then excised from the summed image, which is in
    1733 turn then added to the static sky image.
    1734 
    1735 Prior to Phase 4, the Phase 3 process produces the following products:
    1736 \begin{itemize}
    1737 \item bias-subtracted, flattened, sky-subtracted images;
    1738 \item photometric calibration;
    1739 \item astrometric calibration with mapping to sky cells; and
    1740 \end{itemize}
    1741 
    1742 These will each be used by the Phase 4 modules:
    1743 \begin{itemize}
    1744 \item Combine Images;
    1745 \item Identify Sources;
    1746 \item Transient Identification; and
    1747 \item Add to Static Sky.
    1748 \end{itemize}
    1749 These modules are each explained below.
    1750 
    1751 \subsubsection{Combine Images}
    1752 
    1753 \tbd{for moving objects and images which are not simultaneous, do we
    1754   identify the moving objects?}
    1755 
    1756 \tbd{use the spatial information?  fit a 2-D Nth order polynomial to
    1757   the collection of pixels and then look for outliers}
    1758 
    1759 The first module for Phase 4 is to combine the images from each
    1760 telescope, rejecting artifacts such as cosmic rays and low altitude
    1761 streaks.  The inputs to this module are:
    1762 \begin{itemize}
    1763 \item the sky-subtracted images that overlap the sky cell (or portions
    1764 thereof) --- from the IPP Pixel Server (or directly from Phase 3);
    1765 \item a \tbd{linear} map for the image pixels of each detector to the
    1766 sky cell pixels --- from Phase 3;
    1767 \item photometric calibration (zeropoint) for each image --- from
    1768 Phase 3; and
    1769 \item a (relative) weighting for each image proportional to the
    1770 signal-to-noise (i.e.\ sky noise divided by the square of the seeing)
    1771 --- from metadata associated with the images.
    1772 \end{itemize}
    1773 
    1774 The module maps the detector images to the sky cell using the specified
    1775 linear transformations, combines the images with strong rejection
    1776 criteria and uses the combined sky cell image to identify artifacts in
    1777 the original detector images.  It is desirable that the artifacts are
    1778 masked in the detector plane (i.e.\ before mapping to the sky cell) so
    1779 that they are not smeared out by the mapping; alternatively, the CR
    1780 mask needs to be grown by an additional pixel (which is likely
    1781 faster).  The mapped and masked detector images are then optimally
    1782 combined using the specified weighting.  Both sets of combinations use
    1783 the photometric calibration for the images to set the relative scales
    1784 of the input images.  The final combination should have the adopted
    1785 Universal zeropoint (25 mag, configurable).  The limiting magnitude
    1786 for the combined sky cell image should also be estimated.
    1787 
    1788 The outputs from this module are:
    1789 \begin{itemize}
    1790 \item The combined sky cell image --- sent to the IPP Pixel Server
    1791 and/or the next module;
    1792 \item Limiting magnitude of the combined sky cell image --- metadata
    1793 associated with the combined sky cell image, and used for a later module
    1794 in Phase 4; and
    1795 \item Catalog of sources on the combined sky cell image --- sent to
    1796 the IPP Object Database.
    1797 \end{itemize}
    1798 
    1799 \subsubsection{Identify Sources}
    1800 
    1801 This module identifies sources in the combined sky cell image.  The
    1802 input is the combined sky cell image, which is obtained from the IPP Pixel Server
    1803 or the previous module.
    1804 
    1805 Sources are identified on the combined sky cell image by convolving
    1806 with the PSF and searching for peaks above the noise.  The output
    1807 is the catalog of sources on the combined sky cell image, which is to
    1808 the IPP Object Database.
    1809 
    1810 \subsubsection{Transient Identification}
    1811 
    1812 \tbd{what about different stellar colors?}
    1813 
    1814 This module identifies variable/moving sources.  The inputs are:
    1815 \begin{itemize}
    1816 \item The combined sky cell image --- from the previous module or the
    1817 IPP Pixel Server; and
    1818 \item The current static sky image --- from the Sky Image Server.
    1819 \end{itemize}
    1820 
    1821 The module subtracts the current static sky image from the combined sky
    1822 cell image.  In order to do so, the PSFs need to be matched.  This is
    1823 done by convolving the image that has the narrower PSF with the
    1824 kernel, which is the ratio of the two PSFs (this should be done with a
    1825 fit to the kernel instead of just using the data).  It should be
    1826 sufficient to assume that the kernel is constant over the sky cell
    1827 (otherwise, the sky cell can be broken into smaller sections).
    1828 
    1829 The subtracted image is scoured for point sources above the noise
    1830 threshold, as well as short and long streaks caused by asteroids and
    1831 satellites, respectively.  It may be neccessary to determine whether
    1832 the detection is false by virtue of its PSF (a cosmic ray missed by
    1833 the combination script should have a very narrow PSF, at least in one
    1834 dimension), or negative pixels surrounding a positive core (caused by
    1835 a bad subtraction, in turn caused by a bad kernel).
    1836 
    1837 If the subtraction is very bad (many false detections), then Phase 4
    1838 for this sky cell should fail neatly, with a flag for the human
    1839 supervisor.  Otherwise, all variable sources identified in the
    1840 subtracted image should be masked in the combined sky cell image.  The
    1841 pixels from the combined sky cell image for point sources and short
    1842 trails (asteroids) should be saved (say, 3 $\times$ FWHM in radius
    1843 surrounding the source, configurable).  The long trails (satellites)
    1844 should be removed in the combined sky cell image and the subtracted
    1845 image, from edge to edge.  The dividing limit between short and long
    1846 trails shall be a configurable parameter, initially set to 15 degrees
    1847 per day.
    1848 
    1849 The module outputs:
    1850 \begin{itemize}
    1851 \item Combined sky cell image, with all variable sources masked ---
    1852 used for the next module;
    1853 \item Subtracted image, with long trails masked --- sent to the IPP
    1854 Pixel Server; and
    1855 \item Catalog of variable sources --- sent to the IPP Object
    1856 Database.
    1857 \end{itemize}
    1858 
    1859 \subsubsection{Add to Static Sky}
    1860 
    1861 \tbd{how to handle variable stars?}
    1862 
    1863 This module adds the combined sky cell image into the static sky, so
    1864 that a deep image of the sky may be formed.  This step should only be
    1865 performed if the new data is of sufficient quality that it will not
    1866 degrade the static sky image.  The inputs are:
    1867 \begin{itemize}
    1868 \item The combined sky cell image with variable sources masked ---
    1869 from a previous module;
    1870 \item The current version of the static sky --- from a previous module,
    1871 or the IPP Pixel Server; and
    1872 \item Relative weightings, based on the relative signal-to-noise in
    1873 each of the images --- estimate made from metadata associated with
    1874 each image.
    1875 \end{itemize}
    1876 
    1877 The sky cell image is added to the static sky.  The sky cell image
    1878 should already be photometrically accurate (when combined), and
    1879 variable sources have been masked, so it is safe to simply add the
    1880 images, employing the weightings.  Sources should be identified on the
    1881 new static sky, and the limiting magnitude of the new static sky image
    1882 estimated.
    1883 
    1884 The output is:
    1885 \begin{itemize}
    1886 \item The new static sky image --- sent to the Sky Image Server;
    1887 \item The Catalog of sources on the new static sky image --- sent to the IPP Object Database; and
    1888 \item The estimated limiting magnitude for the new static sky ---
    1889 metadata associated with the the new static sky image.
    1890 \end{itemize}
    1891 
    1892 \subsubsection{Notes}
    1893 
    1894 \begin{itemize}
    1895 \item Catalogs should include positional information ($x,y$, with
    1896 associated errors), photometry (with associated error), and shape
    1897 parameters (FWHM, major and minor axes, position angle).
    1898 \item Limiting magnitudes can be obtained by photometering many
    1899 regions of blank sky (if possible), and (robustly) estimating the mean
    1900 and standard deviation (in counts).  The limiting magnitude is the
    1901 magnitude corresponding to 3 (configurable) standard deviations above
    1902 the mean.
    1903 \end{itemize}
     1854Phase 4 is the image combination stage, in which multiple images of
     1855the same portion of the sky are merged and confronted with the static
     1856sky image.  Phase 4 operates on the smallest data unit of the static
     1857sky, the sky cell, along with the associated pixels from a collection
     1858of images which have been processed through phases 1--3.  The size and
     1859exact representation of a static sky cell are yet to be determined.
     1860The working concept is that the static sky cells contain roughly the
     1861same number of pixels as an OTA (4k x 4k) and represent a portion of a
     1862local tangent plane projection.  As mentioned above
     1863(Section~\ref{IPP:ImageServer}), the pixel scale of the static sky is
     1864planned to be 0.2\arcsec, somewhat smaller than the 0.3\arcsec\ raw
     1865image pixel scale.
     1866
     1867For each sky cell, the corresponding pixels are extracted from the
     1868exposures being processed and mapped to the projection of the sky
     1869cell. The pixels from the multiple input processed images are combined
     1870into a single, cleaned image.  Outlier pixels may be optionally
     1871rejected at this stage (optionally, since moving objects will be
     1872rejected in images obtained over a wide range of times).  This image
     1873is then confronted with the static sky cell data to produce a
     1874difference image.  Residual objects in the difference image above a
     1875threshold are detected and excised from the original cleaned image.
     1876The remaining pixels are added to the existing static sky image.
     1877Object detection must be performed on the difference ($P4\Delta$) and
     1878cleaned ($P4\Sigma$) images.
     1879
     1880\subsubsection{Image Warping and Matching}
     1881
     1882The analysis first maps the detector images to the sky cell using the
     1883specified linear transformations, then combines the images with strong
     1884rejection criteria and uses the combined sky cell image to identify
     1885artifacts in the original detector images.  It is desirable that the
     1886artifacts are masked in the detector plane (i.e.\ before mapping to
     1887the sky cell) so that they are not smeared out by the mapping;
     1888alternatively, the CR mask needs to be grown by an additional pixel.
     1889The mapped and masked detector images are then optimally combined
     1890using the specified weighting.  Both sets of combinations use the
     1891photometric calibration for the images to set the relative scales of
     1892the input images.  The limiting magnitude for the combined sky cell
     1893image should also be estimated.
     1894%
     1895
     1896\subsubsection{Static Sky Subtraction}
     1897
     1898\tbd{add some details about the static-sky subtraction issues.
     1899  Allard-Lupton-Price method}.
     1900
     1901\subsubsection{Object Detection and Measurement}
     1902
     1903Objects in the difference image are detected and a specific set of
     1904object parameters are measured from these detections.
     1905Table~\ref{APdetections} gives a list of the different detection
     1906stages and the object parameters measured for those stages.  For the
     1907Phase 4 difference image (P4$\Delta$), the measured object parameters
     1908consist of: the object centroid and the position covarience matrix,
     1909the instrumental PSF magnitude and error, local background level and
     1910error, a measurement of the star-galaxy separation, and a measurement
     1911of the object shape ($\sigma_x, \sigma_y, \theta$).  The detection
     1912threshold must be configurable, and be a function of the average
     1913background flux or the image noise map.  Detections must be performed
     1914for both positive and negative (static sky only) sources.  Minimal
     1915object classification must be performed to distinguish objects which
     1916are consistent with a single PSF, objects which are inconsistent, and
     1917objects which are saturated.  The resulting collection of detected
     1918objects are saved along with the relevant image metadata (\ie filter,
     1919exposure time, etc).
     1920
     1921Objects in the cleaned, summed image are detected and a specific set
     1922of object parameters are measured from these detections.
     1923Table~\ref{APdetections} gives a list of the different detection
     1924stages and the object parameters measured for those stages.  For the
     1925Phase 4 summed image (P4$\Sigma$), the measured object parameters
     1926consist of: the object centroid and the position covarience matrix,
     1927the instrumental PSF magnitude and error, local background level and
     1928error, a measurement of the star-galaxy separation, a measurement of
     1929the object shape ($\sigma_x, \sigma_y, \theta$), the Petrosian radius,
     1930magnitude, axis ratio, and angle; and the S\'ersic radius, magnitude, axis
     1931ratio, angle, and parameter $\nu$.  The detection threshold must be
     1932configurable, and be a function of the average background flux or the
     1933image noise map.  Minimal object classification must be performed to
     1934distinguish objects which are consistent with a single PSF, objects
     1935which are inconsistent, and objects which are saturated.  The
     1936resulting collection of detected objects are saved along with the
     1937relevant image metadata (\ie filter, exposure time, etc).  In this
     1938measurement, objects at known positions will also be measured even if
     1939they have not been detected.
     1940
     1941Objects which are detected in both of the Phase 4$\Sigma$ and Phase
     19424$\Delta$ images are saved to the AP Database, along with the relevant
     1943image metadata (\ie filter, exposure time, etc).  In the process of
     1944adding these objects to the database, the transients which are
     1945correlated with previous detections of an object (and those which are
     1946not) will automatically be determined.  An independent process will
     1947query the AP Database for such transient objects of interest which are
     1948to be sent, along with their associated metadata, to the MOPS and
     1949other science client pipelines.  This step must be performed at least
     1950once per night.
     1951
     1952\subsubsection{Static Sky Update}
     1953
     1954It is essential that the static sky image (which may have been
     1955painstakingly accumulated over many months) not be corrupted by adding
     1956in transient sources, or data that is of suspect quality (due, e.g.,
     1957to an error upstream in the processing).
     1958
     1959Object analysis of the static sky images is {\em not} a part of the
     1960Phase 4 analysis.  This processing is envisioned to take place
     1961relatively infrequently (perhaps weekly or even monthly) and is
     1962scheduled as a separate analysis task, probably run during the day at
     1963a time when the computing infrastructure is not under significant load.
    19041964
    19051965\begin{figure}
     
    20932153%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    20942154
    2095 \section{System Design : Reference Catalog Processing}
    2096 
    2097 The IPP reference catalog pipelines use the data in the IPP Metadata
    2098 Database and the IPP Object Database to determined improved
    2099 astrometric and photometric calibration references.
     2155\section{System Design : Miscellaneous Tasks}
     2156
     2157In this section, we discuss the design of the science analysis stages
     2158which perform the fundamental image analysis steps of the IPP.
     2159
     2160\subsection{Retrieval}
     2161
     2162The retrieval stages simply retrieve pixel data from an external
     2163source (ordinarily OATS at the Summit, but it could conceivably be
     2164some other external source) and store it on the nodes.
     2165
     2166\subsection{Static Sky Analysis}
     2167
     2168The IPP is responsible for performing object detection and analysis on
     2169the static sky.  This analysis is performed continuously (every day or
     2170week) on those portions of the sky within 15\degree\ of the sun.  In
     2171this analysis, the object measurement is much more detailed than those
     2172performed in the real-time analysis.  The currently envisioned
     2173parameters to be measured for every object are listed in
     2174Table~\ref{APdetections}.  The parameters include the object centroid
     2175and the position covarience matrix, the instrumental PSF magnitude and
     2176error, local background level and error, a measurement of the
     2177star-galaxy separation, a measurement of the object shape ($\sigma_x,
     2178\sigma_y, \theta$), the Petrosian radius, magnitude, axis ratio, and
     2179angle; the S\'ersic radius, magnitude, axis ratio, angle, and
     2180parameter $\nu$, and a collection of annular aperture flux
     2181measurements, all of which are also measured for the P4$\Sigma$
     2182images.  In addition, the galaxy-shape parameters $Gamma_1 \&
     2183\Gamma_2$, along with the complete `polarization' terms are measured,
     2184as well as a collection of annular aperture flux and variance
     2185measurements.  Another unique feature of the static sky analysis is
     2186that the object detection may be performed simultaneously on all
     2187filters, in which case the locations and other parameters may be more
     2188strongly constrained by simultaneously fitting between all bands.  The
     2189analysis to be performed may be substantially more complex than the
     2190real-time analysis because of the relatively low data rate.  Instead
     2191of needing to process thousands of images per night ($\sim 350$Mpix
     2192per second), it is only necessary to process the complete sky in a
     2193year, or an average rate of $\sim$2 Mpix per second, or $< 1$\% of the
     2194object analysis in the other analysis stages.
    21002195
    21012196\subsection{AstroRef: Astrometric Reference Catalog creation}
     2197
     2198\tbd{needs to be fleshed out substantially}
    21022199
    21032200This processing stage shall use many observations over a given time
     
    21082205\subsection{PhotoRef: Photometric Reference Catalog creation}
    21092206
     2207\tbd{needs to be fleshed out substantially}
     2208
    21102209This processing stage shall use many observations over a given time
    21112210period to fit a consistent global photometric solution, resulting in a
     
    21152214%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    21162215
    2117 \section{System Design : Miscellaneous Tasks}
    2118 
    2119 In this section, we discuss the design of the science analysis stages
    2120 which perform the fundamental image analysis steps of the IPP.
    2121 
    2122 \subsection{Retrieval}
    2123 
    2124 The retrieval stages simply retrieve pixel data from an external
    2125 source (ordinarily OATS at the Summit, but it could conceivably be
    2126 some other external source) and store it on the nodes.
    2127 
    2128 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    2129 
    21302216\section{Software Hierarchy}
    21312217
     
    21332219flexibility, the IPP will be built in a layered fashion.  The lowest
    21342220level functions will be written in C and collected together into a
    2135 Pan-STARRS library.  These library functions will be used to write more
    2136 complex modules.  The modules will be written in C but will make use
    2137 of the SWIG tool to make their functionality available within other
    2138 frameworks.  In particular, the modules can be tied together with a
    2139 simple framework (an `engine') or with detailed flow-control through
    2140 the use of a high-level language such as Perl, Python, or Tcl
    2141 employing the SWIG interfaces.  For the high-level functions in the
    2142 operational system, the IPP will make use of \tbd{Python} as the
    2143 scripting language to provide the required flow-control to tie the
    2144 modules together.
     2221Pan-STARRS library.  These library functions will be used to write
     2222more complex modules.  The modules will be written in C but will make
     2223use of SWIG to make their functionality available within other
     2224languages.  In particular, the modules can be tied together with a
     2225program in C or through the use of a high-level language such as Perl,
     2226Python, or Tcl employing the SWIG interfaces.  For the high-level
     2227functions in the operational system, the IPP will make use of
     2228\tbd{Python} as the scripting language to provide the required
     2229flow-control to tie the modules together.
    21452230
    21462231This approach satisfies the requirement that complicated low-level
     
    21942279\subsection{Internal Interfaces}
    21952280
    2196 \tbd{To be updated and expanded.}
    2197 
    2198 Internal interfaces consist of queries to the IMD or IPS, insertion of
    2199 data in the IMD, IPS, or IOD, or processing configuration files.  The
    2200 science and calibration image processing pipelines make requests for
    2201 images from the IPS, metadata from the IMD, and push their results
    2202 back onto the IPS and IMD.  The reference catalog pipelines make
    2203 requests on the IMD and the IOD and push their results back to the
    2204 IOD.  The scheduler creates input processing configuration files for
    2205 the processing pipelines and queries the IMD and IPS and pushes
    2206 results back to the IIS.
    2207 
    2208 FITS Images
    2209 
    2210 FITS Tables
    2211 
    2212 XML
    2213 
    2214 SQL queries
    2215 
    2216 C:DB interactions
     2281Internal interfaces consist of interactions between the analysis
     2282scripts and the IPP Metadata Database, Image Server or AP Database.
     2283There are also interfaces between the IPP Scheduler, Controller, and
     2284the Metadata Database. 
     2285
     2286The science and calibration image processing pipelines make requests
     2287for images from the Image Server, metadata from the Metadata Database,
     2288and push their results back onto the Image Server and Metadata
     2289Database.  The Scheduler specifies analysis tasks and sends them to
     2290the Controller, and determines the next action based on the contents
     2291of the Metadata Database.  The various subsystems specify the API for
     2292client / server interactions with them.  Commands will be sent using
     2293either text-based commands, SOAP or an equivalent protocol.  The
     2294format of the exchanged data may be in one of several forms discussed
     2295below.
     2296
     2297FITS Images will be used to transport images between the components of
     2298the IPP.  Non-standard FITS images representing triangular collections
     2299of pixels may be used to store the static sky images.
     2300
     2301FITS Tables will be used to store and transport tabular data,
     2302especially large queries from database subsystems.  The Autocoding
     2303technique discussed in Appendix~\ref{Autocode} is used to define many
     2304different table interactions.
     2305
     2306XML files will be used to store and transport data which is not
     2307well-suited to the rectangular form of FITS Tables.  Hierarchical data
     2308concepts and variable-length structures fall in this class.  Examples
     2309include mosaic astrometry description information and configuration
     2310information.
     2311
     2312SQL queries and C wrappers of SQL queries will be used as the direct
     2313interface to the databases.
    22172314
    22182315\subsection{External Interfaces}
    2219 
    2220 \tbd{This whole section to be updated.}
    22212316
    22222317This subsection describes the interfaces between the IPP and other
    22232318Pan-STARRS systems and the external clients.  The interfaces are
    2224 illustrated in Figure~\ref{fig:functionalities}.  Incoming data is
    2225 received by either the IPS (pixels), the IMD (metadata), or the IOD
    2226 (objects).  Requests for data by external clients are also made to
    2227 these three databases.  Requests for data made by the IPP are
    2228 generated by the IPP Scheduler or the science processing pipelines.
     2319illustrated in Figure~\ref{overview}. 
     2320
     2321Incoming data is received by
     2322either the IPS (pixels), the IMD (metadata), or the IOD (objects).
     2323Requests for data by external clients are also made to these three
     2324databases.  Requests for data made by the IPP are generated by the IPP
     2325Scheduler or the science processing pipelines.
     2326
     2327\subsubsection{OTIS}
     2328
     2329The IPP Scheduler may query OTIS for a list of new images and
     2330metadata.  The locations of those images in the Summit Pixel Server is
     2331sent back as a table, and all metadata may be sent to the IPP as a
     2332collection of FITS Tables.  The IPP also may send quality assessment
     2333information for each FPA and major frame by writing out FITS tables
     2334and notifying OTIS of the presence of the new tables. 
    22292335
    22302336\subsubsection{Camera}
    22312337
    2232 \subsubsection{OTIS}
    2233 
    2234 The Summit Pixel Server (SPS) sends raw image data, image metadata,
    2235 and enviromental metadata to the IPP.  The IPP provides an interface
    2236 mechanism by which the SPS can register new images with the IPP, which
    2237 sends them to the appropiate subsystem: The image pixel data is sent
    2238 to the IPS while the metadata is sent to the IMD.
    2239 
    2240 The Pan-STARRS Telescope Scheduler (PTS) sends information about the
    2241 telescope schedule to the IPP: observing plan for the night, or longer
    2242 time scales.  The IPP scheduler sends telescope schedule requests to
    2243 the PTS (i.e.\ calibration needs).
     2338Images are pulled from the Summit Pixel Server, part of the Camera
     2339team's purview.  The locations of the files are sent by OTIS.  IPP may
     2340grab these via {\tt http} commands or via {\tt NFS} or another network
     2341file exchange protocol.  The IPP notifies OTIS (and Camera) when each
     2342image has been received.
    22442343
    22452344\subsubsection{PSPS}
    22462345
    2247 The Static Image Server provides segments of the current static sky
    2248 image to the IPP on demand.  IPP subsystems which require this data
    2249 will block until it is available or timeout if it is not.  The IPP
    2250 provides updated static sky images to the SIS when available.
     2346The details of the transfer mechanism have \tbd{not been worked out}.
     2347The data to be transfered include:
     2348\begin{itemize}
     2349\item Static Sky images
     2350\item Postage Stamps
     2351\item Metadata tables
     2352\item Detections \& Object associations.
     2353\end{itemize}
    22512354
    22522355\subsubsection{MOPS}
    22532356
    2254 The Moving Object Processing System interfaces with the IPP to receive
    2255 the objects detected in the difference images via queries to the IOD.
    2256 The MOPS may interface with the IMD as needed.
     2357The details of the transfer mechanism have \tbd{not been worked out}.
     2358The data to be transfered include:
     2359\begin{itemize}
     2360\item Image Metadata tables
     2361\item Orphaned Detections
     2362\end{itemize}
    22572363
    22582364\subsubsection{Other Preferred Client Science Pipelines}
    22592365
    2260 The client science pipelines may interface with the IPP via requests
    2261 for data from the IMD, IOD, or IPS.  \tbd{how many clients max? / how
    2262 much data?}
     2366The details of the transfer mechanism have \tbd{not been worked out}.
    22632367
    22642368%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     
    27032807
    27042808\subsection{Software Runtime Configuration Issues}
     2809\label{RuntimeConfig}
    27052810
    27062811The IPP Software requires extensive runtime configuration information.
     
    28792984
    28802985\end{document}
    2881 
    2882 
    2883 
    2884 \section{Notes}
    2885 
    2886 \subsection{Cell vs Chip vs FPA vs Major Frame}
    2887 
    2888 There are several levels of input data pixel groups: Cell, Chip, Focal
    2889 Plane Array (FPA), and Major Frame.  It is necessary to make the
    2890 association between the data of one level and that of the next in a
    2891 way that is reliable and robust to missing elements.  If a specific
    2892 cell is missing from a chip, that information is known by the
    2893 controller an needs to be represented in the metadata.  Similarly if a
    2894 chip is missing from a mosaic camera, that information is also known
    2895 and must be carried though the metadata.  A more difficult association
    2896 is that between the telescopes to define the major frame.  Some
    2897 possibilities:
    2898 
    2899 \begin{itemize}
    2900 \item exposures in a major frame are always synchronized; the
    2901 telescopes are required to take exposures in a coordinated fashion and
    2902 these linked exposures are identified as being part of a specific
    2903 major frame by the TCS or PTS.
    2904 \item exposures may be taken in a coordinated fashion, and identified
    2905 by the TCS or PTS as part of a specific major frame, but not all
    2906 exposures are required to be taken in this fashion.  Independent
    2907 images are handled by the IPP differently (Phase 3 and Phase 4 are not
    2908 appropriate, some varient is required).
    2909 \item exposure links are defined more generally on the basis of the
    2910 resulting image metadata.  The telescopes may have images requested
    2911 at the same coordinates and time, and are defined as a major frame on
    2912 the basis of the observed time and coordinates.  The TCS or PTS might
    2913 not be the entity which defines these major-frame associations; this
    2914 may be the role of some component in the IPP.  Different types of
    2915 major frames may be defined depending on the correlation period in
    2916 time or space.  For example, a major frame in which the telescopes are
    2917 pointing at the same position in the sky to within a few pixels and
    2918 with exposures taken within a second can be treated with more special
    2919 assumptions (minimal differential distortion; moving objects
    2920 coincident) than a major frame in which the offsets are larger in
    2921 either dimension.
    2922 \end{itemize}
    2923 
    2924 A decisions between these possibilities will drive some requirements
    2925 either on the IPP side or on the PTS/TCS side.
    2926 
    2927 \subsection{Identifying ghosts, spikes, etc}
    2928 
    2929 One of the functions currenly defined for Phase 1 is the prediction of
    2930 the location of the bright star spikes, ghost images, and regions of
    2931 complex astronomical background.  Elsewhere in the IPP, these
    2932 identifications are used to excise or mark image pixels.  How these
    2933 regions are defined and saved are is not very clear.  I propose that
    2934 we use the mask image to mark as bit-flags all of these cosmetic pixel
    2935 flagging issues.  If we need to save this information, for the short
    2936 period that the input science images are kept, then it is only a small
    2937 addition of data.
    2938 
    2939 \subsection{Pending Sky-cell / Detector table}
    2940 
    2941 Define a pending sky-cell / detector table to define the overlaps and to
    2942 give something which the scheduler can query to decide when to
    2943 initiate phase 4.
    2944 
Note: See TracChangeset for help on using the changeset viewer.