Changeset 35941
- Timestamp:
- Aug 13, 2013, 4:01:17 PM (13 years ago)
- Location:
- tags/ipp-20130712
- Files:
-
- 6 edited
-
ippconfig/gpc1/ppStack.config (modified) (1 diff, 1 prop)
-
ippconfig/recipes/ppStack.config (modified) (1 diff, 1 prop)
-
ppStack/src/ppStackPrepare.c (modified) (2 diffs)
-
psModules/src/imcombine/pmSubtractionMatch.c (modified) (1 diff)
-
psModules/src/imcombine/pmSubtractionSimple.c (modified) (10 diffs, 1 prop)
-
psModules/src/imcombine/pmSubtractionSimple.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
tags/ipp-20130712/ippconfig/gpc1/ppStack.config
- Property svn:mergeinfo set to
r35580 r35941 63 63 PSF.INPUT.THRESH F32 10.0 64 64 PSF.INPUT.ASYMMETRY F32 0.2 65 PSF.TARGET.AS.MAX BOOL TRUE 65 66 MATCH.REJ F32 4.0 66 67 SAFE BOOL F -
tags/ipp-20130712/ippconfig/recipes/ppStack.config
- Property svn:mergeinfo set to
r35580 r35941 95 95 PSF.INPUT.THRESH F32 NAN # Set minimum limit below which we do not exclude an input (defaults to 0.0) 96 96 PSF.INPUT.ASYMMETRY F32 NAN # Set difference in mixture model populations to consider equal. 97 PSF.TARGET.AS.MAX BOOL F # Set the target PSF FWHM as the maximum of accepted input FWHM values. 98 PSF.TARGET.AS.MAX.EPSILON F32 0.1 # Amount to set the target PSF FWHM larger than the maximum input. Target = eps + max(input) 99 97 100 98 101 TEMP.IMAGE STR conv.im.fits # Suffix for temporary convolved images -
tags/ipp-20130712/ppStack/src/ppStackPrepare.c
r35530 r35941 257 257 258 258 bool mdok = false; 259 bool simpleClip = psMetadataLookup F32(&mdok, recipe, "PSF.INPUT.CLIP.SIMPLE");259 bool simpleClip = psMetadataLookupBool(&mdok, recipe, "PSF.INPUT.CLIP.SIMPLE"); 260 260 float maxFWHM = psMetadataLookupF32(&mdok, recipe, "PSF.INPUT.MAX"); // max allowed input fwhm 261 261 float clipFWHMnSig = psMetadataLookupF32(&mdok, recipe, "PSF.INPUT.CLIP.NSIGMA"); // sigma clipping of inputs 262 262 float threshFWHM = psMetadataLookupF32(&mdok, recipe, "PSF.INPUT.THRESH"); // FWHM size that we refuse to clip below 263 263 float asymmetryFWHM = psMetadataLookupF32(&mdok, recipe, "PSF.INPUT.ASYMMETRY"); // max bimodal asymmetry 264 264 265 265 266 psString log = psStringCopy("Input seeing FWHMs:\n"); // Log message … … 477 478 "Target PSF for stack", options->psf); 478 479 options->targetSeeing = pmPSFtoFWHM(options->psf, 0.5 * numCols, 0.5 * numRows); // FWHM for target 479 psLogMsg("ppStack", PS_LOG_INFO, "Target seeing FWHM: %f\n", options->targetSeeing); 480 480 481 482 bool psfTargetAsMax = psMetadataLookupBool(&mdok, recipe, "PSF.TARGET.AS.MAX"); 483 if (psfTargetAsMax) { // Should we use the largest input as the target? 484 float psfTargetEpsilon = psMetadataLookupF32(&mdok,recipe,"PSF.TARGET.AS.MAX.EPSILON"); 485 if (!mdok) { psfTargetEpsilon = 0.0; } 486 options->targetSeeing = 0.0; 487 for (int i = 0; i < num; i++) { 488 if (options->inputMask->data.PS_TYPE_VECTOR_MASK_DATA[i]) continue; 489 options->targetSeeing = PS_MAX(options->targetSeeing,options->inputSeeing->data.F32[i]); 490 } 491 psLogMsg("ppStack", PS_LOG_INFO, "Using MAX accepted input FWHM as target (max: %f epsilon: %f target %f)\n", 492 options->targetSeeing,psfTargetEpsilon,options->targetSeeing + psfTargetEpsilon); 493 options->targetSeeing = options->targetSeeing + psfTargetEpsilon; 494 } 495 psLogMsg("ppStack", PS_LOG_INFO, "Target seeing FWHM: %f\n", options->targetSeeing); 496 481 497 pmChip *outChip = pmFPAfileThisChip(config->files, view, "PPSTACK.TARGET.PSF"); // Output chip 482 498 psMetadataAddPtr(outChip->analysis, PS_LIST_TAIL, "PSPHOT.PSF", PS_DATA_UNKNOWN, -
tags/ipp-20130712/psModules/src/imcombine/pmSubtractionMatch.c
r35771 r35941 540 540 // Bail here if we're doing the simple matching 541 541 if (type == PM_SUBTRACTION_KERNEL_SIMPLE) { 542 if (!pmSubtractionSimpleMatch(conv1,conv2,ro1,ro2,sources,size,maskVal,maskBad,maskPoor )) {542 if (!pmSubtractionSimpleMatch(conv1,conv2,ro1,ro2,sources,size,maskVal,maskBad,maskPoor,optThreshold)) { 543 543 return false; 544 544 } -
tags/ipp-20130712/psModules/src/imcombine/pmSubtractionSimple.c
- Property svn:mergeinfo deleted
r35822 r35941 63 63 } 64 64 65 bool simple_apply_mask(psImage *image, psImage *weight, psImage *mask, 66 psImageMaskType maskVal) { 67 for (int y = 0; y < mask->numRows; y++) { 68 for (int x = 0; x < mask->numCols; x++) { 69 if (mask->data.PS_TYPE_IMAGE_MASK_DATA[y][x] & maskVal) { 70 image->data.F32[y][x] = NAN; 71 if (weight) { 72 weight->data.F32[y][x] = NAN; 73 } 74 } 75 } 76 } 77 return(true); 78 } 79 80 65 81 // Copied from pmSubtraction 66 82 static void solvedKernelPreCalc(psKernel *kernel, // Kernel, updated … … 90 106 psImageMaskType maskVal, 91 107 psImageMaskType maskBad, 92 psImageMaskType maskPoor 108 psImageMaskType maskPoor, 109 float deconvolveThreshold 93 110 ) { 94 111 // … … 115 132 psImage *varC2 = NULL; 116 133 134 psImage *maskTemp = NULL; 135 117 136 // Allocate images, as this is usually done by subtractionMatchAlloc after this function is called. 118 137 int numCols = ro1->image->numCols; … … 190 209 if (!conv1) { 191 210 if (convolution_direction == 1) { 192 chisq = 100; 193 } 194 convolution_direction = 2; 211 if (sigma1 - sigma2 > deconvolveThreshold) { 212 chisq = 100; 213 } 214 } 215 // convolution_direction = 2; 195 216 } 196 217 if (!conv2) { 197 218 if (convolution_direction == 2) { 198 chisq = 100; 199 } 200 convolution_direction = 1; 219 if (sigma2 - sigma1 > deconvolveThreshold) { 220 chisq = 100; 221 } 222 } 223 // convolution_direction = 1; 201 224 } 202 225 … … 205 228 int maskBox = (int) ceil(sigmaKern * 1.1774); // diameter is 1/2 FWHM 206 229 int maskBlank = 8; // I should be able to get this from a reference, right? 207 230 int maskPoorVal = 16384; // Another value that should be found elsewhere. 208 231 // 209 232 // Make a fake pmSubtractionKernels element so we can add it appropriately. … … 249 272 // Do convolutions 250 273 if (convolution_direction == 1) { 251 psImageSmoothMask_Threaded(imageC1,image1,mask1,maskVal,sigmaKern,6,1e-6); 252 psImageSmoothMask_Threaded(varC1,var1,mask1,maskVal,sigmaKern * M_SQRT1_2,6,1e-6); 253 maskC1 = psImageConvolveMask(maskC1,mask1,maskVal,maskBad, 254 -maskBox,maskBox,-maskBox,maskBox); 255 conv1->covariance = psImageCovarianceCalculate(kernel,ro1->covariance); 274 if (conv1) { 275 psImageSmoothMask_Threaded(imageC1,image1,mask1,maskVal,sigmaKern,6,1e-6); 276 psImageSmoothMask_Threaded(varC1,var1,mask1,maskVal,sigmaKern * M_SQRT1_2,6,1e-6); 277 278 maskTemp = psImageAlloc(numCols, numRows, PS_TYPE_IMAGE_MASK); 279 maskTemp = psImageConvolveMask(maskTemp,mask1,maskVal,maskBad, // Mask bad values 280 -maskBox,maskBox,-maskBox,maskBox); 281 maskC1 = psImageConvolveMask(maskC1,maskTemp,maskPoorVal,maskPoor, // Mask poor values 282 -maskBox,maskBox,-maskBox,maskBox); 283 psFree(maskTemp); 284 285 conv1->covariance = psImageCovarianceCalculate(kernel,ro1->covariance); 286 pmSubtractionBorder(imageC1,varC1,maskC1,maskBox,maskBlank); 287 simple_apply_mask(imageC1,varC1,maskC1,maskBad); 288 } 256 289 if (conv2) { 257 290 imageC2 = psImageCopy(imageC2,image2,PS_TYPE_F32); … … 260 293 conv2->covariance = psMemIncrRefCounter(ro2->covariance); 261 294 } 262 pmSubtractionBorder(imageC1,varC1,maskC1,maskBox,maskBlank);263 pmSubtractionMaskApply(imageC1,varC1,maskC1,PM_SUBTRACTION_MODE_1);264 295 } 265 296 else if (convolution_direction == 2) { 266 psImageSmoothMask_Threaded(imageC2,image2,mask2,maskVal,sigmaKern,6,1e-6); 267 psImageSmoothMask_Threaded(varC2,var2,mask2,maskVal,sigmaKern * M_SQRT1_2,6,1e-6); 268 maskC2 = psImageConvolveMask(maskC2,mask2,maskVal,maskBad, 269 -maskBox,maskBox,-maskBox,maskBox); 270 conv2->covariance = psImageCovarianceCalculate(kernel,ro2->covariance); 297 if (conv2) { 298 psImageSmoothMask_Threaded(imageC2,image2,mask2,maskVal,sigmaKern,6,1e-6); 299 psImageSmoothMask_Threaded(varC2,var2,mask2,maskVal,sigmaKern * M_SQRT1_2,6,1e-6); 300 301 maskTemp = psImageAlloc(numCols, numRows, PS_TYPE_IMAGE_MASK); 302 maskTemp = psImageConvolveMask(maskTemp,mask2,maskVal,maskBad, // Mask bad values 303 -maskBox,maskBox,-maskBox,maskBox); 304 maskC2 = psImageConvolveMask(maskC2,maskTemp,maskPoorVal,maskPoor, // Mask poor values 305 -maskBox,maskBox,-maskBox,maskBox); 306 psFree(maskTemp); 307 308 conv2->covariance = psImageCovarianceCalculate(kernel,ro2->covariance); 309 pmSubtractionBorder(imageC2,varC2,maskC2,maskBox,maskBlank); 310 simple_apply_mask(imageC2,varC2,maskC2,maskBad); 311 } 271 312 if (conv1) { 272 313 imageC1 = psImageCopy(imageC1,image1,PS_TYPE_F32); … … 275 316 conv1->covariance = psMemIncrRefCounter(ro1->covariance); 276 317 } 277 pmSubtractionBorder(imageC2,varC2,maskC2,maskBox,maskBlank);278 pmSubtractionMaskApply(imageC2,varC2,maskC2,PM_SUBTRACTION_MODE_2);279 318 } 280 319 … … 294 333 float flux1,flux2; 295 334 296 if (conv olution_direction ==1) {335 if (conv1) { 297 336 simple_do_boxphot(&nPix1,&flux1,source,imageC1,maskC1,maskBad,photRadius); 298 if (conv2) { 299 simple_do_boxphot(&nPix2,&flux2,source,imageC2,maskC2,maskBad,photRadius); 300 } 301 else { 302 simple_do_boxphot(&nPix2,&flux2,source,image2,mask2,maskBad,photRadius); 303 } 304 } 305 else if (convolution_direction == 2) { 337 } 338 else { 339 simple_do_boxphot(&nPix1,&flux1,source,image1,mask1,maskBad,photRadius); 340 } 341 342 if (conv2) { 306 343 simple_do_boxphot(&nPix2,&flux2,source,imageC2,maskC2,maskBad,photRadius); 307 if (conv1) { 308 simple_do_boxphot(&nPix1,&flux1,source,imageC1,maskC1,maskBad,photRadius); 309 } 310 else { 311 simple_do_boxphot(&nPix1,&flux1,source,image1,mask1,maskBad,photRadius); 312 } 313 } 344 } 345 else { 346 simple_do_boxphot(&nPix2,&flux2,source,image2,mask2,maskBad,photRadius); 347 } 348 314 349 logFluxDifferences->data.F32[i] = flux2 - flux1; 315 350 fitMask->data.PS_TYPE_VECTOR_MASK_DATA[i] = 0; … … 321 356 // fprintf(stderr,"SOURCES: %d %g %g %g -> %d %d %g %g %d %g\n",i,source->peak->xf,source->peak->yf,source->psfMag, 322 357 // nPix1,nPix2,flux1,flux2,fitMask->data.PS_TYPE_VECTOR_MASK_DATA[i],logFluxDifferences->data.F32[i]); 323 324 358 } 325 359 -
tags/ipp-20130712/psModules/src/imcombine/pmSubtractionSimple.h
r35771 r35941 16 16 psImageMaskType maskVal, 17 17 psImageMaskType maskBad, 18 psImageMaskType maskPoor 18 psImageMaskType maskPoor, 19 float deconvolveThreshold 19 20 ); 20 21
Note:
See TracChangeset
for help on using the changeset viewer.
