Changeset 27838 for branches/tap_branches/psphot/src/psphotReplaceUnfit.c
- Timestamp:
- May 3, 2010, 8:41:49 AM (16 years ago)
- Location:
- branches/tap_branches
- Files:
-
- 4 edited
-
. (modified) (1 prop)
-
psphot (modified) (1 prop)
-
psphot/src (modified) (1 prop)
-
psphot/src/psphotReplaceUnfit.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/tap_branches
- Property svn:mergeinfo changed
-
branches/tap_branches/psphot
-
Property svn:mergeinfo
set to (toggle deleted branches)
/trunk/psphot merged eligible /branches/eam_branches/stackphot.20100406/psphot 27622-27655 /branches/pap_delete/psphot 27530-27595
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
branches/tap_branches/psphot/src
- Property svn:ignore
-
old new 19 19 psphotMomentsStudy 20 20 psphotPetrosianStudy 21 psphotForced 22 psphotMakePSF 23 psphotStack
-
- Property svn:ignore
-
branches/tap_branches/psphot/src/psphotReplaceUnfit.c
r25755 r27838 22 22 } 23 23 24 bool psphotReplaceAllSources (psArray *sources, psMetadata *recipe) { 24 // for now, let's store the detections on the readout->analysis for each readout 25 bool psphotReplaceAllSources (pmConfig *config, const pmFPAview *view) 26 { 27 bool status = true; 28 29 // select the appropriate recipe information 30 psMetadata *recipe = psMetadataLookupPtr (&status, config->recipes, PSPHOT_RECIPE); 31 psAssert (recipe, "missing recipe?"); 32 33 int num = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM"); 34 psAssert (status, "programming error: must define PSPHOT.INPUT.NUM"); 35 36 // loop over the available readouts 37 for (int i = 0; i < num; i++) { 38 if (!psphotReplaceAllSourcesReadout (config, view, "PSPHOT.INPUT", i, recipe)) { 39 psError (PSPHOT_ERR_CONFIG, false, "failed to replace all sources for PSPHOT.INPUT entry %d", i); 40 return false; 41 } 42 } 43 return true; 44 } 45 46 bool psphotReplaceAllSourcesReadout (pmConfig *config, const pmFPAview *view, const char *filename, int index, psMetadata *recipe) { 25 47 26 48 bool status; … … 29 51 psTimerStart ("psphot.replace"); 30 52 53 // find the currently selected readout 54 pmFPAfile *file = pmFPAfileSelectSingle(config->files, filename, index); // File of interest 55 psAssert (file, "missing file?"); 56 57 pmReadout *readout = pmFPAviewThisReadout(view, file->fpa); 58 psAssert (readout, "missing readout?"); 59 60 pmDetections *detections = psMetadataLookupPtr (&status, readout->analysis, "PSPHOT.DETECTIONS"); 61 psAssert (detections, "missing detections?"); 62 63 psArray *sources = detections->allSources; 64 psAssert (sources, "missing sources?"); 65 31 66 // user-defined masks to test for good/bad pixels (build from recipe list if not yet set) 32 67 psImageMaskType maskVal = psMetadataLookupImageMask(&status, recipe, "MASK.PSPHOT"); // Mask value for bad pixels 33 assert (maskVal);68 psAssert (maskVal, "missing mask value?"); 34 69 35 70 for (int i = 0; i < sources->n; i++) { … … 67 102 return true; 68 103 } 69 70 # if (0)71 // add source, if the source has been subtracted; do not modify state72 bool psphotAddWithTest (pmSource *source, bool useState, psImageMaskType maskVal) {73 74 // what is current state? (true : add; false : sub)75 bool state = !(source->tmpFlags & PM_SOURCE_TMPF_SUBTRACTED);76 if (state && useState) return true;77 78 pmSourceAdd (source, PM_MODEL_OP_FULL, maskVal);79 return true;80 }81 82 // sub source, if the source has been added; do not modify state83 bool psphotSubWithTest (pmSource *source, bool useState, psImageMaskType maskVal) {84 85 // what is current state? (true : sub; false : add)86 bool state = (source->tmpFlags & PM_SOURCE_TMPF_SUBTRACTED);87 if (state && useState) return true;88 89 pmSourceSub (source, PM_MODEL_OP_FULL, maskVal);90 return true;91 }92 93 // add or sub source to match recorded state: supply current state as true (add) or false (sub)94 bool psphotSetState (pmSource *source, bool curState, psImageMaskType maskVal) {95 96 // what is desired state? (true : add; false : sub)97 bool newState = !(source->tmpFlags & PM_SOURCE_TMPF_SUBTRACTED);98 if (curState == newState) return true;99 100 if (curState && !newState) {101 pmSourceSub (source, PM_MODEL_OP_FULL, maskVal);102 }103 if (newState && !curState) {104 pmSourceAdd (source, PM_MODEL_OP_FULL, maskVal);105 }106 return true;107 }108 # endif
Note:
See TracChangeset
for help on using the changeset viewer.
