Changeset 6862 for trunk/psphot/src/psphotImageMedian.c
- Timestamp:
- Apr 14, 2006, 11:58:44 AM (20 years ago)
- File:
-
- 1 edited
-
trunk/psphot/src/psphotImageMedian.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psphot/src/psphotImageMedian.c
r6851 r6862 33 33 34 34 // scaling factor 35 int DX = psMetadataLookupS32 (&status, recipe, "BACKGROUND_XBIN"); 36 if (!status) {DX = 64;} 37 int DY = psMetadataLookupS32 (&status, recipe, "BACKGROUND_YBIN"); 38 if (!status) {DY = 64;} 35 int DX = psMetadataLookupS32 (&status, recipe, "BACKGROUND.XBIN"); 36 int DY = psMetadataLookupS32 (&status, recipe, "BACKGROUND.YBIN"); 39 37 40 38 // overhang : we will balance this evenly … … 69 67 70 68 // XXX the value of the upper and lower cuts probably should be studied... 71 modelData[iy][ix] = psImageClippedStats (subset, submask, 0xff, 0.25, 0.75) + SKY_BIAS; 69 psStats *stats = psImageClippedStats (subset, submask, 0xff, 0.25, 0.75); 70 modelData[iy][ix] = stats->robustMedian + SKY_BIAS; 72 71 72 psFree (stats); 73 73 psFree (subset); 74 74 psFree (submask); … … 82 82 psLogMsg ("psphot", 3, "build median image: %f sec\n", psTimerMark ("psphot")); 83 83 84 // XXX temporarily until we get the pmFPAfile output finished 85 psphotSaveImage (NULL, model->image, "model.fits"); 84 // measure background stats and save for later output 85 psStats *stats = psStatsAlloc (PS_STAT_SAMPLE_MEAN | PS_STAT_SAMPLE_STDEV | PS_STAT_MIN | PS_STAT_MAX); 86 stats = psImageStats (stats, model->image, NULL, 0); 87 psMetadataAdd (recipe, PS_LIST_TAIL, "SKY_MEAN", PS_DATA_F32 | PS_META_REPLACE, "sky model mean", stats->sampleMean); 88 psMetadataAdd (recipe, PS_LIST_TAIL, "SKY_STDV", PS_DATA_F32 | PS_META_REPLACE, "sky model stdev", stats->sampleStdev); 89 psMetadataAdd (recipe, PS_LIST_TAIL, "SKY_MAX", PS_DATA_F32 | PS_META_REPLACE, "sky model maximum value", stats->max); 90 psMetadataAdd (recipe, PS_LIST_TAIL, "SKY_MIN", PS_DATA_F32 | PS_META_REPLACE, "sky model minimum value", stats->min); 91 psMetadataAdd (recipe, PS_LIST_TAIL, "SKY_NX", PS_DATA_S32 | PS_META_REPLACE, "sky model size (x)", nx); 92 psMetadataAdd (recipe, PS_LIST_TAIL, "SKY_NY", PS_DATA_S32 | PS_META_REPLACE, "sky model size (y)", ny); 93 psFree (stats); 86 94 87 95 // select background pixels, from output background file, or create … … 89 97 if (background == NULL) { 90 98 background = pmFPAfileCreateInternal (config->files, "PSPHOT.BACKGND", Nx, Ny, PS_TYPE_F32); 91 } else { 92 // replace the supplied image data with an image of the desired size 93 // XXX should not have to do this: it should be allocated correctly 94 // psImageRecycle (background->image, Nx, Ny, PS_TYPE_F32); 95 } 96 99 } 97 100 psF32 **backData = background->image->data.F32; 98 101 … … 100 103 psImageUnbin (background->image, model->image, DX, DY, dx, dy); 101 104 psLogMsg ("psphot", 3, "build resampled image: %f sec\n", psTimerMark ("psphot")); 102 103 // XXX temporarily until we get the pmFPAfile output finished...104 psphotSaveImage (NULL, background->image, "back.fits");105 105 106 106 // back-sub image pixels, from output background file (don't create if not requested)
Note:
See TracChangeset
for help on using the changeset viewer.
