Changeset 30749
- Timestamp:
- Feb 24, 2011, 9:04:26 AM (15 years ago)
- Location:
- branches/eam_branches/ipp-20110213/psphot/src
- Files:
-
- 1 added
- 7 edited
-
Makefile.am (modified) (1 diff)
-
psphot.h (modified) (2 diffs)
-
psphotMaskBackground.c (added)
-
psphotModelBackground.c (modified) (2 diffs)
-
psphotOutput.c (modified) (1 diff)
-
psphotReadout.c (modified) (2 diffs)
-
psphotSubtractBackground.c (modified) (2 diffs)
-
psphotVisual.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20110213/psphot/src/Makefile.am
r30624 r30749 129 129 psphotReadoutMinimal.c \ 130 130 psphotModelBackground.c \ 131 psphotMaskBackground.c \ 131 132 psphotSubtractBackground.c \ 132 133 psphotFindDetections.c \ -
branches/eam_branches/ipp-20110213/psphot/src/psphot.h
r30707 r30749 12 12 13 13 #define PSPHOT_RECIPE_PSF_FAKE_ALLOW "PSF.FAKE.ALLOW" // Name for recipe component permitting fake PSFs 14 15 # define READOUT_OR_INTERNAL(VIEW,FILE)((FILE)->mode == PM_FPA_MODE_INTERNAL) ? (FILE)->readout : pmFPAviewThisReadout((VIEW), (FILE)->fpa) 14 16 15 17 // top-level psphot functions … … 52 54 bool psphotModelBackground (pmConfig *config, const pmFPAview *view, const char *filerule); 53 55 bool psphotModelBackgroundReadoutFileIndex (pmConfig *config, const pmFPAview *view, const char *filerule, int index); 56 57 bool psphotMaskBackground (pmConfig *config, const pmFPAview *view, const char *filerule); 58 bool psphotMaskBackgroundReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe); 54 59 55 60 bool psphotSubtractBackground (pmConfig *config, const pmFPAview *view, const char *filerule); -
branches/eam_branches/ipp-20110213/psphot/src/psphotModelBackground.c
r29936 r30749 58 58 psImageMaskType maskVal = psMetadataLookupImageMask(&status, recipe, "MASK.PSPHOT"); // Mask value for bad pixels 59 59 assert (maskVal); 60 61 // user-defined masks to test for good/bad pixels (build from recipe list if not yet set) 62 psImageMaskType markVal = psMetadataLookupImageMask(&status, recipe, "MARK.PSPHOT"); // Mask value for bad pixels 63 assert (markVal); 64 65 // apply both MASK and MARK to make background model 66 maskVal |= markVal; 60 67 61 68 psRandom *rng = psRandomAlloc(PS_RANDOM_TAUS); … … 308 315 } 309 316 317 if (psTraceGetLevel("psphot") > 5) { 318 char name[256]; 319 sprintf (name, "backfill.%02d.fits", npass); 320 psphotSaveImage (NULL, model, name); 321 sprintf (name, "backfist.%02d.fits", npass); 322 psphotSaveImage (NULL, modelStdev, name); 323 } 324 310 325 psLogMsg ("psphot", PS_LOG_INFO, "built background image: %f sec\n", psTimerMark ("psphot.background")); 311 326 -
branches/eam_branches/ipp-20110213/psphot/src/psphotOutput.c
r30624 r30749 29 29 } 30 30 31 pmReadout *psphotSelectBackground (pmConfig *config, 32 const pmFPAview *view) { 31 pmReadout *psphotSelectBackground (pmConfig *config, const pmFPAview *view) { 33 32 34 33 bool status; 35 pmReadout *background;34 36 35 37 36 pmFPAfile *file = psMetadataLookupPtr (&status, config->files, "PSPHOT.BACKMDL"); 38 37 if (!file) return NULL; 39 if (file->mode == PM_FPA_MODE_INTERNAL) { 40 background = file->readout; 41 } else { 42 background = pmFPAviewThisReadout (view, file->fpa); 43 } 38 39 pmReadout *background = READOUT_OR_INTERNAL(view, file); 44 40 return background; 45 41 } 46 42 47 pmReadout *psphotSelectBackgroundStdev (pmConfig *config, 48 const pmFPAview *view) { 43 pmReadout *psphotSelectBackgroundStdev (pmConfig *config, const pmFPAview *view) { 49 44 50 45 bool status; 51 pmReadout *background;52 46 53 47 pmFPAfile *file = psMetadataLookupPtr (&status, config->files, "PSPHOT.BACKMDL.STDEV"); 54 48 if (!file) return NULL; 55 if (file->mode == PM_FPA_MODE_INTERNAL) { 56 background = file->readout; 57 } else { 58 background = pmFPAviewThisReadout (view, file->fpa); 59 } 49 50 pmReadout *background = READOUT_OR_INTERNAL(view, file); 60 51 return background; 61 52 } -
branches/eam_branches/ipp-20110213/psphot/src/psphotReadout.c
r30707 r30749 52 52 } 53 53 54 # if (0) 55 // XXX test to mask outliers, not very helpful 56 // mask the high values in the image (with MARK) 57 if (!psphotMaskBackground (config, view, filerule)) { 58 return psphotReadoutCleanup (config, view, filerule); 59 } 60 61 // generate a background model (median, smoothed image) 62 if (!psphotModelBackground (config, view, filerule)) { 63 return psphotReadoutCleanup (config, view, filerule); 64 } 65 # endif 66 54 67 if (!psphotSubtractBackground (config, view, filerule)) { 55 68 return psphotReadoutCleanup (config, view, filerule); … … 157 170 // NOTE: possibly re-measure background model here with objects subtracted / or masked 158 171 159 // add noise for subtracted objects 160 psphotAddNoise (config, view, filerule); // pass 1 (detections->allSources) 161 162 // find fainter sources 163 // NOTE: finds new peaks and new footprints, OLD and FULL set are saved on detections 164 psphotFindDetections (config, view, filerule, false); // pass 2 (detections->peaks, detections->footprints) 165 166 // remove noise for subtracted objects (ie, return to normal noise level) 167 // NOTE: this needs to operate only on the OLD sources 168 psphotSubNoise (config, view, filerule); // pass 1 (detections->allSources) 169 170 // define new sources based on only the new peaks 171 // NOTE: new sources are saved on detections->newSources 172 psphotSourceStats (config, view, filerule, false); // pass 2 (detections->newSources) 173 174 // set source type 175 // NOTE: apply only to detections->newSources 176 if (!psphotRoughClass (config, view, filerule)) { // pass 2 (detections->newSources) 177 psLogMsg ("psphot", 3, "failed to find a valid PSF clump for image"); 178 return psphotReadoutCleanup (config, view, filerule); 179 } 180 181 // create full input models, set the radius to fitRadius, set circular fit mask 182 // NOTE: apply only to detections->newSources 183 psphotGuessModels (config, view, filerule); // pass 2 (detections->newSources) 184 185 // replace all sources so fit below applies to all at once 186 // NOTE: apply only to OLD sources (which have been subtracted) 187 psphotReplaceAllSources (config, view, filerule); // pass 2 188 189 // merge the newly selected sources into the existing list 190 // NOTE: merge OLD and NEW 191 // XXX check on free of sources... 192 psphotMergeSources (config, view, filerule); // (detections->newSources + detections->allSources -> detections->allSources) 193 194 // NOTE: apply to ALL sources 195 psphotFitSourcesLinear (config, view, filerule, true); // pass 3 (detections->allSources) 172 // NOTE: this block performs the 2nd pass low-significance PSF detection stage 173 { 174 // add noise for subtracted objects 175 psphotAddNoise (config, view, filerule); // pass 1 (detections->allSources) 176 177 // find fainter sources 178 // NOTE: finds new peaks and new footprints, OLD and FULL set are saved on detections 179 psphotFindDetections (config, view, filerule, false); // pass 2 (detections->peaks, detections->footprints) 180 181 // remove noise for subtracted objects (ie, return to normal noise level) 182 // NOTE: this needs to operate only on the OLD sources 183 psphotSubNoise (config, view, filerule); // pass 1 (detections->allSources) 184 185 // define new sources based on only the new peaks 186 // NOTE: new sources are saved on detections->newSources 187 psphotSourceStats (config, view, filerule, false); // pass 2 (detections->newSources) 188 189 // set source type 190 // NOTE: apply only to detections->newSources 191 if (!psphotRoughClass (config, view, filerule)) { // pass 2 (detections->newSources) 192 psLogMsg ("psphot", 3, "failed to find a valid PSF clump for image"); 193 return psphotReadoutCleanup (config, view, filerule); 194 } 195 196 // create full input models, set the radius to fitRadius, set circular fit mask 197 // NOTE: apply only to detections->newSources 198 psphotGuessModels (config, view, filerule); // pass 2 (detections->newSources) 199 200 // replace all sources so fit below applies to all at once 201 // NOTE: apply only to OLD sources (which have been subtracted) 202 psphotReplaceAllSources (config, view, filerule); // pass 2 203 204 // merge the newly selected sources into the existing list 205 // NOTE: merge OLD and NEW 206 // XXX check on free of sources... 207 psphotMergeSources (config, view, filerule); // (detections->newSources + detections->allSources -> detections->allSources) 208 209 // NOTE: apply to ALL sources 210 psphotFitSourcesLinear (config, view, filerule, true); // pass 3 (detections->allSources) 211 } 212 213 // NOTE: this block performs the 2nd pass low-significance EXT detection stage (smooth or rebin by NxN times PSF size) 214 if (0) { 215 // add noise for subtracted objects 216 psphotAddNoise (config, view, filerule); // pass 1 (detections->allSources) 217 218 // find fainter sources 219 // NOTE: finds new peaks and new footprints, OLD and FULL set are saved on detections 220 psphotFindDetections (config, view, filerule, false); // pass 2 (detections->peaks, detections->footprints) 221 222 // remove noise for subtracted objects (ie, return to normal noise level) 223 // NOTE: this needs to operate only on the OLD sources 224 psphotSubNoise (config, view, filerule); // pass 1 (detections->allSources) 225 226 // define new sources based on only the new peaks 227 // NOTE: new sources are saved on detections->newSources 228 psphotSourceStats (config, view, filerule, false); // pass 2 (detections->newSources) 229 230 // set source type 231 // NOTE: apply only to detections->newSources 232 if (!psphotRoughClass (config, view, filerule)) { // pass 2 (detections->newSources) 233 psLogMsg ("psphot", 3, "failed to find a valid PSF clump for image"); 234 return psphotReadoutCleanup (config, view, filerule); 235 } 236 237 // create full input models, set the radius to fitRadius, set circular fit mask 238 // NOTE: apply only to detections->newSources 239 psphotGuessModels (config, view, filerule); // pass 2 (detections->newSources) 240 241 // replace all sources so fit below applies to all at once 242 // NOTE: apply only to OLD sources (which have been subtracted) 243 psphotReplaceAllSources (config, view, filerule); // pass 2 244 245 // merge the newly selected sources into the existing list 246 // NOTE: merge OLD and NEW 247 // XXX check on free of sources... 248 psphotMergeSources (config, view, filerule); // (detections->newSources + detections->allSources -> detections->allSources) 249 250 // NOTE: apply to ALL sources 251 psphotFitSourcesLinear (config, view, filerule, true); // pass 3 (detections->allSources) 252 } 196 253 197 254 pass1finish: -
branches/eam_branches/ipp-20110213/psphot/src/psphotSubtractBackground.c
r29936 r30749 24 24 assert (modelFile); 25 25 26 pmReadout *model = NULL; 27 if (modelFile->mode == PM_FPA_MODE_INTERNAL) { 28 model = modelFile->readout; 29 } else { 30 model = pmFPAviewThisReadout (view, modelFile->fpa); 31 } 26 pmReadout *model = READOUT_OR_INTERNAL(view, modelFile); 32 27 assert (model); 33 28 … … 44 39 if (file) { 45 40 // we are using PSPHOT.BACKGND as an I/O file: select readout or create 46 if (file->mode == PM_FPA_MODE_INTERNAL) { 47 background = file->readout; 48 } else { 49 background = pmFPAviewThisReadout (view, file->fpa); 50 } 41 background = READOUT_OR_INTERNAL(view, file); 51 42 if (background == NULL) { 52 43 // readout does not yet exist: create from input -
branches/eam_branches/ipp-20110213/psphot/src/psphotVisual.c
r30624 r30749 293 293 bool psphotVisualShowBackground (pmConfig *config, const pmFPAview *view, pmReadout *readout) { 294 294 295 pmReadout *backgnd;296 297 295 if (!pmVisualTestLevel("psphot.image.backgnd", 2)) return true; 298 296 … … 303 301 pmFPAfile *file = psMetadataLookupPtr (&status, config->files, "PSPHOT.BACKGND"); 304 302 305 if (file->mode == PM_FPA_MODE_INTERNAL) { 306 backgnd = file->readout; 307 } else { 308 backgnd = pmFPAviewThisReadout (view, file->fpa); 309 } 303 pmReadout *backgnd = READOUT_OR_INTERNAL(view, file); 310 304 311 305 psphotVisualScaleImage (kapa, backgnd->image, readout->mask, "backgnd", 2);
Note:
See TracChangeset
for help on using the changeset viewer.
