Changeset 14275
- Timestamp:
- Jul 17, 2007, 1:53:35 PM (19 years ago)
- Location:
- trunk/ppStack/src
- Files:
-
- 3 edited
-
ppStackArguments.c (modified) (1 diff)
-
ppStackCamera.c (modified) (7 diffs)
-
ppStackReadout.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppStack/src/ppStackArguments.c
r13750 r14275 19 19 fprintf(stderr, "Usage: %s INPUTS.mdc OUTPUT_ROOT\n" 20 20 "where INPUTS.mdc contains various METADATAs, each with:\n" 21 "\tIMAGE(STR): Image filename\n" 22 "\tMASK(STR): Mask filename\n" 23 "\tSEEING(F32): Seeing FWHM (pixels)\n" 24 "\tWEIGHT(F32): Relative weighting to be applied\n" 25 "\tSCALE(F32): Relative scaling to be applied\n", 21 "\tIMAGE(STR): Image filename\n" 22 "\tMASK(STR): Mask filename\n" 23 "\tWEIGHT(STR) Weight map filename\n" 24 "\tSEEING(F32): Seeing FWHM (pixels)\n" 25 "\tWEIGHTING(F32): Relative weighting to be applied\n" 26 "\tSCALE(F32): Relative scaling to be applied\n", 26 27 program); 27 28 fprintf(stderr, "\n"); -
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 } -
trunk/ppStack/src/ppStackReadout.c
r13613 r14275 45 45 46 46 float seeing = psMetadataLookupF32(NULL, inputFile->fpa->analysis, "PPSTACK.SEEING"); // Seeing FWHM 47 float weight = psMetadataLookupF32(NULL, inputFile->fpa->analysis, "PPSTACK.WEIGHT"); // Rel. weight 47 float weighting = psMetadataLookupF32(NULL, inputFile->fpa->analysis, 48 "PPSTACK.WEIGHTING"); // Relative weighting 48 49 float scale = psMetadataLookupF32(NULL, inputFile->fpa->analysis, "PPSTACK.SCALE"); // Rel. scale 49 50 … … 77 78 totExposure += exposure; // Total exposure time 78 79 (void)psBinaryOp(ro->image, ro->image, "/", psScalarAlloc(exposure, PS_TYPE_F32)); 79 pmStackData *data = pmStackDataAlloc(ro, seeing, weight); // Data to stack 80 if (ro->weight) { 81 (void)psBinaryOp(ro->weight, ro->weight, "/", psScalarAlloc(exposure, PS_TYPE_F32)); 82 } 83 pmStackData *data = pmStackDataAlloc(ro, seeing, weighting); // Data to stack 80 84 psArrayAdd(stack, ARRAY_BUFFER, data); 81 85 psFree(data); // Drop reference … … 100 104 } 101 105 102 #if 1106 #ifdef INSPECTION_FILES 103 107 { 104 108 psFits *fits = psFitsOpen("combined.fits", "w"); … … 131 135 } 132 136 133 #if 1137 #ifdef REJECTION_FILES 134 138 for (int i = 0; i < num; i++) { 135 139 pmStackData *data = stack->data[i]; // Data for this image … … 157 161 // Restore image to counts using the total exposure time 158 162 (void)psBinaryOp(outRO->image, outRO->image, "*", psScalarAlloc(totExposure, PS_TYPE_F32)); 163 if (outRO->weight) { 164 (void)psBinaryOp(outRO->weight, outRO->weight, "*", psScalarAlloc(totExposure, PS_TYPE_F32)); 165 } 159 166 psMetadataAddF32(outRO->parent->concepts, PS_LIST_TAIL, "CELL.EXPOSURE", PS_META_REPLACE, 160 167 "Summed exposure time (sec)", totExposure);
Note:
See TracChangeset
for help on using the changeset viewer.
