Changeset 21150 for branches/pap_branch_20090108/ppStack/src/ppStackMatch.c
- Timestamp:
- Jan 22, 2009, 9:06:25 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/pap_branch_20090108/ppStack/src/ppStackMatch.c
r21114 r21150 173 173 psAssert(recipe, "We've thrown an error on this before."); 174 174 175 float deconvLimit = psMetadataLookupF32(NULL, recipe, "DECONV.LIMIT"); // Limit on deconvolution fraction 176 175 177 // Look up appropriate values from the ppSub recipe 176 178 psMetadata *ppsub = psMetadataLookupMetadata(NULL, config->recipes, "PPSUB"); // PPSUB recipe … … 204 206 assert(outName); 205 207 // Read convolution kernel 206 { 207 psString filename = NULL; // Output filename 208 psStringAppend(&filename, "%s.%d.kernel", outName, numInput); 209 psString resolved = pmConfigConvertFilename(filename, config, false, false); // Resolved filename 210 psFree(filename); 211 psFits *fits = psFitsOpen(resolved, "r"); // FITS file for subtraction kernel 212 psFree(resolved); 213 if (!fits || !pmReadoutReadSubtractionKernels(output, fits)) { 214 psError(PS_ERR_IO, false, "Unable to read previously produced kernel"); 215 psFitsClose(fits); 216 return false; 217 } 208 psString filename = NULL; // Output filename 209 psStringAppend(&filename, "%s.%d.kernel", outName, numInput); 210 psString resolved = pmConfigConvertFilename(filename, config, false, false); // Resolved filename 211 psFree(filename); 212 psFits *fits = psFitsOpen(resolved, "r"); // FITS file for subtraction kernel 213 psFree(resolved); 214 if (!fits || !pmReadoutReadSubtractionKernels(output, fits)) { 215 psError(PS_ERR_IO, false, "Unable to read previously produced kernel"); 218 216 psFitsClose(fits); 219 220 // Add in variance factor 221 pmSubtractionKernels *kernels = psMetadataLookupPtr(NULL, output->analysis, 222 PM_SUBTRACTION_ANALYSIS_KERNEL); // Kernels 223 float vf = pmSubtractionVarianceFactor(kernels, 0.0, 0.0, false); // Variance factor 224 psMetadataItem *vfItem = psMetadataLookup(readout->parent->concepts, "CELL.VARFACTOR"); 225 if (!isfinite(vf)) { 226 vf = 1.0; 227 } 228 if (isfinite(vfItem->data.F32)) { 229 vfItem->data.F32 *= vf; 230 } else { 231 vfItem->data.F32 = vf; 232 } 217 return false; 218 } 219 psFitsClose(fits); 220 221 // Add in variance factor 222 pmSubtractionKernels *kernels = psMetadataLookupPtr(NULL, output->analysis, 223 PM_SUBTRACTION_ANALYSIS_KERNEL); // Kernels 224 float vf = pmSubtractionVarianceFactor(kernels, 0.0, 0.0, false); // Variance factor 225 psMetadataItem *vfItem = psMetadataLookup(readout->parent->concepts, "CELL.VARFACTOR"); 226 if (!isfinite(vf)) { 227 vf = 1.0; 228 } 229 if (isfinite(vfItem->data.F32)) { 230 vfItem->data.F32 *= vf; 231 } else { 232 vfItem->data.F32 = vf; 233 233 } 234 234 … … 253 253 psFree(maskName); 254 254 psFree(weightName); 255 256 psRegion *region = psMetadataLookupPtr(NULL, output->analysis, 257 PM_SUBTRACTION_ANALYSIS_REGION); // Convolution region 258 259 pmSubtractionAnalysis(readout->analysis, kernels, region, 260 readout->image->numCols, readout->image->numRows); 255 261 } else { 256 262 #endif … … 535 541 } 536 542 543 // Reject image completely if the maximum deconvolution fraction exceeds the limit 544 float deconv = psMetadataLookupF32(NULL, output->analysis, 545 PM_SUBTRACTION_ANALYSIS_DECONV_MAX); // Maximum deconvolution fraction 546 if (deconv > deconvLimit) { 547 psWarning("Maximum deconvolution fraction (%f) exceeds limit (%f) --- rejecting\n", 548 deconv, deconvLimit); 549 psFree(output); 550 return NULL; 551 } 552 537 553 // Renormalise the variances if desired 538 554 if (renorm) {
Note:
See TracChangeset
for help on using the changeset viewer.
