- Timestamp:
- Aug 26, 2010, 9:18:39 AM (16 years ago)
- Location:
- branches/sc_branches/trunkTest
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/sc_branches/trunkTest
- Property svn:mergeinfo changed
-
branches/sc_branches/trunkTest/psphot
- Property svn:mergeinfo deleted
-
branches/sc_branches/trunkTest/psphot/src/psphotChoosePSF.c
r28013 r29060 74 74 75 75 // structure to store user options defining the psf 76 pmPSFOptions *options = pmPSFOptionsAlloc ();76 pmPSFOptions *options = pmPSFOptionsAlloc(); 77 77 78 78 // load user options from the recipe. no need to check existence -- they are … … 138 138 return false; 139 139 } 140 float fitTol = psMetadataLookupF32 (&status, recipe, "PSF_FIT_TOL"); // Fit tolerance 141 if (!status || !isfinite(fitTol) || fitTol <= 0) { 142 psError(PS_ERR_BAD_PARAMETER_VALUE, true, "PSF_FIT_TOL is not positive"); 143 return false; 144 } 145 pmSourceFitModelInit(fitIter, fitTol, PS_SQR(SKY_SIG), options->poissonErrorsPhotLMM); 146 140 float fitMinTol = psMetadataLookupF32 (&status, recipe, "PSF_FIT_MIN_TOL"); // Fit tolerance 141 if (!status || !isfinite(fitMinTol) || fitMinTol <= 0) { 142 fitMinTol = psMetadataLookupF32 (&status, recipe, "PSF_FIT_TOL"); // Fit tolerance 143 if (!status || !isfinite(fitMinTol) || fitMinTol <= 0) { 144 psError(PS_ERR_BAD_PARAMETER_VALUE, true, "PSF_FIT_MIN_TOL (and PSF_FIT_TOL) not defined or positive"); 145 return false; 146 } 147 } 148 float fitMaxTol = psMetadataLookupF32 (&status, recipe, "PSF_FIT_MAX_TOL"); // Fit tolerance 149 if (!status || !isfinite(fitMaxTol) || fitMaxTol <= 0) { 150 fitMaxTol = 1.0; 151 } 152 float maxChisqDOF = psMetadataLookupF32 (&status, recipe, "PSF_FIT_MAX_CHISQ"); // Fit tolerance 153 154 // options which modify the behavior of the model fitting 155 options->fitOptions = pmSourceFitOptionsAlloc(); 156 options->fitOptions->nIter = fitIter; 157 options->fitOptions->minTol = fitMinTol; 158 options->fitOptions->maxTol = fitMaxTol; 159 options->fitOptions->maxChisqDOF = maxChisqDOF; 160 options->fitOptions->poissonErrors = options->poissonErrorsPhotLMM; 161 options->fitOptions->weight = PS_SQR(SKY_SIG); 162 options->fitOptions->mode = PM_SOURCE_FIT_PSF; 163 147 164 psArray *stars = psArrayAllocEmpty (sources->n); 148 165 … … 227 244 228 245 // try each model option listed in config 246 // pmPSFtryModel makes a local copy of the sources -- those points are not the same as those for 'sources' 229 247 for (int i = 0; i < modelNames->n; i++) { 230 248 char *modelName = modelNames->data[i]; … … 304 322 305 323 // unset the PSFSTAR flag for stars not used for PSF model 324 // XXX a more efficient way of achieving this would be to record a pair of arrays 325 // of the source index and the source id for the psf stars. but that would require we do 326 // not re-sort the source list in the meanwhile 327 int nDrop = 0; 306 328 for (int i = 0; i < try->sources->n; i++) { 307 329 pmSource *source = try->sources->data[i]; 308 330 if (try->mask->data.PS_TYPE_VECTOR_MASK_DATA[i]) { 309 source->mode &= ~PM_SOURCE_MODE_PSFSTAR; 310 } 311 } 331 // need to find this source in the original list (these are copies, not pointers) 332 for (int j = 0; j < sources->n; j++) { 333 pmSource *realSource = sources->data[j]; 334 if (realSource->id != source->id) continue; 335 realSource->mode &= ~PM_SOURCE_MODE_PSFSTAR; 336 source->mode &= ~PM_SOURCE_MODE_PSFSTAR; 337 nDrop ++; 338 break; 339 } 340 } 341 } 342 // fprintf (stderr, "drop %d stars as PSF stars\n", nDrop); 343 344 // XXX is this working? 345 // int N1 = 0; 346 // for (int i = 0; i < try->sources->n; i++) { 347 // pmSource *source = try->sources->data[i]; 348 // fprintf (stderr, "%llx : %d\n", (long long int) source, (source->mode & PM_SOURCE_MODE_PSFSTAR)); 349 // if (source->mode & PM_SOURCE_MODE_PSFSTAR) { 350 // N1 ++; 351 // } 352 // } 353 // int N2 = 0; 354 // for (int i = 0; i < sources->n; i++) { 355 // pmSource *source = sources->data[i]; 356 // fprintf (stderr, "%llx : %d\n", (long long int) source, (source->mode & PM_SOURCE_MODE_PSFSTAR)); 357 // if (source->mode & PM_SOURCE_MODE_PSFSTAR) { 358 // N2 ++; 359 // } 360 // } 361 // fprintf (stderr, "N1: %d, N2: %d\n", N1, N2); 312 362 313 363 // build a PSF residual image
Note:
See TracChangeset
for help on using the changeset viewer.
