IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 6829


Ignore:
Timestamp:
Apr 11, 2006, 11:24:07 AM (20 years ago)
Author:
eugene
Message:

added new functions created for psModules

Location:
trunk/doc/pslib
Files:
2 edited

Legend:

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

    r6760 r6829  
    1 %%% $Id: ChangeLogSDRS.tex,v 1.201 2006-04-04 03:30:29 price Exp $
     1%%% $Id: ChangeLogSDRS.tex,v 1.202 2006-04-11 21:24:07 eugene Exp $
    22
    33\subsection{Changes from version 00 to version 01}
     
    866866\end{itemize}
    867867
    868 \subsection{Changes from Revistion 19 (21 Feb 2006) to Revision 20 (?? ??? 2006)}
     868\subsection{Changes from Revistion 19 (21 Feb 2006) to Revision 20 (11 Apr 2006)}
    869869
    870870\begin{itemize}
     
    884884  psFitsWriteTable}.  Added \code{psFitsHeaderFromImage,
    885885  psFitsHeaderFromTable}.  See bug 733.
    886 \end{itemize}
     886
     887\item Added \code{psLine} functions
     888\item Added \code{psEllipse} functions
     889\item Added \code{psStringSplit}
     890\item Added \code{psStringStrip}
     891\item Added \code{psMetadataPrint} % added FILE *
     892\item Added \code{psMetadataItemTransfer}
     893\item Added \code{psFitsWriteHeaderNotImage}
     894\item Added \code{psImageFlip} % x and y in same function
     895\item Added \code{psImageJpeg} functions
     896\item Added \code{psMetadataItemParse} functions
     897\item Added \code{psImageBicube} functions
     898\item Added \code{psRegionIsBad}
     899\item Added \code{psRegionIsNaN}
     900\item Added \code{psSparse} functions.
     901
     902\end{itemize}
  • trunk/doc/pslib/psLibSDRS.tex

    r6759 r6829  
    1 %%% $Id: psLibSDRS.tex,v 1.390 2006-04-04 03:29:03 price Exp $
     1%%% $Id: psLibSDRS.tex,v 1.391 2006-04-11 21:24:07 eugene Exp $
    22\documentclass[panstarrs,spec]{panstarrs}
    33
     
    1111\project{Pan-STARRS Image Processing Pipeline}
    1212\organization{Institute for Astronomy}
    13 \version{19}
     13\version{20}
    1414\docnumber{PSDC-430-007}
    1515
     
    505017 & 2005 Oct 18 & draft for cycle 9 \\ \hline
    515118 & 2005 Dec 06 & draft for cycle 10 \\ \hline
     5219 & 2005 Feb 21 & draft for cycle 11 \\ \hline
     5320 & 2005 Apr 11 & draft for cycle 12 \\ \hline
    5254\RevisionsEnd
    5355
     
    906908similarly, except it shall prepend to the \code{dest} string.
    907909
    908 A further useful function is:
     910Other string manipulation functions are listed below.
    909911
    910912\begin{prototype}
     
    916918one of the characters in \code{splitters}.  Split strings of zero
    917919length should not be included in the output list.
     920
     921String whitespace from head and tail of string:
     922\begin{prototype}
     923int psStringStrip (char *string);
     924\end{prototype}
     925
     926\subsubsection{Fixed-Length Lines}
     927
     928We define the \code{psLine} structure to carry a pre-allocated block
     929to store a character string.  The interfaces are similar to
     930\code{psString}, but allow for the container to be allocated initially
     931upfront with a specified length.  They are used to force a
     932fixed-length line.
     933
     934\begin{datatype}
     935// structure to carry a dynamic string
     936typedef struct {
     937    int NLINE;                  // allocated length
     938    int Nline;                  // current lenght
     939    char *line;                 // character string data
     940} psLine;
     941\end{datatype}
     942
     943The following function allocates a line object of length Nline.
     944\begin{prototype}
     945psLine *psLineAlloc (int Nline);
     946\end{prototype}
     947
     948The following function initializes or re-initializes the line, setting
     949the current length to zero and setting the string data values to 0.
     950If the function is passed \code{NULL}, the function returns \code{false}.
     951\begin{prototype}
     952bool psLineInit (psLine *line);
     953\end{prototype}
     954
     955The following function appends a line segment to the string, returning
     956\code{false} if the new segment would overflow the allocated string
     957length.
     958\begin{prototype}
     959bool psLineAdd (psLine *line, char *format, ...);
     960\end{prototype}
    918961
    919962\subsubsection{Type information}
     
    28522895\end{prototype}
    28532896
     2897The following utility functions simplify further the selection of
     2898elements from the metadata.  These functions convert the data
     2899associated with the supplied metadata item to the desired type if
     2900possible. Conversions between types are performed as needed, and
     2901default values are returned for the integer and floating point types
     2902if the data is not available (0 for int, \code{NaN} for float).
     2903
     2904\begin{prototype}
     2905psF32 psMetadataItemParseF32(psMetadataItem *item);
     2906psF64 psMetadataItemParseF64(psMetadataItem *item);
     2907psS32 psMetadataItemParseS32(psMetadataItem *item);
     2908psString psMetadataItemParseString(psMetadataItem *item);
     2909\end{prototype}
     2910
     2911
    28542912Items may be retrieved from the metadata by their entry position.  The
    28552913value of which specifies the desired entry in the fashion of
     
    28992957\end{prototype}
    29002958
     2959A complete metadata structure may be printed to the given file
     2960descriptor with the following command, where the level represents the
     2961desired indentation
     2962\begin{prototype}
     2963bool psMetadataPrint(FILE *fd, const psMetadata *md, int level);
     2964\end{prototype}
     2965
    29012966There will be occasions when we want to perform a deep copy of a
    29022967\code{psMetadata}, for example, to generate a new and independent FITS
     
    29172982the \code{out} metadata, or a new \code{psMetadata} if \code{out} is
    29182983\code{NULL}.
     2984
     2985The following functio copies a single metadata item from one
     2986psMetadata to another:
     2987\begin{prototype}
     2988bool psMetadataItemTransfer (psMetadata *out, // Destination: copy is placed here
     2989                             psMetadata *in,  // Source: item comes from here
     2990                             char *key        // key to identify the metadata item
     2991    );
     2992\end{prototype}
    29192993
    29202994\subsubsection{Configuration files}
     
    37193793The width of the square is thus \code{2radius + 1}.
    37203794
     3795The following fucntions provide tests of the validity of
     3796\code{regions}
     3797\begin{prototype}
     3798bool psRegionIsBad(psRegion region);
     3799bool psRegionIsNaN (psRegion region);
     3800\end{prototype}
     3801
    37213802\pagebreak
    37223803
     
    41324213Write metadata into the header of a FITS image file.  The header is
    41334214written at the current HDU.
     4215
     4216\begin{prototype}
     4217bool psFitsWriteHeaderNotImage(psFits *fits, const psMetadata *header);
     4218\end{prototype}
     4219This function creates a header for a 0 length image.  The resulting
     4220header shall have \code{NAXIS = 0}.  Any \code{NAXISi} elements
     4221present in the header shall be maintained as reference data.
    41344222
    41354223\begin{prototype}
     
    52005288place.
    52015289
     5290The following function flips the given image in the x and/or y
     5291direction.  Note that a request for both an x and a y flip is
     5292identical to a 180\degree\ rotation.
     5293\begin{prototype}
     5294psImage *psImageFlip(psImage *image,  // Image to flip
     5295                     bool xFlip,
     5296                     bool yFlip);
     5297\end{prototype}
     5298
    52025299\subsubsection{Image Pixel Extractions}
    52035300
     
    52515348subimage, the \code{region} argument refers to parent coordinates.
    52525349
    5253 The input region is collapsed in the direction perpendicular to that
     5350The pixel region defined by the coordinate pair \code{start} \&
     5351\code{stop} is collapsed in the direction perpendicular to that
    52545352specified by \code{direction}, and each element of the output vectors
    52555353is derived from the statistics of the pixels at that direction
     
    52585356for which the corresponding \code{mask} pixel matches \code{maskVal}
    52595357are excluded from operations.  If \code{coords} is not \code{NULL},
    5260 the calculated coordinates along the slice are returned in this
    5261 array of pixels.  Only one of the statistics choices may be specified,
     5358the calculated coordinates along the slice are returned in this array
     5359of pixels.  Only one of the statistics choices may be specified,
    52625360otherwise the function must return an error.  This function must be
    52635361defined for the following types: \code{psS8}, \code{psU16},
     
    52715369                     const psImage *mask,
    52725370                     psMaskType maskVal,
    5273                      psRegion region,
     5371                     psPlane *start,
     5372                     psPlane *stop,
    52745373                     unsigned int nSamples,
    52755374                     psImageInterpolateMode mode);
     
    55925691datatype.  The return value shall be the number of pixels overlaid.
    55935692
     5693\subsubsection{Image Local Bicube}
     5694
     5695The following functions provide interpolations of image data values
     5696based on bicubic interpolation.
     5697
     5698This function fits a 2D 2nd order polynomial to the 9 pixels centered
     5699on the coordinate x,y.
     5700\begin{prototype}
     5701psPolynomial2D *psImageBicubeFit (psImage *image, int x, int y);
     5702\end{prototype}
     5703
     5704This function detemines the min (or max) of the special 2D 2nd order
     5705polynomial representing the fit to 9 pixels of an image.
     5706\begin{prototype}
     5707psPlane psImageBicubeMin (psPolynomial2D *poly);
     5708\end{prototype}
     5709
     5710\subsubsection{JPEG operations}
     5711
     5712The following functions and structures are used to convert an image in
     5713memory to a output JPEG file.  These functions allow the user to
     5714define a color map (from a list of predefined color maps) and to
     5715define the dynamic range of the translation from data values to JPEG
     5716color values. 
     5717
     5718The representation of a JPEG colormap is given by the following structure:
     5719\begin{datatype}
     5720typedef struct {
     5721    psString name;
     5722    psVector *red;
     5723    psVector *green;
     5724    psVector *blue;
     5725} psImageJpegColormap;
     5726\end{datatype}
     5727The colormap is just a translation from a \code{psImage} data value to
     5728a JPEG image data value.  The colormap may be used to construct either
     5729single channel or multichannel images.
     5730
     5731The following function allocates, but does not specify, a JPEG colormap:
     5732\begin{prototype}
     5733psImageJpegColormap *psImageJpegColormapAlloc ();
     5734\end{prototype}
     5735
     5736The following function sets the colormap values based on the named
     5737colormap.  Currently defined colormaps have the names \code{greyscale}
     5738(or \code{grayscale}), \code{-grayscale} (or \code{-greyscale}),
     5739\code{rainbow}, \code{heat}.
     5740\begin{prototype}
     5741psImageJpegColormap *psImageJpegColormapSet (psImageJpegColormap *map, char *name);
     5742\end{prototype}
     5743
     5744The following function writes out the specified image as a JPEG file
     5745using the supplied colormap.  The output goes to the specified
     5746filename.  This function performs a single-channel JPEG conversion
     5747(the values of the single image determine the colors).
     5748\begin{prototype}
     5749bool psImageJpeg (psImageJpegColormap *map, psImage *image, char *filename, float min, float max);
     5750\end{prototype}
     5751
    55945752\subsubsection{Mask operations}
    55955753
     
    58526010\end{prototype}
    58536011
     6012\subsubsection{Sparse Matrices}
     6013
     6014Very large matrices (N elements $> 1000$) can be very time consuming
     6015to manipulate.  A certain class of matrices, sparse matrices, are
     6016amenable to iterative solutions even when extremely large (100,000s of
     6017elements).  The following functions define structures to efficiently
     6018represent sparse matricies, to add elements to those matrices, and to
     6019perform linear algebra with them.
     6020
     6021\begin{datatype}
     6022typedef struct {
     6023    psVector *Aij;
     6024    psVector *Bfj;
     6025    psVector *Qii;
     6026    psVector *Si;
     6027    psVector *Sj;
     6028    int Nelem;
     6029    int Nrows;
     6030} psSparse;
     6031\end{datatype}
     6032
     6033The above structure contains the following elements, describing a
     6034sparse matrix equation of the form $A \bar{x} = \bar{Bf}$:
     6035\begin{itemize}
     6036\item the vector \code{Aij} contains the populated elements of the matrix
     6037\item the vector \code{Bfj} contains the elements of the vector Bf
     6038\item the vector \code{Qii} contains the diagonal elements of Aij
     6039\item the vector \code{Si} contains the i-index values of Aij
     6040\item the vector \code{Sj} contains the j-index values of Aij
     6041\item the element \code{Nelem} defines the total number of elements in
     6042matrix \code{Aij}
     6043\item the element \code{Nrows} defines the size of the matrix \code{Aij}
     6044\end{itemize}
     6045
     6046The following structure defines constraints to limit the range of the
     6047value matrix equation solution:
     6048\begin{datatype}
     6049typedef struct {
     6050    double paramDelta;
     6051    double paramMin;
     6052    double paramMax;
     6053} psSparseConstraint;
     6054\end{datatype}
     6055
     6056The following function allocates a sparse matrix structure:
     6057\begin{prototype}
     6058psSparse *psSparseAlloc (int Nrows, int Nelem);
     6059\end{prototype}
     6060
     6061The following function adds a new matrix element.  The user should
     6062only add elements above the diagonal.
     6063\begin{prototype}
     6064void psSparseMatrixElement (psSparse *sparse, int i, int j, float value);
     6065\end{prototype}
     6066
     6067The following function define a new sparse matrix equation vector element:
     6068\begin{prototype}
     6069void psSparseVectorElement (psSparse *sparse, int i, float value);
     6070\end{prototype}
     6071
     6072The following function performs the operation ``matrix times vector''
     6073on a sparse matrix and a vector:
     6074\begin{prototype}
     6075psVector *psSparseMatrixTimesVector (psVector *output, psSparse *matrix, psVector *vector);
     6076\end{prototype}
     6077
     6078The following function re-sorts a sparse matrix to have all elements
     6079in index order rather than insertion order.  The user must call this
     6080function before attempting to solve, but after populating, the matrix and vector:
     6081\begin{prototype}
     6082void psSparseResort (psSparse *sparse);
     6083\end{prototype}
     6084
     6085The following function iteratively solves the equation $A \bar{x} =
     6086\bar{Bf}$.  For the value of $\bar{x}$, a good starting guess is the vector $\bar{Bf}$
     6087\begin{prototype}
     6088psVector *psSparseSolve (psVector *guess, psSparseConstraint constraint, psSparse *sparse, int Niter);
     6089\end{prototype}
     6090
    58546091%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    58556092
     
    61096346Poisson distribution with the given \code{mean} using
    61106347\code{gsl_ran_poisson}.
     6348
     6349\subsection{Ellipse Shape Functions}
     6350
     6351Astronomical objects are frequently decomposed into components
     6352represented by a radial function modified by an elliptical contour.
     6353There are a few ways in which the elliptical shape information can be
     6354represented depending on the circumstance in which it is used.  The
     6355structures and functions in the section provide tools for converting
     6356between the elliptical representations.  We provide three structures
     6357representing three ways in which the elliptical shape is represented.
     6358Like the \code{psRegion}, these datatypes and their supporting
     6359functions do not use allocators.
     6360
     6361This structure represents an ellipse by its major and minor axis
     6362lengths and the orientation angle.
     6363\begin{datatype}
     6364typedef struct {
     6365    double major;
     6366    double minor;
     6367    double theta;
     6368} psEllipseAxes;
     6369\end{datatype}
     6370
     6371This structure represents an elliptical Gaussian by the second moments
     6372measured for that Gaussian. 
     6373\begin{datatype}
     6374typedef struct {
     6375    double x2;
     6376    double y2;
     6377    double xy;
     6378} psEllipseMoments;
     6379\end{datatype}
     6380
     6381This structure represents an ellipse by the components of the
     6382cartesian coordiante equation: $(s_x x)^2 + (s_y y)^2 + s_{x,y} x y =
     6383R$
     6384\begin{datatype}
     6385typedef struct {
     6386    double sx;
     6387    double sy;
     6388    double sxy;
     6389} psEllipseShape;
     6390\end{datatype}
     6391
     6392The following functions provide conversions between the elliptical
     6393shape representations:
     6394
     6395\begin{prototype}
     6396psEllipseAxes psEllipseMomentsToAxes (psEllipseMoments moments);
     6397psEllipseShape psEllipseAxesToShape (psEllipseAxes axes);
     6398psEllipseAxes psEllipseShapeToAxes (psEllipseShape shape);
     6399\end{prototype}
    61116400
    61126401%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Note: See TracChangeset for help on using the changeset viewer.