Changeset 6872 for trunk/psModules/src/objects
- Timestamp:
- Apr 17, 2006, 8:01:05 AM (20 years ago)
- Location:
- trunk/psModules/src/objects
- Files:
-
- 29 added
- 11 edited
-
Makefile.am (modified) (2 diffs)
-
models/pmModel_PGAUSS.c (modified) (4 diffs)
-
models/pmModel_QGAUSS.c (modified) (7 diffs)
-
models/pmModel_RGAUSS.c (modified) (2 diffs)
-
models/pmModel_SGAUSS.c (modified) (10 diffs)
-
models/pmModel_ZGAUSS.c (modified) (4 diffs)
-
pmGrowthCurve.c (added)
-
pmGrowthCurve.h (added)
-
pmModel.c (added)
-
pmModel.h (added)
-
pmModelGroup.c (modified) (4 diffs)
-
pmModelGroup.h (modified) (5 diffs)
-
pmMoments.c (added)
-
pmMoments.h (added)
-
pmObjects.h (modified) (4 diffs)
-
pmPSF.h (modified) (5 diffs)
-
pmPSF_IO.c (added)
-
pmPSF_IO.h (added)
-
pmPSFtry.h (modified) (6 diffs)
-
pmPeaks.c (added)
-
pmPeaks.h (added)
-
pmSource.c (added)
-
pmSource.h (added)
-
pmSourceContour.c (added)
-
pmSourceContour.h (added)
-
pmSourceFitModel.c (added)
-
pmSourceFitModel.h (added)
-
pmSourceFitSet.c (added)
-
pmSourceFitSet.h (added)
-
pmSourceIO.c (added)
-
pmSourceIO.h (added)
-
pmSourceIO_CMF.c (added)
-
pmSourceIO_CMP.c (added)
-
pmSourceIO_OBJ.c (added)
-
pmSourceIO_RAW.c (added)
-
pmSourceIO_SX.c (added)
-
pmSourcePhotometry.c (added)
-
pmSourcePhotometry.h (added)
-
pmSourceSky.c (added)
-
pmSourceSky.h (added)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/objects/Makefile.am
r5844 r6872 1 1 noinst_LTLIBRARIES = libpsmoduleobjects.la 2 2 3 libpsmoduleobjects_la_CPPFLAGS = $(SRCINC) $(PSMODULE_CFLAGS) 3 libpsmoduleobjects_la_CPPFLAGS = $(SRCINC) $(PSMODULE_CFLAGS) -I../pslib/ 4 4 libpsmoduleobjects_la_LDFLAGS = -release $(PACKAGE_VERSION) 5 5 libpsmoduleobjects_la_SOURCES = \ 6 pmObjects.c \ 7 pmPSF.c \ 8 pmPSFtry.c \ 9 pmModelGroup.c \ 10 psEllipse.c 6 pmPeaks.c \ 7 pmMoments.c \ 8 pmModel.c \ 9 pmModelGroup.c \ 10 pmSource.c \ 11 pmSourceSky.c \ 12 pmSourceContour.c \ 13 pmSourceFitModel.c \ 14 pmSourcePhotometry.c \ 15 pmSourceIO.c \ 16 pmSourceIO_CMF.c \ 17 pmSourceIO_CMP.c \ 18 pmSourceIO_OBJ.c \ 19 pmSourceIO_SX.c \ 20 pmSourceIO_RAW.c \ 21 pmPSF.c \ 22 pmPSF_IO.c \ 23 pmPSFtry.c \ 24 pmGrowthCurve.c 11 25 12 26 EXTRA_DIST = \ … … 18 32 psmoduleincludedir = $(includedir) 19 33 psmoduleinclude_HEADERS = \ 20 pmObjects.h \ 21 pmPSF.h \ 22 pmPSFtry.h \ 23 pmModelGroup.h \ 24 psEllipse.h 34 pmPeaks.h \ 35 pmMoments.h \ 36 pmModel.h \ 37 pmModelGroup.h \ 38 pmSource.h \ 39 pmSourceSky.h \ 40 pmSourceContour.h \ 41 pmSourceFitModel.h \ 42 pmSourcePhotometry.h \ 43 pmSourceIO.h \ 44 pmPSF.h \ 45 pmPSF_IO.h \ 46 pmPSFtry.h \ 47 pmGrowthCurve.h -
trunk/psModules/src/objects/models/pmModel_PGAUSS.c
r6511 r6872 26 26 27 27 if (deriv != NULL) { 28 // note difference from a pure gaussian: q = PAR[1]*r28 psF32 *dPAR = deriv->data.F32; 29 29 psF32 q = PAR[1]*r*r*t; 30 d eriv->data.F32[0] = +1.0;31 d eriv->data.F32[1] = +r;32 d eriv->data.F32[2] = q*(2.0*px*PAR[4] + PAR[6]*Y);33 d eriv->data.F32[3] = q*(2.0*py*PAR[5] + PAR[6]*X);34 d eriv->data.F32[4] = -2.0*q*px*X;35 d eriv->data.F32[5] = -2.0*q*py*Y;36 d eriv->data.F32[6] = -q*X*Y;30 dPAR[0] = +1.0; 31 dPAR[1] = +r; 32 dPAR[2] = q*(2.0*px*PAR[4] + PAR[6]*Y); 33 dPAR[3] = q*(2.0*py*PAR[5] + PAR[6]*X); 34 dPAR[4] = -2.0*q*px*X; 35 dPAR[5] = -2.0*q*py*Y; 36 dPAR[6] = -q*X*Y; 37 37 } 38 38 return(f); … … 50 50 51 51 beta_lim[0][0].data.F32[0] = 1000; 52 beta_lim[0][0].data.F32[1] = 10000;52 beta_lim[0][0].data.F32[1] = 3e6; 53 53 beta_lim[0][0].data.F32[2] = 5; 54 54 beta_lim[0][0].data.F32[3] = 5; … … 66 66 67 67 params_max[0][0].data.F32[0] = 1e5; 68 params_max[0][0].data.F32[1] = 1e 6;68 params_max[0][0].data.F32[1] = 1e8; 69 69 params_max[0][0].data.F32[2] = 1e4; // this should be set by image dimensions! 70 70 params_max[0][0].data.F32[3] = 1e4; // this should be set by image dimensions! … … 133 133 params[5] = 1.2 / moments->Sy; 134 134 params[6] = 0.0; 135 135 136 return(true); 136 137 } -
trunk/psModules/src/objects/models/pmModel_QGAUSS.c
r6511 r6872 26 26 psF32 py = PAR[5]*Y; 27 27 psF32 z = 0.5*PS_SQR(px) + 0.5*PS_SQR(py) + PAR[6]*X*Y; 28 29 psF32 r = 1.0 / (1 + PAR[7]*z + pow(z, 2.25)); 30 psF32 f = PAR[1]*r + PAR[0]; 28 psF32 zp = pow(z,1.25); 29 30 psF32 r = 1.0 / (1 + PAR[7]*z + z*zp); 31 // test: psF32 r = 1.0 / (1 + PAR[7]*z + PS_SQR(z)); 32 psF32 r1 = PAR[1]*r; 33 psF32 f = r1 + PAR[0]; 31 34 32 35 if (deriv != NULL) { 36 psF32 *dPAR = deriv->data.F32; 37 33 38 // note difference from a pure gaussian: q = params->data.F32[1]*r 34 psF32 t = PAR[1]*r*r; 35 psF32 q = t*(PAR[7] + 2.25*pow(z, 1.25)); 36 37 deriv->data.F32[0] = +1.0; 38 deriv->data.F32[1] = +r; 39 deriv->data.F32[2] = q*(2.0*px*PAR[4] + PAR[6]*Y); 40 deriv->data.F32[3] = q*(2.0*py*PAR[5] + PAR[6]*X); 41 deriv->data.F32[4] = -2.0*q*px*X; 42 deriv->data.F32[5] = -2.0*q*py*Y; 43 deriv->data.F32[6] = -q*X*Y; 44 deriv->data.F32[7] = -t*z; 39 psF32 t = r1*r; 40 psF32 q = t*(PAR[7] + 2.25*zp); 41 // test: psF32 q = t*(PAR[7] + 2*z); 42 43 dPAR[0] = +1.0; 44 dPAR[1] = +r; 45 dPAR[2] = q*(2.0*px*PAR[4] + PAR[6]*Y); 46 dPAR[3] = q*(2.0*py*PAR[5] + PAR[6]*X); 47 dPAR[4] = -2.0*q*px*X; 48 dPAR[5] = -2.0*q*py*Y; 49 dPAR[6] = -q*X*Y; 50 dPAR[7] = -t*z; 45 51 } 46 52 return(f); … … 58 64 59 65 beta_lim[0][0].data.F32[0] = 1000; 60 beta_lim[0][0].data.F32[1] = 10000;66 beta_lim[0][0].data.F32[1] = 3e6; 61 67 beta_lim[0][0].data.F32[2] = 5; 62 68 beta_lim[0][0].data.F32[3] = 5; … … 76 82 77 83 params_max[0][0].data.F32[0] = 1e5; 78 params_max[0][0].data.F32[1] = 1e 6;84 params_max[0][0].data.F32[1] = 1e8; 79 85 params_max[0][0].data.F32[2] = 1e4; // this should be set by image dimensions! 80 86 params_max[0][0].data.F32[3] = 1e4; // this should be set by image dimensions! … … 102 108 params[6] = 0.0; 103 109 params[7] = 1.0; 110 104 111 return(true); 105 112 } … … 119 126 // the area needs to be multiplied by the integral of f(z) 120 127 norm = 0.0; 121 for (z = 0.0 05; z < 50; z += 0.01) {128 for (z = 0.05; z < 50; z += 0.1) { 122 129 f = 1.0 / (1 + PAR[7]*z + pow(z, 2.25)); 130 // test: f = 1.0 / (1 + PAR[7]*z + PS_SQR(z)); 123 131 norm += f; 124 132 } 125 norm *= 0. 01;133 norm *= 0.1; 126 134 127 135 psF64 Flux = PAR[1] * Area * norm; … … 150 158 151 159 // we can do this much better with intelligent choices here 152 for (z = 0.0; z < 20.0; z += dz) {160 for (z = 0.0; z < 30.0; z += dz) { 153 161 f = 1.0 / (1 + PAR[7]*z + pow(z, 2.25)); 162 // test: f = 1.0 / (1 + PAR[7]*z + PS_SQR(z)); 154 163 if (f < limit) 155 164 break; … … 201 210 status &= ((dPAR[1]/PAR[1]) < 0.5); 202 211 203 if ( status)204 return true;205 return false;206 } 212 if (!status) 213 return false; 214 return true; 215 } -
trunk/psModules/src/objects/models/pmModel_RGAUSS.c
r5257 r6872 117 117 psVector *params = model->params; 118 118 119 EllipseAxes axes;120 EllipseShape shape;121 EllipseMoments moments;119 psEllipseAxes axes; 120 psEllipseShape shape; 121 psEllipseMoments moments; 122 122 123 123 moments.x2 = PS_SQR(source->moments->Sx); … … 125 125 moments.xy = source->moments->Sxy; 126 126 127 axes = EllipseMomentsToAxes(moments);128 shape = EllipseAxesToShape(axes);127 axes = psEllipseMomentsToAxes(moments); 128 shape = psEllipseAxesToShape(axes); 129 129 130 130 params->data.F32[0] = source->moments->Sky; -
trunk/psModules/src/objects/models/pmModel_SGAUSS.c
r6511 r6872 17 17 18 18 # define SQ(A)((A)*(A)) 19 psF64 psImageEllipseContour ( EllipseAxes axes, double xc, double yc, psImage *image);19 psF64 psImageEllipseContour (psEllipseAxes axes, double xc, double yc, psImage *image); 20 20 psF64 p_psImageGetElementF64(psImage *a, int i, int j); 21 21 … … 102 102 103 103 // measure the flux for the elliptical contour 104 psF64 psImageEllipseContour ( EllipseAxes axes, double xc, double yc, psImage *image)104 psF64 psImageEllipseContour (psEllipseAxes axes, double xc, double yc, psImage *image) 105 105 { 106 106 … … 149 149 psF32 *params = model->params->data.F32; 150 150 151 EllipseAxes axes;152 EllipseShape shape;153 EllipseMoments moments;151 psEllipseAxes axes; 152 psEllipseShape shape; 153 psEllipseMoments moments; 154 154 155 155 moments.x2 = PS_SQR(sMoments->Sx); … … 158 158 159 159 // solve the math to go from Moments To Shape 160 axes = EllipseMomentsToAxes(moments);161 shape = EllipseAxesToShape(axes);160 axes = psEllipseMomentsToAxes(moments); 161 shape = psEllipseAxesToShape(axes); 162 162 163 163 params[0] = sMoments->Sky; … … 199 199 float f1, f2; 200 200 201 EllipseAxes axes;202 EllipseShape shape;203 EllipseMoments moments;201 psEllipseAxes axes; 202 psEllipseShape shape; 203 psEllipseMoments moments; 204 204 205 205 moments.x2 = PS_SQR(sMoments->Sx); … … 208 208 209 209 // solve the math to go from Moments To Shape 210 axes = EllipseMomentsToAxes(moments);211 shape = EllipseAxesToShape(axes);210 axes = psEllipseMomentsToAxes(moments); 211 shape = psEllipseAxesToShape(axes); 212 212 213 213 params[0] = sMoments->Sky; … … 265 265 psF64 pmModelRadius_SGAUSS (const psVector *params, psF64 flux) 266 266 { 267 psF64 r, z , pr, f;267 psF64 r, z = 0.0, pr, f; 268 268 psF32 *PAR = params->data.F32; 269 269 270 EllipseAxes axes;271 EllipseShape shape;270 psEllipseAxes axes; 271 psEllipseShape shape; 272 272 273 273 if (flux <= 0) … … 283 283 shape.sxy = PAR[6]; 284 284 285 axes = EllipseShapeToAxes (shape);285 axes = psEllipseShapeToAxes (shape); 286 286 psF64 dr = 1.0 / axes.major; 287 287 psF64 limit = flux / PAR[1]; … … 327 327 psF32 dP; 328 328 bool status; 329 EllipseAxes axes;330 EllipseShape shape;329 psEllipseAxes axes; 330 psEllipseShape shape; 331 331 332 332 psF32 *PAR = model->params->data.F32; … … 337 337 shape.sxy = PAR[6]; 338 338 339 axes = EllipseShapeToAxes (shape);339 axes = psEllipseShapeToAxes (shape); 340 340 341 341 dP = 0; -
trunk/psModules/src/objects/models/pmModel_ZGAUSS.c
r5257 r6872 85 85 psF32 *PAR = params->data.F32; 86 86 87 EllipseAxes axes;88 EllipseShape shape;87 psEllipseAxes axes; 88 psEllipseShape shape; 89 89 90 90 if (flux <= 0) … … 100 100 shape.sxy = PAR[6]; 101 101 102 axes = EllipseShapeToAxes (shape);102 axes = psEllipseShapeToAxes (shape); 103 103 psF64 dr = 1.0 / axes.major; 104 104 psF64 limit = flux / PAR[1]; … … 124 124 psVector *params = model->params; 125 125 126 EllipseAxes axes;127 EllipseShape shape;128 EllipseMoments moments;126 psEllipseAxes axes; 127 psEllipseShape shape; 128 psEllipseMoments moments; 129 129 130 130 moments.x2 = PS_SQR(source->moments->Sx); … … 132 132 moments.xy = source->moments->Sxy; 133 133 134 axes = EllipseMomentsToAxes(moments);135 shape = EllipseAxesToShape(axes);134 axes = psEllipseMomentsToAxes(moments); 135 shape = psEllipseAxesToShape(axes); 136 136 137 137 params->data.F32[0] = source->moments->Sky; -
trunk/psModules/src/objects/pmModelGroup.c
r5844 r6872 1 # include "pmModelGroup.h" 2 1 /** @file pmModelGroup.c 2 * 3 * Functions to define and manipulate object model attributes 4 * 5 * @author GLG, MHPCC 6 * @author EAM, IfA 7 * 8 * @version $Revision: 1.3 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2006-04-17 18:01:05 $ 10 * 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii 12 * 13 */ 14 15 #include <stdio.h> 16 #include <math.h> 17 #include <string.h> 18 #include "pslib.h" 19 #include "psEllipse.h" 20 #include "pmHDU.h" 21 #include "pmFPA.h" 22 #include "pmPeaks.h" 23 #include "pmMoments.h" 24 #include "pmGrowthCurve.h" 25 #include "pmModel.h" 26 #include "pmPSF.h" 27 #include "pmSource.h" 28 #include "pmModelGroup.h" 29 30 // XXX shouldn't these be defined for us in pslib.h ??? 3 31 double hypot(double x, double y); 4 32 double sqrt (double x); 5 33 6 #include "psEllipse.h"7 34 #include "models/pmModel_GAUSS.c" 8 35 #include "models/pmModel_PGAUSS.c" … … 25 52 if (modelGroup == NULL) 26 53 return; 27 psFree (modelGroup);28 54 return; 29 55 } … … 60 86 } 61 87 Nmodels = Nnew; 88 return; 89 } 90 91 void pmModelGroupCleanup (void) 92 { 93 94 psFree (models); 62 95 return; 63 96 } … … 153 186 return (models[type].name); 154 187 } 188 189 /****************************************************************************** 190 pmSourceModelGuess(source, model): This function allocates a new 191 pmModel structure based on the given modelType specified in the argument list. 192 The corresponding pmModelGuess function is returned, and used to 193 supply the values of the params array in the pmModel structure. 194 195 XXX: Many parameters are based on the src->moments structure, which is in 196 image, not subImage coords. Therefore, the calls to the model evaluation 197 functions will be in image, not subImage coords. Remember this. 198 *****************************************************************************/ 199 pmModel *pmSourceModelGuess(pmSource *source, 200 pmModelType modelType) 201 { 202 psTrace(__func__, 3, "---- %s() begin ----\n", __func__); 203 PS_ASSERT_PTR_NON_NULL(source->moments, false); 204 PS_ASSERT_PTR_NON_NULL(source->peak, false); 205 206 pmModel *model = pmModelAlloc(modelType); 207 208 pmModelGuessFunc modelGuessFunc = pmModelGuessFunc_GetFunction(modelType); 209 modelGuessFunc(model, source); 210 psTrace(__func__, 3, "---- %s() end ----\n", __func__); 211 return(model); 212 } 213 -
trunk/psModules/src/objects/pmModelGroup.h
r5844 r6872 9 9 * @author EAM, IfA 10 10 * 11 * @version $Revision: 1. 2$ $Name: not supported by cvs2svn $12 * @date $Date: 200 5-12-24 01:24:32$11 * @version $Revision: 1.3 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2006-04-17 18:01:05 $ 13 13 * 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii 15 15 * 16 16 */ 17 #include "pmObjects.h" 18 #include "pmPSF.h" 19 /** 20 * 21 * This function returns the number of parameters used by the listed function. 22 * 17 18 # ifndef PM_MODEL_GROUP_H 19 # define PM_MODEL_GROUP_H 20 21 // This function is the model chi-square minimization function for this model. 22 typedef psMinimizeLMChi2Func pmModelFunc; 23 24 // This function returns the integrated flux for the given model parameters. 25 typedef psF64 (*pmModelFlux)(const psVector *params); 26 27 28 // This function returns the radius at which the given model and parameters 29 // achieves the given flux. 30 typedef psF64 (*pmModelRadius)(const psVector *params, double flux); 31 32 /* This function sets the model parameter limits vectors for the given model 33 */ 34 typedef bool (*pmModelLimits)(psVector **beta_lim, psVector **params_min, psVector **params_max); 35 36 /* This function provides the model guess parameters based on the details of 37 * the given source. 38 */ 39 typedef bool (*pmModelGuessFunc)(pmModel *model, pmSource *source); 40 41 42 /* This function constructs the PSF model for the given source based on the 43 * supplied psf and the EXT model for the object. 44 */ 45 typedef bool (*pmModelFromPSFFunc)(pmModel *modelPSF, pmModel *modelEXT, pmPSF *psf); 46 47 /* This function returns the success / failure status of the given model fit 48 */ 49 typedef bool (*pmModelFitStatusFunc)(pmModel *model); 50 51 /* Every model instance belongs to a class of models, defined by the value of 52 * the pmModelType type entry. Various functions need access to information about 53 * each of the models. Some of this information varies from model to model, and 54 * may depend on the current parameter values or other data quantities. In order 55 * to keep the code from requiring the information about each model to be coded 56 * into the low-level fitting routines, we define a collection of functions which 57 * allow us to abstract this type of model-dependent information. These generic 58 * functions take the model type and return the corresponding function pointer 59 * for the specified model. Each model is defined by creating this collection of 60 * specific functions, and placing them in a single file for each model. We 61 * define the following structure to carry the collection of information about 62 * the models. 63 */ 64 typedef struct 65 { 66 char *name; 67 int nParams; 68 pmModelFunc modelFunc; 69 pmModelFlux modelFlux; 70 pmModelRadius modelRadius; 71 pmModelLimits modelLimits; 72 pmModelGuessFunc modelGuessFunc; 73 pmModelFromPSFFunc modelFromPSFFunc; 74 pmModelFitStatusFunc modelFitStatusFunc; 75 } 76 pmModelGroup; 77 78 // allocate a pmModelGroup to hold nModels entries 79 pmModelGroup *pmModelGroupAlloc (int nModels); 80 81 // initialize the internal (static) model group with the default models 82 void pmModelGroupInit (void); 83 84 // free the internal (static) model group 85 void pmModelGroupCleanup (void); 86 87 // add a new model to the internal (static) model group 88 void pmModelGroupAdd (pmModelGroup *model); 89 90 /* This function returns the number of parameters used by the listed function. 23 91 */ 24 92 int pmModelParameterCount( … … 27 95 28 96 29 /** 30 * 31 * This function returns the user-space model names for the specified model type. 32 * 97 /* This function returns the user-space model names for the specified model type. 33 98 */ 34 99 char *pmModelGetType( … … 46 111 ); 47 112 48 49 #ifndef PM_MODEL_GROUP_H50 #define PM_MODEL_GROUP_H51 52 /**53 *54 * This function is the model chi-square minimization function for this model.55 *56 */57 typedef psMinimizeLMChi2Func pmModelFunc;58 59 60 /**61 *62 * This function returns the integrated flux for the given model parameters.63 */64 typedef psF64 (*pmModelFlux)(const psVector *params);65 66 67 /**68 *69 * This function returns the radius at which the given model and parameters70 * achieves the given flux.71 *72 */73 typedef psF64 (*pmModelRadius)(const psVector *params, double flux);74 75 /**76 *77 * This function sets the model parameter limits vectors for the given model78 *79 */80 typedef bool (*pmModelLimits)(psVector **beta_lim, psVector **params_min, psVector **params_max);81 82 /**83 *84 * This function provides the model guess parameters based on the details of85 * the given source.86 *87 */88 typedef bool (*pmModelGuessFunc)(pmModel *model, pmSource *source);89 90 91 /**92 *93 * This function constructs the PSF model for the given source based on the94 * supplied psf and the FLT model for the object.95 *96 */97 typedef bool (*pmModelFromPSFFunc)(pmModel *modelPSF, pmModel *modelFLT, pmPSF *psf);98 99 /**100 *101 * This function returns the success / failure status of the given model fit102 *103 */104 typedef bool (*pmModelFitStatusFunc)(pmModel *model);105 106 113 /** 107 114 * … … 110 117 * 111 118 */ 112 113 119 114 120 /** … … 177 183 178 184 185 /** pmSourceModelGuess() 186 * 187 * Convert available data to an initial guess for the given model. This 188 * function allocates a pmModel entry for the pmSource structure based on the 189 * provided model selection. The method of defining the model parameter guesses 190 * are specified for each model below. The guess values are placed in the model 191 * parameters. The function returns TRUE on success or FALSE on failure. 192 * 193 */ 194 pmModel *pmSourceModelGuess( 195 pmSource *source, ///< The input pmSource 196 pmModelType model ///< The type of model to be created. 197 ); 179 198 180 181 /** 182 * 183 * Every model instance belongs to a class of models, defined by the value of 184 * the pmModelType type entry. Various functions need access to information about 185 * each of the models. Some of this information varies from model to model, and 186 * may depend on the current parameter values or other data quantities. In order 187 * to keep the code from requiring the information about each model to be coded 188 * into the low-level fitting routines, we define a collection of functions which 189 * allow us to abstract this type of model-dependent information. These generic 190 * functions take the model type and return the corresponding function pointer 191 * for the specified model. Each model is defined by creating this collection of 192 * specific functions, and placing them in a single file for each model. We 193 * define the following structure to carry the collection of information about 194 * the models. 195 * 196 */ 197 typedef struct 198 { 199 char *name; 200 int nParams; 201 pmModelFunc modelFunc; 202 pmModelFlux modelFlux; 203 pmModelRadius modelRadius; 204 pmModelLimits modelLimits; 205 pmModelGuessFunc modelGuessFunc; 206 pmModelFromPSFFunc modelFromPSFFunc; 207 pmModelFitStatusFunc modelFitStatusFunc; 208 } 209 pmModelGroup; 210 211 // allocate a pmModelGroup to hold nModels entries 212 pmModelGroup *pmModelGroupAlloc (int nModels); 213 214 // initialize the internal (static) model group with the default models 215 void pmModelGroupInit (void); 216 217 // add a new model to the internal (static) model group 218 void pmModelGroupAdd (pmModelGroup *model); 219 220 # endif 199 # endif /* PM_MODEL_GROUP_H */ -
trunk/psModules/src/objects/pmObjects.h
r5844 r6872 10 10 * @author GLG, MHPCC 11 11 * 12 * @version $Revision: 1. 5$ $Name: not supported by cvs2svn $13 * @date $Date: 200 5-12-24 01:24:32$12 * @version $Revision: 1.6 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2006-04-17 18:01:05 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 27 27 #include <math.h> 28 28 #include "pslib.h" 29 #include "pmAstrometry.h"30 /**31 * In the object analysis process, we will use specific mask values to mark the32 * image pixels. The following structure defines the relevant mask values.33 *34 * XXX: This is probably a bad solution: we will want to set mask values35 * outside of the PSPHOT code. Perhaps we can set up a registered set of mask36 * values with specific meanings that other functions can add to or define?37 */38 typedef enum {39 PSPHOT_MASK_CLEAR = 0x00,40 PSPHOT_MASK_INVALID = 0x01,41 PSPHOT_MASK_SATURATED = 0x02,42 PSPHOT_MASK_MARKED = 0x08,43 } psphotMaskValues;44 45 46 /** pmPeakType47 *48 * A peak pixel may have several features which may be determined when the49 * peak is found or measured. These are specified by the pmPeakType enum.50 * PM_PEAK_LONE represents a single pixel which is higher than its 8 immediate51 * neighbors. The PM_PEAK_EDGE represents a peak pixel which touching the image52 * edge. The PM_PEAK_FLAT represents a peak pixel which has more than a specific53 * number of neighbors at the same value, within some tolarence:54 *55 */56 typedef enum {57 PM_PEAK_LONE, ///< Isolated peak.58 PM_PEAK_EDGE, ///< Peak on edge.59 PM_PEAK_FLAT, ///< Peak has equal-value neighbors.60 PM_PEAK_UNDEF ///< Undefined.61 } pmPeakType;62 63 64 /** pmPeak data structure65 *66 * A source has the capacity for several types of measurements. The67 * simplest measurement of a source is the location and flux of the peak pixel68 * associated with the source:69 *70 */71 typedef struct72 {73 int x; ///< X-coordinate of peak pixel.74 int y; ///< Y-coordinate of peak pixel.75 float counts; ///< Value of peak pixel (above sky?).76 pmPeakType class; ///< Description of peak.77 }78 pmPeak;79 80 81 /** pmMoments data structure82 *83 * One of the simplest measurements which can be made quickly for an object84 * are the object moments. We specify a structure to carry the moment information85 * for a specific source:86 *87 */88 typedef struct89 {90 float x; ///< X-coord of centroid.91 float y; ///< Y-coord of centroid.92 float Sx; ///< x-second moment.93 float Sy; ///< y-second moment.94 float Sxy; ///< xy cross moment.95 float Sum; ///< Pixel sum above sky (background).96 float Peak; ///< Peak counts above sky.97 float Sky; ///< Sky level (background).98 float SN; ///< approx signal-to-noise99 int nPixels; ///< Number of pixels used.100 }101 pmMoments;102 103 104 /** pmPSFClump data structure105 *106 * A collection of object moment measurements can be used to determine107 * approximate object classes. The key to this analysis is the location and108 * statistics (in the second-moment plane,109 *110 */111 typedef struct112 {113 float X;114 float dX;115 float Y;116 float dY;117 }118 pmPSFClump;119 120 // type of model carried by the pmModel structure121 typedef int pmModelType;122 123 typedef enum {124 PM_MODEL_UNTRIED, ///< model fit not yet attempted125 PM_MODEL_SUCCESS, ///< model fit succeeded126 PM_MODEL_NONCONVERGE, ///< model fit did not converge127 PM_MODEL_OFFIMAGE, ///< model fit drove out of range128 PM_MODEL_BADARGS ///< model fit called with invalid args129 } pmModelStatus;130 131 /** pmModel data structure132 *133 * Every source may have two types of models: a PSF model and a FLT (floating)134 * model. The PSF model represents the best fit of the image PSF to the specific135 * object. In this case, the PSF-dependent parameters are specified for the136 * object by the PSF, not by the fit. The FLT model represents the best fit of137 * the given model to the object, with all parameters floating in the fit.138 *139 */140 typedef struct141 {142 pmModelType type; ///< Model to be used.143 psVector *params; ///< Paramater values.144 psVector *dparams; ///< Parameter errors.145 float chisq; ///< Fit chi-squared.146 int nDOF; ///< number of degrees of freedom147 int nIter; ///< number of iterations to reach min148 int status; ///< fit status149 float radius; ///< fit radius actually used150 }151 pmModel;152 153 /** pmSourceType enumeration154 *155 * A given source may be identified as most-likely to be one of several source156 * types. The pmSource entry pmSourceType defines the current best-guess for this157 * source.158 *159 * XXX: The values given below are currently illustrative and will require160 * some modification as the source classification code is developed. (TBD)161 *162 */163 typedef enum {164 PM_SOURCE_DEFECT, ///< a cosmic-ray165 PM_SOURCE_SATURATED, ///< random saturated pixels166 167 PM_SOURCE_SATSTAR, ///< a saturated star168 PM_SOURCE_PSFSTAR, ///< a PSF star169 PM_SOURCE_GOODSTAR, ///< a good-quality star170 171 PM_SOURCE_POOR_FIT_PSF, ///< poor quality PSF fit172 PM_SOURCE_FAIL_FIT_PSF, ///< failed to get a good PSF fit173 PM_SOURCE_FAINTSTAR, ///< below S/N cutoff174 175 PM_SOURCE_GALAXY, ///< an extended object (galaxy)176 PM_SOURCE_FAINT_GALAXY, ///< a galaxy below S/N cutoff177 PM_SOURCE_DROP_GALAXY, ///< ?178 PM_SOURCE_FAIL_FIT_GAL, ///< failed on the galaxy fit179 PM_SOURCE_POOR_FIT_GAL, ///< poor quality galaxy fit180 181 PM_SOURCE_OTHER, ///< unidentified182 } pmSourceType;183 184 /** pmSource data structure185 *186 * This source has the capacity for several types of measurements. The187 * simplest measurement of a source is the location and flux of the peak pixel188 * associated with the source:189 *190 */191 typedef struct192 {193 pmPeak *peak; ///< Description of peak pixel.194 psImage *pixels; ///< Rectangular region including object pixels.195 psImage *weight; ///< Image variance.196 psImage *mask; ///< Mask which marks pixels associated with objects.197 pmMoments *moments; ///< Basic moments measure for the object.198 pmModel *modelPSF; ///< PSF Model fit (parameters and type)199 pmModel *modelFLT; ///< FLT (floating) Model fit (parameters and type).200 pmSourceType type; ///< Best identification of object.201 float apMag;202 float fitMag;203 }204 pmSource;205 206 207 /** pmPeakAlloc()208 *209 * @return pmPeak* newly allocated pmPeak with all internal pointers set to NULL210 */211 pmPeak *pmPeakAlloc(212 int x, ///< Row-coordinate in image space213 int y, ///< Col-coordinate in image space214 float counts, ///< The value of the peak pixel215 pmPeakType class ///< The type of peak pixel216 );217 218 219 /** pmMomentsAlloc()220 *221 */222 pmMoments *pmMomentsAlloc();223 224 225 /** pmModelAlloc()226 *227 */228 pmModel *pmModelAlloc(pmModelType type);229 230 231 /** pmSourceAlloc()232 *233 */234 pmSource *pmSourceAlloc();235 236 237 /** pmFindVectorPeaks()238 *239 * Find all local peaks in the given vector above the given threshold. A peak240 * is defined as any element with a value greater than its two neighbors and with241 * a value above the threshold. Two types of special cases must be addressed.242 * Equal value elements: If an element has the same value as the following243 * element, it is not considered a peak. If an element has the same value as the244 * preceding element (but not the following), then it is considered a peak. Note245 * that this rule (arbitrarily) identifies flat regions by their trailing edge.246 * Edge cases: At start of the vector, the element must be higher than its247 * neighbor. At the end of the vector, the element must be higher or equal to its248 * neighbor. These two rules again places the peak associated with a flat region249 * which touches the image edge at the image edge. The result of this function is250 * a vector containing the coordinates (element number) of the detected peaks251 * (type psU32).252 *253 */254 psVector *pmFindVectorPeaks(255 const psVector *vector, ///< The input vector (float)256 float threshold ///< Threshold above which to find a peak257 );258 259 260 /** pmFindImagePeaks()261 *262 * Find all local peaks in the given image above the given threshold. This263 * function should find all row peaks using pmFindVectorPeaks, then test each row264 * peak and exclude peaks which are not local peaks. A peak is a local peak if it265 * has a higher value than all 8 neighbors. If the peak has the same value as its266 * +y neighbor or +x neighbor, it is NOT a local peak. If any other neighbors267 * have an equal value, the peak is considered a valid peak. Note two points:268 * first, the +x neighbor condition is already enforced by pmFindVectorPeaks.269 * Second, these rules have the effect of making flat-topped regions have single270 * peaks at the (+x,+y) corner. When selecting the peaks, their type must also be271 * set. The result of this function is an array of pmPeak entries.272 *273 */274 psArray *pmFindImagePeaks(275 const psImage *image, ///< The input image where peaks will be found (float)276 float threshold ///< Threshold above which to find a peak277 );278 279 280 /** pmCullPeaks()281 *282 * Eliminate peaks from the psList that have a peak value above the given283 * maximum, or fall outside the valid region.284 *285 */286 psList *pmCullPeaks(287 psList *peaks, ///< The psList of peaks to be culled288 float maxValue, ///< Cull peaks above this value289 const psRegion valid ///< Cull peaks otside this psRegion290 );291 292 293 /** pmPeaksSubset()294 *295 * Create a new peaks array, removing certain types of peaks from the input296 * array of peaks based on the given criteria. Peaks should be eliminated if they297 * have a peak value above the given maximum value limit or if the fall outside298 * the valid region. The result of the function is a new array with a reduced299 * number of peaks.300 *301 */302 psArray *pmPeaksSubset(303 psArray *peaks, ///< Add comment.304 float maxvalue, ///< Add comment.305 const psRegion valid ///< Add comment.306 );307 308 309 /** pmSourceDefinePixels()310 *311 * Define psImage subarrays for the source located at coordinates x,y on the312 * image set defined by readout. The pixels defined by this operation consist of313 * a square window (of full width 2Radius+1) centered on the pixel which contains314 * the given coordinate, in the frame of the readout. The window is defined to315 * have limits which are valid within the boundary of the readout image, thus if316 * the radius would fall outside the image pixels, the subimage is truncated to317 * only consist of valid pixels. If readout->mask or readout->weight are not318 * NULL, matching subimages are defined for those images as well. This function319 * fails if no valid pixels can be defined (x or y less than Radius, for320 * example). This function should be used to define a region of interest around a321 * source, including both source and sky pixels.322 *323 * XXX: must code this.324 *325 */326 // XXX: Uncommenting the pmReadout causes compile errors.327 bool pmSourceDefinePixels(328 pmSource *mySource, ///< Add comment.329 pmReadout *readout, ///< Add comment.330 psF32 x, ///< Add comment.331 psF32 y, ///< Add comment.332 psF32 Radius ///< Add comment.333 );334 335 336 /** pmSourceLocalSky()337 *338 * Measure the local sky in the vicinity of the given source. The Radius339 * defines the square aperture in which the moments will be measured. This340 * function assumes the source pixels have been defined, and that the value of341 * Radius here is smaller than the value of Radius used to define the pixels. The342 * annular region not contained within the radius defined here is used to measure343 * the local background in the vicinity of the source. The local background344 * measurement uses the specified statistic passed in via the statsOptions entry.345 * This function allocates the pmMoments structure. The resulting sky is used to346 * set the value of the pmMoments.sky element of the provided pmSource structure.347 *348 */349 bool pmSourceLocalSky(350 pmSource *source, ///< The input image (float)351 psStatsOptions statsOptions, ///< The statistic used in calculating the background sky352 float Radius ///< The inner radius of the square annulus to exclude353 );354 355 356 /** pmSourceMoments()357 *358 * Measure source moments for the given source, using the value of359 * source.moments.sky provided as the local background value and the peak360 * coordinates as the initial source location. The resulting moment values are361 * applied to the source.moments entry, and the source is returned. The moments362 * are measured within the given circular radius of the source.peak coordinates.363 * The return value indicates the success (TRUE) of the operation.364 *365 */366 bool pmSourceMoments(367 pmSource *source, ///< The input pmSource for which moments will be computed368 float radius ///< Use a circle of pixels around the peak369 );370 371 372 /** pmSourcePSFClump()373 *374 * We use the source moments to make an initial, approximate source375 * classification, and as part of the information needed to build a PSF model for376 * the image. As long as the PSF shape does not vary excessively across the377 * image, the sources which are represented by a PSF (the start) will have very378 * similar second moments. The function pmSourcePSFClump searches a collection of379 * sources with measured moments for a group with moments which are all very380 * similar. The function returns a pmPSFClump structure, representing the381 * centroid and size of the clump in the sigma_x, sigma_y second-moment plane.382 *383 * The goal is to identify and characterize the stellar clump within the384 * sigma_x, sigma_y second-moment plane. To do this, an image is constructed to385 * represent this plane. The units of sigma_x and sigma_y are in image pixels. A386 * pixel in this analysis image represents 0.1 pixels in the input image. The387 * dimensions of the image need only be 10 pixels. The peak pixel in this image388 * (above a threshold of half of the image maximum) is found. The coordinates of389 * this peak pixel represent the 2D mode of the sigma_x, sigma_y distribution.390 * The sources with sigma_x, sigma_y within 0.2 pixels of this value are then391 * * used to calculate the median and standard deviation of the sigma_x, sigma_y392 * values. These resulting values are returned via the pmPSFClump structure.393 *394 * The return value indicates the success (TRUE) of the operation.395 *396 * XXX: Limit the S/N of the candidate sources (part of Metadata)? (TBD).397 * XXX: Save the clump parameters on the Metadata (TBD)398 *399 */400 pmPSFClump pmSourcePSFClump(401 psArray *source, ///< The input pmSource402 psMetadata *metadata ///< Contains classification parameters403 );404 405 406 /** pmSourceRoughClass()407 *408 * Based on the specified data values, make a guess at the source409 * classification. The sources are provides as a psArray of pmSource entries.410 * Definable parameters needed to make the classification are provided to the411 * routine with the psMetadata structure. The rules (in SDRS) refer to values which412 * can be extracted from the metadata using the given keywords. Except as noted,413 * the data type for these parameters are psF32.414 *415 */416 bool pmSourceRoughClass(417 psArray *source, ///< The input pmSource418 psMetadata *metadata, ///< Contains classification parameters419 pmPSFClump clump ///< Statistics about the PSF clump420 );421 422 423 /** pmSourceModelGuess()424 *425 * Convert available data to an initial guess for the given model. This426 * function allocates a pmModel entry for the pmSource structure based on the427 * provided model selection. The method of defining the model parameter guesses428 * are specified for each model below. The guess values are placed in the model429 * parameters. The function returns TRUE on success or FALSE on failure.430 *431 */432 pmModel *pmSourceModelGuess(433 pmSource *source, ///< The input pmSource434 pmModelType model ///< The type of model to be created.435 );436 437 438 /** pmContourType439 *440 * Only one type is defined at present.441 *442 */443 typedef enum {444 PS_CONTOUR_CRUDE,445 PS_CONTOUR_UNKNOWN01,446 PS_CONTOUR_UNKNOWN02447 } pmContourType;448 449 450 /** pmSourceContour()451 *452 * Find points in a contour for the given source at the given level. If type453 * is PM_CONTOUR_CRUDE, the contour is found by starting at the source peak,454 * running along each pixel row until the level is crossed, then interpolating to455 * the level coordinate for that row. This is done for each row, with the456 * starting point determined by the midpoint of the previous row, until the457 * starting point has a value below the contour level. The returned contour458 * consists of two vectors giving the x and y coordinates of the contour levels.459 * This function may be used as part of the model guess inputs. Other contour460 * types may be specified in the future for more refined contours (TBD)461 *462 */463 psArray *pmSourceContour(464 pmSource *source, ///< The input pmSource465 const psImage *image, ///< The input image (float) (this arg should be removed)466 float level, ///< The level of the contour467 pmContourType mode ///< Currently this must be PS_CONTOUR_CRUDE468 );469 470 471 /** pmSourceFitModel()472 *473 * Fit the requested model to the specified source. The starting guess for the474 * model is given by the input source.model parameter values. The pixels of475 * interest are specified by the source.pixelsand source.maskentries. This476 * function calls psMinimizeLMChi2() on the image data. The function returns TRUE477 * on success or FALSE on failure.478 *479 */480 bool pmSourceFitModel(481 pmSource *source, ///< The input pmSource482 pmModel *model, ///< model to be fitted483 const bool PSF ///< Treat model as PSF or FLT?484 );485 486 487 /** pmModelFitStatus()488 *489 * This function wraps the call to the model-specific function returned by490 * pmModelFitStatusFunc_GetFunction. The model-specific function examines the491 * model parameters, parameter errors, Chisq, S/N, and other parameters available492 * from model to decide if the particular fit was successful or not.493 *494 * XXX: Must code this.495 *496 */497 bool pmModelFitStatus(498 pmModel *model ///< Add comment.499 );500 501 502 /** pmSourceAddModel()503 *504 * Add the given source model flux to/from the provided image. The boolean505 * option center selects if the source is re-centered to the image center or if506 * it is placed at its centroid location. The boolean option sky selects if the507 * background sky is applied (TRUE) or not. The pixel range in the target image508 * is at most the pixel range specified by the source.pixels image. The success509 * status is returned.510 *511 */512 bool pmSourceAddModel(513 psImage *image, ///< The output image (float)514 psImage *mask, ///< The image pixel mask (valid == 0)515 pmModel *model, ///< The input pmModel516 bool center, ///< A boolean flag that determines whether pixels are centered517 bool sky ///< A boolean flag that determines if the sky is subtracted518 );519 520 521 /** pmSourceSubModel()522 *523 * Subtract the given source model flux to/from the provided image. The524 * boolean option center selects if the source is re-centered to the image center525 * or if it is placed at its centroid location. The boolean option sky selects if526 * the background sky is applied (TRUE) or not. The pixel range in the target527 * image is at most the pixel range specified by the source.pixels image. The528 * success status is returned.529 *530 */531 bool pmSourceSubModel(532 psImage *image, ///< The output image (float)533 psImage *mask, ///< The image pixel mask (valid == 0)534 pmModel *model, ///< The input pmModel535 bool center, ///< A boolean flag that determines whether pixels are centered536 bool sky ///< A boolean flag that determines if the sky is subtracted537 );538 539 540 /**541 *542 * The function returns both the magnitude of the fit, defined as -2.5log(flux),543 * where the flux is integrated under the model, theoretically from a radius of 0544 * to infinity. In practice, we integrate the model beyond 50sigma. The aperture magnitude is545 * defined as -2.5log(flux) , where the flux is summed for all pixels which are546 * not excluded by the aperture mask. The model flux is calculated by calling the547 * model-specific function provided by pmModelFlux_GetFunction.548 *549 * XXX: must code this.550 *551 */552 bool pmSourcePhotometry(553 float *fitMag, ///< integrated fit magnitude554 float *obsMag, ///< aperture flux magnitude555 pmModel *model, ///< model used for photometry556 psImage *image, ///< image pixels to be used557 psImage *mask ///< mask of pixels to ignore558 );559 560 29 561 30 /** … … 563 32 * This function converts the source classification into the closest available 564 33 * approximation to the Dophot classification scheme: 34 * XXX EAM : fix this to use current source classification scheme 565 35 * 566 36 * PM_SOURCE_DEFECT: 8 … … 598 68 ); 599 69 600 /** pmSourceFitModel_v5()601 *602 * Fit the requested model to the specified source. The starting guess for the603 * model is given by the input source.model parameter values. The pixels of604 * interest are specified by the source.pixelsand source.maskentries. This605 * function calls psMinimizeLMChi2() on the image data. The function returns TRUE606 * on success or FALSE on failure.607 *608 */609 bool pmSourceFitModel_v5(610 pmSource *source, ///< The input pmSource611 pmModel *model, ///< model to be fitted612 const bool PSF ///< Treat model as PSF or FLT?613 );614 615 616 /** pmSourceFitModel_v7()617 *618 * Fit the requested model to the specified source. The starting guess for the619 * model is given by the input source.model parameter values. The pixels of620 * interest are specified by the source.pixelsand source.maskentries. This621 * function calls psMinimizeLMChi2() on the image data. The function returns TRUE622 * on success or FALSE on failure.623 *624 */625 bool pmSourceFitModel_v7(626 pmSource *source, ///< The input pmSource627 pmModel *model, ///< model to be fitted628 const bool PSF ///< Treat model as PSF or FLT?629 );630 631 632 /** pmSourcePhotometry()633 *634 * XXX: Need descriptions635 *636 */637 bool pmSourcePhotometry(638 float *fitMag,639 float *obsMag,640 pmModel *model,641 psImage *image,642 psImage *mask643 );644 645 /** pmModelEval()646 *647 * XXX: Need descriptions648 *649 */650 psF32 pmModelEval(651 pmModel *model,652 psImage *image,653 psS32 col,654 psS32 row655 );656 70 657 71 #endif -
trunk/psModules/src/objects/pmPSF.h
r5255 r6872 6 6 * @author EAM, IfA 7 7 * 8 * @version $Revision: 1. 1$ $Name: not supported by cvs2svn $9 * @date $Date: 200 5-10-10 19:53:40$8 * @version $Revision: 1.2 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2006-04-17 18:01:05 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 15 15 # ifndef PM_PSF_H 16 16 # define PM_PSF_H 17 18 17 19 18 /** pmPSF data structure … … 33 32 pmModelType type; ///< PSF Model in use 34 33 psArray *params; ///< Model parameters (psPolynomial2D) 35 float chisq; ///< PSF goodness statistic 36 float ApResid; ///< ??? 37 float dApResid; ///< ??? 38 float skyBias; ///< ??? 34 psPolynomial1D *ChiTrend; ///< Chisq vs flux fit (correction for systematic errors) 35 psPolynomial4D *ApTrend; ///< ApResid vs (x,y,rflux) (rflux = ten(0.4*mInst) 36 pmGrowthCurve *growth; ///< apMag vs Radius 37 float ApResid; ///< apMag - psfMag (for PSF stars) 38 float dApResid; ///< scatter of ApResid 39 float skyBias; ///< implied residual sky offset from ApResid fit 40 float skySat; ///< roll-over of ApResid fit 41 float chisq; ///< PSF goodness statistic (unused??) 39 42 int nPSFstars; ///< number of stars used to measure PSF 43 int nApResid; ///< number of stars used to measure ApResid 44 bool poissonErrors; 40 45 } 41 46 pmPSF; 42 47 48 typedef enum { 49 PM_PSF_NONE, 50 PM_PSF_CONSTANT, 51 PM_PSF_SKYBIAS, 52 PM_PSF_SKYSAT, 53 PM_PSF_XY_LIN, 54 PM_PSF_XY_QUAD, 55 PM_PSF_SKY_XY_LIN, 56 PM_PSF_SKYSAT_XY_LIN, 57 PM_PSF_ALL 58 } pmPSF_ApTrendOptions; 43 59 44 60 /** … … 48 64 */ 49 65 pmPSF *pmPSFAlloc( 50 pmModelType type ///< Add comment 66 pmModelType type, // type of model for PSF 67 bool poissonErrors ///< use poissonian errors or not? 51 68 ); 52 69 … … 85 102 ); 86 103 104 bool pmPSF_MaskApTrend (pmPSF *psf, pmPSF_ApTrendOptions option); 105 87 106 # endif -
trunk/psModules/src/objects/pmPSFtry.h
r5844 r6872 6 6 * @author EAM, IfA 7 7 * 8 * @version $Revision: 1. 3$ $Name: not supported by cvs2svn $9 * @date $Date: 200 5-12-24 01:24:32$8 * @version $Revision: 1.4 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2006-04-17 18:01:05 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 18 18 19 19 /** 20 * 20 * 21 21 * This structure contains a pointer to the collection of sources which will 22 22 * be used to test the PSF model form. It lists the pmModelType type of model 23 23 * being tests, and contains an element to store the resulting psf 24 24 * representation. In addition, this structure carries the complete collection of 25 * FLT (floating parameter) and PSF (fixed parameter) model fits to each of the26 * sources model FLT and modelPSF. It also contains a mask which is set by the25 * EXT (floating parameter) and PSF (fixed parameter) model fits to each of the 26 * sources modelEXT and modelPSF. It also contains a mask which is set by the 27 27 * model fitting and psf fitting steps. For each model, the value of the quality 28 28 * metric is stored in the vector metric and the fitted instrumental magnitude is … … 38 38 * ultimate metric to intercompare multiple types of PSF models is the value of 39 39 * the aperture correction scatter. 40 * 40 * 41 41 * XXX: There are many more members in the SDRS then in the prototype code. 42 42 * I stuck with the prototype code. 43 * 44 * 43 * 44 * 45 45 */ 46 46 typedef struct … … 48 48 pmPSF *psf; ///< Add comment. 49 49 psArray *sources; ///< pointers to the original sources 50 psArray *model FLT; ///< model fits, floating parameters50 psArray *modelEXT; ///< model fits, floating parameters 51 51 psArray *modelPSF; ///< model fits, PSF parameters 52 52 psVector *mask; ///< Add comment. … … 58 58 59 59 /** pmPSFtryMaskValues 60 * 60 * 61 61 * The following datatype defines the masks used by the pmPSFtry analysis to 62 62 * identify sources which should or should not be included in the analysis. 63 * 63 * 64 64 */ 65 enum {65 typedef enum { 66 66 PSFTRY_MASK_CLEAR = 0x00, ///< Add comment. 67 67 PSFTRY_MASK_OUTLIER = 0x01, ///< 1: outlier in psf polynomial fit (provided by psPolynomials) 68 PSFTRY_MASK_ FLT_FAIL = 0x02, ///< 2: flt model failed to converge68 PSFTRY_MASK_EXT_FAIL = 0x02, ///< 2: ext model failed to converge 69 69 PSFTRY_MASK_PSF_FAIL = 0x04, ///< 3: psf model failed to converge 70 70 PSFTRY_MASK_BAD_PHOT = 0x08, ///< 4: invalid source photometry … … 74 74 75 75 /** pmPSFtryAlloc() 76 * 76 * 77 77 * Allocate a pmPSFtry data structure. 78 * 78 * 79 79 */ 80 80 pmPSFtry *pmPSFtryAlloc( 81 81 psArray *stars, ///< Add comment. 82 char *modelName ///< Add comment. 82 char *modelName, ///< Add comment. 83 bool poissonErrors // use poissonian or constant errors? 83 84 ); 84 85 85 86 86 87 /** pmPSFtryModel() 87 * 88 * 88 89 * This function takes the input collection of sources and performs a complete 89 90 * analysis to determine a PSF model of the given type (specified by model name). 90 91 * The result is a pmPSFtry with the results of the analysis. 91 * 92 * 92 93 */ 93 94 pmPSFtry *pmPSFtryModel( 94 95 psArray *sources, ///< Add comment. 95 96 char *modelName, ///< Add comment. 96 float radius ///< Add comment. 97 float radius, ///< Add comment. 98 bool poissonErrors // use poissonian or constant errors? 97 99 ); 98 100 99 101 100 102 /** pmPSFtryMetric() 101 * 103 * 102 104 * This function is used to measure the PSF model metric for the set of 103 105 * results contained in the pmPSFtry structure. 104 * 106 * 105 107 */ 106 108 bool pmPSFtryMetric(
Note:
See TracChangeset
for help on using the changeset viewer.
