Changeset 4178 for trunk/doc/pslib/psLibSDRS.tex
- Timestamp:
- Jun 8, 2005, 7:16:41 PM (21 years ago)
- File:
-
- 1 edited
-
trunk/doc/pslib/psLibSDRS.tex (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/doc/pslib/psLibSDRS.tex
r4166 r4178 1 %%% $Id: psLibSDRS.tex,v 1.27 0 2005-06-09 00:40:48eugene Exp $1 %%% $Id: psLibSDRS.tex,v 1.271 2005-06-09 05:16:41 eugene Exp $ 2 2 \documentclass[panstarrs,spec]{panstarrs} 3 3 … … 831 831 % 832 832 \begin{prototype} 833 void psTrace(const char *facil, int level,...); 833 void psTrace(const char *facil, int level, const char *fmt,...); 834 void psTraceV(const char *facil, int level, const char *fmt, va_list ap); 834 835 \end{prototype} 835 836 % 836 where the last argument is a printf-style formatting code and possible 837 arguments to that formatting statement, to be implemented using the 838 \code{vprintf} functions. This command specifies the name of the 839 facility to which the message belongs (\code{facil}), the trace level 840 for this message in that facility (\code{level}) and the message 841 itself. 837 where the \code{fmt} argument is a printf-style formatting code 838 followed by possible arguments to that formatting statement, to be 839 implemented using the \code{vprintf} functions. This command 840 specifies the name of the facility to which the message belongs 841 (\code{facil}), the trace level for this message in that facility 842 (\code{level}) and the message itself. The \code{psTraceV} version of 843 the command accepts a \code{va_list} argument list rather than a 844 variable number of arguments. 842 845 843 846 The trace level for any facility may be set at any time with the … … 929 932 functions, effectively resetting all trace levels to 0. 930 933 931 932 The trace may optionally be written to a file on specifying a filename 933 with \code{psTraceSetDestination}: 934 \begin{prototype} 935 void psTraceSetDestination(FILE *fp); 936 \end{prototype} 937 If the \code{fp} is \code{NULL}, then the trace is sent to standard 938 output, otherwise it is sent to the specified file pointer. 934 The trace may optionally be written to a file or other output 935 destination with \code{psTraceSetDestination}: 936 \begin{prototype} 937 void psTraceSetDestination(int fd); 938 \end{prototype} 939 If the \code{fd} is 0, then the trace is sent to standard output, 940 otherwise it is sent to the specified file descriptor. A call to 941 \code{psTraceSetDestination} automatically closes the file descriptor. 942 943 The corresponding function 944 \begin{prototype} 945 int psTraceGetDestination(); 946 \end{prototype} 947 returns the current trace destination file descriptor. If the 948 destination has not been defined by the user, the descriptor for 949 \code{stdout} is returned. 950 951 The trace output format is controlled with the function: 952 % 953 \begin{prototype} 954 bool psTraceSetFormat(const char *fmt); 955 \end{prototype} 956 % 957 which expects a string consisting of the letters \code{H} (host), 958 \code{L} (level), \code{M} (message), \code{N} (name), and \code{T} 959 (time). The default is \code{THLNM}, which produces trace messages in 960 the form: 961 \begin{verbatim} 962 YYYY-MM-DD hh:mm:ssZ | hostname | L | name 963 The message goes here 964 and is indented by 4 spaces. 965 \end{verbatim} 966 where \code{YYYY}, \code{MM}, \code{DD}, \code{hh}, \code{mm}, and 967 \code{ss} are the year, month (Jan is 01), day of the month, hours 968 (0--23), minutes, and seconds when the trace message was received. Note 969 that the timestamp is in ISO order, and that the timezone is GMT 970 (hence the \code{Z}). The \code{hostname} is returned by 971 \code{gethostname}, \code{L} is a character associated with the level 972 (\code{A}, \code{E}, \code{W}, and \code{I} for \code{PS_LOG_ABORT}, 973 \code{PS_LOG_ERROR}, \code{PS_LOG_WARN}, and \code{PS_LOG_INFO} 974 respectively. Other levels are represented numerically (\code{5} 975 etc.). The other two fields, \code{facil} and \code{msg}, are the 976 arguments to \code{psTrace}. The \code{msg} is placed on a new line 977 (allowing the \code{name} to fill the rest of the previous line), 978 with each line indented by 4 spaces. An example message is: 979 % 980 \begin{verbatim} 981 2004:02:24 20:14:18Z | alibaba.IfA.Hawaii.Edu | I | example.utils.helloWorld 982 Hello world, 983 it's me calling. 984 \end{verbatim} 985 % 986 The possible order of the format entries is fixed and not determined 987 by the order of the letters used in \code{psTraceSetFormat}. Selecting 988 an output format with fewer than the complete set of 5 entries simply 989 removes those entries from the output messages. 990 991 Specifying a \code{fmt} of \code{NULL} turns off logging (equivalent 992 to calling \code{psLogSetDestination(PS_LOG_TO_NONE)}, whereas if the 993 \code{fmt} is \code{""}, then the format reverts to the default. 939 994 940 995 \subsubsection{Message Logging} … … 993 1048 % 994 1049 \begin{prototype} 995 bool psLogSetDestination(const char *dest); 996 \end{prototype} 997 % 998 The destination string consists of a URL in the form 999 \code{protocol:location}. The \code{protocol} value may be 1000 \code{file}, to send the log to a local file named by the value of 1001 \code{location}. Future expansion may allow the logger to send 1002 messages to an IP logger, with a protocol to be defined later. Three 1003 other special values are allowed for the \code{dest} parameter 1004 (without specifying a protocol): \code{stderr} and \code{stdout}, 1005 which write to \code{stderr} and \code{stdout} respectively, and 1006 \code{none} to turn off logging. 1050 bool psLogSetDestination(int fd); 1051 \end{prototype} 1052 % 1053 If the \code{fd} is 0, then the log is sent to standard output, 1054 otherwise it is sent to the specified file descriptor. A call to 1055 \code{psLogSetDestination} automatically closes an open file 1056 descriptor. 1057 1058 The corresponding function 1059 \begin{prototype} 1060 int psLogGetDestination(); 1061 \end{prototype} 1062 returns the current log destination file descriptor. If the 1063 destination has not been defined by the user, the descriptor for 1064 \code{stdout} is returned. 1007 1065 1008 1066 The output format is controlled with the function: … … 1049 1107 to calling \code{psLogSetDestination(PS_LOG_TO_NONE)}, whereas if the 1050 1108 \code{fmt} is \code{""}, then the format reverts to the default. 1109 1110 The following utility opens an output file descriptor for use by the 1111 trace and log facilities. 1112 \begin{prototype} 1113 int psMessageDestination (const char *dest); 1114 \end{prototype} 1115 % 1116 The destination string consists of a URL in the form 1117 \code{protocol:location}. The \code{protocol} value may be 1118 \code{file}, to send the log to a local file named by the value of 1119 \code{location}. Future expansion may allow the logger to send 1120 messages to an IP logger, with a protocol to be defined later. Three 1121 other special values are allowed for the \code{dest} parameter 1122 (without specifying a protocol): \code{stderr} and \code{stdout}, 1123 which return the file descriptors for \code{stderr} and \code{stdout} 1124 respectively, and \code{none} which returns the special descriptor to 1125 turn off logging. 1051 1126 1052 1127 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% … … 1660 1735 output of this function is a region with negative upper limits 1661 1736 replaced by their corrected value appropriate to the given image. 1737 1738 \subsubsection{Image Pixel Lists} 1739 1740 Usually an image mask is the best way to carry information about what 1741 pixels mean what. However, in the case where the number of pixels in 1742 which we are interested is limited, it is more efficient to simply 1743 carry a list of pixels. An example of this is in the image 1744 combination code, where we want to perform an operation on a 1745 relatively small fraction of pixels, and it is inefficient to go 1746 through an entire mask image checking each pixel. 1747 1748 \begin{datatype} 1749 typedef struct { 1750 int x; // x coordinate 1751 int y; // y coordinate 1752 } psPixelCoord; 1753 1754 typedef struct { 1755 psU32 n; // Number in use 1756 const psU32 nalloc; // Number allocated 1757 psPixelCoord *data; // The pixel coordinates 1758 } psPixels; 1759 \end{datatype} 1760 1761 \begin{prototype} 1762 psPixels *psPixelsAlloc(psU32 nalloc); 1763 psPixels *psPixelsRealloc(psPixels *pixels, psU32 nalloc); 1764 \end{prototype} 1765 1766 \code{psPixelsAlloc} and \code{psPixelsRealloc} provide dynamic 1767 allocation and reallocation in a manner analogous to those provided 1768 by \code{psVectorAlloc} and \code{psVectorRealloc}. 1769 1770 \begin{prototype} 1771 psImage *psPixelsToMask(psImage *out, const psPixels *pixels, psRegion region, unsigned int maskVal); 1772 psPixels *psPixelsFromMask(psPixels *out, const psImage *mask, unsigned int maskVal); 1773 \end{prototype} 1774 1775 \code{psPixelsToMask} shall return an image of type U8 with the 1776 \code{pixels} lying within the specified \code{region} set to the 1777 \code{maskVal}. The \code{out} image shall be modified if supplied, 1778 or allocated and returned if \code{NULL}. The size of the output 1779 image shall be \code{region.x1 - region.x0} by \code{region.y1 - 1780 region.y0}, with \code{out->x0 = region.x0} and \code{out->y0 = 1781 region.y0}. In the event that either of \code{pixels} or 1782 \code{region} are \code{NULL}, the function shall generate an error 1783 and return \code{NULL}. 1784 1785 \code{psMaskToPixels} shall return a \code{psPixels} containing the 1786 coordinates in the \code{mask} that match the \code{maskVal}. The 1787 \code{out} pixel list shall be modified if supplied, or allocated and 1788 returned if \code{NULL}. In the event that \code{mask} is 1789 \code{NULL}, the function shall generate an error and return 1790 \code{NULL}. 1791 1792 \begin{prototype} 1793 psPixels *psPixelsCopy(psPixels *out, const psPixels *pixels); 1794 psPixels *psPixelsConcatenate(psPixels *out, const psPixels *pixels); 1795 \end{prototype} 1796 1797 \code{psPixelsCopy} shall copy the contents of \code{pixels} to the 1798 \code{out}. In the event that \code{out} is \code{NULL}, a new 1799 \code{psPixels} shall be allocated, and the contents of \code{pixels} 1800 simply copied in. If \code{pixels} is \code{NULL}, the function shall 1801 generate an error and return \code{NULL}. 1802 1803 \code{psPixelsConcatenate} shall concatenate the \code{pixels} onto 1804 \code{out}. In the event that \code{out} is \code{NULL}, the function 1805 performs a \code{psPixelsCopy}, returning the copy. If \code{pixels} 1806 is \code{NULL}, the function shall generate an error and return 1807 \code{NULL}. The function shall take care to ensure that there are no 1808 duplicate pixels in \code{out} (since the order in which the pixels 1809 are stored is not important, the values may be sorted, allowing the 1810 use of a faster algorithm than a linear scan). 1662 1811 1663 1812 \subsection{Math Casting} … … 4620 4769 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4621 4770 4622 \subsection{Image Pixel Lists}4623 4624 Usually an image mask is the best way to carry information about what4625 pixels mean what. However, in the case where the number of pixels in4626 which we are interested is limited, it is more efficient to simply4627 carry a list of pixels. An example of this is in the image4628 combination code, where we want to perform an operation on a4629 relatively small fraction of pixels, and it is inefficient to go4630 through an entire mask image checking each pixel.4631 4632 \begin{datatype}4633 typedef struct {4634 int x; // x coordinate4635 int y; // y coordinate4636 } psPixelCoord;4637 4638 typedef struct {4639 psU32 n; // Number in use4640 const psU32 nalloc; // Number allocated4641 psPixelCoord *data; // The pixel coordinates4642 } psPixels;4643 \end{datatype}4644 4645 \begin{prototype}4646 psPixels *psPixelsAlloc(psU32 nalloc);4647 psPixels *psPixelsRealloc(psPixels *pixels, psU32 nalloc);4648 \end{prototype}4649 4650 \code{psPixelsAlloc} and \code{psPixelsRealloc} provide dynamic4651 allocation and reallocation in a manner analogous to those provided4652 by \code{psVectorAlloc} and \code{psVectorRealloc}.4653 4654 \begin{prototype}4655 psImage *psPixelsToMask(psImage *out, const psPixels *pixels, psRegion region, unsigned int maskVal);4656 psPixels *psPixelsFromMask(psPixels *out, const psImage *mask, unsigned int maskVal);4657 \end{prototype}4658 4659 \code{psPixelsToMask} shall return an image of type U8 with the4660 \code{pixels} lying within the specified \code{region} set to the4661 \code{maskVal}. The \code{out} image shall be modified if supplied,4662 or allocated and returned if \code{NULL}. The size of the output4663 image shall be \code{region.x1 - region.x0} by \code{region.y1 -4664 region.y0}, with \code{out->x0 = region.x0} and \code{out->y0 =4665 region.y0}. In the event that either of \code{pixels} or4666 \code{region} are \code{NULL}, the function shall generate an error4667 and return \code{NULL}.4668 4669 \code{psMaskToPixels} shall return a \code{psPixels} containing the4670 coordinates in the \code{mask} that match the \code{maskVal}. The4671 \code{out} pixel list shall be modified if supplied, or allocated and4672 returned if \code{NULL}. In the event that \code{mask} is4673 \code{NULL}, the function shall generate an error and return4674 \code{NULL}.4675 4676 \begin{prototype}4677 psPixels *psPixelsCopy(psPixels *out, const psPixels *pixels);4678 psPixels *psPixelsConcatenate(psPixels *out, const psPixels *pixels);4679 \end{prototype}4680 4681 \code{psPixelsCopy} shall copy the contents of \code{pixels} to the4682 \code{out}. In the event that \code{out} is \code{NULL}, a new4683 \code{psPixels} shall be allocated, and the contents of \code{pixels}4684 simply copied in. If \code{pixels} is \code{NULL}, the function shall4685 generate an error and return \code{NULL}.4686 4687 \code{psPixelsConcatenate} shall concatenate the \code{pixels} onto4688 \code{out}. In the event that \code{out} is \code{NULL}, the function4689 performs a \code{psPixelsCopy}, returning the copy. If \code{pixels}4690 is \code{NULL}, the function shall generate an error and return4691 \code{NULL}. The function shall take care to ensure that there are no4692 duplicate pixels in \code{out} (since the order in which the pixels4693 are stored is not important, the values may be sorted, allowing the4694 use of a faster algorithm than a linear scan).4695 4696 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%4697 4698 4771 \subsection{Vector and Image Arithmetic} 4699 4772 \label{sec:arithmetic} … … 5132 5205 5133 5206 \pagebreak 5134 \section{Astronomy- SpecificFunctions}5207 \section{Astronomy-Related Functions} 5135 5208 5136 5209 The previous sections of this document defined basic functionality … … 5147 5220 \item Dates and times 5148 5221 \item Detector and sky positions 5149 \item Astronomical Image Containers5150 5222 \item Astrometry 5151 5223 \item Photometry … … 6185 6257 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5 6186 6258 6187 \subsection{Photometry}6188 6189 \tbd{This section is to be deferred, and for now consists only of6190 place holders, with no functional items.}6191 6192 Photometric observations are performed in an instrumental photometric6193 system, and must be related to other photometric systems. We6194 require a data structure which defines a photometric system, as well6195 as a structure to define the transformation between photometric6196 systems.6197 6198 The photometric system is defined by the psPhotSystem structure.6199 A photometric system is identified by a human-readable \code{name}6200 (ie, SDSS.g, Landolt92.B, GPC1.OTA32.r). Each photometric system is6201 given a unique identifier \code{ID}. Observations taken with a6202 specific camera, detector, and filter represent their own photometric6203 system, and it may be necessary to perform transformations between6204 these systems. Photometric systems associated with observations from6205 a specific camera/detector/filter combination can be associated with6206 those components.6207 \begin{datatype}6208 typedef struct {6209 const int ID; ///< ID number for this photometric system6210 const char *name; ///< Name of photometric system6211 const char *camera; ///< Camera for photometric system6212 const char *filter; ///< Filter used for photometric system6213 const char *detector; ///< Detector used for photometric system6214 } psPhotSystem;6215 \end{datatype}6216 6217 The following structure defines the transformation between two6218 photometric systems.6219 \begin{datatype}6220 typedef struct {6221 psPhotSystem src; ///< Source photometric system6222 psPhotSystem dst; ///< Destination photometric system6223 psPhotSystem pP, pM; ///< Primary color reference6224 psPhotSystem sP, sM; ///< Secondary color reference6225 float pA, sA; ///< Color offset for references6226 psPolynomial3D transform; ///< Transformation from source to destination6227 } psPhotTransform;6228 \end{datatype}6229 6230 The transformation between two photometric systems may depend on the6231 airmass of the observation and on the colors of the object of6232 interest. For a specific observation, such a transformations can be6233 defined as a polynomial function of the color of the star and the6234 airmass of the observations. If sufficient data exists, the6235 transformation between the photometric systems may include more than6236 one color, constraining the curvature of the stellar spectral energy6237 distributions. This latter term may be significant for stars which6238 are highly reddened, for example. Derived photometric quantities may6239 have been corrected for airmass variations, in which case only color6240 terms may be measurable. The structure defines the transformation6241 between a source photometric system (\code{src}) and a target6242 photometric system (\code{dst}). The photometric system of a primary6243 color is defined by \code{pP, pM} such that the color is constructed6244 as $pP - pM$. A secondary color is defined by \code{sP, sM}. For6245 both, a reference color is specified (\code{pA, sA}): the polynomial6246 transformation terms refer to colors in the form $pP - pM - pA$. The6247 transformation is specified as a 3D polynomial. For a star of6248 magnitude $M_{\rm src}$ in the source photometric system, with6249 additional magnitude information in the other systems $M_{\rm pP}$,6250 $M_{\rm pM}$, $M_{\rm sP}$, $M_{\rm sM}$, observed at an airmass of6251 $z$, the magnitude of the star in the target system $M_{\rm dst}$ is6252 given by: $M_{\rm dst} = M_{\rm src} + transform(z, M_{\rm pP} -6253 M_{\rm pM} - pA, M_{\rm sP} - M_{\rm sM} - sA)$.6254 6255 6259 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 6256 6260 6257 6261 %%% Astronomical Images and Astrometry 6258 \include{psLibSDRS_Astrom}6262 % \include{psLibSDRS_Astrom} 6259 6263 6260 6264 \subsection{Astronomical objects}
Note:
See TracChangeset
for help on using the changeset viewer.
