Changeset 18554 for trunk/psModules/src/objects
- Timestamp:
- Jul 15, 2008, 10:25:00 AM (18 years ago)
- Location:
- trunk/psModules/src/objects
- Files:
-
- 7 edited
-
pmPSF.c (modified) (5 diffs)
-
pmPSFtry.c (modified) (7 diffs)
-
pmSource.c (modified) (2 diffs)
-
pmSourcePhotometry.c (modified) (6 diffs)
-
pmSourcePhotometry.h (modified) (2 diffs)
-
pmSourcePlotMoments.c (modified) (2 diffs)
-
pmSourceSky.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/objects/pmPSF.c
r15983 r18554 6 6 * @author EAM, IfA 7 7 * 8 * @version $Revision: 1.3 5$ $Name: not supported by cvs2svn $9 * @date $Date: 2008-0 1-02 20:41:55$8 * @version $Revision: 1.36 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2008-07-15 20:25:00 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 404 404 405 405 // we generate the growth curve for the center of the image with the specified psf model 406 bool pmGrowthCurveGenerate (pmReadout *readout, pmPSF *psf, bool ignore, psMaskType maskVal, psMaskType mark )406 bool pmGrowthCurveGenerate (pmReadout *readout, pmPSF *psf, bool ignore, psMaskType maskVal, psMaskType markVal) 407 407 { 408 408 PS_ASSERT_PTR_NON_NULL(readout, false); … … 416 416 // create template model 417 417 pmModel *modelRef = pmModelAlloc(psf->type); 418 419 // maskVal is used to test for rejected pixels, and must include markVal 420 maskVal |= markVal; 418 421 419 422 // use the center of the center pixel of the image … … 465 468 466 469 // mask the given aperture and measure the apMag 467 psImageKeepCircle (mask, xc, yc, radius, "OR", mark );470 psImageKeepCircle (mask, xc, yc, radius, "OR", markVal); 468 471 if (!pmSourcePhotometryAper (&apMag, model, image, mask, maskVal)) { 469 472 psError(PM_ERR_PHOTOM, false, "Measuring apMag for radius == %g", radius); … … 473 476 break; 474 477 } 475 476 // XXX since we re-mask on each pass, this could be dropped. 477 psImageKeepCircle (mask, xc, yc, radius, "AND", PS_NOT_U8(mark)); 478 psImageKeepCircle (mask, xc, yc, radius, "AND", PS_NOT_U8(markVal)); 478 479 479 480 // the 'ignore' mode is for testing -
trunk/psModules/src/objects/pmPSFtry.c
r18040 r18554 5 5 * @author EAM, IfA 6 6 * 7 * @version $Revision: 1.5 6$ $Name: not supported by cvs2svn $8 * @date $Date: 2008-0 6-10 01:32:15$7 * @version $Revision: 1.57 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2008-07-15 20:25:00 $ 9 9 * 10 10 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 98 98 99 99 // generate a pmPSFtry with a copy of the test PSF sources 100 pmPSFtry *pmPSFtryModel (const psArray *sources, const char *modelName, pmPSFOptions *options, psMaskType maskVal, psMaskType mark )100 pmPSFtry *pmPSFtryModel (const psArray *sources, const char *modelName, pmPSFOptions *options, psMaskType maskVal, psMaskType markVal) 101 101 { 102 102 bool status; … … 116 116 return NULL; 117 117 } 118 119 // maskVal is used to test for rejected pixels, and must include markVal 120 maskVal |= markVal; 118 121 119 122 // stage 1: fit an EXT model to all candidates PSF sources … … 129 132 } 130 133 131 // set object mask to define valid pixels -- XXX not unset?132 psImageKeepCircle (source->maskObj, source->peak->x, source->peak->y, options->radius, "OR", mark );134 // set object mask to define valid pixels 135 psImageKeepCircle (source->maskObj, source->peak->x, source->peak->y, options->radius, "OR", markVal); 133 136 134 137 // fit model as EXT, not PSF 135 138 status = pmSourceFitModel (source, source->modelEXT, PM_SOURCE_FIT_EXT, maskVal); 139 140 // clear object mask to define valid pixels 141 psImageKeepCircle (source->maskObj, source->peak->x, source->peak->y, options->radius, "AND", PS_NOT_U8(markVal)); 136 142 137 143 // exclude the poor fits … … 170 176 source->modelPSF->radiusFit = options->radius; 171 177 172 // set object mask to define valid pixels -- XXX not unset?173 psImageKeepCircle (source->maskObj, source->peak->x, source->peak->y, options->radius, "OR", mark );178 // set object mask to define valid pixels 179 psImageKeepCircle (source->maskObj, source->peak->x, source->peak->y, options->radius, "OR", markVal); 174 180 175 181 // fit the PSF model to the source … … 178 184 // skip poor fits 179 185 if (!status) { 186 psImageKeepCircle (source->maskObj, source->peak->x, source->peak->y, options->radius, "AND", PS_NOT_U8(markVal)); 180 187 psfTry->mask->data.U8[i] = PSFTRY_MASK_PSF_FAIL; 181 188 psTrace ("psModules.objects", 4, "dropping %d (%d,%d) : failed PSF fit\n", i, source->peak->x, source->peak->y); … … 183 190 } 184 191 185 // XXX : use a different aperture radius from the fit radius? 186 status = pmSourceMagnitudes (source, psfTry->psf, PM_SOURCE_PHOT_INTERP, maskVal, mark); 192 status = pmSourceMagnitudes (source, psfTry->psf, PM_SOURCE_PHOT_INTERP, maskVal); 187 193 if (!status || isnan(source->apMag)) { 194 psImageKeepCircle (source->maskObj, source->peak->x, source->peak->y, options->radius, "AND", PS_NOT_U8(markVal)); 188 195 psfTry->mask->data.U8[i] = PSFTRY_MASK_BAD_PHOT; 189 196 psTrace ("psModules.objects", 4, "dropping %d (%d,%d) : poor photometry\n", i, source->peak->x, source->peak->y); 190 197 continue; 191 198 } 199 200 // clear object mask to define valid pixels 201 psImageKeepCircle (source->maskObj, source->peak->x, source->peak->y, options->radius, "AND", PS_NOT_U8(markVal)); 192 202 193 203 psfTry->fitMag->data.F32[i] = source->psfMag; -
trunk/psModules/src/objects/pmSource.c
r18042 r18554 6 6 * @author EAM, IfA: significant modifications. 7 7 * 8 * @version $Revision: 1.5 4$ $Name: not supported by cvs2svn $9 * @date $Date: 2008-0 6-10 02:26:17$8 * @version $Revision: 1.55 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2008-07-15 20:25:00 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 838 838 839 839 // should we call pmSourceCacheModel if it does not exist? 840 bool pmSourceOp (pmSource *source, pmModelOpMode mode, bool add, 841 psMaskType maskVal, int dx, int dy) 840 bool pmSourceOp (pmSource *source, pmModelOpMode mode, bool add, psMaskType maskVal, int dx, int dy) 842 841 { 843 842 PS_ASSERT_PTR_NON_NULL(source, false); -
trunk/psModules/src/objects/pmSourcePhotometry.c
r17998 r18554 3 3 * @author EAM, IfA; GLG, MHPCC 4 4 * 5 * @version $Revision: 1.4 2$ $Name: not supported by cvs2svn $6 * @date $Date: 2008-0 6-09 00:43:46$5 * @version $Revision: 1.43 $ $Name: not supported by cvs2svn $ 6 * @date $Date: 2008-07-15 20:25:00 $ 7 7 * 8 8 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 64 64 65 65 // XXX masked region should be (optionally) elliptical 66 bool pmSourceMagnitudes (pmSource *source, pmPSF *psf, pmSourcePhotometryMode mode, 67 psMaskType maskVal, psMaskType mark) 66 bool pmSourceMagnitudes (pmSource *source, pmPSF *psf, pmSourcePhotometryMode mode, psMaskType maskVal) 68 67 { 69 68 PS_ASSERT_PTR_NON_NULL(source, false); … … 230 229 mask = source->maskObj; 231 230 } 232 // set aperture mask circle to model radius233 // XXX use a different radius for apertures and fits...234 // XXX can I remove this? the source should have the mask defined when it is constructed or235 // when the fit / aperture radius is changed...236 psImageKeepCircle (source->maskObj, x, y, model->radiusFit, "OR", mark);237 231 238 232 // measure the weight of included pixels 239 233 // XXX is this supposed to use the weight or the flux? 240 234 if (mode & PM_SOURCE_PHOT_WEIGHT) { 241 pmSourcePixelWeight (&source->pixWeight, model, source->pixels, source->maskObj, maskVal | mark);235 pmSourcePixelWeight (&source->pixWeight, model, source->pixels, source->maskObj, maskVal); 242 236 } 243 237 244 238 // measure object aperture photometry 245 status = pmSourcePhotometryAper (&source->apMag, model, flux, mask, maskVal | mark);239 status = pmSourcePhotometryAper (&source->apMag, model, flux, mask, maskVal); 246 240 if (!status) { 247 241 psTrace ("psModules.objects", 3, "fail mag : bad Ap Mag"); … … 264 258 psFree(mask); 265 259 } 266 267 // unmask aperture268 // XXX can I remove this? this will probably break things downstream...269 psImageKeepCircle (source->maskObj, x, y, model->radiusFit, "AND", PS_NOT_U8(mark));270 260 271 261 // if source was originally subtracted, re-subtract object, leave local sky … … 308 298 309 299 // return source aperture magnitude 310 bool pmSourcePhotometryAper (float *apMag, pmModel *model, psImage *image, psImage *mask, 311 psMaskType maskVal) 300 bool pmSourcePhotometryAper (float *apMag, pmModel *model, psImage *image, psImage *mask, psMaskType maskVal) 312 301 { 313 302 PS_ASSERT_PTR_NON_NULL(apMag, false); … … 347 336 348 337 // return source aperture magnitude 349 bool pmSourcePixelWeight (float *pixWeight, pmModel *model, psImage *image, psImage *mask, 350 psMaskType maskVal) 338 bool pmSourcePixelWeight (float *pixWeight, pmModel *model, psImage *image, psImage *mask, psMaskType maskVal) 351 339 { 352 340 PS_ASSERT_PTR_NON_NULL(pixWeight, false); -
trunk/psModules/src/objects/pmSourcePhotometry.h
r13898 r18554 4 4 * @author EAM, IfA; GLG, MHPCC 5 5 * 6 * @version $Revision: 1.1 0$ $Name: not supported by cvs2svn $7 * @date $Date: 200 7-06-20 02:22:26$6 * @version $Revision: 1.11 $ $Name: not supported by cvs2svn $ 7 * @date $Date: 2008-07-15 20:25:00 $ 8 8 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii 9 9 */ … … 50 50 51 51 bool pmSourceMagnitudesInit (psMetadata *config); 52 bool pmSourceMagnitudes (pmSource *source, pmPSF *psf, pmSourcePhotometryMode mode, psMaskType maskVal , psMaskType mark);52 bool pmSourceMagnitudes (pmSource *source, pmPSF *psf, pmSourcePhotometryMode mode, psMaskType maskVal); 53 53 bool pmSourcePixelWeight (float *pixWeight, pmModel *model, psImage *image, psImage *mask, psMaskType maskVal); 54 54 bool pmSourceChisq (pmModel *model, psImage *image, psImage *mask, psImage *weight, psMaskType maskVal); -
trunk/psModules/src/objects/pmSourcePlotMoments.c
r15562 r18554 5 5 * @author EAM, IfA 6 6 * 7 * @version $Revision: 1.1 0$ $Name: not supported by cvs2svn $8 * @date $Date: 200 7-11-10 01:09:20 $7 * @version $Revision: 1.11 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2008-07-15 20:25:00 $ 9 9 * 10 10 * Copyright 2006 IfA, University of Hawaii … … 95 95 graphdata.xmin = -0.05; 96 96 graphdata.ymin = -0.05; 97 graphdata.xmax = + 2.05;98 graphdata.ymax = + 2.05;97 graphdata.xmax = +4.05; 98 graphdata.ymax = +4.05; 99 99 KapaSetLimits (kapa, &graphdata); 100 100 -
trunk/psModules/src/objects/pmSourceSky.c
r15980 r18554 6 6 * @author EAM, IfA: significant modifications. 7 7 * 8 * @version $Revision: 1.1 6$ $Name: not supported by cvs2svn $9 * @date $Date: 2008-0 1-02 20:39:04$8 * @version $Revision: 1.17 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2008-07-15 20:25:00 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 42 42 43 43 The source.pixels and source.mask must already exist 44 45 This function modifies the source mask; it should only be called before the object aperture is defined 44 46 *****************************************************************************/ 45 47 … … 49 51 psF32 Radius, 50 52 psMaskType maskVal, 51 psMaskType mark )53 psMaskType markVal) 52 54 { 53 55 psTrace("psModules.objects", 3, "---- %s() begin ----\n", __func__); … … 69 71 psRegion srcRegion; 70 72 73 // maskVal is used to test for rejected pixels, and must include markVal 74 maskVal |= markVal; 75 71 76 srcRegion = psRegionForSquare(peak->x, peak->y, Radius); 72 77 srcRegion = psRegionForImage(mask, srcRegion); 73 78 74 psImageMaskRegion(mask, srcRegion, "OR", mark );79 psImageMaskRegion(mask, srcRegion, "OR", markVal); 75 80 psStats *myStats = psStatsAlloc(statsOptions); 76 if (!psImageStats(myStats, image, mask, maskVal | mark)) {81 if (!psImageStats(myStats, image, mask, maskVal)) { 77 82 psError(PS_ERR_UNKNOWN, false, "Unable to get image statistics.\n"); 78 83 psFree(myStats); 79 84 return false; 80 85 } 81 psImageMaskRegion(mask, srcRegion, "AND", PS_NOT_U8(mark ));86 psImageMaskRegion(mask, srcRegion, "AND", PS_NOT_U8(markVal)); 82 87 double value = psStatsGetValue(myStats, statistic); 83 88 psFree(myStats); … … 101 106 psF32 Radius, 102 107 psMaskType maskVal, 103 psMaskType mark 108 psMaskType markVal 104 109 ) 105 110 { … … 110 115 PS_ASSERT_PTR_NON_NULL(source->peak, false); 111 116 PS_ASSERT_INT_POSITIVE(Radius, false); 117 118 // maskVal is used to test for rejected pixels, and must include markVal 119 maskVal |= markVal; 112 120 113 121 psStatsOptions statistic = psStatsSingleOption(statsOptions); … … 125 133 srcRegion = psRegionForImage(mask, srcRegion); 126 134 127 psImageMaskRegion(mask, srcRegion, "OR", mark );135 psImageMaskRegion(mask, srcRegion, "OR", markVal); 128 136 psStats *myStats = psStatsAlloc(statsOptions); 129 if (!psImageStats(myStats, image, mask, maskVal | mark)) {137 if (!psImageStats(myStats, image, mask, maskVal)) { 130 138 psError(PS_ERR_UNKNOWN, false, "Unable to get image statistics.\n"); 131 139 psFree(myStats); 132 140 return false; 133 141 } 134 psImageMaskRegion(mask, srcRegion, "AND", PS_NOT_U8(mark ));142 psImageMaskRegion(mask, srcRegion, "AND", PS_NOT_U8(markVal)); 135 143 double value = psStatsGetValue(myStats, statistic); 136 144 psFree(myStats);
Note:
See TracChangeset
for help on using the changeset viewer.
