- Timestamp:
- Feb 5, 2010, 1:38:43 PM (16 years ago)
- Location:
- branches/eam_branches/20091201/psphot
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
src/psphotReadoutMinimal.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/20091201/psphot
-
Property svn:mergeinfo
set to (toggle deleted branches)
/branches/eam_branches/psphot.stack.20100120 merged eligible /branches/eam_branches/20091113/psphot 26119-26255
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
branches/eam_branches/20091201/psphot/src/psphotReadoutMinimal.c
r26648 r26788 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 20 if (!psphotAddPhotcode(config, view)) { … … 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, view, 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) { 34 // find the detections (by peak and/or footprint) in the image. (final pass) 35 if (!psphotFindDetections(config, view, false)) { 53 36 psError (PSPHOT_ERR_UNKNOWN, false, "failure in peak analysis"); 54 return psphotReadoutCleanup (config, readout, recipe, detections, psf, NULL);37 return psphotReadoutCleanup (config, view); 55 38 } 56 #if 0 57 if (!detections->peaks->n) { 58 psLogMsg ("psphot", 3, "unable to find detections in this image"); 59 return psphotReadoutCleanup (config, readout, recipe, detections, psf, NULL); 39 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); 60 44 } 61 #endif62 45 63 // construct sources and measure basic stats 64 psArray *sources = psphotSourceStats (config, readout, detections, false); 65 if (!sources) return false; 46 // find blended neighbors of very saturated stars 47 psphotDeblendSatstars (config, view); 66 48 67 // Do the efficiency before everything else, to ensure it's done 68 if (!psphotEfficiency(config, readout, view, psf, recipe, sources)) { 49 // mark blended peaks PS_SOURCE_BLEND 50 if (!psphotBasicDeblend (config, view)) { 51 psLogMsg ("psphot", 3, "failed on deblend analysis"); 52 return psphotReadoutCleanup (config, view); 53 } 54 55 // classify sources based on moments, brightness (use supplied psf shape parameters) 56 if (!psphotRoughClass (config, view)) { 57 psLogMsg ("psphot", 3, "failed to find a valid PSF clump for image"); 58 return psphotReadoutCleanup (config, view); 59 } 60 61 // construct an initial model for each object 62 psphotGuessModels (config, view); 63 64 // linear PSF fit to source peaks 65 psphotFitSourcesLinear (config, view, false); 66 67 // XXX eventually, add the extended source fits here 68 # if (0) 69 // measure source size for the remaining sources 70 psphotSourceSize (config, view); 71 72 psphotExtendedSourceAnalysis (config, view); 73 74 psphotExtendedSourceFits (config, view); 75 # endif 76 77 // calculate source magnitudes 78 psphotMagnitudes(config, view); 79 80 // XXX ensure this is measured if the analysis succeeds (even if quality is low) 81 if (!psphotEfficiency(config, view)) { 69 82 psErrorStackPrint(stderr, "Unable to determine detection efficiencies from fake sources"); 70 83 psErrorClear(); 71 84 } 72 85 73 if (detections->peaks->n == 0 || sources->n == 0) {74 psLogMsg ("psphot", 3, "unable to find detections in this image");75 return psphotReadoutCleanup (config, readout, recipe, detections, psf, NULL);76 }77 78 79 80 // find blended neighbors of very saturated stars81 // XXX merge this with Basic Deblend?82 psphotDeblendSatstars (readout, sources, recipe);83 84 // mark blended peaks PS_SOURCE_BLEND85 if (!psphotBasicDeblend (sources, recipe)) {86 psLogMsg ("psphot", 3, "failed on deblend analysis");87 return psphotReadoutCleanup (config, readout, recipe, detections, psf, sources);88 }89 90 // classify sources based on moments, brightness (use supplied psf shape parameters)91 if (!psphotRoughClass (readout, sources, recipe, true)) {92 psLogMsg ("psphot", 3, "failed to find a valid PSF clump for image");93 return psphotReadoutCleanup (config, readout, recipe, detections, psf, sources);94 }95 96 // construct an initial model for each object97 psphotGuessModels (config, readout, sources, psf);98 99 // linear PSF fit to source peaks100 psphotFitSourcesLinear (readout, sources, recipe, psf, FALSE);101 102 // We have to place these visualizations here because the models are not realized until103 // psphotGuessModels or fitted until psphotFitSourcesLinear.104 psphotVisualShowPSFStars (recipe, psf, sources);105 psphotVisualShowSatStars (recipe, psf, sources);106 107 // XXX eventually, add the extended source fits here108 # if (0)109 // measure source size for the remaining sources110 psphotSourceSize (config, readout, sources, recipe, 0);111 112 psphotExtendedSourceAnalysis (readout, sources, recipe);113 114 psphotExtendedSourceFits (readout, sources, recipe);115 # endif116 117 // calculate source magnitudes118 psphotMagnitudes(config, readout, view, sources, psf);119 120 86 // drop the references to the image pixels held by each source 121 psphotSourceFreePixels ( sources);87 psphotSourceFreePixels (config, view); 122 88 123 89 // create the exported-metadata and free local data 124 return psphotReadoutCleanup(config, readout, recipe, detections, psf, sources);90 return psphotReadoutCleanup(config, view); 125 91 }
Note:
See TracChangeset
for help on using the changeset viewer.
