IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 19879 for trunk/psModules


Ignore:
Timestamp:
Oct 3, 2008, 10:59:16 AM (18 years ago)
Author:
eugene
Message:

converted pmMoments elements to Mxx, Myy, Mxxx, etc

Location:
trunk/psModules/src/objects
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/objects/Makefile.am

    r18830 r19879  
    1919     pmModelUtils.c \
    2020     pmSource.c \
     21     pmSourceMoments.c \
    2122     pmSourceExtendedPars.c \
    2223     pmSourceUtils.c \
  • trunk/psModules/src/objects/models/pmModel_GAUSS.c

    r15834 r19879  
    193193{
    194194    pmMoments *moments = source->moments;
     195    pmPeak    *peak    = source->peak;
    195196    psF32     *PAR  = model->params->data.F32;
    196197
    197198    psEllipseMoments emoments;
    198     emoments.x2 = moments->Sx;
    199     emoments.y2 = moments->Sy;
    200     emoments.xy = moments->Sxy;
     199    emoments.x2 = moments->Mxx;
     200    emoments.y2 = moments->Myy;
     201    emoments.xy = moments->Mxy;
    201202
    202203    // force the axis ratio to be < 20.0
     
    205206
    206207    PAR[PM_PAR_SKY]  = moments->Sky;
    207     PAR[PM_PAR_I0]   = moments->Peak - moments->Sky;
    208     PAR[PM_PAR_XPOS] = moments->x;
    209     PAR[PM_PAR_YPOS] = moments->y;
     208    PAR[PM_PAR_I0]   = peak->flux;
     209    PAR[PM_PAR_XPOS] = peak->xf;
     210    PAR[PM_PAR_YPOS] = peak->yf;
    210211    PAR[PM_PAR_SXX] = PS_MAX(0.5, M_SQRT2*shape.sx);
    211212    PAR[PM_PAR_SYY] = PS_MAX(0.5, M_SQRT2*shape.sy);
  • trunk/psModules/src/objects/models/pmModel_PGAUSS.c

    r15982 r19879  
    194194{
    195195    pmMoments *moments = source->moments;
     196    pmPeak    *peak    = source->peak;
    196197    psF32     *PAR     = model->params->data.F32;
    197198
    198199    psEllipseMoments emoments;
    199     emoments.x2 = moments->Sx;
    200     emoments.y2 = moments->Sx;
    201     emoments.xy = moments->Sxy;
     200    emoments.x2 = moments->Mxx;
     201    emoments.xy = moments->Mxy;
     202    emoments.y2 = moments->Myy;
    202203
    203204    psEllipseAxes axes = psEllipseMomentsToAxes (emoments, 20.0);
     
    205206
    206207    PAR[PM_PAR_SKY]  = moments->Sky;
    207     PAR[PM_PAR_I0]   = moments->Peak - moments->Sky;
    208     PAR[PM_PAR_XPOS] = moments->x; // XXX use peak->xf, peak->yf?
    209     PAR[PM_PAR_YPOS] = moments->y;
     208    PAR[PM_PAR_I0]   = peak->flux;
     209    PAR[PM_PAR_XPOS] = peak->xf;
     210    PAR[PM_PAR_YPOS] = peak->yf;
    210211    PAR[PM_PAR_SXX] = PS_MAX(0.5, M_SQRT2*shape.sx);
    211212    PAR[PM_PAR_SYY] = PS_MAX(0.5, M_SQRT2*shape.sy);
  • trunk/psModules/src/objects/models/pmModel_QGAUSS.c

    r17805 r19879  
    220220
    221221    psEllipseMoments emoments;
    222     emoments.x2 = moments->Sx;
    223     emoments.y2 = moments->Sy;
    224     emoments.xy = moments->Sxy;
     222    emoments.x2 = moments->Mxx;
     223    emoments.xy = moments->Mxy;
     224    emoments.y2 = moments->Myy;
    225225
    226226    // force the axis ratio to be < 20.0
     
    239239    // XXX turn this off here for now PAR[PM_PAR_SKY]  = moments->Sky;
    240240    PAR[PM_PAR_SKY]  = 0.0;
    241     PAR[PM_PAR_I0]   = moments->Peak;
    242     PAR[PM_PAR_XPOS] = peak->x;
    243     PAR[PM_PAR_YPOS] = peak->y;
     241    PAR[PM_PAR_I0]   = peak->flux;
     242    PAR[PM_PAR_XPOS] = peak->xf;
     243    PAR[PM_PAR_YPOS] = peak->yf;
    244244    PAR[PM_PAR_SXX]  = PS_MAX(0.5, M_SQRT2*shape.sx);
    245245    PAR[PM_PAR_SYY]  = PS_MAX(0.5, M_SQRT2*shape.sy);
  • trunk/psModules/src/objects/models/pmModel_RGAUSS.c

    r15834 r19879  
    213213
    214214    psEllipseMoments emoments;
    215     emoments.x2 = moments->Sx;
    216     emoments.y2 = moments->Sy;
    217     emoments.xy = moments->Sxy;
     215    emoments.x2 = moments->Mxx;
     216    emoments.xy = moments->Mxy;
     217    emoments.y2 = moments->Myy;
    218218
    219219    // force the axis ratio to be < 20.0
     
    231231
    232232    PAR[PM_PAR_SKY]  = moments->Sky;
    233     PAR[PM_PAR_I0]   = moments->Peak - moments->Sky;
    234     PAR[PM_PAR_XPOS] = peak->x;
    235     PAR[PM_PAR_YPOS] = peak->y;
     233    PAR[PM_PAR_I0]   = peak->flux;
     234    PAR[PM_PAR_XPOS] = peak->xf;
     235    PAR[PM_PAR_YPOS] = peak->yf;
    236236    PAR[PM_PAR_SXX]  = PS_MAX(0.5, M_SQRT2*shape.sx);
    237237    PAR[PM_PAR_SYY]  = PS_MAX(0.5, M_SQRT2*shape.sy);
  • trunk/psModules/src/objects/models/pmModel_SERSIC.c

    r17396 r19879  
    230230
    231231    psEllipseMoments emoments;
    232     emoments.x2 = moments->Sx;
    233     emoments.y2 = moments->Sy;
    234     emoments.xy = moments->Sxy;
     232    emoments.x2 = moments->Mxx;
     233    emoments.xy = moments->Mxy;
     234    emoments.y2 = moments->Myy;
    235235
    236236    // force the axis ratio to be < 20.0
     
    249249    // XXX PAR[PM_PAR_SKY]  = moments->Sky;
    250250    PAR[PM_PAR_SKY]  = 0.0;
    251     PAR[PM_PAR_I0]   = moments->Peak;
    252     PAR[PM_PAR_XPOS] = peak->x;
    253     PAR[PM_PAR_YPOS] = peak->y;
     251    PAR[PM_PAR_I0]   = peak->flux;
     252    PAR[PM_PAR_XPOS] = peak->xf;
     253    PAR[PM_PAR_YPOS] = peak->yf;
    254254    PAR[PM_PAR_SXX]  = PS_MAX(0.5, M_SQRT2*shape.sx);
    255255    PAR[PM_PAR_SYY]  = PS_MAX(0.5, M_SQRT2*shape.sy);
  • trunk/psModules/src/objects/pmMoments.c

    r8815 r19879  
    66 *  @author EAM, IfA
    77 *
    8  *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2006-09-15 09:49:01 $
     8 *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2008-10-03 20:59:16 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2929    psTrace("psModules.objects", 3, "---- %s() begin ----\n", __func__);
    3030    pmMoments *tmp = (pmMoments *) psAlloc(sizeof(pmMoments));
    31     tmp->x = 0.0;
    32     tmp->y = 0.0;
    33     tmp->Sx = 0.0;
    34     tmp->Sy = 0.0;
    35     tmp->Sxy = 0.0;
     31    tmp->Mx = 0.0;
     32    tmp->My = 0.0;
     33
     34    tmp->Mxx = 0.0;
     35    tmp->Mxy = 0.0;
     36    tmp->Myy = 0.0;
     37
     38    tmp->Mxxx = 0.0;
     39    tmp->Mxxy = 0.0;
     40    tmp->Mxyy = 0.0;
     41    tmp->Myyy = 0.0;
     42
     43    tmp->Mxxxx = 0.0;
     44    tmp->Mxxxy = 0.0;
     45    tmp->Mxxyy = 0.0;
     46    tmp->Mxyyy = 0.0;
     47    tmp->Myyyy = 0.0;
     48
    3649    tmp->Sum = 0.0;
    3750    tmp->Peak = 0.0;
     
    4255    return(tmp);
    4356}
    44 
  • trunk/psModules/src/objects/pmMoments.h

    r19847 r19879  
    44 * @author GLG, MHPCC
    55 *
    6  * @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
    7  * @date $Date: 2008-10-02 20:50:41 $
     6 * @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
     7 * @date $Date: 2008-10-03 20:59:16 $
    88 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii
    99 */
     
    2424typedef struct
    2525{
    26     float x;     ///< X-coord of centroid.
    27     float y;     ///< Y-coord of centroid.
    28     float Sx;    ///< x-second moment = sigma_x^2 = = (FWHM_x/2.355)^2
    29     float Sy;    ///< y-second moment = sigma_y^2 = = (FWHM_y/2.355)^2
    30     float Sxy;   ///< xy cross moment = sigma_xy
    31     float Sum;   ///< Pixel sum above sky (background).
    32     float Peak;  ///< Peak counts above sky.
    33     float Sky;   ///< Sky level (background).
    34     float dSky;  ///< local Sky variance
    35     float SN;    ///< approx signal-to-noise
    36     int nPixels; ///< Number of pixels used.
     26    float Mx;     ///< X-coord of centroid.
     27    float My;     ///< Y-coord of centroid.
     28    float Mxx;    ///< x-second moment = sigma_x^2 = = (FWHM_x/2.355)^2
     29    float Mxy;    ///< xy cross moment = sigma_xy
     30    float Myy;    ///< y-second moment = sigma_y^2 = = (FWHM_y/2.355)^2
     31
     32    float Mxxx;    ///< third moment
     33    float Mxxy;    ///< third moment
     34    float Mxyy;    ///< third moment
     35    float Myyy;    ///< third moment
     36
     37    float Mxxxx;   ///< fourth moment
     38    float Mxxxy;   ///< fourth moment
     39    float Mxxyy;   ///< fourth moment
     40    float Mxyyy;   ///< fourth moment
     41    float Myyyy;   ///< fourth moment
     42
     43    float Sum;    ///< Pixel sum above sky (background).
     44    float Peak;   ///< Peak counts above sky.
     45    float Sky;    ///< Sky level (background).
     46    float dSky;   ///< local Sky variance
     47    float SN;     ///< approx signal-to-noise
     48    int nPixels;  ///< Number of pixels used.
    3749}
    3850pmMoments;
  • trunk/psModules/src/objects/pmSource.c

    r19848 r19879  
    66 *  @author EAM, IfA: significant modifications.
    77 *
    8  *  @version $Revision: 1.56 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2008-10-02 20:51:29 $
     8 *  @version $Revision: 1.57 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2008-10-03 20:59:16 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    330330
    331331            // Sx,Sy are limited at 0.  a peak at 0,0 is artificial
    332             if (fabs(tmpSrc->moments->Sx) < 0.05)
    333                 continue;
    334             if (fabs(tmpSrc->moments->Sy) < 0.05)
    335                 continue;
    336             if ((tmpSrc->moments->Sx / tmpSrc->moments->Sy) > AR_MAX)
    337                 continue;
    338             if ((tmpSrc->moments->Sx / tmpSrc->moments->Sy) < AR_MIN)
     332            if (fabs(tmpSrc->moments->Mxx) < 0.05)
     333                continue;
     334            if (fabs(tmpSrc->moments->Myy) < 0.05)
     335                continue;
     336            if ((tmpSrc->moments->Mxx / tmpSrc->moments->Myy) > AR_MAX)
     337                continue;
     338            if ((tmpSrc->moments->Mxx / tmpSrc->moments->Myy) < AR_MIN)
    339339                continue;
    340340            if (tmpSrc->mode & PM_SOURCE_MODE_BLEND)
     
    342342
    343343            // for the moment, force splane dimensions to be 10x10 image pix
    344             binX = tmpSrc->moments->Sx/SCALE;
     344            binX = tmpSrc->moments->Mxx/SCALE;
    345345            if (binX < 0)
    346346                continue;
     
    348348                continue;
    349349
    350             binY = tmpSrc->moments->Sy/SCALE;
     350            binY = tmpSrc->moments->Myy/SCALE;
    351351            if (binY < 0)
    352352                continue;
     
    427427                continue;
    428428
    429             if (tmpSrc->moments->Sx < minSx)
    430                 continue;
    431             if (tmpSrc->moments->Sx > maxSx)
    432                 continue;
    433             if (tmpSrc->moments->Sy < minSy)
    434                 continue;
    435             if (tmpSrc->moments->Sy > maxSy)
    436                 continue;
    437             tmpSx->data.F32[tmpSx->n] = tmpSrc->moments->Sx;
    438             tmpSy->data.F32[tmpSy->n] = tmpSrc->moments->Sy;
     429            if (tmpSrc->moments->Mxx < minSx)
     430                continue;
     431            if (tmpSrc->moments->Mxx > maxSx)
     432                continue;
     433            if (tmpSrc->moments->Myy < minSy)
     434                continue;
     435            if (tmpSrc->moments->Myy > maxSy)
     436                continue;
     437            tmpSx->data.F32[tmpSx->n] = tmpSrc->moments->Mxx;
     438            tmpSy->data.F32[tmpSy->n] = tmpSrc->moments->Myy;
    439439            tmpSx->n++;
    440440            tmpSy->n++;
     
    519519        }
    520520
    521         psF32 sigX = source->moments->Sx;
    522         psF32 sigY = source->moments->Sy;
     521        psF32 sigX = source->moments->Mxx;
     522        psF32 sigY = source->moments->Myy;
    523523
    524524        // XXX EAM : can we use the value of SATURATE if mask is NULL?
     
    635635# define VALID_RADIUS(X,Y,RAD2) (((RAD2) >= (PS_SQR(X) + PS_SQR(Y))) ? 1 : 0)
    636636
     637/*** this been moved to pmSourceMoments.c ***/
     638# if (0)
    637639bool pmSourceMoments(pmSource *source,
    638640                     psF32 radius)
     
    774776    }
    775777
    776     source->moments->x = x + xPeak;
    777     source->moments->y = y + yPeak;
     778    source->moments->Mx = x + xPeak;
     779    source->moments->My = y + yPeak;
    778780
    779781    // XXX EAM : Sxy needs to have x*y subtracted
    780     source->moments->Sxy = XY/Sum - x*y;
     782    source->moments->Mxy = XY/Sum - x*y;
    781783    source->moments->Sum = Sum;
    782784    source->moments->SN  = Sum / sqrt(Var);
     
    786788    // XXX EAM : these values can be negative, so we need to limit the range
    787789    // XXX EAM : make the use of this consistent: should this be the second moment or sqrt?
    788     // source->moments->Sx = sqrt(PS_MAX(X2/Sum - PS_SQR(x), 0));
    789     // source->moments->Sy = sqrt(PS_MAX(Y2/Sum - PS_SQR(y), 0));
    790     source->moments->Sx = PS_MAX(X2/Sum - PS_SQR(x), 0);
    791     source->moments->Sy = PS_MAX(Y2/Sum - PS_SQR(y), 0);
     790    // source->moments->Mxx = sqrt(PS_MAX(X2/Sum - PS_SQR(x), 0));
     791    // source->moments->Myy = sqrt(PS_MAX(Y2/Sum - PS_SQR(y), 0));
     792    source->moments->Mxx = PS_MAX(X2/Sum - PS_SQR(x), 0);
     793    source->moments->Myy = PS_MAX(Y2/Sum - PS_SQR(y), 0);
    792794
    793795    psTrace ("psModules.objects", 4,
    794              "sky: %f  Sum: %f  x: %f  y: %f  Sx: %f  Sy: %f  Sxy: %f\n",
    795              sky, Sum, source->moments->x, source->moments->y,
    796              source->moments->Sx, source->moments->Sy, source->moments->Sxy);
     796             "sky: %f  Sum: %f  Mx: %f  My: %f  Mxx: %f  Myy: %f  Mxy: %f\n",
     797             sky, Sum, source->moments->Mx, source->moments->My,
     798             source->moments->Mxx, source->moments->Myy, source->moments->Mxy);
    797799
    798800    psTrace("psModules.objects", 5, "---- end ----\n");
    799801    return(true);
    800802}
    801 
     803# endif
    802804// construct a realization of the source model
    803805bool pmSourceCacheModel (pmSource *source, psMaskType maskVal) {
  • trunk/psModules/src/objects/pmSourceIO_RAW.c

    r15562 r19879  
    33 *  @author EAM, IfA
    44 *
    5  *  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
    6  *  @date $Date: 2007-11-10 01:09:20 $
     5 *  @version $Revision: 1.19 $ $Name: not supported by cvs2svn $
     6 *  @date $Date: 2008-10-03 20:59:16 $
    77 *
    88 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    225225        fprintf (f, "%5d %5d  %7.1f  %7.1f %7.1f  %6.3f %6.3f  %8.1f %7.1f %7.1f %7.1f  %4d %2d\n",
    226226                 source->peak->x, source->peak->y, source->peak->value,
    227                  moment->x, moment->y,
    228                  moment->Sx, moment->Sy,
     227                 moment->Mx, moment->My,
     228                 moment->Mxx, moment->Myy,
    229229                 moment->Sum, moment->Peak,
    230230                 moment->Sky, moment->SN,
     
    258258        fprintf (f, "%5d %5d  %7.1f  %7.1f %7.1f  %6.3f %6.3f  %10.1f %7.1f %7.1f %7.1f  %4d %2d %#5x\n",
    259259                 source->peak->x, source->peak->y, source->peak->value,
    260                  source->moments->x, source->moments->y,
    261                  source->moments->Sx, source->moments->Sy,
     260                 source->moments->Mx, source->moments->My,
     261                 source->moments->Mxx, source->moments->Myy,
    262262                 source->moments->Sum, source->moments->Peak,
    263263                 source->moments->Sky, source->moments->SN,
  • trunk/psModules/src/objects/pmSourcePlotMoments.c

    r18554 r19879  
    55 *  @author EAM, IfA
    66 *
    7  *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2008-07-15 20:25:00 $
     7 *  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2008-10-03 20:59:16 $
    99 *
    1010 *  Copyright 2006 IfA, University of Hawaii
     
    117117            continue;
    118118
    119         xFaint->data.F32[nF] = source->moments->Sx;
    120         yFaint->data.F32[nF] = source->moments->Sy;
     119        xFaint->data.F32[nF] = source->moments->Mxx;
     120        yFaint->data.F32[nF] = source->moments->Myy;
    121121        nF++;
    122122
     
    125125            continue;
    126126
    127         xBright->data.F32[nB] = source->moments->Sx;
    128         yBright->data.F32[nB] = source->moments->Sy;
     127        xBright->data.F32[nB] = source->moments->Mxx;
     128        yBright->data.F32[nB] = source->moments->Myy;
    129129        nB++;
    130130    }
  • trunk/psModules/src/objects/pmSourcePlotPSFModel.c

    r15562 r19879  
    55 *  @author EAM, IfA
    66 *
    7  *  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2007-11-10 01:09:20 $
     7 *  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2008-10-03 20:59:16 $
    99 *
    1010 *  Copyright 2006 IfA, University of Hawaii
     
    123123
    124124        psEllipseMoments moments;
    125         moments.x2 = source->moments->Sx;
    126         moments.y2 = source->moments->Sy;
    127         moments.xy = source->moments->Sxy;
     125        moments.x2 = source->moments->Mxx;
     126        moments.xy = source->moments->Mxy;
     127        moments.y2 = source->moments->Myy;
    128128
    129129        // force the axis ratio to be < 20.0
Note: See TracChangeset for help on using the changeset viewer.