IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 3068


Ignore:
Timestamp:
Jan 19, 2005, 9:46:41 PM (21 years ago)
Author:
eugene
Message:

added source detection pieces (still incomplete)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/doc/modules/ModulesSDRS.tex

    r2818 r3068  
    1 %%% $Id: ModulesSDRS.tex,v 1.26 2004-12-24 02:30:50 price Exp $
     1%%% $Id: ModulesSDRS.tex,v 1.27 2005-01-20 07:46:41 eugene Exp $
    22\documentclass[panstarrs]{panstarrs}
    33
     
    10361036of the same type.
    10371037
     1038\section{Object Detection, Measurement, and Classification Routines}
     1039
     1040\subsection{Overview}
     1041
     1042The process of finding, measurering, and classifying astronomical
     1043sources on images is one of the critical tasks of the IPP or any
     1044astronomical software system.  In this section, we define structures
     1045and functions related to the task of source detection and measurement.
     1046The elements defined in this section are generally low-level
     1047components which can be connected together to construct a complete
     1048object measurement suite.  An example pseudo-C program using these
     1049functions is provided in Appendix~\ref{psphot}. 
     1050
     1051We first define the collection of structures needed to carry
     1052information about the detected sources.  A major challenge is to
     1053define what we mean by an astronomical object in the context of image
     1054source detection.  An astronomical object may be as simple as a
     1055stellar point source, or it may consist of a more complex galaxy which
     1056has smooth extended structure, or it may consist of an irregular
     1057galaxy or galaxy group with substantial and complex sub-structure, or
     1058it may consist of complex non-stellar structures such as planetary
     1059nebular, reflection nebular, outflows and jets. 
     1060
     1061The simplest objects (ie, stars) can be sufficiently modelled by the
     1062point-source function (PSF).  More complex objects (such as simple,
     1063smooth galaxies), may have approximate analytical models which
     1064represent their morphology with more-or-less accuracy.  In the extreme
     1065cases, the objects are not well modelled at all and must be
     1066represented in other ways.  Thus, one aspect of our data structures
     1067must be elements to specify if an object has been represented by a
     1068model, what the model parameters are, and how well it is represented
     1069by the model.  Another aspect of the data structures must be a
     1070representation of the pixels associated with the object so complex
     1071structures may be reference without attempting to supply an analytical
     1072model.  Finally, it is often useful to allow a single complex model to
     1073be represented as a collection of simpler contained structures which
     1074may be modelled.  Thus, the representation of an object must be
     1075capable of identifying children, or substructures, of that object.
     1076
     1077Two additional aspects must be considered.  First, source detection
     1078need no be performed on a single image in isolation: it is necessary
     1079for multiple realizations of the same source in multiple images to be
     1080measured together (whether or not through simultaneous fitting in
     1081multiple bands or via application of the results from one image to
     1082another image).  Second, it may be necessary for object measurements
     1083to be performed on pixels in which no source is actually detectable.
     1084For example, this is a convenient way to provide flux upper limits at
     1085the locations of known objects.
     1086
     1087\subsection{Source Structures}
     1088
     1089We start by defining a single source detected in a single band:
     1090\begin{verbatim}
     1091typedef struct {
     1092  psPeak *peak;
     1093  psPixels *pixels;
     1094  psMoments *moments;
     1095  psModel *models;
     1096  psSourceType type;
     1097} psSource;
     1098\end{verbatim}
     1099
     1100This source has the capacity for several types of measurements.  The
     1101simplest measurement of a source is the location of the peak pixel
     1102associated with the source:
     1103\begin{verbatim}
     1104typedef struct {
     1105  int x;
     1106  int y;
     1107  float counts;
     1108  psPeakType class;
     1109} psPeak;
     1110\end{verbatim}
     1111
     1112A peak pixel may have several features which may be determined when
     1113the peak is found or measured.  These are carried by the
     1114\code{psPeakType} structure.  The \code{PS_PEAK_LONE} represents a
     1115single pixel which is higher than its 8 immediate neighbors.  The
     1116\code{PS_PEAK_EDGE} represents a peak pixel which touching the image
     1117edge.  The \code{PS_PEAK_FLAT} represents a peak pixel which has more
     1118than a specific number of neighbors at the same value, within some
     1119tolarence:
     1120\begin{verbatim}
     1121typedef enum {
     1122  PS_PEAK_LONE;
     1123  PS_PEAK_EDGE;
     1124  PS_PEAK_FLAT;
     1125} psPeakType;
     1126\end{verbatim}
     1127
     1128In addition, the pixels which contain the source may be specified with
     1129the \code{psPixels} element.  A \code{psPixels} collection identifies
     1130a group of pixels by specifying sets of pixel spans:
     1131\begin{verbatim}
     1132typedef struct {
     1133  int nspan;
     1134  int rmin, rmax;
     1135  int cmin, cmax;
     1136  psSpan *s;
     1137} psPixels;
     1138\end{verbatim}
     1139%
     1140\begin{verbatim}
     1141typedef struct {
     1142  short row;
     1143  short col0;
     1144  short col1;
     1145} psSpan;
     1146\end{verbatim}
     1147
     1148One of the simplest measurements which can be made quickly for an
     1149object are the object moments.  We specify a structure to carry the
     1150moment information for a specific source:
     1151
     1152\begin{verbatim}
     1153typedef struct {
     1154  float x;
     1155  float y;
     1156  float Sx;
     1157  float Sy;
     1158  float Sxy;
     1159  float Sum;
     1160  float Peak;
     1161  float Sky;
     1162  int   nPixels;
     1163} psMoments;
     1164\end{verbatim}
     1165
     1166An object may be modelled with some analytical function.  The result
     1167of the model includes the model parameters and their errors, along
     1168with the fit $\Chi^2$.
     1169
     1170\begin{verbatim}
     1171typedef struct {
     1172  psObjectModel type;
     1173  int Nparams;
     1174  float *params;
     1175  float *dparams;
     1176  float chisq;
     1177} psModel;
     1178\end{verbatim}
     1179
     1180\begin{verbatim}
     1181typedef enum {
     1182  PS_MODEL_GAUSS;
     1183  PS_MODEL_PGAUSS;
     1184  PS_MODEL_TWIST_GAUSS;
     1185  PS_MODEL_WAUSS;
     1186  PS_MODEL_SERSIC;
     1187  PS_MODEL_SERSIC_BULGE;
     1188} psModelType;
     1189\end{verbatim}
     1190
     1191\subsection{Basic Object Detection APIs}
     1192
     1193\begin{verbatim}
     1194psVector *pmFindVectorPeaks (psVector vector, float threshold);
     1195\end{verbatim}
     1196
     1197Find all local peaks in the given vector above the given threshold.  A
     1198peak is defined as any element with a value greater than its two
     1199neighbors with a value above the threshold.  Two types of special
     1200cases have to be addressed.  If an element has the same value as the
     1201following element, it is not considered a peak.  If an element has the
     1202same value as the preceeding element (but not the following), then it
     1203is considered a peak.  Note that this rule (arbitrarily) identifies
     1204flat regions by their trailing edge.  At the edges, the element must
     1205be higher than its neighbor, or equal for the end edge.  This rule
     1206again places the peak associated with a flat region which touches the
     1207image edge at the image edge.  The result fo this function is a vector
     1208containing the coordinates of the detected peaks.
     1209
     1210\begin{verbatim}
     1211psList *pmFindImagePeaks (psImage image, float threshold);
     1212\end{verbatim}
     1213
     1214Find all local peaks in the given image above the given threshold.
     1215This function should find all row peaks using
     1216\code{pmFindVectorPeaks}, then test each row peak and exclude peaks
     1217which are not local peaks.  A peak is a local peak if it is higher
     1218than all 8 neighbors.  \tbd{flat region?}  The result of this function
     1219is a list of \code{psPeak} entries.
     1220
     1221\begin{verbatim}
     1222psList *pmCullPeaks (psList peaks, float maxvalue, psRegion valid);
     1223\end{verbatim}
     1224
     1225Remove certain types of peaks from a list of peaks based on the given
     1226criteria.  Peaks should be eliminated if they have a peak value above
     1227the given maximum value limit or if the fall outside the valid
     1228region. 
     1229
     1230\begin{verbatim}
     1231psSource *pmSourceLocalSky (psImage *image, psPeak *peak, float inner_radius, float outer_radius),
     1232\end{verbatim}
     1233
     1234Measure the local sky in the vicinity of the given \code{peak}.  The
     1235image pixels in the square annulus with inner and outer radii as
     1236specified are used to measure the median (clipped mean?)  (statistic
     1237from \code{psStats}?) in the vicinity of the the specified peak
     1238coordinates.  The resulting sky is applied to the \code{psMoments}
     1239element of the allocated \code{psSource} structure.  The input
     1240\code{peak} is also added to the \code{psSource} element, which is
     1241returned.
     1242
     1243\begin{verbatim}
     1244psSource *pmSourceMoments (psImage *image, psSource *source, float radius),
     1245\end{verbatim}
     1246
     1247Measure source moments for the given \code{source}, using the value of
     1248\code{source.moments.sky} provided.  The resulting moment values are
     1249applied to the \code{source.moments} entry, and the source is
     1250retained.  The moments are measured within the given radius of the
     1251\code{source.peak} coordinates.
     1252
     1253\begin{verbatim}
     1254psSource *pmSourceRoughClass (psSource *source, float saturate, float SNlim, psRegion valid);
     1255\end{verbatim}
     1256
     1257\begin{verbatim}
     1258pmSourceFitModel (psImage *image, psSource *source, psModelType model);
     1259\end{verbatim}
     1260
     1261\begin{verbatim}
     1262pmSourceFitModel (psImage *image, psSource *source, psModelType model);
     1263\end{verbatim}
     1264
     1265\subsection{Basic Object Models}
     1266
     1267float PGaussian (psVector *deriv, psVector *params, psVector *x);
     1268
     1269  X = x[0] - param[2];
     1270  Y = x[1] - param[3];
     1271 
     1272  px = param[4]*X;
     1273  py = param[5]*Y;
     1274
     1275  z = 0.5*SQ(px) + 0.5*SQ(py) + param[6]*X*Y;
     1276  r = 1.0 / (1 + z + 0.5*z*z*(1 + z/3)); /* ~ exp (-Z) */
     1277  f = param[1]*r + param[0];
     1278  q = param[1]*r*r*(1 + z + 0.5*z*z);
     1279  /* note difference from gaussian: q = param[1]*r */
     1280
     1281  deriv[0] = +1;
     1282  deriv[1] = +r;
     1283  deriv[2] = q*(2*px*param[4] + param[6]*Y);
     1284  deriv[3] = q*(2*py*param[5] + param[6]*X);
     1285  deriv[4] = -2*q*px*X;
     1286  deriv[5] = -2*q*py*Y;
     1287  deriv[6] = -q*X*Y;
     1288
     1289float Waussian (psVector *deriv, psVector *params, psVector *x);
     1290
     1291  X = x - param[2];
     1292  Y = y - param[2];
     1293 
     1294  px = param[4]*X;
     1295  py = param[5]*Y;
     1296
     1297  z = 0.5*SQ(px) + 0.5*SQ(py) + param[6]*X*Y;
     1298  k = 0.5*z*z*(1 + param[8]*z/3);
     1299  r = 1.0 / (1 + z + param[7]*k); /* ~ exp (-Z) */
     1300  f = param[1]*r + param[0];
     1301  q = param[1]*r*r*(1 + param[7]*z*(1 + param[8]*z/2));
     1302  /* note difference from gaussian: q = param[1]*r */
     1303
     1304  deriv[0] = +1;
     1305  deriv[1] = +r;
     1306  deriv[2] = q*(2*px*param[4] + param[6]*Y);
     1307  deriv[3] = q*(2*py*param[5] + param[6]*X);
     1308  deriv[4] = -2*q*px*X;
     1309  deriv[5] = -2*q*py*Y;
     1310  deriv[6] = -q*X*Y;
     1311  deriv[7] = -100*param[1]*r*r*k;
     1312  deriv[8] = -100*param[1]*r*r*param[7]*(z*z*z)/6;
     1313  /* the values of 100 dampen the swing of param[7,8] */
     1314
     1315float TwistGaussian ()
     1316
     1317  X = x - param[2];
     1318  Y = y - param[3];
     1319 
     1320  px1 = param[4]*X;
     1321  py1 = param[5]*Y;
     1322  px2 = param[7]*X;
     1323  py2 = param[8]*Y;
     1324
     1325  z1 = 0.5*SQ(px1) + 0.5*SQ(py1) + param[4]*X*Y;
     1326  z2 = 0.5*SQ(px2) + 0.5*SQ(py2) + param[9]*X*Y;
     1327
     1328  r = 1.0 / (1 + z1 + pow(z2,Npow));
     1329  f = param[5]*r + param[6];
     1330
     1331  q1 = param[5]*SQ(r);
     1332  q2 = param[5]*SQ(r)*Npow*pow(z2,(Npow-1));
     1333
     1334  deriv[0] = +1;
     1335  deriv[1] = +r;
     1336  deriv[2] = q1*(2*px1*param[4] + param[6]*Y) + q2*(2*px2*param[7] + param[9]*Y);
     1337  deriv[3] = q1*(2*py1*param[5] + param[6]*X) + q2*(2*py2*param[8] + param[9]*X);
     1338
     1339  /* these fudge factors impede the growth of param[4] beyond param[7] */
     1340  f1 = fabs(param[7]) / fabs(param[4]);
     1341  f2 = (f1 < FSCALE) ? 1 : FFACTOR*(f1 - FSCALE) + 1;
     1342  deriv[4] = -2*q1*px1*X*f2;
     1343
     1344  /* these fudge factors impede the growth of param[5] beyond param[8] */
     1345  f1 = fabs(param[8]) / fabs(param[5]);
     1346  f2 = (f1 < FSCALE) ? 1 : FFACTOR*(f1 - FSCALE) + 1;
     1347  deriv[5] = -2*q1*py1*Y*f2;
     1348
     1349  deriv[6] = -q1*X*Y;
     1350
     1351  deriv[7] = -2*q2*px2*X;
     1352  deriv[8] = -2*q2*py2*Y;
     1353  deriv[9] = -q2*X*Y;
     1354
     1355
     1356
    10381357\section{Revision Change Log}
    10391358\input{ChangeLogSDRS.tex}
Note: See TracChangeset for help on using the changeset viewer.