IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 15, 2005, 3:10:36 PM (21 years ago)
Author:
gusciora
Message:

There are a lot of changes here required by the new SDRS. Most changes
involve the new definitions of the psAstrometry types. Not all tests work
correctly.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/pmObjects.h

    r4579 r4770  
    55 *  @author GLG, MHPCC
    66 *
    7  *  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2005-07-19 01:44:48 $
     7 *  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2005-08-16 01:10:34 $
    99 *
    1010 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2323#include "pslib.h"
    2424
     25/** pmPeakType
     26 *
     27 *  A peak pixel may have several features which may be determined when the
     28 *  peak is found or measured. These are specified by the pmPeakType enum.
     29 *  PM_PEAK_LONE represents a single pixel which is higher than its 8 immediate
     30 *  neighbors.  The PM_PEAK_EDGE represents a peak pixel which touching the image
     31 *  edge. The PM_PEAK_FLAT represents a peak pixel which has more than a specific
     32 *  number of neighbors at the same value, within some tolarence:
     33 *
     34 */
    2535typedef enum {
    26     PM_PEAK_LONE,           ///< Isolated peak.
    27     PM_PEAK_EDGE,           ///< Peak on edge.
    28     PM_PEAK_FLAT,           ///< Peak has equal-value neighbors.
    29     PM_PEAK_UNDEF           ///< Undefined.
    30 } psPeakType;
    31 
     36    PM_PEAK_LONE,                       ///< Isolated peak.
     37    PM_PEAK_EDGE,                       ///< Peak on edge.
     38    PM_PEAK_FLAT,                       ///< Peak has equal-value neighbors.
     39    PM_PEAK_UNDEF                       ///< Undefined.
     40} pmPeakType;
     41
     42/** pmPeak data structure
     43 * 
     44 * 
     45 * 
     46 */
    3247typedef struct
    3348{
    34     psS32 x;                ///< X-coordinate of peak pixel.
    35     psS32 y;                ///< Y-coordinate of peak pixel.
    36     psF32 counts;           ///< Value of peak pixel (above sky?).
    37     psPeakType class;       ///< Description of peak.
     49    int x;                              ///< X-coordinate of peak pixel.
     50    int y;                              ///< Y-coordinate of peak pixel.
     51    float counts;                       ///< Value of peak pixel (above sky?).
     52    pmPeakType class;                   ///< Description of peak.
    3853}
    39 psPeak;
    40 
     54pmPeak;
     55
     56/** pmMoments data structure
     57 * 
     58 * 
     59 * 
     60 */
    4161typedef struct
    4262{
    43     psF32 x;                ///< X-coord of centroid.
    44     psF32 y;                ///< Y-coord of centroid.
    45     psF32 Sx;               ///< x-second moment.
    46     psF32 Sy;               ///< y-second moment.
    47     psF32 Sxy;              ///< xy cross moment.
    48     psF32 Sum;              ///< Pixel sum above sky (background).
    49     psF32 Peak;             ///< Peak counts above sky.
    50     psF32 Sky;              ///< Sky level (background).
    51     psS32 nPixels;          ///< Number of pixels used.
     63    float x;                            ///< X-coord of centroid.
     64    float y;                            ///< Y-coord of centroid.
     65    float Sx;                           ///< x-second moment.
     66    float Sy;                           ///< y-second moment.
     67    float Sxy;                          ///< xy cross moment.
     68    float Sum;                          ///< Pixel sum above sky (background).
     69    float Peak;                         ///< Peak counts above sky.
     70    float Sky;                          ///< Sky level (background).
     71    int nPixels;                        ///< Number of pixels used.
    5272}
    53 psMoments;
    54 
     73pmMoments;
     74
     75/** pmModelType enumeration
     76 * 
     77 * 
     78 * 
     79 */
    5580typedef enum {
    56     PS_MODEL_GAUSS,   ///< Regular 2-D Gaussian
    57     PS_MODEL_PGAUSS,  ///< Psuedo 2-D Gaussian
    58     PS_MODEL_TWIST_GAUSS, ///< 2-D Twisted Gaussian
    59     PS_MODEL_WAUSS,  ///< 2-D Waussian
    60     PS_MODEL_SERSIC,  ///< Sersic
    61     PS_MODEL_SERSIC_CORE, ///< Sersic Core
    62     PS_MODEL_UNDEFINED  ///< Undefined
    63 } psModelType;
    64 
    65 // XXX: It will be better if params, and dparams, were psVectors.
     81    PS_MODEL_GAUSS,                     ///< Regular 2-D Gaussian
     82    PS_MODEL_PGAUSS,                    ///< Psuedo 2-D Gaussian
     83    PS_MODEL_TWIST_GAUSS,               ///< 2-D Twisted Gaussian
     84    PS_MODEL_WAUSS,                     ///< 2-D Waussian
     85    PS_MODEL_SERSIC,                    ///< Sersic
     86    PS_MODEL_SERSIC_CORE,               ///< Sersic Core
     87    PS_MODEL_UNDEFINED                  ///< Undefined
     88} pmModelType;
     89
     90/** pmModel data structure
     91 * 
     92 * 
     93 * 
     94 */
     95// XXX: The SDRS has the "type" member of type psS32.
    6696typedef struct
    6797{
    68     psModelType type;       ///< Model to be used.
    69     psVector *params;       ///< Paramater values.
    70     psVector *dparams;      ///< Parameter errors.
    71     psF32 chisq;            ///< Fit chi-squared.
    72     psS32 nDOF;             ///< number of degrees of freedom
    73     psS32 nIter;            ///< number of iterations to reach min
     98    pmModelType type;                   ///< Model to be used.
     99    psVector *params;                   ///< Paramater values.
     100    psVector *dparams;                  ///< Parameter errors.
     101    float chisq;                        ///< Fit chi-squared.
     102    int nDOF;                           ///< number of degrees of freedom
     103    int nIter;                          ///< number of iterations to reach min
    74104}
    75 psModel;
    76 
     105pmModel;
     106
     107/** pmSourceType enumeration
     108 * 
     109 * 
     110 * 
     111 */
    77112typedef enum {
    78113    PS_SOURCE_PSFSTAR,
     
    84119    PS_SOURCE_BRIGHTSTAR,
    85120    PS_SOURCE_OTHER
    86 } psSourceType;
    87 
     121} pmSourceType;
     122
     123/** pmSource data structure
     124 * 
     125 *  This source has the capacity for several types of measurements. The
     126 *  simplest measurement of a source is the location and flux of the peak pixel
     127 *  associated with the source:
     128 * 
     129 */
    88130typedef struct
    89131{
    90     psPeak *peak;           ///< Description of peak pixel.
    91     psImage *pixels;        ///< Rectangular region including object pixels.
    92     psImage *mask;          ///< Mask which marks pixels associated with objects.
    93     psMoments *moments;     ///< Basic moments measure for the object.
    94     psModel *models;        ///< Model parameters and type.
    95     psSourceType type;      ///< Best identification of object.
     132    pmPeak *peak;                       ///< Description of peak pixel.
     133    psImage *pixels;                    ///< Rectangular region including object pixels.
     134    psImage *mask;                      ///< Mask which marks pixels associated with objects.
     135    pmMoments *moments;                 ///< Basic moments measure for the object.
     136    pmModel *modelPSF;                  ///< PSF model parameters and type
     137    pmModel *modelFLT;                  ///< FLT model parameters and type
     138    pmSourceType type;                  ///< Best identification of object.
    96139}
    97 psSource;
    98 
    99 psPeak *pmPeakAlloc(psS32 x,  ///< Row-coordinate in image space
    100                     psS32 y,  ///< Col-coordinate in image space
    101                     psF32 counts, ///< The value of the peak pixel
    102                     psPeakType class ///< The type of peak pixel
    103                    );
    104 
    105 psMoments *pmMomentsAlloc();
    106 psModel *pmModelAlloc(psModelType type);
    107 psSource *pmSourceAlloc();
     140pmSource;
     141
     142/** pmPeak data structure
     143 * 
     144 * 
     145 * 
     146 */
     147typedef struct
     148{
     149    psS32 type;                         ///< PSF Model in use
     150    psArray *params;                    ///< Model parameters (psPolynomial2D)
     151    psF32 chisq;                        ///< PSF goodness statistic
     152    psS32 nPSFstars;                    ///< number of stars used to measure PSF
     153}
     154pmPSF;
     155
     156
     157
     158pmPeak *pmPeakAlloc(
     159    int x,                              ///< Row-coordinate in image space
     160    int y,                              ///< Col-coordinate in image space
     161    float counts,                       ///< The value of the peak pixel
     162    pmPeakType class                    ///< The type of peak pixel
     163);
     164
     165pmMoments *pmMomentsAlloc();
     166pmModel *pmModelAlloc(pmModelType type);
     167pmSource *pmSourceAlloc();
    108168
    109169/******************************************************************************
     
    112172the location (x value) of all peaks.
    113173 *****************************************************************************/
    114 psVector *pmFindVectorPeaks(const psVector *vector, ///< The input vector (psF32)
    115                             psF32 threshold  ///< Threshold above which to find a peak
    116                            );
     174psVector *pmFindVectorPeaks(
     175    const psVector *vector,             ///< The input vector (float)
     176    float threshold                     ///< Threshold above which to find a peak
     177);
    117178
    118179/******************************************************************************
     
    121182value) of all peaks.
    122183 *****************************************************************************/
    123 psArray *pmFindImagePeaks(const psImage *image, ///< The input image where peaks will be found (psF32)
    124                           psF32 threshold ///< Threshold above which to find a peak
    125                          );
     184psArray *pmFindImagePeaks(
     185    const psImage *image,               ///< The input image where peaks will be found (float)
     186    float threshold                     ///< Threshold above which to find a peak
     187);
    126188
    127189/******************************************************************************
     
    129191a peak value above the given maximum, or fall outside the valid region.
    130192 *****************************************************************************/
    131 psList *pmCullPeaks(psList *peaks,  ///< The psList of peaks to be culled
    132                     psF32 maxValue,  ///< Cull peaks above this value
    133                     const psRegion *valid ///< Cull peaks otside this psRegion
    134                    );
    135 
    136 /******************************************************************************
    137 psSource *pmSourceLocalSky(image, peak, innerRadius, outerRadius):
     193psList *pmCullPeaks(
     194    psList *peaks,                      ///< The psList of peaks to be culled
     195    float maxValue,                     ///< Cull peaks above this value
     196    const psRegion *valid               ///< Cull peaks otside this psRegion
     197);
     198
     199/******************************************************************************
     200pmSource *pmSourceLocalSky(image, peak, innerRadius, outerRadius):
    138201 
    139202 *****************************************************************************/
    140 psSource *pmSourceLocalSky(const psImage *image, ///< The input image (psF32)
    141                            const psPeak *peak,  ///< The peak for which the psSource struct is created.
    142                            psStatsOptions statsOptions, ///< The statistic used in calculating the background sky
    143                            psF32 innerRadius,  ///< The inner radius of the suqare annulus for calculating sky
    144                            psF32 outerRadius  ///< The outer radius of the suqare annulus for calculating sky
    145                           );
    146 
    147 /******************************************************************************
    148  *****************************************************************************/
    149 psSource *pmSourceMoments(psSource *source, ///< The input psSource for which moments will be computed
    150                           psF32 radius  ///< Use a circle of pixels around the peak
    151                          );
     203pmSource *pmSourceLocalSky(
     204    const psImage *image,               ///< The input image (float)
     205    const pmPeak *peak,                 ///< The peak for which the psSource struct is created.
     206    psStatsOptions statsOptions,        ///< The statistic used in calculating the background sky
     207    float innerRadius,                  ///< The inner radius of the suqare annulus for calculating sky
     208    float outerRadius                   ///< The outer radius of the suqare annulus for calculating sky
     209);
     210
     211/******************************************************************************
     212 *****************************************************************************/
     213pmSource *pmSourceMoments(
     214    pmSource *source,                   ///< The input pmSource for which moments will be computed
     215    float radius                        ///< Use a circle of pixels around the peak
     216);
    152217
    153218/******************************************************************************
     
    155220source classification.
    156221 *****************************************************************************/
    157 bool pmSourceRoughClass(psArray *source, ///< The input psSource
    158                         psMetadata *metadata ///< Contains classification parameters
    159                        );
     222bool pmSourceRoughClass(
     223    psArray *source,                    ///< The input pmSource
     224    psMetadata *metadata                ///< Contains classification parameters
     225);
    160226/******************************************************************************
    161227pmSourceSetPixelCircle(source, image, radius)
    162228 *****************************************************************************/
    163 bool pmSourceSetPixelsCircle(psSource *source,  ///< The input psSource
    164                              const psImage *image, ///< The input image (psF32)
    165                              psF32 radius  ///< The radius of the circle
    166                             );
    167 
    168 /******************************************************************************
    169  *****************************************************************************/
    170 bool pmSourceModelGuess(psSource *source, ///< The input psSource
    171                         const psImage *image, ///< The input image (psF32)
    172                         psModelType model ///< The type of model to be created.
    173                        );
     229bool pmSourceSetPixelsCircle(
     230    pmSource *source,                   ///< The input pmSource
     231    const psImage *image,               ///< The input image (float)
     232    float radius                        ///< The radius of the circle
     233);
     234
     235/******************************************************************************
     236 *****************************************************************************/
     237bool pmSourceModelGuess(
     238    pmSource *source,                   ///< The input pmSource
     239    const psImage *image,               ///< The input image (float)
     240    pmModelType model                   ///< The type of model to be created.
     241);
    174242
    175243/******************************************************************************
     
    179247} pmContourType;
    180248
    181 psArray *pmSourceContour(psSource *source, ///< The input psSource
    182                          const psImage *image, ///< The input image (psF32) (this arg should be removed)
    183                          psF32 level,  ///< The level of the contour
    184                          pmContourType mode ///< Currently this must be PS_CONTOUR_CRUDE
    185                         );
    186 
    187 /******************************************************************************
    188  *****************************************************************************/
    189 bool pmSourceFitModel(psSource *source,  ///< The input psSource
    190                       const psImage *image ///< The input image (psF32)
    191                      );
    192 
    193 /******************************************************************************
    194  *****************************************************************************/
    195 bool pmSourceAddModel(psImage *image,  ///< The opuut image (psF32)
    196                       psSource *source,  ///< The input psSource
    197                       bool center  ///< A boolean flag that determines whether pixels are centered
    198                      );
    199 
    200 /******************************************************************************
    201  *****************************************************************************/
    202 bool pmSourceSubModel(psImage *image,  ///< The output image (psF32)
    203                       psSource *source,  ///< The input psSource
    204                       bool center  ///< A boolean flag that determines whether pixels are centered
    205                      );
     249psArray *pmSourceContour(
     250    pmSource *source,                   ///< The input pmSource
     251    const psImage *image,               ///< The input image (float) (this arg should be removed)
     252    float level,                        ///< The level of the contour
     253    pmContourType mode                  ///< Currently this must be PS_CONTOUR_CRUDE
     254);
     255
     256/******************************************************************************
     257 *****************************************************************************/
     258bool pmSourceFitModel(
     259    pmSource *source,                   ///< The input pmSource
     260    const psImage *image                ///< The input image (float)
     261);
     262
     263/******************************************************************************
     264 *****************************************************************************/
     265bool pmSourceAddModel(
     266    psImage *image,                     ///< The opuut image (float)
     267    pmSource *source,                   ///< The input pmSource
     268    bool center                         ///< A boolean flag that determines whether pixels are centered
     269);
     270
     271/******************************************************************************
     272 *****************************************************************************/
     273bool pmSourceSubModel(
     274    psImage *image,                     ///< The output image (float)
     275    pmSource *source,                   ///< The input pmSource
     276    bool center                         ///< A boolean flag that determines whether pixels are centered
     277);
    206278
    207279/******************************************************************************
    208280XXX: Why only *x argument?
    209 XXX EAM: psMinimizeLMChi2Func returns psF64, not psF32
     281XXX EAM: psMinimizeLMChi2Func returns psF64, not float
    210282 *****************************************************************************/
    211283float pmMinLM_Gauss2D(
    212     psVector *deriv,                   ///< A possibly-NULL structure for the output derivatives
    213     const psVector *params,            ///< A psVector which holds the parameters of this function
    214     const psVector *x                  ///< A psVector which holds the row/col coordinate
     284    psVector *deriv,                    ///< A possibly-NULL structure for the output derivatives
     285    const psVector *params,             ///< A psVector which holds the parameters of this function
     286    const psVector *x                   ///< A psVector which holds the row/col coordinate
    215287);
    216288
     
    218290 *****************************************************************************/
    219291float pmMinLM_PsuedoGauss2D(
    220     psVector *deriv, ///< A possibly-NULL structure for the output derivatives
    221     const psVector *params, ///< A psVector which holds the parameters of this function
    222     const psVector *x  ///< A psVector which holds the row/col coordinate
     292    psVector *deriv,                    ///< A possibly-NULL structure for the output derivatives
     293    const psVector *params,             ///< A psVector which holds the parameters of this function
     294    const psVector *x                   ///< A psVector which holds the row/col coordinate
    223295);
    224296
     
    226298 *****************************************************************************/
    227299float pmMinLM_Wauss2D(
    228     psVector *deriv,  ///< A possibly-NULL structure for the output derivatives
    229     const psVector *params,  ///< A psVector which holds the parameters of this function
    230     const psVector *x  ///< A psVector which holds the row/col coordinate
     300    psVector *deriv,                    ///< A possibly-NULL structure for the output derivatives
     301    const psVector *params,             ///< A psVector which holds the parameters of this function
     302    const psVector *x                   ///< A psVector which holds the row/col coordinate
    231303);
    232304
     
    234306 *****************************************************************************/
    235307float pmMinLM_TwistGauss2D(
    236     psVector *deriv, ///< A possibly-NULL structure for the output derivatives
    237     const psVector *params, ///< A psVector which holds the parameters of this function
    238     const psVector *x  ///< A psVector which holds the row/col coordinate
     308    psVector *deriv,                    ///< A possibly-NULL structure for the output derivatives
     309    const psVector *params,             ///< A psVector which holds the parameters of this function
     310    const psVector *x                   ///< A psVector which holds the row/col coordinate
    239311);
    240312
     
    242314 *****************************************************************************/
    243315float pmMinLM_Sersic(
    244     psVector *deriv,  ///< A possibly-NULL structure for the output derivatives
    245     const psVector *params,  ///< A psVector which holds the parameters of this function
    246     const psVector *x  ///< A psVector which holds the row/col coordinate
     316    psVector *deriv,                    ///< A possibly-NULL structure for the output derivatives
     317    const psVector *params,             ///< A psVector which holds the parameters of this function
     318    const psVector *x                   ///< A psVector which holds the row/col coordinate
    247319);
    248320
     
    250322 *****************************************************************************/
    251323float pmMinLM_SersicCore(
    252     psVector *deriv, ///< A possibly-NULL structure for the output derivatives
    253     const psVector *params, ///< A psVector which holds the parameters of this function
    254     const psVector *x  ///< A psVector which holds the row/col coordinate
     324    psVector *deriv,                    ///< A possibly-NULL structure for the output derivatives
     325    const psVector *params,             ///< A psVector which holds the parameters of this function
     326    const psVector *x                   ///< A psVector which holds the row/col coordinate
    255327);
    256328
     
    258330 *****************************************************************************/
    259331float pmMinLM_PsuedoSersic(
    260     psVector *deriv, ///< A possibly-NULL structure for the output derivatives
    261     const psVector *params, ///< A psVector which holds the parameters of this function
    262     const psVector *x  ///< A psVector which holds the row/col coordinate
    263 );
    264 
     332    psVector *deriv,                    ///< A possibly-NULL structure for the output derivatives
     333    const psVector *params,             ///< A psVector which holds the parameters of this function
     334    const psVector *x                   ///< A psVector which holds the row/col coordinate
     335);
     336
     337
     338/**
     339 *
     340 *  The object model functions are defined to allow for the flexible addition
     341 *  of new object models. Every object model, with parameters represented by
     342 *  pmModel, has an associated set of functions which provide necessary support
     343 *  operations. A set of abstract functions allow the programmer to select the
     344 *  approriate function or property for a specific named object model.
     345 *
     346 */
     347
     348/**
     349 *
     350 *  This function is the model chi-square minimization function for this model.
     351 *
     352 */
     353typedef psMinimizeLMChi2Func pmModelFunc;
     354
     355
     356/**
     357 *
     358 * This function returns the integrated flux for the given model parameters.
     359 */
     360typedef psF64 (*pmModelFlux)(const psVector *params);
     361
     362
     363/**
     364 *
     365 *  This function provides the model guess parameters based on the details of
     366 *   the given source.
     367 *
     368 */
     369typedef bool (*pmModelGuessFunc)(pmModel *model, pmSource *source);
     370
     371
     372/**
     373 *
     374 *  This function constructs the PSF model for the given source based on the
     375 *  supplied psf and the FLT model for the object.
     376 *
     377 */
     378typedef bool (*pmModelFromPSFFunc)(pmModel *modelPSF, pmModel *modelFLT, pmPSF *psf);
     379
     380
     381/**
     382 *
     383 *  This function returns the radius at which the given model and parameters
     384 *  achieves the given flux.
     385 *
     386 */
     387typedef psF64 (*pmModelRadius)(const psVector *params, double flux);
     388
     389
     390/**
     391 *
     392 *  Each of the function types above has a corresponding function which returns
     393 *  the function given the model type:
     394 *
     395 */
     396pmModelFunc pmModelFunc_GetFunction (pmModelType type);
     397pmModelFlux pmModelFlux_GetFunction (pmModelType type);
     398pmModelGuessFunc pmModelGuessFunc_GetFunction (pmModelType type);
     399pmModelFromPSFFunc pmModelFromPSFFunc_GetFunction (pmModelType type);
     400pmModelRadius pmModelRadius_GetFunction (pmModelType type);
    265401
    266402#endif
Note: See TracChangeset for help on using the changeset viewer.