- Timestamp:
- Apr 19, 2013, 3:42:02 PM (13 years ago)
- Location:
- branches/eam_branches/ipp-20130307
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
ppStack/src/ppStackPrepare.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20130307
- Property svn:mergeinfo changed
/trunk merged: 35353-35354,35356-35368,35380,35383-35384,35388-35392,35394-35400,35409-35411
- Property svn:mergeinfo changed
-
branches/eam_branches/ipp-20130307/ppStack/src/ppStackPrepare.c
r34800 r35413 1 1 # include "ppStack.h" 2 3 4 // Option to use the old FWHM rejection code. 5 # define NEW_REJECTION 6 // #define OLD_REJECTION 7 2 8 3 9 # define RE_PHOTOMETER 0 … … 253 259 float maxFWHM = psMetadataLookupF32(&mdok, recipe, "PSF.INPUT.MAX"); // max allowed input fwhm 254 260 float clipFWHMnSig = psMetadataLookupF32(&mdok, recipe, "PSF.INPUT.CLIP.NSIGMA"); // sigma clipping of inputs 255 261 float threshFWHM = psMetadataLookupF32(&mdok, recipe, "PSF.INPUT.THRESH"); // FWHM size that we refuse to clip below 262 float asymmetryFWHM = psMetadataLookupF32(&mdok, recipe, "PSF.INPUT.ASYMMETRY"); // max bimodal asymmetry 256 263 psString log = psStringCopy("Input seeing FWHMs:\n"); // Log message 257 264 bool havePSFs = false; // Do we have any PSFs? … … 286 293 options->inputSeeing->data.F32[i] = sumFWHM / (float)numFWHM; 287 294 } 288 295 #ifdef OLD_REJECTION 289 296 // reject any input images which exceed the specified max FWHM 290 297 if (isfinite(maxFWHM) && (options->inputSeeing->data.F32[i] > maxFWHM)) { … … 292 299 psLogMsg("ppStack", PS_LOG_INFO, "PSF FWHM for image %d is too large (%f vs %f maxFWHM) --- rejected.", i, options->inputSeeing->data.F32[i], maxFWHM); 293 300 } 294 301 // End old rejection fixed limit. 302 #endif 295 303 psStringAppend(&log, "Input %d: %f\n", i, options->inputSeeing->data.F32[i]); 296 304 } … … 300 308 psFree(log); 301 309 310 #ifdef NEW_REJECTION 311 // Do GMM test with two modes to decide where to put the break. 312 double Punimodal; 313 int m = 2; 314 psVector *modes = psVectorAlloc(num,PS_TYPE_F32); 315 psVector *means = psVectorAlloc(m,PS_TYPE_F32); 316 psVector *S = psVectorAlloc(m,PS_TYPE_F32); 317 psVector *pi = psVectorAlloc(m,PS_TYPE_F32); 318 psImage *P = psImageAlloc(m,num,PS_TYPE_F32); 319 float limit; 320 if (!psMM1DClass(options->inputSeeing, 321 options->inputSeeing->n, 322 modes,means, 323 S,pi,P, 324 2, 325 &Punimodal)) { 326 // Handle error here 327 psFree(modes); 328 psFree(means); 329 psFree(S); 330 psFree(pi); 331 psFree(P); 332 return(false); 333 } 334 // fprintf(stderr,"means: %g %g\n",means->data.F32[0],means->data.F32[1]); 335 // fprintf(stderr,"sigma: %g %g \n",S->data.F32[0],S->data.F32[1]); 336 337 // fprintf(stderr,"pi: %g %g\n",pi->data.F32[0],pi->data.F32[1]); 338 339 // unwrittenGMMfunction(options->inputSeeing, options->inputMask, 0xff, 340 // &Punimodal, 341 // &m1,&s1,&pi1, 342 // &m2,&s2,&pi2); 343 344 // Use Gaussian mixture model analysis of the FWHM distribution to decide an optional FWHM limit 345 if ((Punimodal > 0.5)|| // This distribution is best represented by a single mode 346 (num <= 4)) { // Or we have a small number of inputs, making this statistic poor. 347 limit = maxFWHM; 348 } 349 else { // This is a bimodal distribution 350 if ((fabs(pi->data.F32[0] - pi->data.F32[1]) < asymmetryFWHM)|| // However, both modes are equally populated 351 (pi->data.F32[1] > pi->data.F32[0])) { // Or the larger FWHM mode is more populated 352 limit = means->data.F32[1] + clipFWHMnSig * S->data.F32[1]; 353 } 354 else { // The smaller FWHM mode is more populated 355 limit = means->data.F32[0] + clipFWHMnSig * S->data.F32[0]; 356 } 357 } 358 if (limit > maxFWHM) { limit = maxFWHM; } // We should not be larger than our max 359 if (limit < threshFWHM) { limit = threshFWHM; } // Nor smaller than our min 360 361 for (int i = 0; i < num; i++) { 362 if (options->inputSeeing->data.F32[i] > limit) { 363 options->inputMask->data.PS_TYPE_VECTOR_MASK_DATA[i] = PPSTACK_MASK_PSF; 364 psLogMsg("ppStack", PS_LOG_INFO, 365 "PSF FWHM for image %d is too large (%f vs %f fwhmlimit) --- rejected", 366 i, options->inputSeeing->data.F32[i],limit); 367 } 368 } 369 psFree(means); 370 psFree(modes); 371 psFree(S); 372 psFree(pi); 373 psFree(P); 374 // End new rejection code 375 #endif 376 377 #ifdef OLD_REJECTION 302 378 // We should have the ability to filter the input list based on the seeing: 303 379 // * reject above some max value and/or min value … … 323 399 } 324 400 } 325 401 // End old rejection sigma clip 402 #endif 326 403 // Generate target PSF 327 404 if (options->convolve) {
Note:
See TracChangeset
for help on using the changeset viewer.
