IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 30, 2005, 11:14:48 AM (21 years ago)
Author:
eugene
Message:

serious reorg for release 13

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/doc/pslib/psLibSDRS_Astrom.tex

    r3181 r3564  
    270270\code{TRUE} if they are all correctly assigned, otherwise \code{FALSE}.
    271271
    272 \subsubsection{Coordinate Transformations}
     272\subsubsection{Detector Coordinate Transformations}
    273273
    274274\begin{figure}
     
    322322\end{verbatim}
    323323
    324 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    325 
    326 % add psExposure to metadata?
    327 % add grommit to metadata?
    328 % add photsystem data to metadata?
    329 % add statistics to metadata?
    330 
    331 \subsubsection{Observatory data}
     324%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     325
     326\subsection{Astrometry}
     327
     328Astrometry is a basic functionality required for the IPP that will be
     329used repeatedly, both for low-precision (roughly where is my favorite
     330object?) and high-precision (what is the proper motion of this star?).
     331As such, it must be flexible, yet robust.
     332
     333\subsubsection{Coordinate frames}
     334\label{sec:coordinateFrames}
     335
     336There are five coordinate frames that we need to worry about for the
     337purposes of astrometry:
     338\begin{itemize}
     339\item Cell: $(x,y)$ in pixels --- raw coordinates;
     340\item Chip: $(X,Y)$ in pixels --- the location on the silicon;
     341\item Focal Plane: $(p,q)$ in microns --- the location on the focal plane;
     342\item Tangent Plane: $(l,m)$ in arcsec from the telescope boresight; and
     343\item Sky: (RA,Dec) --- ICRS.
     344\end{itemize}
     345
     346The following steps are required to convert from the cell coordinates to
     347the sky:
     348\begin{itemize}
     349\item Cell $\longleftrightarrow$ Chip: two 2D polynomials, $(X,Y) = f(x,y)$;
     350\item Chip $\longleftrightarrow$ FP: two 2D polynomials, $(p,q) = g(X,Y)$;
     351\item FP $\longleftrightarrow$ TP: two 4D polynomials, $(l,m) =
     352h(p,q,m,c)$, where $m$ and $c$ are the magnitude and color of the
     353object, respectively; and
     354\item TP $\longleftrightarrow$ Sky:  transformation to the sky using
     355pre-computed coefficients for each pointing.
     356\end{itemize}
     357
     358Note that the transformation between the Focal Plane and the Tangent
     359Plane is a four-dimensional polynomial, in order to account for any
     360possible dependencies in the astrometry on the stellar magnitude and
     361color; the former serves as a check for charge transfer
     362inefficiencies, while the latter will correct chromatic refraction,
     363both through the atmosphere and the corrector lenses.
     364
     365We require structures to contain each of the above transformations as
     366well as the pixel data.
     367
     368\subsubsection{Position Finding}
     369
     370We require functions to return the structure containing given
     371coordinates.  For example, we want the chip that corresponds to the
     372focal plane coordinates $(p,q) = (-1.234,+5.678)$.  These routines
     373handle the one-to-many problem --- i.e., for one given focal plane
     374coordinate, there are many chips that this coordinate may be
     375correspond to; these functions will select the correct one.
     376%
     377\begin{verbatim}
     378psCell *psCellInFPA (const psPlane *coord, const psFPA *fpa);
     379psChip *psChipInFPA (const psPlane *coord, const psFPA *fpa);
     380psCell *psCellInChip(const psPlane *coord, const psChip *chip);
     381\end{verbatim}
     382
     383\subsubsection{Conversion Functions}
     384
     385We require functions to convert between the various coordinate frames
     386(Section~\ref{sec:coordinateFrames}).  The hierarchy of the coordinate
     387frames and the transformations between each are shown in
     388Figure~\ref{fig:coco}.  The functions that employ the transformations
     389are shown in Figure~\ref{fig:cocoFunc}.  In addition to
     390transformations between each adjoining coordinate frame in the
     391hierarchy, we also require higher-level functions to convert between
     392the Cell and Sky coordinate frames; these will simply perform the
     393intermediate steps.
     394
     395\begin{figure}
     396\psfig{file=coordinateFrames,height=7in,angle=-90}
     397\caption{The coordinate systems in the \PS{} IPP, and the relation
     398between each by transformations contained in the appropriate
     399structures.}
     400\label{fig:coco}
     401\end{figure}
     402
     403\begin{figure}
     404\psfig{file=coordinateConv,height=7in,angle=-90}
     405\caption{Conversion between coordinate systems by PSLib.}
     406\label{fig:cocoFunc}
     407\end{figure}
     408
     409We specify the following functions to convert between coordinates in
     410one type of frame to another type of frame.  The first group consist
     411of unambiguous transformations: from the coordinates in a low-level
     412frame to the coordinates in the containing higher-level frame, of
     413which only one exists.  In all of these functions, the output
     414coordinate structure may be \code{NULL} or may be supplied by the
     415calling function.  In the former case, the structure must be
     416allocated; in the latter case, the supplied structure must be used.
     417
     418\begin{verbatim}
     419psPlane *psCoordCellToChip (psPlane *out, const psPlane *in, const psCell *cell);
     420% astrometry comes from cell (no need for parent)
     421\end{verbatim}
     422which converts coordindates \code{in} on the specified \code{cell} to
     423the coordinates on the parent chip.
     424
     425\begin{verbatim}
     426psPlane *psCoordChipToFPA (psPlane *out, const psPlane *in, const psChip *chip);
     427% astrometry comes from chip (no need for parent)
     428\end{verbatim}
     429which converts the coordinates \code{in} on the specified \code{chip}
     430to the coordinates on the parent FPA.
     431
     432\begin{verbatim}
     433psPlane *psCoordFPAToTP(psPlane *out, const psPlane *in, float color, float mag, const psFPA *fpa);
     434% astrometry comes from FPA (no need for parent)
     435\end{verbatim}
     436which converts coordinates \code{in} on the specified focal plane
     437\code{fpa} to tangent plane coordinates, applying the appropriate
     438distortion terms.  The \code{color} and magnitude (\code{mag}) of the
     439source is necessary in order to perform the distortion between the
     440focal plane and the tangent plane.
     441
     442\begin{verbatim}
     443psSphere *psCoordTPToSky(psSphere *out, const psPlane *in, const psGrommit *grommit);
     444\end{verbatim}
     445which converts the tangent plane coordinates \code{in} to (RA,Dec) on
     446the sky, based on the environmental information specified by
     447\code{grommit}.
     448
     449% astrometry comes from cell
     450\begin{verbatim}
     451psPlane *psCoordCellToFPA(psPlane *out, const psPlane *in, const psCell *cell);
     452\end{verbatim}
     453which performs the single-step conversion between Cell coordinates
     454\code{in} and FPA coordinates.
     455
     456% astrometry comes from cell,chip,fpa (PARENT IS NEEDED HERE)
     457\begin{verbatim}
     458psSphere *psCoordCellToSky(psSphere *out, const psPlane *in, float color, float mag, const psCell *cell);
     459\end{verbatim}
     460which converts coordinates on the specified cell to (RA,Dec).  This
     461transformation must be performed using the intermediate stage
     462transformations of Cell to Chip, Chip to FPA, FPA to Tangent Plane,
     463Tangent Plane to Sky.  The information needed for each of these
     464transformations is available in the \code{.parent} elements of
     465\code{psCell} and \code{psChip}, and the \code{psFPA.exposure}
     466element.  The \code{color} and magnitude (\code{mag}) of the source is
     467necessary in order to perform the distortion between the focal plane
     468and the tangent plane.
     469
     470% astrometry comes from cell (no need for parent)
     471\begin{verbatim}
     472psSphere *psCoordCellToSkyQuick(psSphere *out, const psPlane *in, const psCell *cell);
     473\end{verbatim}
     474which uses the 'quick-and-dirty' transformation to convert coordinates
     475on the specified cell to (RA,Dec).  This transformation should use the
     476locally linear transformation specified by the element
     477\code{psCell.toTP}.  Although the accuracy of this transformation
     478is lower than the complete transformation above, the calculation is
     479substantially faster as it only involves linear transformations.
     480
     481The following functions convert from high-level frames to the
     482coordinates of contained lower-level frames. 
     483
     484\begin{verbatim}
     485psPlane *psCoordSkyToTP(psPlane *out, const psSphere *in, const psGrommit *grommit);
     486\end{verbatim}
     487which converts (RA,Dec) coordinates \code{in} to tangent plane coords
     488based on the enviromental information supplied by \code{grommit}.
     489
     490\begin{verbatim}
     491psPlane *psCoordTPToFPA(psPlane *out, const psPlane *in, float color, float mag, const psFPA *fpa);
     492\end{verbatim}
     493which converts the tangent plane coordinates \code{in} to focal plane
     494coordinates.  The \code{color} and magnitude (\code{mag}) of the
     495source is necessary in order to perform the distortion between the
     496focal plane and the tangent plane.
     497
     498\begin{verbatim}
     499psPlane *psCoordFPAToChip (psPlane *out, const psPlane *in, const psChip *chip);
     500\end{verbatim}
     501which converts the specified FPA coordinates \code{in} to the
     502coordinates on the given Chip.  The specified chip need not contain
     503the input coordinate.  To find the chip which contains a particular
     504coordinate, the function \code{psChipInFPA}, defined above, should be
     505used.
     506
     507\begin{verbatim}
     508psPlane *psCoordChipToCell (psPlane *out, const psPlane *in, const psCell *cell);
     509\end{verbatim}
     510which converts the specified Chip coordinate \code{in} to the
     511coordinate on the given Cell.  The specified Cell need not contain the
     512input coordinate.  To find the cell which contains a particular
     513coordinate, the function \code{psCellInChip}, defined above, should be
     514used.
     515
     516\begin{verbatim}
     517psPlane *psCoordSkyToCell(psPlane *out, const psSphere *in, float color, float mag, psCell *cell);
     518\end{verbatim}
     519which directly converts (RA,Dec) \code{in} to coordinates on the
     520specified cell.  The specified cell need not contain the input
     521coordinates.  The \code{color} and magnitude (\code{mag}) of the
     522source is necessary in order to perform the distortion between the
     523focal plane and the tangent plane.
     524
     525\begin{verbatim}
     526psPlane *psCoordSkyToCellQuick(psPlane *out, const psSphere *in, psCell *cell);
     527\end{verbatim}
     528which directly converts (RA,Dec) \code{in} to coordinates on the
     529specified cell.  The specified cell need not contain the input
     530coordinates.  This transformation should use the locally linear
     531transformation specified by the element \code{psCell.toTP}.
     532Although the accuracy of this transformation is lower than the
     533complete transformation above, the calculation is substantially faster
     534as it only involves linear transformations.
     535
     536%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     537
     538\subsection{Astrometry and World Coordinate System}
     539
     540The FITS World Coordinate System (WCS) headers are commonly employed
     541with astronomical images in order to relate pixels to celestial (or
     542otherwise) coordinates.  Since it is a FITS standard, we must be able
     543to read and write from WCS into our internal format.  For the time
     544being, we will consider only celestial WCS (i.e., no spectral
     545wavelength calibrations, etc).  Because WCS does not support the
     546multiple layers that we have built for \PS{}, we will use a simple
     547internal representation: a transformation, which handles any
     548distortions (i.e., goes directly from the coordinate frame of the
     549image to the tangent plane); and the projection.
     550
     551\begin{verbatim}
     552bool psAstrometryReadWCS(psPlaneTransform **transform, // Output transformation
     553                         psProjection **projection, // Output projection
     554                         psMetadata *header // Input FITS header
     555                         );
     556bool psAstrometryWriteWCS(psMetadata *header, // Output FITS header
     557                          psPlaneTransform *transform, // Input transformation
     558                          psProjection *projection, // Input projection
     559                          double color, // Mean color to use
     560                          double magnitude, // Mean magnitude to use
     561                          );
     562bool psAstrometrySimplify(psPlaneTransform **transform, // Output transformation
     563                          psProjection **projection, // Output projection
     564                          psCell *cell // Cell for which to generate transform and projection
     565                          );
     566\end{verbatim}                 
     567
     568\code{pmReadAstrometry} shall parse the specified FITS \code{header},
     569returning new instances of the \code{transform} and \code{projection}
     570that represent the WCS.  The function shall return \code{true} if it
     571was able to successfully generate the outputs; otherwise it shall
     572return \code{false}.
     573
     574\code{pmWriteAstrometry} shall add WCS keywords to the supplied FITS
     575\code{header} that implement the given \code{transform} and
     576\code{projection}.  The function shall return \code{true} if it was
     577able to successfully generate the output; otherwise it shall return
     578\code{false}.
     579
     580\code{pmSimplifyAstrometry} shall take a \code{cell} and simplify the
     581internal astrometric representation (\code{cell->toFPA} or equivalent,
     582\code{cell->parent->parent->toTangentPlane} and
     583\code{cell->parent->parent->grommit}) to a single \code{transform} and
     584\code{projection}.  This allows the subsequent use of
     585\code{pmWriteAstrometry} in the case that we have only the
     586multi-layered \PS{} internal astrometric representation.  The function
     587shall return \code{true} if it was able to successfully generate the
     588output; otherwise it shall return \code{false}.
     589
     590\subsection{Observatory data}
    332591
    333592We need a container for the observatory data that doesn't change per
     
    350609\end{verbatim}
    351610
    352 \subsubsection{Exposure information}
     611\subsection{Exposure information}
    353612
    354613We need several quantities from the telescope in order to make a
     
    388647\end{verbatim}
    389648
    390 \subsubsection{Environmental Information}
    391 
    392 A-priori astrometric transformations between the tangent plane and the
    393 sky require several pieces of information describing the current
    394 environmental conditions.  These quantities are consistent from image
    395 to image, and may vary only slowly with time.  Pre-computing these
    396 quantities for exposures means that subsequent transformations are
    397 faster.  The structure below carries the environment data of interest.
    398 For historical reasons, this structure is known colloquially as ``the
    399 Grommit''.
    400 
    401 \begin{verbatim}
    402 typedef struct {
    403     const double latitude;              ///< geodetic latitude (radians)
    404     const double sinLat, cosLat;        ///< sine and cosine of geodetic latitude
    405     const double abberationMag;         ///< magnitude of diurnal aberration vector
    406     const double height;                ///< height (HM)
    407     const double temperature;           ///< ambient temperature (TDK)
    408     const double pressure;              ///< pressure (PMB)
    409     const double humidity;              ///< relative humidity (RH)
    410     const double wavelength;            ///< wavelength (WL)
    411     const double lapseRate;             ///< lapse rate (TLR)
    412     const double refractA, refractB;    ///< refraction constants A and B (radians)
    413     const double longitudeOffset;       ///< longitude + ... (radians)
    414     const double siderealTime;          ///< local apparent sidereal time (radians)
    415 } psGrommit;
    416 \end{verbatim}
    417 
    418 The \code{psGrommit} is calculated from telescope information for the
    419 particular exposure, \code{exp}:
    420 \begin{verbatim}
    421 psGrommit *psGrommitAlloc(const psExposure *exp);
    422 \end{verbatim}
    423 
    424 \subsubsection{Fixed Pattern}
    425 
    426 The fixed pattern is a correction to the general astrometric solution
    427 formed by summing the residuals from many observations.  The intent is
    428 to correct for higher-order distortions in the camera system on a
    429 coarse grid (larger than individual pixels, but smaller than a single
    430 cell).  Hence, in addition to the offsets, we need to specify the size
    431 and scale of the grid in $x$ and $y$, as well as the origin of the
    432 grid.
    433 
    434 \begin{verbatim}
    435 typedef struct {
    436     int nX, nY;                         ///< Number of elements in x and y
    437     double x0, y0;                      ///< Position of 0,0 corner on focal plane
    438     double xScale, yScale;              ///< Scale of the grid
    439     double **x, **y;                    ///< The grid of offsets in x and y
    440 } psFixedPattern;
    441 \end{verbatim}
    442 
    443 The constructor for \code{psFixedPattern} shall be:
    444 \begin{verbatim}
    445 psFixedPattern *psFixedPatternAlloc(double x0,        double y0,
    446                                     double xScale,    double yScale,
    447                                     const psImage *x, const psImage *y);
    448 \end{verbatim}
    449 Here, \code{x0}, \code{y0}, \code{xScale} and \code{yScale} have the
    450 same meaning as in the \code{psFixedPattern} structure.  Note that the
    451 values of the fixed pattern offsets are specified as images, the
    452 values from which need to be copied into the \code{double **x} and
    453 \code{double **y} of \code{psFixedPattern}, and that the number of
    454 elements may be derived from the size of the images.
    455 
    456 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    457 
    458 \subsection{Astrometry}
    459 
    460 Astrometry is a basic functionality required for the IPP that will be
    461 used repeatedly, both for low-precision (roughly where is my favorite
    462 object?) and high-precision (what is the proper motion of this star?).
    463 As such, it must be flexible, yet robust.  Accordingly, we will wrap
    464 the StarLink Astronomy Libraries (SLALib), which has already been
    465 developed.  \tbd{SLAlib functions will be replaced in the next
    466 release}.
    467 
    468 \subsubsection{Coordinate frames}
    469 \label{sec:coordinateFrames}
    470 
    471 There are five coordinate frames that we need to worry about for the
    472 purposes of astrometry:
    473 \begin{itemize}
    474 \item Cell: $(x,y)$ in pixels --- raw coordinates;
    475 \item Chip: $(X,Y)$ in pixels --- the location on the silicon;
    476 \item Focal Plane: $(p,q)$ in microns --- the location on the focal plane;
    477 \item Tangent Plane: $(l,m)$ in arcsec from the telescope boresight; and
    478 \item Sky: (RA,Dec) --- ICRS.
    479 \end{itemize}
    480 
    481 The following steps are required to convert from the cell coordinates to
    482 the sky:
    483 \begin{itemize}
    484 \item Cell $\longleftrightarrow$ Chip: two 2D polynomials, $(X,Y) = f(x,y)$;
    485 \item Chip $\longleftrightarrow$ FP: two 2D polynomials, $(p,q) = g(X,Y)$;
    486 \item FP $\longleftrightarrow$ TP: two 4D polynomials, $(l,m) =
    487 h(p,q,m,c)$, where $m$ and $c$ are the magnitude and color of the
    488 object, respectively; and
    489 \item TP $\longleftrightarrow$ Sky:  transformation to the sky using
    490 pre-computed coefficients for each pointing.
    491 \end{itemize}
    492 
    493 Note that the transformation between the Focal Plane and the Tangent
    494 Plane is a four-dimensional polynomial, in order to account for any
    495 possible dependencies in the astrometry on the stellar magnitude and
    496 color; the former serves as a check for charge transfer
    497 inefficiencies, while the latter will correct chromatic refraction,
    498 both through the atmosphere and the corrector lenses.
    499 
    500 We require structures to contain each of the above transformations as
    501 well as the pixel data.
    502 
    503 \subsubsection{Position Finding}
    504 
    505 We require functions to return the structure containing given
    506 coordinates.  For example, we want the chip that corresponds to the
    507 focal plane coordinates $(p,q) = (-1.234,+5.678)$.  These routines
    508 handle the one-to-many problem --- i.e., for one given focal plane
    509 coordinate, there are many chips that this coordinate may be
    510 correspond to; these functions will select the correct one.
    511 %
    512 \begin{verbatim}
    513 psCell *psCellInFPA (const psPlane *coord, const psFPA *fpa);
    514 psChip *psChipInFPA (const psPlane *coord, const psFPA *fpa);
    515 psCell *psCellInChip(const psPlane *coord, const psChip *chip);
    516 \end{verbatim}
    517 
    518 \subsubsection{Conversion Functions}
    519 
    520 We require functions to convert between the various coordinate frames
    521 (Section~\ref{sec:coordinateFrames}).  The hierarchy of the coordinate
    522 frames and the transformations between each are shown in
    523 Figure~\ref{fig:coco}.  The functions that employ the transformations
    524 are shown in Figure~\ref{fig:cocoFunc}.  In addition to
    525 transformations between each adjoining coordinate frame in the
    526 hierarchy, we also require higher-level functions to convert between
    527 the Cell and Sky coordinate frames; these will simply perform the
    528 intermediate steps.
    529 
    530 \begin{figure}
    531 \psfig{file=coordinateFrames,height=7in,angle=-90}
    532 \caption{The coordinate systems in the \PS{} IPP, and the relation
    533 between each by transformations contained in the appropriate
    534 structures.}
    535 \label{fig:coco}
    536 \end{figure}
    537 
    538 \begin{figure}
    539 \psfig{file=coordinateConv,height=7in,angle=-90}
    540 \caption{Conversion between coordinate systems by PSLib.}
    541 \label{fig:cocoFunc}
    542 \end{figure}
    543 
    544 We specify the following functions to convert between coordinates in
    545 one type of frame to another type of frame.  The first group consist
    546 of unambiguous transformations: from the coordinates in a low-level
    547 frame to the coordinates in the containing higher-level frame, of
    548 which only one exists.  In all of these functions, the output
    549 coordinate structure may be \code{NULL} or may be supplied by the
    550 calling function.  In the former case, the structure must be
    551 allocated; in the latter case, the supplied structure must be used.
    552 
    553 \begin{verbatim}
    554 psPlane *psCoordCellToChip (psPlane *out, const psPlane *in, const psCell *cell);
    555 % astrometry comes from cell (no need for parent)
    556 \end{verbatim}
    557 which converts coordindates \code{in} on the specified \code{cell} to
    558 the coordinates on the parent chip.
    559 
    560 \begin{verbatim}
    561 psPlane *psCoordChipToFPA (psPlane *out, const psPlane *in, const psChip *chip);
    562 % astrometry comes from chip (no need for parent)
    563 \end{verbatim}
    564 which converts the coordinates \code{in} on the specified \code{chip}
    565 to the coordinates on the parent FPA.
    566 
    567 \begin{verbatim}
    568 psPlane *psCoordFPAToTP(psPlane *out, const psPlane *in, float color, float mag, const psFPA *fpa);
    569 % astrometry comes from FPA (no need for parent)
    570 \end{verbatim}
    571 which converts coordinates \code{in} on the specified focal plane
    572 \code{fpa} to tangent plane coordinates, applying the appropriate
    573 distortion terms.  The \code{color} and magnitude (\code{mag}) of the
    574 source is necessary in order to perform the distortion between the
    575 focal plane and the tangent plane.
    576 
    577 \begin{verbatim}
    578 psSphere *psCoordTPToSky(psSphere *out, const psPlane *in, const psGrommit *grommit);
    579 \end{verbatim}
    580 which converts the tangent plane coordinates \code{in} to (RA,Dec) on
    581 the sky, based on the environmental information specified by
    582 \code{grommit}.
    583 
    584 \begin{verbatim}
    585 psPlane *psCoordCellToFPA(psPlane *out, const psPlane *in, const psCell *cell);
    586 % astrometry comes from cell
    587 \end{verbatim}
    588 which performs the single-step conversion between Cell coordinates
    589 \code{in} and FPA coordinates.
    590 
    591 \begin{verbatim}
    592 psSphere *psCoordCellToSky(psSphere *out, const psPlane *in, float color, float mag, const psCell *cell);
    593 % astrometry comes from cell,chip,fpa (PARENT IS NEEDED HERE)
    594 \end{verbatim}
    595 which converts coordinates on the specified cell to (RA,Dec).  This
    596 transformation must be performed using the intermediate stage
    597 transformations of Cell to Chip, Chip to FPA, FPA to Tangent Plane,
    598 Tangent Plane to Sky.  The information needed for each of these
    599 transformations is available in the \code{.parent} elements of
    600 \code{psCell} and \code{psChip}, and the \code{psFPA.exposure}
    601 element.  The \code{color} and magnitude (\code{mag}) of the source is
    602 necessary in order to perform the distortion between the focal plane
    603 and the tangent plane.
    604 
    605 \begin{verbatim}
    606 psSphere *psCoordCellToSkyQuick(psSphere *out, const psPlane *in, const psCell *cell);
    607 % astrometry comes from cell (no need for parent)
    608 \end{verbatim}
    609 which uses the 'quick-and-dirty' transformation to convert coordinates
    610 on the specified cell to (RA,Dec).  This transformation should use the
    611 locally linear transformation specified by the element
    612 \code{psCell.toTP}.  Although the accuracy of this transformation
    613 is lower than the complete transformation above, the calculation is
    614 substantially faster as it only involves linear transformations.
    615 
    616 The following functions convert from high-level frames to the
    617 coordinates of contained lower-level frames. 
    618 
    619 \begin{verbatim}
    620 psPlane *psCoordSkyToTP(psPlane *out, const psSphere *in, const psGrommit *grommit);
    621 \end{verbatim}
    622 which converts (RA,Dec) coordinates \code{in} to tangent plane coords
    623 based on the enviromental information supplied by \code{grommit}.
    624 
    625 \begin{verbatim}
    626 psPlane *psCoordTPToFPA(psPlane *out, const psPlane *in, float color, float mag, const psFPA *fpa);
    627 \end{verbatim}
    628 which converts the tangent plane coordinates \code{in} to focal plane
    629 coordinates.  The \code{color} and magnitude (\code{mag}) of the
    630 source is necessary in order to perform the distortion between the
    631 focal plane and the tangent plane.
    632 
    633 \begin{verbatim}
    634 psPlane *psCoordFPAToChip (psPlane *out, const psPlane *in, const psChip *chip);
    635 \end{verbatim}
    636 which converts the specified FPA coordinates \code{in} to the
    637 coordinates on the given Chip.  The specified chip need not contain
    638 the input coordinate.  To find the chip which contains a particular
    639 coordinate, the function \code{psChipInFPA}, defined above, should be
    640 used.
    641 
    642 \begin{verbatim}
    643 psPlane *psCoordChipToCell (psPlane *out, const psPlane *in, const psCell *cell);
    644 \end{verbatim}
    645 which converts the specified Chip coordinate \code{in} to the
    646 coordinate on the given Cell.  The specified Cell need not contain the
    647 input coordinate.  To find the cell which contains a particular
    648 coordinate, the function \code{psCellInChip}, defined above, should be
    649 used.
    650 
    651 \begin{verbatim}
    652 psPlane *psCoordSkyToCell(psPlane *out, const psSphere *in, float color, float mag, psCell *cell);
    653 \end{verbatim}
    654 which directly converts (RA,Dec) \code{in} to coordinates on the
    655 specified cell.  The specified cell need not contain the input
    656 coordinates.  The \code{color} and magnitude (\code{mag}) of the
    657 source is necessary in order to perform the distortion between the
    658 focal plane and the tangent plane.
    659 
    660 \begin{verbatim}
    661 psPlane *psCoordSkyToCellQuick(psPlane *out, const psSphere *in, psCell *cell);
    662 \end{verbatim}
    663 which directly converts (RA,Dec) \code{in} to coordinates on the
    664 specified cell.  The specified cell need not contain the input
    665 coordinates.  This transformation should use the locally linear
    666 transformation specified by the element \code{psCell.toTP}.
    667 Although the accuracy of this transformation is lower than the
    668 complete transformation above, the calculation is substantially faster
    669 as it only involves linear transformations.
    670 
    671 \subsubsection{Additional functions}
    672 
    673 We require additional functions to perform general functions which
    674 will be useful for astrometry.  Given coordinates on the sky, we
    675 need to get the airmass, the parallactic angle, and an estimate of
    676 the atmospheric refraction.
    677 
    678 \begin{verbatim}
    679 float psGetAirmass(const psSphere *coord, psTime *lst, float height);
    680 \end{verbatim}
    681 which returns the airmass for a given position and local sidereal time
    682 (\code{lst}).
    683 
    684 \begin{verbatim}
    685 float psGetParallactic(const psSphere *coord, double siderealTime);
    686 \end{verbatim}
    687 which returns the parallactic angle for a given position and sidereal time.
    688 
    689 \begin{verbatim}
    690 float psGetRefraction(float colour,            ///< Colour of object
    691                       psPhotSystem colorPlus,  ///< Colour reference
    692                       psPhotSystem colorMinus, ///< Colour reference
    693                       const psExposure *exp);  ///< Telescope pointing information
    694 \end{verbatim}
    695 which provides an estimate of the atmospheric refraction, along the parallactic angle.
    696 
    697 \begin{verbatim}
    698 double psGetParallaxFactor(const psExposure *exp)
    699 \end{verbatim}
    700 Calculate the parallax factor for the given exposure.  \tbd{Why do we need this?}.
    701 
    702 
    703 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    704 
    705 \subsection{Astrometry and World Coordinate System}
    706 
    707 The FITS World Coordinate System (WCS) headers are commonly employed
    708 with astronomical images in order to relate pixels to celestial (or
    709 otherwise) coordinates.  Since it is a FITS standard, we must be able
    710 to read and write from WCS into our internal format.  For the time
    711 being, we will consider only celestial WCS (i.e., no spectral
    712 wavelength calibrations, etc).  Because WCS does not support the
    713 multiple layers that we have built for \PS{}, we will use a simple
    714 internal representation: a transformation, which handles any
    715 distortions (i.e., goes directly from the coordinate frame of the
    716 image to the tangent plane); and the projection.
    717 
    718 \begin{verbatim}
    719 bool psAstrometryReadWCS(psPlaneTransform **transform, // Output transformation
    720                          psProjection **projection, // Output projection
    721                          psMetadata *header // Input FITS header
    722                          );
    723 bool psAstrometryWriteWCS(psMetadata *header, // Output FITS header
    724                           psPlaneTransform *transform, // Input transformation
    725                           psProjection *projection, // Input projection
    726                           double color, // Mean color to use
    727                           double magnitude, // Mean magnitude to use
    728                           );
    729 bool psAstrometrySimplify(psPlaneTransform **transform, // Output transformation
    730                           psProjection **projection, // Output projection
    731                           psCell *cell // Cell for which to generate transform and projection
    732                           );
    733 \end{verbatim}                 
    734 
    735 \code{pmReadAstrometry} shall parse the specified FITS \code{header},
    736 returning new instances of the \code{transform} and \code{projection}
    737 that represent the WCS.  The function shall return \code{true} if it
    738 was able to successfully generate the outputs; otherwise it shall
    739 return \code{false}.
    740 
    741 \code{pmWriteAstrometry} shall add WCS keywords to the supplied FITS
    742 \code{header} that implement the given \code{transform} and
    743 \code{projection}.  The function shall return \code{true} if it was
    744 able to successfully generate the output; otherwise it shall return
    745 \code{false}.
    746 
    747 \code{pmSimplifyAstrometry} shall take a \code{cell} and simplify the
    748 internal astrometric representation (\code{cell->toFPA} or equivalent,
    749 \code{cell->parent->parent->toTangentPlane} and
    750 \code{cell->parent->parent->grommit}) to a single \code{transform} and
    751 \code{projection}.  This allows the subsequent use of
    752 \code{pmWriteAstrometry} in the case that we have only the
    753 multi-layered \PS{} internal astrometric representation.  The function
    754 shall return \code{true} if it was able to successfully generate the
    755 output; otherwise it shall return \code{false}.
    756 
Note: See TracChangeset for help on using the changeset viewer.