Changeset 29551 for trunk/ppSub/src/ppSubMatchPSFs.c
- Timestamp:
- Oct 25, 2010, 3:20:10 PM (16 years ago)
- File:
-
- 1 edited
-
trunk/ppSub/src/ppSubMatchPSFs.c (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppSub/src/ppSubMatchPSFs.c
r28119 r29551 110 110 pmReadout *kernelRO = pmFPAfileThisReadout(config->files, view, "PPSUB.OUTPUT.KERNELS"); // RO with kernel 111 111 if (kernelRO) { 112 psAbort("we probably need to set the FWHM values"); 112 113 psFree(view); 113 114 return true; … … 117 118 psMetadata *recipe = psMetadataLookupMetadata(NULL, config->recipes, PPSUB_RECIPE); // Recipe for ppSim 118 119 psAssert(recipe, "We checked this earlier, so it should be here."); 119 if (!psMetadataLookupBool(NULL, recipe, "SCALE")) {120 // No scaling requested121 psFree(view);122 return true;123 }124 120 125 121 // Input images … … 131 127 pmReadout *refSourceRO = pmFPAfileThisReadout(config->files, view, "PPSUB.REF.SOURCES"); 132 128 if (!inSourceRO || !refSourceRO) { 133 ps Warning("Unable to scale kernel, since no sources were provided.");134 return true;129 psError(PPSUB_ERR_DATA, false, "Unable to scale kernel, since no sources were provided."); 130 return false; 135 131 } 136 132 … … 141 137 142 138 if (!inDetections || !refDetections) { 143 ps Warning("Unable toscale kernel, since no sources were provided.");144 return true;139 psError(PPSUB_ERR_DATA, false, "Unable to set FWHM or scale kernel, since no sources were provided."); 140 return false; 145 141 } 146 142 … … 161 157 psLogMsg("ppSub", PS_LOG_INFO, "Input FWHM: %f\nReference FWHM: %f\n", inFWHM, refFWHM); 162 158 if (!isfinite(inFWHM) || !isfinite(refFWHM)) { 163 psWarning("Unable to scale kernel, since unable to measure PSFs."); 159 psError(PPSUB_ERR_DATA, false, "Cannot determine FHWM for images, giving up."); 160 return false; 161 } 162 163 // we need to register the FWHM values for use downstream 164 pmSubtractionSetFWHMs(inFWHM, refFWHM); 165 166 // is auto-scaling needed? 167 if (!psMetadataLookupBool(NULL, recipe, "SCALE")) { 168 // No scaling requested 169 psFree(view); 164 170 return true; 165 171 } … … 175 181 } 176 182 177 if (!pmSubtractionParamsScale(kernelSize, stampSize, kernelWidths, inFWHM, refFWHM, 178 scaleRef, scaleMin, scaleMax)) { 183 if (!pmSubtractionParamsScale(kernelSize, stampSize, kernelWidths, scaleRef, scaleMin, scaleMax)) { 179 184 psError(PPSUB_ERR_DATA, false, "Unable to scale parameters."); 180 185 return false; … … 184 189 } 185 190 191 pmSubtractionMode subModeFromString (char *string) { 192 193 if (!strcasecmp(string, "AUTO")) return PM_SUBTRACTION_MODE_UNSURE; 194 if (!strcasecmp(string, "DUAL")) return PM_SUBTRACTION_MODE_DUAL; 195 if (!strcasecmp(string, "SINGLE1")) return PM_SUBTRACTION_MODE_1; 196 if (!strcasecmp(string, "SINGLE2")) return PM_SUBTRACTION_MODE_2; 197 if (!strcasecmp(string, "1")) return PM_SUBTRACTION_MODE_1; 198 if (!strcasecmp(string, "2")) return PM_SUBTRACTION_MODE_2; 199 200 return PM_SUBTRACTION_MODE_UNSURE; 201 } 186 202 187 203 bool ppSubMatchPSFs(ppSubData *data) … … 317 333 psImageMaskType maskBad = pmConfigMaskGet("BLANK", config); // Bits to mask for bad pixels 318 334 335 // we have three things to control the convolution choice: 336 337 // 1) in the recipe, the keyword DUAL can be TRUE or FALSE. if TRUE, DUAL is used. If not 338 // DUAL, then we are doing SINGLE convolution (but see CONVOLVE.TARGET below). 339 340 // 2) if the -convolve option is given on the command line, the specified input (1 or 2) is 341 // the one convolved. Allowed values are 1 or 2. 342 343 // 3) if the -convolve option is NOT given, then the value of the recipe keyword 344 // CONVOLVE.TARGET is used. this may have the value DUAL, AUTO, SINGLE1, SINGLE2, 1, 2. 345 // thus, DUAL convolution can be turned on with either DUAL = T or CONVOLVE.TARGET = DUAL 346 319 347 bool dual = psMetadataLookupBool(&mdok, recipe, "DUAL"); // Dual convolution? 320 348 pmSubtractionMode subMode; // Subtraction mode … … 322 350 subMode = PM_SUBTRACTION_MODE_DUAL; 323 351 } else { 324 int convolve = psMetadataLookupS32(NULL, config->arguments, "-convolve"); // Image number to convolve 325 switch (convolve) { 326 case 0: 327 subMode = PM_SUBTRACTION_MODE_UNSURE; 328 break; 329 case 1: 330 subMode = PM_SUBTRACTION_MODE_1; 331 break; 332 case 2: 333 subMode = PM_SUBTRACTION_MODE_2; 334 break; 335 default: 336 psError(PPSUB_ERR_ARGUMENTS, false, "Invalid value for -convolve"); 337 return false; 338 } 352 char *convolveName = psMetadataLookupStr(&mdok, recipe, "CONVOLVE.TARGET"); // recipe value for target 353 int convolve = psMetadataLookupS32(&mdok, config->arguments, "-convolve"); // override with command-line option 354 switch (convolve) { 355 case 0: 356 // convolve is 0 if it is not supplied on the command line 357 subMode = subModeFromString(convolveName); 358 break; 359 case 1: 360 subMode = PM_SUBTRACTION_MODE_1; 361 break; 362 case 2: 363 subMode = PM_SUBTRACTION_MODE_2; 364 break; 365 default: 366 psError(PPSUB_ERR_ARGUMENTS, false, "Invalid value for -convolve"); 367 return false; 368 } 339 369 } 340 370
Note:
See TracChangeset
for help on using the changeset viewer.
