Changeset 34266 for trunk/psphot/src/psphotMergeSources.c
- Timestamp:
- Jul 31, 2012, 6:17:31 PM (14 years ago)
- File:
-
- 1 edited
-
trunk/psphot/src/psphotMergeSources.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psphot/src/psphotMergeSources.c
r33910 r34266 939 939 } 940 940 941 bool psphotCopyEfficiency (pmConfig *config, const pmFPAview *view, const char *ruleOut, const char *ruleSrc) 942 { 943 bool status = true; 944 945 int num = psphotFileruleCount(config, ruleSrc); 946 947 // skip the chisq image because it is a duplicate of the detection version 948 int chisqNum = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.CHISQ.NUM"); 949 if (!status) chisqNum = -1; 950 951 // loop over the available readouts 952 for (int i = 0; i < num; i++) { 953 if (i == chisqNum) continue; // skip chisq image 954 if (!psphotCopyEfficiencyReadout (config, view, ruleOut, ruleSrc, i)) { 955 psError (PSPHOT_ERR_CONFIG, false, "failed to copy detection efficiency from %s to %s entry %d", ruleSrc, ruleOut, i); 956 return false; 957 } 958 } 959 return true; 960 } 961 962 // add newly selected sources to the existing list of sources 963 bool psphotCopyEfficiencyReadout (pmConfig *config, const pmFPAview *view, const char *ruleOut, const char *ruleSrc, int index) { 964 965 bool status; 966 967 // find the currently selected readout 968 pmFPAfile *fileSrc = pmFPAfileSelectSingle(config->files, ruleSrc, index); // File of interest 969 psAssert (fileSrc, "missing file?"); 970 971 pmReadout *readoutSrc = pmFPAviewThisReadout(view, fileSrc->fpa); 972 psAssert (readoutSrc, "missing readout?"); 973 974 // find the currently selected readout 975 pmFPAfile *fileOut = pmFPAfileSelectSingle(config->files, ruleOut, index); // File of interest 976 psAssert (fileOut, "missing file?"); 977 978 pmReadout *readoutOut = pmFPAviewThisReadout(view, fileOut->fpa); 979 psAssert (readoutOut, "missing readout?"); 980 981 pmDetEff *de = psMetadataLookupPtr(&status, readoutSrc->analysis, PM_DETEFF_ANALYSIS); // Detection efficiency 982 if (!status || !de) { 983 // nothing there 984 return true; 985 } 986 987 // save DetEff on the readoutOut->analysis 988 if (!psMetadataAddPtr (readoutOut->analysis, PS_LIST_TAIL, PM_DETEFF_ANALYSIS, PS_META_REPLACE | PS_DATA_UNKNOWN, "Detection efficiency", de)) { 989 psError (PSPHOT_ERR_CONFIG, false, "problem saving Detection efficiency on readout"); 990 return false; 991 } 992 993 return true; 994 }
Note:
See TracChangeset
for help on using the changeset viewer.
