Changeset 27838 for branches/tap_branches/psphot/src/psphotReadoutMinimal.c
- Timestamp:
- May 3, 2010, 8:41:49 AM (16 years ago)
- Location:
- branches/tap_branches
- Files:
-
- 4 edited
-
. (modified) (1 prop)
-
psphot (modified) (1 prop)
-
psphot/src (modified) (1 prop)
-
psphot/src/psphotReadoutMinimal.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/tap_branches
- Property svn:mergeinfo changed
-
branches/tap_branches/psphot
-
Property svn:mergeinfo
set to (toggle deleted branches)
/trunk/psphot merged eligible /branches/eam_branches/stackphot.20100406/psphot 27622-27655 /branches/pap_delete/psphot 27530-27595
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
branches/tap_branches/psphot/src
- Property svn:ignore
-
old new 19 19 psphotMomentsStudy 20 20 psphotPetrosianStudy 21 psphotForced 22 psphotMakePSF 23 psphotStack
-
- Property svn:ignore
-
branches/tap_branches/psphot/src/psphotReadoutMinimal.c
r25755 r27838 1 1 # include "psphotInternal.h" 2 2 3 // this badly-named function performs photometry assuming (a) a supplied PSF, (b) 4 // background subtraction, (c) linear psf-model fits only. it is currently only being5 // used by ppSub.3 // this badly-named function performs photometry assuming (a) a supplied PSF, (b) background 4 // subtraction, (c) linear psf-model fits only, (d) a prior analysis has supplied the moments 5 // window parameters. It is currently only being used by ppSub. 6 6 7 7 // NOTE: ppSub needs to perform extended source analysis for comets and trails. … … 17 17 pmModelClassSetLimits(PM_MODEL_LIMITS_LAX); 18 18 19 // select the current recipe20 psMetadata *recipe = psMetadataLookupPtr (NULL, config->recipes, PSPHOT_RECIPE);21 if (!recipe) {22 psError(PSPHOT_ERR_CONFIG, false, "missing recipe %s", PSPHOT_RECIPE);23 return false;24 }25 26 19 // set the photcode for this image 27 if (!psphotAddPhotcode( recipe, config, view, "PSPHOT.INPUT")) {20 if (!psphotAddPhotcode(config, view)) { 28 21 psError(PSPHOT_ERR_CONFIG, false, "trouble defining the photcode"); 29 22 return false; 30 23 } 31 24 32 // find the currently selected readout 33 pmReadout *readout = pmFPAfileThisReadout (config->files, view, "PSPHOT.INPUT"); 34 PS_ASSERT_PTR_NON_NULL (readout, false); 25 // Generate the mask and weight images, including the user-defined analysis region of interest 26 psphotSetMaskAndVariance (config, view); 35 27 36 // Generate the mask and weight images, including the user-defined analysis region of interest 37 psphotSetMaskAndVariance (config, readout, recipe); 38 39 // display the image, weight, mask (ch 1,2,3) 40 psphotVisualShowImage (readout); 41 42 // load the psf model, if suppled. FWHM_X,FWHM_Y,etc are saved in the recipe 43 pmPSF *psf = psphotLoadPSF (config, view, recipe); 44 if (!psf) { 28 // load the psf model, if suppled. FWHM_X,FWHM_Y,etc are saved on readout->analysis 29 if (!psphotLoadPSF (config, view)) { 45 30 psError (PSPHOT_ERR_CONFIG, false, "missing psf model"); 46 return psphotReadoutCleanup (config, readout, recipe, NULL, NULL, NULL);31 return psphotReadoutCleanup (config, view); 47 32 } 48 33 49 // find the detections (by peak and/or footprint) in the image. 50 pmDetections *detections = pmDetectionsAlloc(); // New detections; allocated to ensure pass=2 51 detections = psphotFindDetections(detections, readout, recipe); 52 if (!detections) { 53 psLogMsg ("psphot", 3, "unable to find detections in this image"); 54 return psphotReadoutCleanup (config, readout, recipe, detections, psf, NULL); 34 // find the detections (by peak and/or footprint) in the image. (final pass) 35 if (!psphotFindDetections(config, view, false)) { 36 psError (PSPHOT_ERR_UNKNOWN, false, "failure in peak analysis"); 37 return psphotReadoutCleanup (config, view); 55 38 } 56 39 57 // construct sources and measure basic stats 58 psArray *sources = psphotSourceStats (config, readout, detections, true); 59 if (!sources) return false; 40 // construct sources and measure basic stats (saved on detections->newSources) 41 if (!psphotSourceStats (config, view, false)) { // pass 1 42 psError(PSPHOT_ERR_UNKNOWN, false, "failure to generate sources"); 43 return psphotReadoutCleanup (config, view); 44 } 60 45 61 46 // find blended neighbors of very saturated stars 62 // XXX merge this with Basic Deblend? 63 psphotDeblendSatstars (readout, sources, recipe); 47 psphotDeblendSatstars (config, view); 64 48 65 49 // mark blended peaks PS_SOURCE_BLEND 66 if (!psphotBasicDeblend ( sources, recipe)) {50 if (!psphotBasicDeblend (config, view)) { 67 51 psLogMsg ("psphot", 3, "failed on deblend analysis"); 68 return psphotReadoutCleanup (config, readout, recipe, detections, psf, sources);52 return psphotReadoutCleanup (config, view); 69 53 } 70 54 71 55 // classify sources based on moments, brightness (use supplied psf shape parameters) 72 if (!psphotRoughClass ( readout, sources, recipe, true)) {56 if (!psphotRoughClass (config, view)) { 73 57 psLogMsg ("psphot", 3, "failed to find a valid PSF clump for image"); 74 return psphotReadoutCleanup (config, readout, recipe, detections, psf, sources);58 return psphotReadoutCleanup (config, view); 75 59 } 76 60 77 61 // construct an initial model for each object 78 psphotGuessModels (config, readout, sources, psf); 62 psphotGuessModels (config, view); 63 64 // merge the newly selected sources into the existing list 65 psphotMergeSources (config, view); 79 66 80 67 // linear PSF fit to source peaks 81 psphotFitSourcesLinear (readout, sources, recipe, psf, FALSE); 82 83 // We have to place these visualizations here because the models are not realized until 84 // psphotGuessModels or fitted until psphotFitSourcesLinear. 85 psphotVisualShowPSFStars (recipe, psf, sources); 86 psphotVisualShowSatStars (recipe, psf, sources); 68 psphotFitSourcesLinear (config, view, false); 87 69 88 70 // XXX eventually, add the extended source fits here 89 71 # if (0) 90 72 // measure source size for the remaining sources 91 psphotSourceSize (config, readout, sources, recipe, 0);73 psphotSourceSize (config, view); 92 74 93 psphotExtendedSourceAnalysis ( readout, sources, recipe);75 psphotExtendedSourceAnalysis (config, view); 94 76 95 psphotExtendedSourceFits ( readout, sources, recipe);77 psphotExtendedSourceFits (config, view); 96 78 # endif 97 79 98 80 // calculate source magnitudes 99 psphotMagnitudes(config, readout, view, sources, psf);81 psphotMagnitudes(config, view); 100 82 101 if (!psphotEfficiency(config, readout, view, psf, recipe, sources)) { 83 // XXX ensure this is measured if the analysis succeeds (even if quality is low) 84 if (!psphotEfficiency(config, view)) { 102 85 psErrorStackPrint(stderr, "Unable to determine detection efficiencies from fake sources"); 103 86 psErrorClear(); … … 105 88 106 89 // drop the references to the image pixels held by each source 107 psphotSourceFreePixels ( sources);90 psphotSourceFreePixels (config, view); 108 91 109 92 // create the exported-metadata and free local data 110 return psphotReadoutCleanup(config, readout, recipe, detections, psf, sources);93 return psphotReadoutCleanup(config, view); 111 94 }
Note:
See TracChangeset
for help on using the changeset viewer.
