Changeset 14275 for trunk/ppStack/src/ppStackCamera.c
- Timestamp:
- Jul 17, 2007, 1:53:35 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/ppStack/src/ppStackCamera.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppStack/src/ppStackCamera.c
r14238 r14275 13 13 bool ppStackCamera(pmConfig *config) 14 14 { 15 bool haveWeights = false; // Do we have weight maps? 16 15 17 psMetadata *inputs = psMetadataLookupMetadata(NULL, config->arguments, "INPUTS"); // The inputs info 16 18 psMetadataIterator *iter = psMetadataIteratorAlloc(inputs, PS_LIST_HEAD, NULL); // Iterator … … 36 38 bool mdok; 37 39 psString mask = psMetadataLookupStr(&mdok, input, "MASK"); // Name of mask 40 psString weight = psMetadataLookupStr(&mdok, input, "WEIGHT"); // Name of weight map 38 41 39 42 float seeing = psMetadataLookupF32(NULL, input, "SEEING"); // Seeing FWHM … … 44 47 } 45 48 46 float weight = psMetadataLookupF32(NULL, input, "WEIGHT"); // Relative weight47 if (isnan(weight )) {48 psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Component %s lacks WEIGHT of type F32", item->name);49 float weighting = psMetadataLookupF32(NULL, input, "WEIGHTING"); // Relative weighting 50 if (isnan(weighting)) { 51 psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Component %s lacks WEIGHTING of type F32", item->name); 49 52 psFree(iter); 50 53 return false; … … 85 88 86 89 bool status; 87 pmFPAfile *maskFile = pmFPAfileBindFromArgs(&status, imageFile, config, "PPSTACK.INPUT.MASK", "MASK.FILENAMES"); 90 pmFPAfile *maskFile = pmFPAfileBindFromArgs(&status, imageFile, config, "PPSTACK.INPUT.MASK", 91 "MASK.FILENAMES"); 88 92 if (!status) { 89 93 psError(PS_ERR_UNKNOWN, false, "Unable to define file from mask %d (%s)", i, mask); … … 96 100 } 97 101 102 // Optionally add the weight file 103 if (weight && strlen(weight) > 0) { 104 haveWeights = true; 105 psArray *weightFiles = psArrayAlloc(1); // Array of filenames for this FPA 106 weightFiles->data[0] = psMemIncrRefCounter(weight); 107 psMetadataAddArray(config->arguments, PS_LIST_TAIL, "WEIGHT.FILENAMES", PS_META_REPLACE, 108 "Filenames of weight files", weightFiles); 109 psFree(weightFiles); 110 111 bool status; 112 pmFPAfile *weightFile = pmFPAfileBindFromArgs(&status, imageFile, config, "PPSTACK.INPUT.WEIGHT", 113 "WEIGHT.FILENAMES"); 114 if (!status) { 115 psError(PS_ERR_UNKNOWN, false, "Unable to define file from weight %d (%s)", i, weight); 116 return false; 117 } 118 if (weightFile->type != PM_FPA_FILE_WEIGHT) { 119 psError(PS_ERR_IO, true, "PPSTACK.INPUT.WEIGHT is not of type WEIGHT"); 120 return false; 121 } 122 } 123 98 124 psMetadataAddF32(imageFile->fpa->analysis, PS_LIST_TAIL, "PPSTACK.SEEING", 0, 99 125 "Seeing for image", seeing); 100 psMetadataAddF32(imageFile->fpa->analysis, PS_LIST_TAIL, "PPSTACK.WEIGHT ", 0,101 "Relative weight for image", weight);126 psMetadataAddF32(imageFile->fpa->analysis, PS_LIST_TAIL, "PPSTACK.WEIGHTING", 0, 127 "Relative weighting for image", weighting); 102 128 psMetadataAddF32(imageFile->fpa->analysis, PS_LIST_TAIL, "PPSTACK.SCALE", 0, 103 129 "Relative scale for image", scale); … … 109 135 if (psMetadataLookup(config->arguments, "MASK.FILENAMES")) { 110 136 psMetadataRemoveKey(config->arguments, "MASK.FILENAMES"); 137 } 138 if (psMetadataLookup(config->arguments, "WEIGHT.FILENAMES")) { 139 psMetadataRemoveKey(config->arguments, "WEIGHT.FILENAMES"); 111 140 } 112 141 … … 180 209 outMask->save = true; 181 210 211 // Output weight 212 if (haveWeights) { 213 pmFPAfile *outWeight = pmFPAfileDefineOutput(config, output->fpa, "PPSTACK.OUTPUT.WEIGHT"); 214 if (!outWeight) { 215 psError(PS_ERR_IO, false, _("Unable to generate output file from PPSTACK.OUTPUT.WEIGHT")); 216 return false; 217 } 218 if (outWeight->type != PM_FPA_FILE_WEIGHT) { 219 psError(PS_ERR_IO, true, "PPSTACK.OUTPUT.WEIGHT is not of type WEIGHT"); 220 return false; 221 } 222 } 223 182 224 return true; 183 225 }
Note:
See TracChangeset
for help on using the changeset viewer.
