Changeset 33963 for trunk/psphot/src
- Timestamp:
- May 30, 2012, 1:46:12 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 11 edited
-
. (modified) (1 prop)
-
psphot (modified) (1 prop)
-
psphot/src (modified) (1 prop)
-
psphot/src/psphot.h (modified) (1 diff)
-
psphot/src/psphotDefineFiles.c (modified) (1 diff)
-
psphot/src/psphotEfficiency.c (modified) (1 diff)
-
psphot/src/psphotFitSourcesLinear.c (modified) (12 diffs)
-
psphot/src/psphotModelBackground.c (modified) (8 diffs)
-
psphot/src/psphotStackImageLoop.c (modified) (1 prop)
-
psphot/src/psphotTest.c (modified) (1 diff)
-
psphot/src/psphotTestSourceOutput.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
trunk/psphot
- Property svn:mergeinfo changed
/branches/eam_branches/ipp-20111122/psphot merged: 33070-33071,33086,33088,33094-33095,33612,33640 /branches/eam_branches/ipp-20120405/psphot (added) merged: 33946,33953
- Property svn:mergeinfo changed
-
trunk/psphot/src
- Property svn:mergeinfo changed
/branches/eam_branches/ipp-20111122/psphot/src merged: 33070-33071,33086,33094,33612,33640 /branches/eam_branches/ipp-20120405/psphot/src (added) merged: 33946,33953
- Property svn:mergeinfo changed
-
trunk/psphot/src/psphot.h
r33883 r33963 99 99 100 100 bool psphotFitSourcesLinear (pmConfig *config, const pmFPAview *view, const char *filerule, bool final); 101 bool psphotFitSourcesLinearReadout (psMetadata *recipe, pmReadout *readout, psArray *sources, pmPSF *psf, bool final );101 bool psphotFitSourcesLinearReadout (psMetadata *recipe, pmReadout *readout, psArray *sources, pmPSF *psf, bool final, pmSourceFitVarMode fitVarMode); 102 102 103 103 bool psphotSourceSize (pmConfig *config, const pmFPAview *view, const char *filerule, bool getPSFsize); -
trunk/psphot/src/psphotDefineFiles.c
r25983 r33963 85 85 output->save = true; 86 86 } 87 // // optionally save the smoothed variance model (small FITS image) 88 // if (psMetadataLookupBool(NULL, recipe, "SAVE.BACKMDL")) { 89 // int DX = psMetadataLookupS32 (&status, recipe, "BACKGROUND.XBIN"); 90 // int DY = psMetadataLookupS32 (&status, recipe, "BACKGROUND.YBIN"); 91 // pmFPAfile *output = pmFPAfileDefineFromFile (config, input, DX, DY, "PSPHOT.VARMDL"); 92 // if (!output) { 93 // psError(PSPHOT_ERR_CONFIG, false, "Cannot find a rule for PSPHOT.VARMDL"); 94 // return false; 95 // } 96 // output->save = true; 97 // } 98 // // optionally save the smoothed variance model's standard deviation (small FITS image) 99 // if (psMetadataLookupBool(NULL, recipe, "SAVE.VARMDL.STDEV")) { 100 // int DX = psMetadataLookupS32 (&status, recipe, "BACKGROUND.XBIN"); 101 // int DY = psMetadataLookupS32 (&status, recipe, "BACKGROUND.YBIN"); 102 // pmFPAfile *output = pmFPAfileDefineFromFile (config, input, DX, DY, "PSPHOT.VARMDL.STDEV"); 103 // if (!output) { 104 // psError(PSPHOT_ERR_CONFIG, false, "Cannot find a rule for PSPHOT.VARMDL.STDEV"); 105 // return false; 106 // } 107 // output->save = true; 108 // } 87 109 // optionally save the PSF Model 88 110 if (psMetadataLookupBool(NULL, recipe, "SAVE.PSF")) { -
trunk/psphot/src/psphotEfficiency.c
r32695 r33963 420 420 421 421 // psphotFitSourcesLinearReadout subtracts the model fits 422 if (!psphotFitSourcesLinearReadout(recipe, readout, fakeSourcesAll, psf, true )) {422 if (!psphotFitSourcesLinearReadout(recipe, readout, fakeSourcesAll, psf, true, PM_SOURCE_PHOTFIT_CONST)) { 423 423 psError(PS_ERR_UNKNOWN, false, "Unable to perform linear fit on fake sources."); 424 424 psFree(fakeSources); -
trunk/psphot/src/psphotFitSourcesLinear.c
r32996 r33963 12 12 static bool SetBorderMatrixElements (psSparseBorder *border, pmReadout *readout, psArray *sources, bool constant_weights, int SKY_FIT_ORDER, psImageMaskType markVal); 13 13 14 bool psphotGenerateModelVariance (pmConfig *config, const pmFPAview *view, pmFPAfile *file, int index, psMetadata *recipe, pmReadout *readout, psArray *sources); 15 pmSourceFitVarMode psphotGetFitVarMode (psMetadata *recipe); 16 bool psphotFreeModelVariance (pmReadout *readout, psArray *sources); 17 14 18 // for now, let's store the detections on the readout->analysis for each readout 15 19 bool psphotFitSourcesLinear (pmConfig *config, const pmFPAview *view, const char *filerule, bool final) … … 24 28 assert (recipe); 25 29 30 pmSourceFitVarMode fitVarMode = psphotGetFitVarMode (recipe); 31 if (!fitVarMode) { 32 psError (PSPHOT_ERR_CONFIG, true, "failed to get LINEAR_FIT_VARIANCE_MODE"); 33 return false; 34 } 35 // MODEL_VAR requires 2 passes -- in the first, we get the rough fluxes; in the second, we 36 // use the flux to define the model variance before fitting the objects. Other modes only 37 // do a single pass. 38 pmSourceFitVarMode fitVarModePass1 = (fitVarMode == PM_SOURCE_PHOTFIT_MODEL_VAR) ? PM_SOURCE_PHOTFIT_CONST : fitVarMode; 39 26 40 int num = psphotFileruleCount(config, filerule); 27 41 … … 50 64 psAssert (psf, "missing psf?"); 51 65 52 if (!psphotFitSourcesLinearReadout (recipe, readout, sources, psf, final )) {66 if (!psphotFitSourcesLinearReadout (recipe, readout, sources, psf, final, fitVarModePass1)) { 53 67 psError (PSPHOT_ERR_CONFIG, false, "failed to fit sources (linear) for %s entry %d", filerule, i); 54 68 return false; 55 69 } 70 71 // the MODEL_VAR weighting scheme requires knowledge of the model fluxes to generate the variance 72 // after we have determined the initial set of fits, then we can generate the variance image and 73 // re-run the fit against that variance. 74 if (fitVarMode == PM_SOURCE_PHOTFIT_MODEL_VAR) { 75 // generate the model variance image & source pointers 76 if (!psphotGenerateModelVariance (config, view, file, i, recipe, readout, sources)) { 77 psError (PSPHOT_ERR_CONFIG, false, "failed to fit sources (linear) for %s entry %d", filerule, i); 78 return false; 79 } 80 81 // replace all sources (use TMPF_SUBTRACTED as test) 82 psphotReplaceAllSourcesReadout (config, view, filerule, i, recipe, false); 83 84 // rerun fit with correct fitVarMode 85 if (!psphotFitSourcesLinearReadout (recipe, readout, sources, psf, final, fitVarMode)) { 86 psError (PSPHOT_ERR_CONFIG, false, "failed to fit sources (linear) for %s entry %d", filerule, i); 87 return false; 88 } 89 90 // free the model variance image & source pointers 91 if (!psphotFreeModelVariance (readout, sources)) { 92 psError (PSPHOT_ERR_CONFIG, false, "failed to fit sources (linear) for %s entry %d", filerule, i); 93 return false; 94 } 95 } 56 96 57 97 psphotVisualShowResidualImage (readout, (num > 0)); … … 62 102 } 63 103 64 bool psphotFitSourcesLinearReadout (psMetadata *recipe, pmReadout *readout, psArray *sources, pmPSF *psf, bool final) { 104 // look up the fit variance mode from the recipe; older recipes do not have the value 105 // 'LINEAR_FIT_VARIANCE_MODE'; in those cases, look for 'CONSTANT_PHOTOMETRIC_WEIGHTS' as a boolean and 106 // set the value to either CONST or IMAGE_VAR 107 pmSourceFitVarMode psphotGetFitVarMode (psMetadata *recipe) { 108 109 bool status = false; 110 111 char *fitVarModeString = psMetadataLookupStr(&status, recipe, "LINEAR_FIT_VARIANCE_MODE"); 112 if (!status) { 113 bool CONSTANT_PHOTOMETRIC_WEIGHTS = psMetadataLookupBool(&status, recipe, "CONSTANT_PHOTOMETRIC_WEIGHTS"); 114 if (!status) { 115 psAbort("You must provide a value for LINEAR_FIT_VARIANCE_MODE or CONSTANT_PHOTOMETRIC_WEIGHTS"); 116 } 117 pmSourceFitVarMode fitVarMode = CONSTANT_PHOTOMETRIC_WEIGHTS ? PM_SOURCE_PHOTFIT_CONST : PM_SOURCE_PHOTFIT_IMAGE_VAR; 118 return fitVarMode; 119 } 120 if (!strcasecmp(fitVarModeString, "CONSTANT") || !strcasecmp(fitVarModeString, "CONST")) { 121 return PM_SOURCE_PHOTFIT_CONST; 122 } 123 if (!strcasecmp(fitVarModeString, "IMAGE") || !strcasecmp(fitVarModeString, "IMAGE_VAR")) { 124 return PM_SOURCE_PHOTFIT_IMAGE_VAR; 125 } 126 if (!strcasecmp(fitVarModeString, "MODEL") || !strcasecmp(fitVarModeString, "MODEL_VAR")) { 127 return PM_SOURCE_PHOTFIT_MODEL_VAR; 128 } 129 psError (PSPHOT_ERR_CONFIG, false, "Invalid value for LINEAR_FIT_VARIANCE_MODE (%s)", fitVarModeString); 130 return PM_SOURCE_PHOTFIT_NONE; 131 } 132 133 bool psphotFitSourcesLinearReadout (psMetadata *recipe, pmReadout *readout, psArray *sources, pmPSF *psf, bool final, pmSourceFitVarMode fitVarMode) { 65 134 66 135 bool status; … … 99 168 if (psRegionIsNaN (AnalysisRegion)) psAbort("analysis region mis-defined"); 100 169 101 bool CONSTANT_PHOTOMETRIC_WEIGHTS =102 psMetadataLookupBool(&status, recipe, "CONSTANT_PHOTOMETRIC_WEIGHTS");103 if (!status) {104 psAbort("You must provide a value for the BOOL recipe CONSTANT_PHOTOMETRIC_WEIGHTS");105 }106 170 int SKY_FIT_ORDER = psMetadataLookupS32(&status, recipe, "SKY_FIT_ORDER"); 107 171 if (!status) { … … 231 295 psSparseBorder *border = psSparseBorderAlloc (sparse, nBorder); 232 296 297 // if fitVarMode is MODEL_VAR, then we need to generate the model image variance 298 // XXX we have two possibilities here: 299 300 // 1) do 2 passes, where in the first case we use the CONST weighting, and in the second 301 // use the fitted model values to define the model 302 303 // 2) do a single pass, and use the model guess to define the model variance (but do I trust the Model Guess?) 304 233 305 // fill out the sparse matrix elements and border elements (B) 234 306 // SRCi is the current source of interest … … 238 310 239 311 // diagonal elements of the sparse matrix (auto-cross-product) 240 f = pmSourceModelDotModel (SRCi, SRCi, CONSTANT_PHOTOMETRIC_WEIGHTS, covarFactor, maskVal);312 f = pmSourceModelDotModel (SRCi, SRCi, fitVarMode, covarFactor, maskVal); 241 313 psSparseMatrixElement (sparse, i, i, f); 242 314 243 // the formal error depends on the weighting scheme244 if ( CONSTANT_PHOTOMETRIC_WEIGHTS) {245 float var = pmSourceModelDotModel (SRCi, SRCi, false, covarFactor, maskVal);315 // if we have used CONSTANT errors, then we need to calculate the value of the parameter error 316 if (fitVarMode != PM_SOURCE_PHOTFIT_IMAGE_VAR) { 317 float var = pmSourceModelDotModel (SRCi, SRCi, PM_SOURCE_PHOTFIT_IMAGE_VAR, covarFactor, maskVal); 246 318 errors->data.F32[i] = 1.0 / sqrt(var); 247 319 } else { … … 251 323 252 324 // find the image x model value 253 f = pmSourceDataDotModel (SRCi, SRCi, CONSTANT_PHOTOMETRIC_WEIGHTS, covarFactor, maskVal);325 f = pmSourceDataDotModel (SRCi, SRCi, fitVarMode, covarFactor, maskVal); 254 326 psSparseVectorElement (sparse, i, f); 255 327 … … 257 329 switch (SKY_FIT_ORDER) { 258 330 case 1: 259 f = pmSourceModelWeight (SRCi, 1, CONSTANT_PHOTOMETRIC_WEIGHTS, covarFactor, maskVal);331 f = pmSourceModelWeight (SRCi, 1, fitVarMode, covarFactor, maskVal); 260 332 psSparseBorderElementB (border, i, 1, f); 261 f = pmSourceModelWeight (SRCi, 2, CONSTANT_PHOTOMETRIC_WEIGHTS, covarFactor, maskVal);333 f = pmSourceModelWeight (SRCi, 2, fitVarMode, covarFactor, maskVal); 262 334 psSparseBorderElementB (border, i, 2, f); 263 335 264 336 case 0: 265 f = pmSourceModelWeight (SRCi, 0, CONSTANT_PHOTOMETRIC_WEIGHTS, covarFactor, maskVal);337 f = pmSourceModelWeight (SRCi, 0, fitVarMode, covarFactor, maskVal); 266 338 psSparseBorderElementB (border, i, 0, f); 267 339 break; … … 283 355 284 356 // got an overlap; calculate cross-product and add to output array 285 f = pmSourceModelDotModel (SRCi, SRCj, CONSTANT_PHOTOMETRIC_WEIGHTS, covarFactor, maskVal);357 f = pmSourceModelDotModel (SRCi, SRCj, fitVarMode, covarFactor, maskVal); 286 358 psSparseMatrixElement (sparse, j, i, f); 287 359 } … … 321 393 322 394 // set the sky, sky_x, sky_y components of border matrix 323 SetBorderMatrixElements (border, readout, fitSources, CONSTANT_PHOTOMETRIC_WEIGHTS, SKY_FIT_ORDER, markVal);395 SetBorderMatrixElements (border, readout, fitSources, (fitVarMode == PM_SOURCE_PHOTFIT_CONST), SKY_FIT_ORDER, markVal); 324 396 325 397 psSparseConstraint constraint; … … 479 551 return true; 480 552 } 553 554 bool psphotModelBackgroundReadout(psImage *model, // Model image 555 psImage *modelStdev, // Model stdev image 556 psMetadata *analysis, // Analysis metadata for outputs 557 pmReadout *readout, // Readout for which to generate a background model 558 psImageBinning *binning, // Binning parameters 559 const pmConfig *config,// Configuration 560 bool useVarianceImage 561 ); 562 563 bool psphotGenerateModelVariance (pmConfig *config, const pmFPAview *view, pmFPAfile *file, int index, psMetadata *recipe, pmReadout *readout, psArray *sources) { 564 565 bool status = false; 566 psRegion fullRegion = psRegionSet (0, 0, 0, 0); 567 568 // bit-masks to test for good/bad pixels 569 psImageMaskType maskVal = psMetadataLookupImageMask(&status, recipe, "MASK.PSPHOT"); 570 assert (maskVal); 571 572 // bit-mask to mark pixels not used in analysis 573 psImageMaskType markVal = psMetadataLookupImageMask(&status, recipe, "MARK.PSPHOT"); 574 assert (markVal); 575 576 // maskVal is used to test for rejected pixels, and must include markVal 577 maskVal |= markVal; 578 579 // create a model variance image 580 psImage *modelVar = psImageCopy (NULL, readout->variance, PS_TYPE_F32); 581 582 // find the binning information 583 psImageBinning *backBinning = psphotBackgroundBinning (modelVar, config); 584 assert (backBinning); 585 586 psImage *varModel = psImageAlloc(backBinning->nXruff, backBinning->nYruff, PS_TYPE_F32); // Background model 587 psImage *varModelStdev = psImageAlloc(backBinning->nXruff, backBinning->nYruff, PS_TYPE_F32); // Background model 588 589 if (!psphotModelBackgroundReadout(varModel, varModelStdev, NULL, readout, backBinning, config, true)) { 590 psError(PS_ERR_UNKNOWN, false, "Unable to generate background model"); 591 psFree (varModel); 592 psFree (varModelStdev); 593 return false; 594 } 595 596 // linear interpolation to full-scale 597 if (!psImageUnbin (modelVar, varModel, backBinning)) { 598 psError (PSPHOT_ERR_PROG, true, "inconsistent sizes for unbinning"); 599 psFree (varModel); 600 psFree (varModelStdev); 601 return false; 602 } 603 604 psFree (varModel); 605 psFree (varModelStdev); 606 607 // XXX for a test: 608 psphotSaveImage (NULL, modelVar, "model.bck.fits"); 609 610 // insert all of the source models 611 for (int i = 0; i < sources->n; i++) { 612 613 // source of interest 614 pmSource *source = sources->data[i]; 615 616 // skip sources which were not fitted already 617 if (!(source->mode & PM_SOURCE_MODE_LINEAR_FIT)) continue; 618 619 // pixel region appropriate for the source 620 psRegion region = psRegionForImage (source->pixels, fullRegion); 621 622 // define the source->modelVar pixels (view on modelVar image) 623 psAssert (!source->modelVar, "programming error : modelVar should be NULL here"); 624 psAssert (source->modelFlux, "programming error : modelFlux should not be NULL here"); 625 psAssert (source->modelFlux->data.F32, "programming error : modelFlux should not be NULL here"); 626 source->modelVar = psImageSubset(modelVar, region); 627 628 // add the source model to the model variance image 629 pmSourceAdd (source, PM_MODEL_OP_MODELVAR, maskVal); 630 } 631 632 // XXX for a test: 633 psphotSaveImage (NULL, modelVar, "model.var.fits"); 634 psphotSaveImage (NULL, readout->variance, "image.var.fits"); 635 636 // we save the model variance for future reference 637 psMetadataAddImage(readout->analysis, PS_LIST_TAIL, "PSPHOT.MODEL.VAR", PS_META_REPLACE, "model variance", modelVar); 638 psFree (modelVar); 639 640 return true; 641 } 642 643 bool psphotFreeModelVariance (pmReadout *readout, psArray *sources) { 644 645 bool status = false; 646 647 // find the binning information 648 psImage *modelVar = psMetadataLookupPtr(&status, readout->analysis, "PSPHOT.MODEL.VAR"); 649 assert (modelVar); 650 651 psMetadataRemoveKey (readout->analysis, "PSPHOT.MODEL.VAR"); 652 653 // clear modelVar pointers for all of the source models 654 for (int i = 0; i < sources->n; i++) { 655 656 // source of interest 657 pmSource *source = sources->data[i]; 658 psFree (source->modelVar); 659 } 660 661 return true; 662 } -
trunk/psphot/src/psphotModelBackground.c
r32348 r33963 37 37 // corresponding to the model. Other information about the background model is saved on the 38 38 // readout->analysis 39 static bool psphotModelBackgroundReadout(psImage *model, // Model image 40 psImage *modelStdev, // Model stdev image 41 psMetadata *analysis, // Analysis metadata for outputs 42 pmReadout *readout, // Readout for which to generate a background model 43 psImageBinning *binning, // Binning parameters 44 const pmConfig *config // Configuration 39 bool psphotModelBackgroundReadout(psImage *model, // Model image 40 psImage *modelStdev, // Model stdev image 41 psMetadata *analysis, // Analysis metadata for outputs 42 pmReadout *readout, // Readout for which to generate a background model 43 psImageBinning *binning, // Binning parameters 44 const pmConfig *config,// Configuration 45 bool useVarianceImage 45 46 ) 46 47 { … … 49 50 bool status = true; 50 51 51 psImage *image = readout->image, *mask = readout->mask; // Image and mask for readout 52 psImage *image = useVarianceImage ? readout->variance : readout->image; 53 psImage *mask = readout->mask; // Image and mask for readout 52 54 53 55 // select the appropriate recipe information … … 143 145 144 146 // we save the binning structure for use in psphotMagnitudes 145 psMetadataAddPtr(analysis, PS_LIST_TAIL, "PSPHOT.BACKGROUND.BINNING", PS_DATA_UNKNOWN | PS_META_REPLACE, "Background binning", binning); 147 if (!useVarianceImage) { 148 psMetadataAddPtr(analysis, PS_LIST_TAIL, "PSPHOT.BACKGROUND.BINNING", PS_DATA_UNKNOWN | PS_META_REPLACE, "Background binning", binning); 149 } 146 150 147 151 psVector *dQ = psVectorAllocEmpty (100, PS_TYPE_F32); … … 159 163 160 164 // measure clipped median for subimages 161 psRegion ruffRegion = {0,0,0,0};162 psRegion fineRegion = {0,0,0,0};165 psRegion ruffRegion = psRegionSet (0,0,0,0); 166 psRegion fineRegion = psRegionSet (0,0,0,0); 163 167 for (int iy = 0; iy < model->numRows; iy++) { 164 168 for (int ix = 0; ix < model->numCols; ix++) { … … 330 334 psVectorStats (statsDQ, dQ, NULL, NULL, 0); 331 335 332 psMetadataAddF32(readout->analysis, PS_LIST_TAIL, "SKY_MEAN", PS_META_REPLACE, "sky mean", Value); 333 psMetadataAddF32(readout->analysis, PS_LIST_TAIL, "SKY_STDEV", PS_META_REPLACE, "sky stdev", ValueStdev); 334 psMetadataAddF32(readout->analysis, PS_LIST_TAIL, "SKY_DQ", PS_META_REPLACE, "sky quartile slope", statsDQ->sampleMedian); 335 psLogMsg ("psphot", PS_LOG_INFO, "image sky : mean %f, stdev %f, dQ %f", Value, ValueStdev, statsDQ->sampleMedian); 336 337 // measure image and background stats and save for later output 338 psStats *statsBck = psStatsAlloc (PS_STAT_SAMPLE_MEAN | 339 PS_STAT_SAMPLE_STDEV | 340 PS_STAT_MIN | 341 PS_STAT_MAX); 342 psImageStats (statsBck, model, NULL, 0); 343 psMetadataAddF32 (readout->analysis, PS_LIST_TAIL, "MSKY_MN", PS_META_REPLACE, "sky model mean", statsBck->sampleMean); 344 psMetadataAddF32 (readout->analysis, PS_LIST_TAIL, "MSKY_SIG", PS_META_REPLACE, "sky model stdev", statsBck->sampleStdev); 345 psMetadataAddF32 (readout->analysis, PS_LIST_TAIL, "MSKY_DEV", PS_META_REPLACE, "sky stdev", ValueStdev); 346 psMetadataAddF32 (readout->analysis, PS_LIST_TAIL, "MSKY_DQ", PS_META_REPLACE, "sky quartile slope", statsDQ->sampleMedian); 347 psMetadataAddF32 (readout->analysis, PS_LIST_TAIL, "MSKY_MAX", PS_META_REPLACE, "sky model maximum value", statsBck->max); 348 psMetadataAddF32 (readout->analysis, PS_LIST_TAIL, "MSKY_MIN", PS_META_REPLACE, "sky model minimum value", statsBck->min); 349 psMetadataAddS32 (readout->analysis, PS_LIST_TAIL, "MSKY_NX", PS_META_REPLACE, "sky model size (x)", model->numCols); 350 psMetadataAddS32 (readout->analysis, PS_LIST_TAIL, "MSKY_NY", PS_META_REPLACE, "sky model size (y)", model->numRows); 351 psLogMsg ("psphot", PS_LOG_INFO, "background sky : min %f mean %f max %f stdev %f", 352 statsBck->min, statsBck->sampleMean, statsBck->max, statsBck->sampleStdev); 336 if (!useVarianceImage) { 337 psMetadataAddF32(readout->analysis, PS_LIST_TAIL, "SKY_MEAN", PS_META_REPLACE, "sky mean", Value); 338 psMetadataAddF32(readout->analysis, PS_LIST_TAIL, "SKY_STDEV", PS_META_REPLACE, "sky stdev", ValueStdev); 339 psMetadataAddF32(readout->analysis, PS_LIST_TAIL, "SKY_DQ", PS_META_REPLACE, "sky quartile slope", statsDQ->sampleMedian); 340 psLogMsg ("psphot", PS_LOG_INFO, "image sky : mean %f, stdev %f, dQ %f", Value, ValueStdev, statsDQ->sampleMedian); 341 342 // measure image and background stats and save for later output 343 psStats *statsBck = psStatsAlloc (PS_STAT_SAMPLE_MEAN | 344 PS_STAT_SAMPLE_STDEV | 345 PS_STAT_MIN | 346 PS_STAT_MAX); 347 psImageStats (statsBck, model, NULL, 0); 348 psMetadataAddF32 (readout->analysis, PS_LIST_TAIL, "MSKY_MN", PS_META_REPLACE, "sky model mean", statsBck->sampleMean); 349 psMetadataAddF32 (readout->analysis, PS_LIST_TAIL, "MSKY_SIG", PS_META_REPLACE, "sky model stdev", statsBck->sampleStdev); 350 psMetadataAddF32 (readout->analysis, PS_LIST_TAIL, "MSKY_DEV", PS_META_REPLACE, "sky stdev", ValueStdev); 351 psMetadataAddF32 (readout->analysis, PS_LIST_TAIL, "MSKY_DQ", PS_META_REPLACE, "sky quartile slope", statsDQ->sampleMedian); 352 psMetadataAddF32 (readout->analysis, PS_LIST_TAIL, "MSKY_MAX", PS_META_REPLACE, "sky model maximum value", statsBck->max); 353 psMetadataAddF32 (readout->analysis, PS_LIST_TAIL, "MSKY_MIN", PS_META_REPLACE, "sky model minimum value", statsBck->min); 354 psMetadataAddS32 (readout->analysis, PS_LIST_TAIL, "MSKY_NX", PS_META_REPLACE, "sky model size (x)", model->numCols); 355 psMetadataAddS32 (readout->analysis, PS_LIST_TAIL, "MSKY_NY", PS_META_REPLACE, "sky model size (y)", model->numRows); 356 psLogMsg ("psphot", PS_LOG_INFO, "background sky : min %f mean %f max %f stdev %f", 357 statsBck->min, statsBck->sampleMean, statsBck->max, statsBck->sampleStdev); 358 psFree(statsBck); 359 } else { 360 psLogMsg ("psphot", PS_LOG_INFO, "variance data : mean %f, stdev %f, dQ %f", Value, ValueStdev, statsDQ->sampleMedian); 361 } 353 362 354 363 psFree(statsDQ); … … 356 365 357 366 psFree(stats); 358 psFree(statsBck);359 367 psFree(statsDefaults); 360 368 psFree(binning); … … 375 383 psImage *modelStdev = psImageAlloc(binning->nXruff, binning->nYruff, PS_TYPE_F32); // Standard deviation 376 384 377 if (!psphotModelBackgroundReadout(model, modelStdev, readout->analysis, readout, binning, config )) {385 if (!psphotModelBackgroundReadout(model, modelStdev, readout->analysis, readout, binning, config, false)) { 378 386 psFree(model); 379 387 psFree(modelStdev); … … 400 408 pmReadout *modelStdev = pmFPAGenerateReadout(config, view, "PSPHOT.BACKMDL.STDEV", inFPA, binning, index); 401 409 402 if (!psphotModelBackgroundReadout(model->image, modelStdev->image, model->analysis, readout, binning, config )) {410 if (!psphotModelBackgroundReadout(model->image, modelStdev->image, model->analysis, readout, binning, config, false)) { 403 411 psError(PS_ERR_UNKNOWN, false, "Unable to generate background model"); 404 412 return false; -
trunk/psphot/src/psphotStackImageLoop.c
- Property svn:mergeinfo changed
/branches/eam_branches/ipp-20111122/psphot/src/psphotStackImageLoop.c merged: 33640 /branches/eam_branches/ipp-20120405/psphot/src/psphotStackImageLoop.c (added) merged: 33946,33953
- Property svn:mergeinfo changed
-
trunk/psphot/src/psphotTest.c
r33089 r33963 103 103 # if (0) 104 104 105 psRegion region = {0,0,0,0}; // a region representing the entire array105 psRegion region = psRegionSet (0,0,0,0); // a region representing the entire array 106 106 psphotTestArguments (&argc, argv); 107 107 -
trunk/psphot/src/psphotTestSourceOutput.c
r21183 r33963 136 136 137 137 // generate working image for this source 138 psRegion region = {ix - dx, ix + dx, iy - dy, iy + dy};138 psRegion region = psRegionSet(ix - dx, ix + dx, iy - dy, iy + dy); 139 139 140 140 psImage *vM = psImageSubset (imMo, region);
Note:
See TracChangeset
for help on using the changeset viewer.
