- Timestamp:
- Mar 29, 2010, 3:55:49 PM (16 years ago)
- Location:
- branches/eam_branches/20100225
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
ppStack/src/ppStackReadout.c (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/20100225
- Property svn:mergeinfo changed
-
branches/eam_branches/20100225/ppStack/src/ppStackReadout.c
r26898 r27517 23 23 psVector *mask = options->inputMask; // Mask for inputs 24 24 psVector *weightings = options->weightings; // Weightings (1/noise^2) for each image 25 psVector *exposures = options->exposures; // Exposure times for each image 25 26 psVector *addVariance = options->matchChi2; // Additional variance when rejecting 26 27 27 28 job->results = ppStackReadoutInitial(config, outRO, thread->readouts, mask, 28 weightings, addVariance);29 weightings, exposures, addVariance); 29 30 thread->busy = false; 30 31 … … 37 38 38 39 psArray *args = job->args; // Arguments 39 p mReadout *target = args->data[0]; // Output readout40 p pStackThread *thread = args->data[1]; // Thread40 ppStackThread *thread = args->data[0]; // Thread 41 psArray *reject = args->data[1]; // Rejected pixels for each image 41 42 ppStackOptions *options = args->data[2]; // Options 42 43 pmConfig *config = args->data[3]; // Configuration … … 45 46 46 47 psVector *mask = options->inputMask; // Mask for inputs 47 psArray *rejected = options->rejected; // Rejected pixels48 48 psVector *weightings = options->weightings; // Weightings (1/noise^2) for each image 49 psVector *exposures = options->exposures; // Exposure times for each image 49 50 psVector *addVariance = options->matchChi2; // Additional variance when rejecting 50 51 psVector *norm = normalise ? options->norm : NULL; // Normalisations to apply to images 51 52 52 bool status = ppStackReadoutFinal(config, target, thread->readouts, mask, rejected,53 weightings, addVariance, safety, norm); // Status of operation53 bool status = ppStackReadoutFinal(config, options->outRO, options->expRO, thread->readouts, mask, reject, 54 weightings, exposures, addVariance, safety, norm); // Status of operation 54 55 55 56 thread->busy = false; 57 58 psAssert(status, "Stacking failed."); 56 59 57 60 return status; … … 101 104 102 105 psArray *ppStackReadoutInitial(const pmConfig *config, pmReadout *outRO, const psArray *readouts, 103 const psVector *mask, const psVector *weightings, const psVector *addVariance) 106 const psVector *mask, const psVector *weightings, const psVector *exposures, 107 const psVector *addVariance) 104 108 { 105 109 assert(config); … … 143 147 } 144 148 145 #if 0146 // This doesn't seem to work, so getting the weightings directly from a vector147 float weighting = psMetadataLookupF32(&mdok, ro->analysis, "PPSTACK.WEIGHTING"); // Relative weight148 if (!mdok || !isfinite(weighting)) {149 psWarning("No weighting supplied for image %d --- set to unity.", i);150 weighting = 1.0;151 } else {152 psLogMsg("ppStack", PS_LOG_INFO, "Weighting for image %d is %f", i, weighting);153 }154 #endif155 156 149 // Ensure there is a mask, or pmStackCombine will complain 157 150 if (!ro->mask) { … … 160 153 } 161 154 162 stack->data[i] = pmStackDataAlloc(ro, weightings->data.F32[i], addVariance->data.F32[i]); 163 } 164 165 if (!pmStackCombine(outRO, stack, maskVal | maskBad, maskSuspect, maskBad, kernelSize, iter, 155 stack->data[i] = pmStackDataAlloc(ro, weightings->data.F32[i], exposures->data.F32[i], 156 addVariance->data.F32[i]); 157 } 158 159 if (!pmStackCombine(outRO, NULL, stack, maskVal | maskBad, maskSuspect, maskBad, kernelSize, iter, 166 160 combineRej, combineSys, combineDiscard, useVariance, safe, false)) { 167 161 psError(PS_ERR_UNKNOWN, false, "Unable to combine input readouts with rejection."); … … 198 192 199 193 200 bool ppStackReadoutFinal(const pmConfig *config, pmReadout *outRO, const psArray *readouts,194 bool ppStackReadoutFinal(const pmConfig *config, pmReadout *outRO, pmReadout *expRO, const psArray *readouts, 201 195 const psVector *mask, const psArray *rejected, const psVector *weightings, 202 const psVector *addVariance, bool safety, const psVector *norm) 196 const psVector *exposures, const psVector *addVariance, bool safety, 197 const psVector *norm) 203 198 { 204 199 assert(config); 205 200 assert(outRO); 201 assert(expRO); 206 202 assert(readouts); 207 203 assert(!rejected || readouts->n == rejected->n); … … 243 239 } 244 240 245 #if 0246 // This doesn't seem to work, so getting the weightings directly from a vector247 bool mdok; // Status of MD lookup248 float weighting = psMetadataLookupF32(&mdok, ro->analysis, "PPSTACK.WEIGHTING"); // Relative weight249 if (!mdok || !isfinite(weighting)) {250 psWarning("No WEIGHTING supplied for image %d --- set to unity.", i);251 weighting = 1.0;252 }253 #endif254 255 241 // Ensure there is a mask, or pmStackCombine will complain 256 242 if (!ro->mask) { … … 259 245 } 260 246 261 pmStackData *data = pmStackDataAlloc(ro, weightings->data.F32[i], 247 pmStackData *data = pmStackDataAlloc(ro, weightings->data.F32[i], exposures->data.F32[i], 262 248 addVariance ? addVariance->data.F32[i] : NAN); 263 249 data->reject = rejected ? psMemIncrRefCounter(rejected->data[i]) : NULL; … … 271 257 } 272 258 273 if (!pmStackCombine(outRO, stack, maskVal | maskBad, maskSuspect, maskBad, 0, iter, combineRej,259 if (!pmStackCombine(outRO, expRO, stack, maskVal | maskBad, maskSuspect, maskBad, 0, iter, combineRej, 274 260 combineSys, combineDiscard, useVariance, safe, rejected)) { 275 261 psError(PS_ERR_UNKNOWN, false, "Unable to combine input readouts."); … … 280 266 pmCell *outCell = outRO->parent; // Output cell 281 267 pmChip *outChip = outCell->parent; // Output chip 282 283 268 outRO->data_exists = true; 284 269 outCell->data_exists = true; 285 270 outChip->data_exists = true; 286 271 272 pmCell *expCell = expRO->parent; // Exposure cell 273 pmChip *expChip = expCell->parent; // Exposure chip 274 expRO->data_exists = true; 275 expCell->data_exists = true; 276 expChip->data_exists = true; 277 287 278 psFree(stack); 288 279
Note:
See TracChangeset
for help on using the changeset viewer.
