00001 /** @file pmObjects.h 00002 * 00003 * Functions to define and manipulate object models 00004 * 00005 * @author GLG, MHPCC 00006 * @author EAM, IfA 00007 * 00008 * @version $Revision: 1.2 $ $Name: rel12 $ 00009 * @date $Date: 2006/04/17 18:01:05 $ 00010 * 00011 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii 00012 * 00013 */ 00014 00015 # ifndef PM_MODEL_H 00016 # define PM_MODEL_H 00017 00018 // type of model carried by the pmModel structure 00019 typedef int pmModelType; 00020 00021 typedef enum { 00022 PM_MODEL_UNTRIED, ///< model fit not yet attempted 00023 PM_MODEL_SUCCESS, ///< model fit succeeded 00024 PM_MODEL_NONCONVERGE, ///< model fit did not converge 00025 PM_MODEL_OFFIMAGE, ///< model fit drove out of range 00026 PM_MODEL_BADARGS ///< model fit called with invalid args 00027 } pmModelStatus; 00028 00029 /** pmModel data structure 00030 * 00031 * Every source may have two types of models: a PSF model and a EXT (extended-source) 00032 * model. The PSF model represents the best fit of the image PSF to the specific 00033 * object. In this case, the PSF-dependent parameters are specified for the 00034 * object by the PSF, not by the fit. The EXT model represents the best fit of 00035 * the given model to the object, with all shape parameters floating in the fit. 00036 * 00037 */ 00038 typedef struct 00039 { 00040 pmModelType type; ///< Model to be used. 00041 psVector *params; ///< Paramater values. 00042 psVector *dparams; ///< Parameter errors. 00043 float chisq; ///< Fit chi-squared. 00044 float chisqNorm; ///< re-normalized fit chi-squared. 00045 int nDOF; ///< number of degrees of freedom 00046 int nIter; ///< number of iterations to reach min 00047 pmModelStatus status; ///< fit status 00048 float radiusTMP; ///< fit radius actually used 00049 } 00050 pmModel; 00051 00052 /** pmModelAlloc() 00053 * 00054 */ 00055 pmModel *pmModelAlloc(pmModelType type); 00056 00057 // copy model to a new structure 00058 pmModel *pmModelCopy (pmModel *model); 00059 00060 psF32 pmModelEval(pmModel *model, psImage *image, psS32 col, psS32 row); 00061 00062 /** pmModelAdd() 00063 * 00064 * Add the given source model flux to/from the provided image. The boolean 00065 * option center selects if the source is re-centered to the image center or if 00066 * it is placed at its centroid location. The boolean option sky selects if the 00067 * background sky is applied (TRUE) or not. The pixel range in the target image 00068 * is at most the pixel range specified by the source.pixels image. The success 00069 * status is returned. 00070 * 00071 */ 00072 bool pmModelAdd( 00073 psImage *image, ///< The output image (float) 00074 psImage *mask, ///< The image pixel mask (valid == 0) 00075 pmModel *model, ///< The input pmModel 00076 bool center, ///< A boolean flag that determines whether pixels are centered 00077 bool sky ///< A boolean flag that determines if the sky is subtracted 00078 ); 00079 00080 00081 /** pmModelSub() 00082 * 00083 * Subtract the given source model flux to/from the provided image. The 00084 * boolean option center selects if the source is re-centered to the image center 00085 * or if it is placed at its centroid location. The boolean option sky selects if 00086 * the background sky is applied (TRUE) or not. The pixel range in the target 00087 * image is at most the pixel range specified by the source.pixels image. The 00088 * success status is returned. 00089 * 00090 */ 00091 bool pmModelSub( 00092 psImage *image, ///< The output image (float) 00093 psImage *mask, ///< The image pixel mask (valid == 0) 00094 pmModel *model, ///< The input pmModel 00095 bool center, ///< A boolean flag that determines whether pixels are centered 00096 bool sky ///< A boolean flag that determines if the sky is subtracted 00097 ); 00098 00099 /** pmModelFitStatus() 00100 * 00101 * This function wraps the call to the model-specific function returned by 00102 * pmModelFitStatusFunc_GetFunction. The model-specific function examines the 00103 * model parameters, parameter errors, Chisq, S/N, and other parameters available 00104 * from model to decide if the particular fit was successful or not. 00105 * 00106 * XXX: Must code this. 00107 * 00108 */ 00109 bool pmModelFitStatus( 00110 pmModel *model ///< Model to be used 00111 ); 00112 00113 # endif /* PM_MODEL_H */
1.4.4