Changeset 19879 for trunk/psModules/src/objects
- Timestamp:
- Oct 3, 2008, 10:59:16 AM (18 years ago)
- Location:
- trunk/psModules/src/objects
- Files:
-
- 12 edited
-
Makefile.am (modified) (1 diff)
-
models/pmModel_GAUSS.c (modified) (2 diffs)
-
models/pmModel_PGAUSS.c (modified) (2 diffs)
-
models/pmModel_QGAUSS.c (modified) (2 diffs)
-
models/pmModel_RGAUSS.c (modified) (2 diffs)
-
models/pmModel_SERSIC.c (modified) (2 diffs)
-
pmMoments.c (modified) (3 diffs)
-
pmMoments.h (modified) (2 diffs)
-
pmSource.c (modified) (9 diffs)
-
pmSourceIO_RAW.c (modified) (3 diffs)
-
pmSourcePlotMoments.c (modified) (3 diffs)
-
pmSourcePlotPSFModel.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/objects/Makefile.am
r18830 r19879 19 19 pmModelUtils.c \ 20 20 pmSource.c \ 21 pmSourceMoments.c \ 21 22 pmSourceExtendedPars.c \ 22 23 pmSourceUtils.c \ -
trunk/psModules/src/objects/models/pmModel_GAUSS.c
r15834 r19879 193 193 { 194 194 pmMoments *moments = source->moments; 195 pmPeak *peak = source->peak; 195 196 psF32 *PAR = model->params->data.F32; 196 197 197 198 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; 201 202 202 203 // force the axis ratio to be < 20.0 … … 205 206 206 207 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; 210 211 PAR[PM_PAR_SXX] = PS_MAX(0.5, M_SQRT2*shape.sx); 211 212 PAR[PM_PAR_SYY] = PS_MAX(0.5, M_SQRT2*shape.sy); -
trunk/psModules/src/objects/models/pmModel_PGAUSS.c
r15982 r19879 194 194 { 195 195 pmMoments *moments = source->moments; 196 pmPeak *peak = source->peak; 196 197 psF32 *PAR = model->params->data.F32; 197 198 198 199 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; 202 203 203 204 psEllipseAxes axes = psEllipseMomentsToAxes (emoments, 20.0); … … 205 206 206 207 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; 210 211 PAR[PM_PAR_SXX] = PS_MAX(0.5, M_SQRT2*shape.sx); 211 212 PAR[PM_PAR_SYY] = PS_MAX(0.5, M_SQRT2*shape.sy); -
trunk/psModules/src/objects/models/pmModel_QGAUSS.c
r17805 r19879 220 220 221 221 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; 225 225 226 226 // force the axis ratio to be < 20.0 … … 239 239 // XXX turn this off here for now PAR[PM_PAR_SKY] = moments->Sky; 240 240 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; 244 244 PAR[PM_PAR_SXX] = PS_MAX(0.5, M_SQRT2*shape.sx); 245 245 PAR[PM_PAR_SYY] = PS_MAX(0.5, M_SQRT2*shape.sy); -
trunk/psModules/src/objects/models/pmModel_RGAUSS.c
r15834 r19879 213 213 214 214 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; 218 218 219 219 // force the axis ratio to be < 20.0 … … 231 231 232 232 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; 236 236 PAR[PM_PAR_SXX] = PS_MAX(0.5, M_SQRT2*shape.sx); 237 237 PAR[PM_PAR_SYY] = PS_MAX(0.5, M_SQRT2*shape.sy); -
trunk/psModules/src/objects/models/pmModel_SERSIC.c
r17396 r19879 230 230 231 231 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; 235 235 236 236 // force the axis ratio to be < 20.0 … … 249 249 // XXX PAR[PM_PAR_SKY] = moments->Sky; 250 250 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; 254 254 PAR[PM_PAR_SXX] = PS_MAX(0.5, M_SQRT2*shape.sx); 255 255 PAR[PM_PAR_SYY] = PS_MAX(0.5, M_SQRT2*shape.sy); -
trunk/psModules/src/objects/pmMoments.c
r8815 r19879 6 6 * @author EAM, IfA 7 7 * 8 * @version $Revision: 1. 5$ $Name: not supported by cvs2svn $9 * @date $Date: 200 6-09-15 09:49:01$8 * @version $Revision: 1.6 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2008-10-03 20:59:16 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 29 29 psTrace("psModules.objects", 3, "---- %s() begin ----\n", __func__); 30 30 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 36 49 tmp->Sum = 0.0; 37 50 tmp->Peak = 0.0; … … 42 55 return(tmp); 43 56 } 44 -
trunk/psModules/src/objects/pmMoments.h
r19847 r19879 4 4 * @author GLG, MHPCC 5 5 * 6 * @version $Revision: 1. 4$ $Name: not supported by cvs2svn $7 * @date $Date: 2008-10-0 2 20:50:41$6 * @version $Revision: 1.5 $ $Name: not supported by cvs2svn $ 7 * @date $Date: 2008-10-03 20:59:16 $ 8 8 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii 9 9 */ … … 24 24 typedef struct 25 25 { 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. 37 49 } 38 50 pmMoments; -
trunk/psModules/src/objects/pmSource.c
r19848 r19879 6 6 * @author EAM, IfA: significant modifications. 7 7 * 8 * @version $Revision: 1.5 6$ $Name: not supported by cvs2svn $9 * @date $Date: 2008-10-0 2 20:51:29$8 * @version $Revision: 1.57 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2008-10-03 20:59:16 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 330 330 331 331 // 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) 339 339 continue; 340 340 if (tmpSrc->mode & PM_SOURCE_MODE_BLEND) … … 342 342 343 343 // for the moment, force splane dimensions to be 10x10 image pix 344 binX = tmpSrc->moments-> Sx/SCALE;344 binX = tmpSrc->moments->Mxx/SCALE; 345 345 if (binX < 0) 346 346 continue; … … 348 348 continue; 349 349 350 binY = tmpSrc->moments-> Sy/SCALE;350 binY = tmpSrc->moments->Myy/SCALE; 351 351 if (binY < 0) 352 352 continue; … … 427 427 continue; 428 428 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; 439 439 tmpSx->n++; 440 440 tmpSy->n++; … … 519 519 } 520 520 521 psF32 sigX = source->moments-> Sx;522 psF32 sigY = source->moments-> Sy;521 psF32 sigX = source->moments->Mxx; 522 psF32 sigY = source->moments->Myy; 523 523 524 524 // XXX EAM : can we use the value of SATURATE if mask is NULL? … … 635 635 # define VALID_RADIUS(X,Y,RAD2) (((RAD2) >= (PS_SQR(X) + PS_SQR(Y))) ? 1 : 0) 636 636 637 /*** this been moved to pmSourceMoments.c ***/ 638 # if (0) 637 639 bool pmSourceMoments(pmSource *source, 638 640 psF32 radius) … … 774 776 } 775 777 776 source->moments-> x = x + xPeak;777 source->moments-> y = y + yPeak;778 source->moments->Mx = x + xPeak; 779 source->moments->My = y + yPeak; 778 780 779 781 // 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; 781 783 source->moments->Sum = Sum; 782 784 source->moments->SN = Sum / sqrt(Var); … … 786 788 // XXX EAM : these values can be negative, so we need to limit the range 787 789 // 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); 792 794 793 795 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); 797 799 798 800 psTrace("psModules.objects", 5, "---- end ----\n"); 799 801 return(true); 800 802 } 801 803 # endif 802 804 // construct a realization of the source model 803 805 bool pmSourceCacheModel (pmSource *source, psMaskType maskVal) { -
trunk/psModules/src/objects/pmSourceIO_RAW.c
r15562 r19879 3 3 * @author EAM, IfA 4 4 * 5 * @version $Revision: 1.1 8$ $Name: not supported by cvs2svn $6 * @date $Date: 200 7-11-10 01:09:20$5 * @version $Revision: 1.19 $ $Name: not supported by cvs2svn $ 6 * @date $Date: 2008-10-03 20:59:16 $ 7 7 * 8 8 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 225 225 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", 226 226 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, 229 229 moment->Sum, moment->Peak, 230 230 moment->Sky, moment->SN, … … 258 258 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", 259 259 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, 262 262 source->moments->Sum, source->moments->Peak, 263 263 source->moments->Sky, source->moments->SN, -
trunk/psModules/src/objects/pmSourcePlotMoments.c
r18554 r19879 5 5 * @author EAM, IfA 6 6 * 7 * @version $Revision: 1.1 1$ $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 $ 9 9 * 10 10 * Copyright 2006 IfA, University of Hawaii … … 117 117 continue; 118 118 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; 121 121 nF++; 122 122 … … 125 125 continue; 126 126 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; 129 129 nB++; 130 130 } -
trunk/psModules/src/objects/pmSourcePlotPSFModel.c
r15562 r19879 5 5 * @author EAM, IfA 6 6 * 7 * @version $Revision: 1.1 2$ $Name: not supported by cvs2svn $8 * @date $Date: 200 7-11-10 01:09:20$7 * @version $Revision: 1.13 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2008-10-03 20:59:16 $ 9 9 * 10 10 * Copyright 2006 IfA, University of Hawaii … … 123 123 124 124 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; 128 128 129 129 // force the axis ratio to be < 20.0
Note:
See TracChangeset
for help on using the changeset viewer.
