Changeset 20348
- Timestamp:
- Oct 23, 2008, 2:16:09 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/pswarp/src/pswarpLoop.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pswarp/src/pswarpLoop.c
r20115 r20348 3 3 4 4 #define WCS_NONLIN_TOL 0.001 // Non-linear tolerance for header WCS 5 #define PSPHOT_FIND_PSF 0 // Use psphot's findPSF function? 6 //#define TESTING 1 // Testing output? 5 7 6 8 // Lists of file rules for the detectors and skycells, and an independent list of everything else … … 8 10 static char *detectorFiles[] = { "PSWARP.INPUT", "PSWARP.MASK", "PSWARP.WEIGHT", NULL }; 9 11 static char *skycellFiles[] = { "PSWARP.OUTPUT", "PSWARP.OUTPUT.MASK", "PSWARP.OUTPUT.WEIGHT", NULL }; 10 static char *photFiles[] = { "PSPHOT.INPUT", "PSPHOT.OUTPUT", "PSPHOT.INPUT.CMF", "PSPHOT.RESID", 12 static char *photFiles[] = { "PSPHOT.INPUT", "PSPHOT.OUTPUT", 13 #if PSPHOT_FIND_PSF 14 "PSPHOT.INPUT.CMF", 15 #endif 16 "PSPHOT.RESID", 11 17 "PSPHOT.BACKMDL", "PSPHOT.BACKMDL.STDEV", "PSPHOT.BACKGND", "PSPHOT.BACKSUB", 12 18 "PSPHOT.PSF.SAVE", "SOURCE.PLOT.MOMENTS", "SOURCE.PLOT.PSFMODEL", … … 350 356 "Don't allow psphot to fit a fake PSF!", false); 351 357 352 #if 0358 #if !PSPHOT_FIND_PSF 353 359 // Get rid of the transformed sources so that we can measure the PSF 354 360 psMetadataRemoveKey(output->analysis, "PSPHOT.SOURCES"); … … 360 366 pmFPAview *view = pmFPAviewAlloc(0); // View into skycell 361 367 view->chip = view->cell = view->readout = 0; 368 369 #if PSPHOT_FIND_PSF 370 // Need to adjust the weight --- the main operation in psphotReadoutFindPSF is not determining the 371 // signficance of sources, but looking at the significance of individual pixels. 372 // We can adjust the weight directly since this is a deep copy 373 pmReadout *photRO = pmFPAviewThisReadout(view, photFile->fpa); 374 float vf = psMetadataLookupF32(NULL, photRO->parent->concepts, "CELL.VARFACTOR"); // Variance factor 375 psBinaryOp(photRO->weight, photRO->weight, "*", psScalarAlloc(vf, PS_TYPE_F32)); 376 362 377 if (!psphotReadoutFindPSF(config, view)) { 363 378 psError(PS_ERR_UNKNOWN, false, "Unable to determine PSF for warped image."); 364 379 return false; 365 380 } 381 #else 382 if (!psphotReadout(config, view)) { 383 psError(PS_ERR_UNKNOWN, false, "Unable to determine PSF for warped image."); 384 return false; 385 } 386 #endif 387 388 #ifdef TESTING 389 { 390 #define PSF_SIZE 20 // Half-size of PSF 391 #define PSF_FLUX 10000 // Central flux for PSF 392 pmChip *photChip = pmFPAviewThisChip(view, photFile->fpa); 393 pmPSF *psf = psMetadataLookupPtr(NULL, photChip->analysis, "PSPHOT.PSF"); 394 psImage *image = psImageAlloc(2 * PSF_SIZE + 1, 2 * PSF_SIZE + 1, PS_TYPE_F32); 395 psImageInit(image, 0); 396 pmModel *model = pmModelFromPSFforXY(psf, PSF_SIZE, PSF_SIZE, PSF_FLUX); 397 pmModelAdd(image, NULL, model, PM_MODEL_OP_FULL, 0); 398 psFree(model); 399 psFits *fits = psFitsOpen("psf.fits", "w"); 400 psFitsWriteImage(fits, NULL, image, 0, NULL); 401 psFitsClose(fits); 402 psFree(image); 403 } 404 #endif 405 366 406 psFree(view); 367 407 }
Note:
See TracChangeset
for help on using the changeset viewer.
