00001 /* @file pmModelGroup.h 00002 * 00003 * The object model function types are defined to allow for the flexible addition 00004 * of new object models. Every object model, with parameters represented by 00005 * pmModel, has an associated set of functions which provide necessary support 00006 * operations. A set of abstract functions allow the programmer to select the 00007 * approriate function or property for a specific named object model. 00008 * 00009 * @author EAM, IfA 00010 * 00011 * @version $Revision: 1.7 $ $Name: $ 00012 * @date $Date: 2007/01/24 02:54:15 $ 00013 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii 00014 */ 00015 00016 # ifndef PM_MODEL_GROUP_H 00017 # define PM_MODEL_GROUP_H 00018 00019 /// @addtogroup Objects Object Detection / Analysis Functions 00020 /// @{ 00021 00022 // This function is the model chi-square minimization function for this model. 00023 typedef psMinimizeLMChi2Func pmModelFunc; 00024 00025 // This function is the model chi-square minimization function for this model. 00026 typedef psMinimizeLMLimitFunc pmModelLimits; 00027 00028 // This function returns the integrated flux for the given model parameters. 00029 typedef psF64 (*pmModelFlux)(const psVector *params); 00030 00031 00032 // This function returns the radius at which the given model and parameters 00033 // achieves the given flux. 00034 typedef psF64 (*pmModelRadius)(const psVector *params, double flux); 00035 00036 /* This function sets the model parameter limits vectors for the given model 00037 */ 00038 // typedef bool (*pmModelLimits)(psVector **beta_lim, psVector **params_min, psVector **params_max); 00039 00040 /* This function provides the model guess parameters based on the details of 00041 * the given source. 00042 */ 00043 typedef bool (*pmModelGuessFunc)(pmModel *model, pmSource *source); 00044 00045 00046 /* This function constructs the PSF model for the given source based on the 00047 * supplied psf and the EXT model for the object. 00048 */ 00049 typedef bool (*pmModelFromPSFFunc)(pmModel *modelPSF, pmModel *modelEXT, pmPSF *psf); 00050 00051 /* This function returns the success / failure status of the given model fit 00052 */ 00053 typedef bool (*pmModelFitStatusFunc)(pmModel *model); 00054 00055 /* Every model instance belongs to a class of models, defined by the value of 00056 * the pmModelType type entry. Various functions need access to information about 00057 * each of the models. Some of this information varies from model to model, and 00058 * may depend on the current parameter values or other data quantities. In order 00059 * to keep the code from requiring the information about each model to be coded 00060 * into the low-level fitting routines, we define a collection of functions which 00061 * allow us to abstract this type of model-dependent information. These generic 00062 * functions take the model type and return the corresponding function pointer 00063 * for the specified model. Each model is defined by creating this collection of 00064 * specific functions, and placing them in a single file for each model. We 00065 * define the following structure to carry the collection of information about 00066 * the models. 00067 */ 00068 typedef struct 00069 { 00070 char *name; 00071 int nParams; 00072 pmModelFunc modelFunc; 00073 pmModelFlux modelFlux; 00074 pmModelRadius modelRadius; 00075 pmModelLimits modelLimits; 00076 pmModelGuessFunc modelGuessFunc; 00077 pmModelFromPSFFunc modelFromPSFFunc; 00078 pmModelFitStatusFunc modelFitStatusFunc; 00079 } 00080 pmModelGroup; 00081 00082 // allocate a pmModelGroup to hold nModels entries 00083 pmModelGroup *pmModelGroupAlloc (int nModels); 00084 00085 // initialize the internal (static) model group with the default models 00086 bool pmModelGroupInit (void); 00087 00088 // free the internal (static) model group 00089 void pmModelGroupCleanup (void); 00090 00091 // add a new model to the internal (static) model group 00092 void pmModelGroupAdd (pmModelGroup *model); 00093 00094 /* This function returns the number of parameters used by the listed function. 00095 */ 00096 int pmModelParameterCount( 00097 pmModelType type ///< Add comment. 00098 ); 00099 00100 00101 /* This function returns the user-space model names for the specified model type. 00102 */ 00103 char *pmModelGetType( 00104 pmModelType type ///< Add comment. 00105 ); 00106 00107 00108 /** 00109 * 00110 * This function returns the internal model type code for the user-space model names. 00111 * 00112 */ 00113 pmModelType pmModelSetType( 00114 char *name ///< Add comment. 00115 ); 00116 00117 /** 00118 * 00119 * Each of the function types above has a corresponding function which returns 00120 * the function given the model type: 00121 * 00122 */ 00123 00124 /** 00125 * 00126 * pmModelFunc is the function used to determine the value of the model at a 00127 * specific coordinate, and is the one used by psMinimizeLMChi2. 00128 * 00129 */ 00130 pmModelFunc pmModelFunc_GetFunction (pmModelType type); 00131 00132 00133 /** 00134 * 00135 * pmModelFlux returns the total integrated flux for the given input parameters. 00136 * 00137 */ 00138 pmModelFlux pmModelFlux_GetFunction (pmModelType type); 00139 00140 00141 /** 00142 * 00143 * pmModelRadius returns the scaling radius at which the flux of the model 00144 * matches the specified flux. This presumes that the model is a function of an 00145 * elliptical contour. 00146 * 00147 */ 00148 pmModelRadius pmModelRadius_GetFunction (pmModelType type); 00149 00150 00151 /** 00152 * 00153 * pmModelLimits sets the parameter limit vectors for the function. 00154 * 00155 */ 00156 pmModelLimits pmModelLimits_GetFunction (pmModelType type); 00157 00158 00159 /** 00160 * 00161 * pmModelGuessFunc generates an initial guess for the model based on the 00162 * provided source statistics (moments and pixel values as needed). 00163 * 00164 */ 00165 pmModelGuessFunc pmModelGuessFunc_GetFunction (pmModelType type); 00166 00167 00168 /** 00169 * 00170 * pmModelFromPSFFunc takes as input a representation of the psf and a value 00171 * for the model and fills in the PSF parameters of the model. The input 00172 * primarily relies upon the centroid coordinates of the input model, though the 00173 * normalization may potentially be used. 00174 * 00175 */ 00176 pmModelFromPSFFunc pmModelFromPSFFunc_GetFunction (pmModelType type); 00177 00178 00179 /** 00180 * 00181 * pmModelFitStatusFunc returns a true or false values based on the success or 00182 * failure of a model fit. The success is determined by quantities such as the 00183 * chisq or the signal-to-noise. 00184 * 00185 */ 00186 pmModelFitStatusFunc pmModelFitStatusFunc_GetFunction (pmModelType type); 00187 00188 00189 /** pmSourceModelGuess() 00190 * 00191 * Convert available data to an initial guess for the given model. This 00192 * function allocates a pmModel entry for the pmSource structure based on the 00193 * provided model selection. The method of defining the model parameter guesses 00194 * are specified for each model below. The guess values are placed in the model 00195 * parameters. The function returns TRUE on success or FALSE on failure. 00196 * 00197 */ 00198 pmModel *pmSourceModelGuess( 00199 pmSource *source, ///< The input pmSource 00200 pmModelType model ///< The type of model to be created. 00201 ); 00202 00203 /// @} 00204 # endif /* PM_MODEL_GROUP_H */
1.5.1