Changeset 35394
- Timestamp:
- Apr 11, 2013, 3:21:06 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 5 edited
-
ippconfig/gpc1/ppStack.config (modified) (2 diffs)
-
ippconfig/recipes/ppStack.config (modified) (1 diff)
-
ppStack/src/ppStackPrepare.c (modified) (5 diffs)
-
psLib/src/math/Makefile.am (modified) (2 diffs)
-
psLib/src/math/psMixtureModels.c (added)
-
psLib/src/math/psMixtureModels.h (added)
-
psLib/src/pslib_strict.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippconfig/gpc1/ppStack.config
r35337 r35394 1 1 PSF.MODEL STR PS_MODEL_PS1_V1 # Model for PSF generation 2 BACKGROUND.MODEL BOOL F 2 3 3 4 ZP.AIRMASS METADATA # Airmass terms by filter … … 30 31 OUTPUT.LOGFLUX BOOL FALSE 31 32 OUTPUT.REPLICATE BOOL TRUE 32 PSF.INPUT.MAX F32 7.533 PSF.INPUT.MAX F32 10.0 33 34 PSF.INPUT.CLIP.NSIGMA F32 1.5 35 PSF.INPUT.THRESH F32 5.0 36 PSF.INPUT.ASYMMETRY F32 0.2 34 37 END 35 38 -
trunk/ippconfig/recipes/ppStack.config
r35337 r35394 92 92 PSF.INPUT.MAX F32 NAN 93 93 PSF.INPUT.CLIP.NSIGMA F32 NAN 94 PSF.INPUT.THRESH F32 NAN 95 PSF.INPUT.ASYMMETRY F32 NAN 94 96 95 97 TEMP.IMAGE STR conv.im.fits # Suffix for temporary convolved images -
trunk/ppStack/src/ppStackPrepare.c
r34800 r35394 253 253 float maxFWHM = psMetadataLookupF32(&mdok, recipe, "PSF.INPUT.MAX"); // max allowed input fwhm 254 254 float clipFWHMnSig = psMetadataLookupF32(&mdok, recipe, "PSF.INPUT.CLIP.NSIGMA"); // sigma clipping of inputs 255 255 float threshFWHM = psMetadataLookupF32(&mdok, recipe, "PSF.INPUT.THRESH"); // FWHM size that we refuse to clip below 256 float asymmetryFWHM = psMetadataLookupF32(&mdok, recipe, "PSF.INPUT.ASYMMETRY"); // max bimodal asymmetry 256 257 psString log = psStringCopy("Input seeing FWHMs:\n"); // Log message 257 258 bool havePSFs = false; // Do we have any PSFs? … … 286 287 options->inputSeeing->data.F32[i] = sumFWHM / (float)numFWHM; 287 288 } 288 289 #ifdef OLD_REJECTION 289 290 // reject any input images which exceed the specified max FWHM 290 291 if (isfinite(maxFWHM) && (options->inputSeeing->data.F32[i] > maxFWHM)) { … … 292 293 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 294 } 294 295 #endif 295 296 psStringAppend(&log, "Input %d: %f\n", i, options->inputSeeing->data.F32[i]); 296 297 } … … 300 301 psFree(log); 301 302 303 // Do GMM test with two modes to decide where to put the break. 304 double Punimodal; 305 int m = 2; 306 psVector *modes = psVectorAlloc(num,PS_TYPE_F32); 307 psVector *means = psVectorAlloc(m,PS_TYPE_F32); 308 psVector *S = psVectorAlloc(m,PS_TYPE_F32); 309 psVector *pi = psVectorAlloc(m,PS_TYPE_F32); 310 psImage *P = psImageAlloc(m,num,PS_TYPE_F32); 311 float limit; 312 if (!psMM1DClass(options->inputSeeing, 313 options->inputSeeing->n, 314 modes,means, 315 S,pi,P, 316 2, 317 &Punimodal)) { 318 // Handle error here 319 psFree(modes); 320 psFree(means); 321 psFree(S); 322 psFree(pi); 323 psFree(P); 324 return(false); 325 } 326 fprintf(stderr,"means: %g %g\n",means->data.F32[0],means->data.F32[1]); 327 fprintf(stderr,"sigma: %g %g \n",S->data.F32[0],S->data.F32[1]); 328 329 fprintf(stderr,"pi: %g %g\n",pi->data.F32[0],pi->data.F32[1]); 330 331 // unwrittenGMMfunction(options->inputSeeing, options->inputMask, 0xff, 332 // &Punimodal, 333 // &m1,&s1,&pi1, 334 // &m2,&s2,&pi2); 335 336 // Use Gaussian mixture model analysis of the FWHM distribution to decide an optional FWHM limit 337 if ((Punimodal > 0.5)|| // This distribution is best represented by a single mode 338 (num <= 4)) { // Or we have a small number of inputs, making this statistic poor. 339 limit = maxFWHM; 340 } 341 else { // This is a bimodal distribution 342 if ((fabs(pi->data.F32[0] - pi->data.F32[1]) < asymmetryFWHM)|| // However, both modes are equally populated 343 (pi->data.F32[1] > pi->data.F32[0])) { // Or the larger FWHM mode is more populated 344 limit = means->data.F32[1] + clipFWHMnSig * S->data.F32[1]; 345 } 346 else { // The smaller FWHM mode is more populated 347 limit = means->data.F32[0] + clipFWHMnSig * S->data.F32[0]; 348 } 349 } 350 if (limit > maxFWHM) { limit = maxFWHM; } // We should not be larger than our max 351 if (limit < threshFWHM) { limit = threshFWHM; } // Nor smaller than our min 352 353 for (int i = 0; i < num; i++) { 354 if (options->inputSeeing->data.F32[i] > limit) { 355 options->inputMask->data.PS_TYPE_VECTOR_MASK_DATA[i] = PPSTACK_MASK_PSF; 356 psLogMsg("ppStack", PS_LOG_INFO, 357 "PSF FWHM for image %d is too large (%f vs %f fwhmlimit) --- rejected", 358 i, options->inputSeeing->data.F32[i],limit); 359 } 360 } 361 psFree(means); 362 psFree(modes); 363 psFree(S); 364 psFree(pi); 365 psFree(P); 366 367 #ifdef OLD_REJECTION 302 368 // We should have the ability to filter the input list based on the seeing: 303 369 // * reject above some max value and/or min value … … 323 389 } 324 390 } 325 391 #endif 326 392 // Generate target PSF 327 393 if (options->convolve) { -
trunk/psLib/src/math/Makefile.am
r16793 r35394 16 16 psMinimizePowell.c \ 17 17 psMinimizePolyFit.c \ 18 psMixtureModels.c \ 18 19 psPolynomial.c \ 19 20 psPolynomialMetadata.c \ … … 45 46 psMinimizePowell.h \ 46 47 psMinimizePolyFit.h \ 48 psMixtureModels.h \ 47 49 psPolynomial.h \ 48 50 psPolynomialMetadata.h \ -
trunk/psLib/src/pslib_strict.h
r32251 r35394 76 76 #include "psMinimizePowell.h" 77 77 #include "psMinimizePolyFit.h" 78 #include "psMixtureModels.h" 78 79 #include "psMutex.h" 79 80 #include "psRandom.h"
Note:
See TracChangeset
for help on using the changeset viewer.
