Changeset 12436
- Timestamp:
- Mar 13, 2007, 4:42:49 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/psphot/src/psphotImageMedian.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psphot/src/psphotImageMedian.c
r11384 r12436 62 62 stats->options |= PS_STAT_USE_BINSIZE; 63 63 } 64 65 psMetadataConfigPrint (stderr, recipe); 66 67 // optionally set the sigma clipping 68 stats->clipSigma = psMetadataLookupF32 (&status, recipe, "SKY_CLIP_SIGMA"); 69 if (!status) { 70 stats->clipSigma = 1.0; 71 } 72 73 // stats is not initialized by psStats??? use this to save the input options 74 psStats *statsDefaults = psStatsAlloc (statsOption); 75 *statsDefaults = *stats; 64 76 65 77 // find the currently selected readout … … 142 154 int sx = ix*DX - xOffset; 143 155 int sy = iy*DY - yOffset; 156 157 // XXX test override 158 // sx = 1955; 159 // sy = 4; 160 144 161 region = psRegionSet (sx, sx + 2*DX, sy, sy + 2*DY); 145 162 region = psRegionForImage (image, region); … … 152 169 psImage *submask = psImageSubset (mask, region); 153 170 171 // reset the default values 172 *stats = *statsDefaults; 173 154 174 // Use the selected background statistic for the first pass 155 175 // If it fails, fall back on the "ROBUST_MEDIAN" version 156 176 // If both fail, set the pixel to NAN and (below) interpolate 157 177 // XXX psImageBackground will probably be renamed psImageStats 178 // XXX don't bother trying if there are no valid pixels... 158 179 if (psImageBackground(stats, subset, submask, 0xff, rng)) { 159 180 if (stats->options & PS_STAT_ROBUST_QUARTILE) { … … 164 185 } else { 165 186 psStatsOptions currentOptions = stats->options; 166 stats->options |= PS_STAT_ROBUST_MEDIAN;187 stats->options = PS_STAT_ROBUST_MEDIAN; 167 188 if (!psImageBackground(stats, subset, submask, 0xff, rng)) { 168 189 psLogMsg ("psphot", PS_LOG_WARN, "Failed to estimate background using ROBUST_MEDIAN for " … … 299 320 # ifdef TESTSAVE 300 321 psphotSaveImage (NULL, image, "backsub.fits"); 322 exit (1); 301 323 # endif 302 324 303 325 psLogMsg ("psphot", PS_LOG_INFO, "subtracted background model: %f sec\n", psTimerMark ("psphot")); 304 326 psFree(stats); 327 psFree(statsDefaults); 305 328 psFree(rng); 306 329
Note:
See TracChangeset
for help on using the changeset viewer.
