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