Changeset 27919
- Timestamp:
- May 11, 2010, 3:27:39 PM (16 years ago)
- Location:
- branches/eam_branches/psphot.20100506/src
- Files:
-
- 8 edited
-
psphot.h (modified) (2 diffs)
-
psphotMergeSources.c (modified) (1 diff)
-
psphotPetrosianRadialBins.c (modified) (1 diff)
-
psphotPetrosianStats.c (modified) (1 diff)
-
psphotRadialBins.c (modified) (2 diffs)
-
psphotSourceStats.c (modified) (1 diff)
-
psphotStackChisqImage.c (modified) (3 diffs)
-
psphotStackReadout.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/psphot.20100506/src/psphot.h
r27909 r27919 349 349 bool psphotStackImageLoop (pmConfig *config); 350 350 bool psphotStackReadout (pmConfig *config, const pmFPAview *view); 351 bool psphotStackChisqImage (pmConfig *config, const pmFPAview *view, const char * filerule);351 bool psphotStackChisqImage (pmConfig *config, const pmFPAview *view, const char *ruleDet, const char *ruleCnv); 352 352 bool psphotStackChisqImageAddReadout(const pmConfig *config, // Configuration 353 353 const pmFPAview *view, … … 455 455 pmFPAfile *psphotStackGetConvolveSource (pmConfig *config, psphotStackOptions *options, int index); 456 456 457 bool psphotCopySources (pmConfig *config, const pmFPAview *view, const char *ruleOut, const char *ruleSrc); 458 bool psphotCopySourcesReadout (pmConfig *config, const pmFPAview *view, const char *ruleOut, const char *ruleSrc, int index); 459 457 460 #endif -
branches/eam_branches/psphot.20100506/src/psphotMergeSources.c
r27909 r27919 399 399 return true; 400 400 } 401 402 // copy the detections from one pmFPAfile to another 403 bool psphotCopySources (pmConfig *config, const pmFPAview *view, const char *ruleOut, const char *ruleSrc) 404 { 405 bool status = true; 406 407 int num = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM"); 408 psAssert (status, "programming error: must define PSPHOT.INPUT.NUM"); 409 410 // skip the chisq image because it is a duplicate of the detection version 411 int chisqNum = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.CHISQ.NUM"); 412 if (!status) chisqNum = -1; 413 414 // loop over the available readouts 415 for (int i = 0; i < num; i++) { 416 if (i == chisqNum) continue; // skip chisq image 417 if (!psphotCopySourcesReadout (config, view, ruleOut, ruleSrc, i)) { 418 psError (PSPHOT_ERR_CONFIG, false, "failed to copy sources from %s to %s entry %d", ruleSrc, ruleOut, i); 419 return false; 420 } 421 } 422 return true; 423 } 424 425 // add newly selected sources to the existing list of sources 426 bool psphotCopySourcesReadout (pmConfig *config, const pmFPAview *view, const char *ruleOut, const char *ruleSrc, int index) { 427 428 bool status; 429 430 // find the currently selected readout 431 pmFPAfile *fileSrc = pmFPAfileSelectSingle(config->files, ruleSrc, index); // File of interest 432 psAssert (fileSrc, "missing file?"); 433 434 pmReadout *readoutSrc = pmFPAviewThisReadout(view, fileSrc->fpa); 435 psAssert (readoutSrc, "missing readout?"); 436 437 pmDetections *detections = psMetadataLookupPtr (&status, readoutSrc->analysis, "PSPHOT.DETECTIONS"); 438 psAssert (detections, "missing detections?"); 439 440 // find the currently selected readout 441 pmFPAfile *fileOut = pmFPAfileSelectSingle(config->files, ruleOut, index); // File of interest 442 psAssert (fileOut, "missing file?"); 443 444 pmReadout *readoutOut = pmFPAviewThisReadout(view, fileOut->fpa); 445 psAssert (readoutOut, "missing readout?"); 446 447 // save detections on the readout->analysis 448 // XXX this replaced any existing entry; allow this operation to merge? 449 if (!psMetadataAddPtr (readoutOut->analysis, PS_LIST_TAIL, "PSPHOT.DETECTIONS", PS_META_REPLACE | PS_DATA_UNKNOWN, "psphot detections", detections)) { 450 psError (PSPHOT_ERR_CONFIG, false, "problem saving detections on readout"); 451 return false; 452 } 453 454 return true; 455 } 456 -
branches/eam_branches/psphot.20100506/src/psphotPetrosianRadialBins.c
r27819 r27919 182 182 psFree(values); 183 183 psFree(stats); 184 return false;184 return true; 185 185 } 186 186 -
branches/eam_branches/psphot.20100506/src/psphotPetrosianStats.c
r27819 r27919 15 15 16 16 pmSourceRadialProfile *profile = source->extpars->petProfile; 17 18 if (!profile->binSB) { 19 psLogMsg ("psphot", PS_LOG_DETAIL, "no petrosian profile, skipping source %f, %f", source->peak->xf, source->peak->yf); 20 return true; 21 } 17 22 18 23 psVector *binSB = profile->binSB; -
branches/eam_branches/psphot.20100506/src/psphotRadialBins.c
r27819 r27919 44 44 psVector *radMin = psMetadataLookupPtr (&status, recipe, "RADIAL.ANNULAR.BINS.LOWER"); 45 45 psVector *radMax = psMetadataLookupPtr (&status, recipe, "RADIAL.ANNULAR.BINS.UPPER"); 46 if (!radMin || !radMin->n) return false; 47 if (!radMax || !radMax->n) return false; 46 if (!radMin || !radMin->n) { 47 psError (PSPHOT_ERR_CONFIG, true, "error in definition of annular bins (radMin missing or empty)"); 48 return false; 49 } 50 if (!radMax || !radMax->n) { 51 psError (PSPHOT_ERR_CONFIG, true, "error in definition of annular bins (radMax missing or empty)"); 52 return false; 53 } 48 54 49 55 psVector *binSB = psVectorAllocEmpty(radMin->n, PS_TYPE_F32); // surface brightness of radial bin … … 155 161 psFree(values); 156 162 psFree(stats); 157 return false;163 return true; 158 164 } 159 165 -
branches/eam_branches/psphot.20100506/src/psphotSourceStats.c
r27909 r27919 16 16 psAssert (status, "programming error: must define PSPHOT.INPUT.NUM"); 17 17 18 // skip the chisq image (optionally?) 19 // int chisqNum = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.CHISQ.NUM"); 20 // if (!status) chisqNum = -1; 21 18 22 // loop over the available readouts 19 23 for (int i = 0; i < num; i++) { 24 // if (i == chisqNum) continue; // skip chisq image 20 25 if (!psphotSourceStatsReadout (config, view, filerule, i, recipe, setWindow)) { 21 26 psError (PSPHOT_ERR_CONFIG, false, "failed to find initial detections for %s entry %d", filerule, i); -
branches/eam_branches/psphot.20100506/src/psphotStackChisqImage.c
r27909 r27919 6 6 7 7 // XXX supply filename or keep PSPHOT.INPUT fixed? 8 bool psphotStackChisqImage (pmConfig *config, const pmFPAview *view, const char * filerule)8 bool psphotStackChisqImage (pmConfig *config, const pmFPAview *view, const char *ruleDet, const char *ruleCnv) 9 9 { 10 10 bool status = false; … … 21 21 22 22 // loop over the available readouts 23 // generate the chisq image from the 'detection' images 23 24 for (int i = 0; i < num; i++) { 24 if (!psphotStackChisqImageAddReadout(config, view, filerule, &chiReadout, i)) {25 psError (PSPHOT_ERR_CONFIG, false, "failed to model background for %s entry %d", filerule, i);25 if (!psphotStackChisqImageAddReadout(config, view, ruleDet, &chiReadout, i)) { 26 psError (PSPHOT_ERR_CONFIG, false, "failed to model background for %s entry %d", ruleDet, i); 26 27 return false; 27 28 } … … 35 36 psMetadataAddS32(config->arguments, PS_LIST_TAIL, "PSPHOT.INPUT.NUM", PS_META_REPLACE, "", num); 36 37 37 // save the resulting image 38 if (!psMetadataAddPtr(config->files, PS_LIST_TAIL, filerule, PS_DATA_UNKNOWN | PS_META_DUPLICATE_OK, "", chisqFile)) { 38 // save the resulting image in the 'detection' set 39 if (!psMetadataAddPtr(config->files, PS_LIST_TAIL, ruleDet, PS_DATA_UNKNOWN | PS_META_DUPLICATE_OK, "", chisqFile)) { 40 psError(PM_ERR_CONFIG, false, "could not add chisqFPA to config files"); 41 return false; 42 } 43 44 // save the resulting image in the 'convolved' set 45 if (!psMetadataAddPtr(config->files, PS_LIST_TAIL, ruleCnv, PS_DATA_UNKNOWN | PS_META_DUPLICATE_OK, "", chisqFile)) { 39 46 psError(PM_ERR_CONFIG, false, "could not add chisqFPA to config files"); 40 47 return false; -
branches/eam_branches/psphot.20100506/src/psphotStackReadout.c
r27909 r27919 39 39 // generate a background model (median, smoothed image) 40 40 // XXX I think this is not defined correctly for an array of images. 41 // XXX probably need to subtract the model (same model?) for both RAW and OUT 41 42 if (!psphotModelBackground (config, view, STACK_RAW)) { 42 43 return psphotReadoutCleanup (config, view, STACK_OUT); … … 56 57 } 57 58 58 if (!psphotStackChisqImage(config, view, STACK_RAW )) {59 if (!psphotStackChisqImage(config, view, STACK_RAW, STACK_OUT)) { 59 60 psError (PSPHOT_ERR_UNKNOWN, false, "failure to generate chisq image"); 60 61 return psphotReadoutCleanup (config, view, STACK_OUT); … … 68 69 if (!psphotFindDetections (config, view, STACK_RAW, true)) { // pass 1 69 70 // this only happens if we had an error in psphotFindDetections 71 psError (PSPHOT_ERR_UNKNOWN, false, "failure in peak analysis"); 72 return psphotReadoutCleanup (config, view, STACK_OUT); 73 } 74 75 // XXX do this now or below? 76 // remove chisq image from config->file:PSPHOT.INPUT (why?) 77 // psphotStackRemoveChisqFromInputs(config, STACK_RAW); 78 79 // copy the detections from RAW to OUT 80 if (!psphotCopySources (config, view, STACK_OUT, STACK_RAW)) { 70 81 psError (PSPHOT_ERR_UNKNOWN, false, "failure in peak analysis"); 71 82 return psphotReadoutCleanup (config, view, STACK_OUT); … … 170 181 psphotSourceFreePixels (config, view, STACK_OUT); 171 182 183 // XXX do this now or above? 172 184 // remove chisq image from config->file:PSPHOT.INPUT (why?) 173 185 psphotStackRemoveChisqFromInputs(config, STACK_RAW);
Note:
See TracChangeset
for help on using the changeset viewer.
