Changeset 36747 for trunk/psphot/src/psphotGalaxyShape.c
- Timestamp:
- May 13, 2014, 2:40:41 PM (12 years ago)
- File:
-
- 1 edited
-
trunk/psphot/src/psphotGalaxyShape.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psphot/src/psphotGalaxyShape.c
r36718 r36747 80 80 assert (markVal); 81 81 82 // maskVal is used to test for rejected pixels, and must include markVal83 82 maskVal |= markVal; 84 83 85 // bit-mask to mark pixels not used in analysis86 84 psphotGalaxyShapeOptions *opt = psphotGalaxyShapeOptionsAlloc(); 85 opt->Q = psMetadataLookupF32(&status, recipe, "GALAXY_SHAPES_Q"); 86 psAssert (status, "missing GALAXY_SHAPES_Q"); 87 opt->NSigma = psMetadataLookupF32(&status, recipe, "GALAXY_SHAPES_NSIGMA"); 88 psAssert (status, "missing GALAXY_SHAPES_NSIGMA"); 89 opt->clampSN = psMetadataLookupF32(&status, recipe, "GALAXY_SHAPES_CLAMP_SN"); 90 psAssert (status, "missing GALAXY_SHAPES_NSIGMA"); 91 92 #ifdef notdef 87 93 opt->fRmajorMin = psMetadataLookupF32(&status, recipe, "GALAXY_SHAPES_FR_MAJOR_MIN"); if (!status) opt->fRmajorMin = 0.5; 88 94 opt->fRmajorMax = psMetadataLookupF32(&status, recipe, "GALAXY_SHAPES_FR_MAJOR_MAX"); if (!status) opt->fRmajorMax = 2.0; … … 91 97 opt->fRminorMax = psMetadataLookupF32(&status, recipe, "GALAXY_SHAPES_FR_MINOR_MAX"); if (!status) opt->fRminorMax = 2.0; 92 98 opt->fRminorDel = psMetadataLookupF32(&status, recipe, "GALAXY_SHAPES_FR_MINOR_DEL"); if (!status) opt->fRminorDel = 0.1; 99 #endif 93 100 94 101 // what fraction of the PSF is used? (radius in pixels : 2 -> 5x5 box) … … 238 245 bool psphotGalaxyShapeGrid (pmSource *source, pmSourceFitOptions *fitOptions, psphotGalaxyShapeOptions *opt, psImageMaskType maskVal, int psfSize) { 239 246 247 240 248 for (int iModel = 0 ; iModel < source->modelFits->n; iModel++) { 241 249 pmModel *model = source->modelFits->data[iModel]; … … 252 260 253 261 // double check that the guess is carried along... 254 255 // I have some source guess (e0, e1, e2)256 psEllipseAxes guessAxes = pmPSF_ModelToAxes (PAR, modelType);257 258 262 if (!source->galaxyFits) { 259 263 source->galaxyFits = psArrayAllocEmpty(1); 260 // source->galaxyFits = pmSourceGalaxyFitsAlloc();261 264 } 262 265 pmSourceGalaxyFits *galaxyFits = pmSourceGalaxyFitsAlloc(); … … 264 267 psFree(galaxyFits); 265 268 269 // set the options for this source 270 psphotGalaxyShapeOptionsSet(source, galaxyFits, opt); 271 272 // I have some source guess (e0, e1, e2) 273 psEllipseAxes guessAxes = pmPSF_ModelToAxes (PAR, modelType); 274 266 275 float fRmajorBest = NAN; 267 276 float fRminorBest = NAN; 268 277 float chisqBest = NAN; 269 for (float fRmajor = opt->fRmajorMin; fRmajor < opt->fRmajorMax + 0.5*opt->fRmajorDel; fRmajor += opt->fRmajorDel) {270 for (float fRminor = opt->fRminorMin; fRminor < opt->fRminorMax + 0.5*opt->fRminorDel; fRminor += opt->fRminorDel) {278 for (float fRmajor = galaxyFits->fRmajorMin; fRmajor < galaxyFits->fRmajorMax + 0.5*galaxyFits->fRmajorDel; fRmajor += galaxyFits->fRmajorDel) { 279 for (float fRminor = galaxyFits->fRminorMin; fRminor < galaxyFits->fRminorMax + 0.5*galaxyFits->fRminorDel; fRminor += galaxyFits->fRminorDel) { 271 280 272 281 psEllipseAxes testAxes = guessAxes; … … 405 414 psMemSetDeallocator(opt, (psFreeFunc) psphotGalaxyShapeOptionsFree); 406 415 416 #ifdef notdef 407 417 opt->fRmajorMin = 0.5; 408 418 opt->fRmajorMax = 2.0; … … 411 421 opt->fRminorMax = 2.0; 412 422 opt->fRminorDel = 0.1; 423 opt->snMinAllTrials = 20; // for sources with cff SN < 20 ... 424 opt->reduceTrialsFactor = 2; // cut the number of trials in half (double the deltas) 425 #endif 413 426 414 427 return opt; 415 428 } 416 429 430 void psphotGalaxyShapeOptionsSet(pmSource *source, pmSourceGalaxyFits *galaxyFits, psphotGalaxyShapeOptions *options) 431 { 432 // XXX: put these in recipe 433 // doesn't make sense to use too small of a spacing 434 float clampedSN = source->extSN < options->clampSN ? source->extSN : options->clampSN; 435 436 float f_del = options->Q / clampedSN; 437 float f_min = 1 - options->NSigma * f_del; 438 float f_max = 1 + options->NSigma * f_del; 439 440 galaxyFits->fRmajorMin = f_min; 441 galaxyFits->fRmajorMax = f_max; 442 galaxyFits->fRmajorDel = f_del; 443 galaxyFits->fRminorMin = f_min; 444 galaxyFits->fRminorMax = f_max; 445 galaxyFits->fRminorDel = f_del; 446 } 447
Note:
See TracChangeset
for help on using the changeset viewer.
