- Timestamp:
- May 3, 2010, 8:50:52 AM (16 years ago)
- Location:
- branches/simtest_nebulous_branches
- Files:
-
- 4 edited
-
. (modified) (1 prop)
-
psphot (modified) (1 prop)
-
psphot/src (modified) (1 prop)
-
psphot/src/psphotReplaceUnfit.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/simtest_nebulous_branches
- Property svn:mergeinfo changed
-
branches/simtest_nebulous_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/simtest_nebulous_branches/psphot/src
- Property svn:ignore
-
old new 18 18 psphotVersionDefinitions.h 19 19 psphotMomentsStudy 20 psphotPetrosianStudy 21 psphotForced 22 psphotMakePSF 23 psphotStack
-
- Property svn:ignore
-
branches/simtest_nebulous_branches/psphot/src/psphotReplaceUnfit.c
r21519 r27840 17 17 replace: 18 18 pmSourceAdd (source, PM_MODEL_OP_FULL, maskVal); 19 source->tmpFlags &= ~PM_SOURCE_TMPF_SUBTRACTED;20 19 } 21 20 psLogMsg ("psphot.replace", 3, "replace unfitted models: %f sec (%ld objects)\n", psTimerMark ("psphot.replace"), sources->n); … … 23 22 } 24 23 25 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) { 26 47 27 48 bool status; … … 30 51 psTimerStart ("psphot.replace"); 31 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 32 66 // user-defined masks to test for good/bad pixels (build from recipe list if not yet set) 33 67 psImageMaskType maskVal = psMetadataLookupImageMask(&status, recipe, "MASK.PSPHOT"); // Mask value for bad pixels 34 assert (maskVal);68 psAssert (maskVal, "missing mask value?"); 35 69 36 70 for (int i = 0; i < sources->n; i++) { … … 41 75 42 76 pmSourceAdd (source, PM_MODEL_OP_FULL, maskVal); 43 source->tmpFlags &= ~PM_SOURCE_TMPF_SUBTRACTED;44 77 } 45 78 psLogMsg ("psphot.replace", PS_LOG_INFO, "replaced models for %ld objects: %f sec\n", sources->n, psTimerMark ("psphot.replace")); … … 47 80 } 48 81 49 bool psphotRemoveAllSources ( psArray *sources,psMetadata *recipe) {82 bool psphotRemoveAllSources (const psArray *sources, const psMetadata *recipe) { 50 83 51 84 bool status; … … 64 97 if (source->tmpFlags & PM_SOURCE_TMPF_SUBTRACTED) continue; 65 98 66 pmSourceAdd (source, PM_MODEL_OP_FULL, maskVal); 67 source->tmpFlags |= PM_SOURCE_TMPF_SUBTRACTED; 99 pmSourceSub (source, PM_MODEL_OP_FULL, maskVal); 68 100 } 69 101 psLogMsg ("psphot.replace", PS_LOG_INFO, "replaced models for %ld objects: %f sec\n", sources->n, psTimerMark ("psphot.replace")); 70 102 return true; 71 103 } 72 73 // add source, if the source has been subtracted; do not modify state74 bool psphotAddWithTest (pmSource *source, bool useState, psImageMaskType maskVal) {75 76 // what is current state? (true : add; false : sub)77 bool state = !(source->tmpFlags & PM_SOURCE_TMPF_SUBTRACTED);78 if (state && useState) return true;79 80 pmSourceAdd (source, PM_MODEL_OP_FULL, maskVal);81 return true;82 }83 84 // sub source, if the source has been added; do not modify state85 bool psphotSubWithTest (pmSource *source, bool useState, psImageMaskType maskVal) {86 87 // what is current state? (true : sub; false : add)88 bool state = (source->tmpFlags & PM_SOURCE_TMPF_SUBTRACTED);89 if (state && useState) return true;90 91 pmSourceSub (source, PM_MODEL_OP_FULL, maskVal);92 return true;93 }94 95 // add or sub source to match recorded state: supply current state as true (add) or false (sub)96 bool psphotSetState (pmSource *source, bool curState, psImageMaskType maskVal) {97 98 // what is desired state? (true : add; false : sub)99 bool newState = !(source->tmpFlags & PM_SOURCE_TMPF_SUBTRACTED);100 if (curState == newState) return true;101 102 if (curState && !newState) {103 pmSourceSub (source, PM_MODEL_OP_FULL, maskVal);104 }105 if (newState && !curState) {106 pmSourceAdd (source, PM_MODEL_OP_FULL, maskVal);107 }108 return true;109 }
Note:
See TracChangeset
for help on using the changeset viewer.
