Changeset 27838 for branches/tap_branches/psphot/src/psphotRoughClass.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/psphotRoughClass.c (modified) (6 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/psphotRoughClass.c
r25852 r27838 7 7 } } 8 8 9 bool psphotRoughClassRegion (int nRegion, psRegion *region, psArray *sources, psMetadata *target, psMetadata *recipe, const bool havePSF); 9 // for now, let's store the detections on the readout->analysis for each readout 10 bool psphotRoughClass (pmConfig *config, const pmFPAview *view) 11 { 12 bool status = true; 10 13 11 // 2006.02.02 : no leaks 12 bool psphotRoughClass (pmReadout *readout, psArray *sources, psMetadata *recipe, const bool havePSF) { 14 // select the appropriate recipe information 15 psMetadata *recipe = psMetadataLookupPtr (&status, config->recipes, PSPHOT_RECIPE); 16 psAssert (recipe, "missing recipe?"); 17 18 int num = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM"); 19 psAssert (status, "programming error: must define PSPHOT.INPUT.NUM"); 20 21 // skip the chisq image (optionally?) 22 int chisqNum = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.CHISQ.NUM"); 23 if (!status) chisqNum = -1; 24 25 // loop over the available readouts 26 for (int i = 0; i < num; i++) { 27 if (i == chisqNum) continue; // skip chisq image 28 if (!psphotRoughClassReadout (config, view, "PSPHOT.INPUT", i, recipe)) { 29 psError (PSPHOT_ERR_CONFIG, false, "failed on rough classification for PSPHOT.INPUT entry %d", i); 30 return false; 31 } 32 } 33 return true; 34 } 35 36 bool psphotRoughClassReadout (pmConfig *config, const pmFPAview *view, const char *filename, int index, psMetadata *recipe) { 13 37 14 38 bool status; 15 39 16 40 psTimerStart ("psphot.rough"); 41 42 // find the currently selected readout 43 pmFPAfile *file = pmFPAfileSelectSingle(config->files, filename, index); // File of interest 44 psAssert (file, "missing file?"); 45 46 pmReadout *readout = pmFPAviewThisReadout(view, file->fpa); 47 psAssert (readout, "missing readout?"); 48 49 // if we have a PSF, use the existing PSF clump region below 50 bool havePSF = false; 51 if (psMetadataLookupPtr (&status, readout->analysis, "PSPHOT.PSF")) { 52 havePSF = true; 53 } 54 55 pmDetections *detections = psMetadataLookupPtr (&status, readout->analysis, "PSPHOT.DETECTIONS"); 56 psAssert (detections, "missing detections?"); 57 58 psArray *sources = detections->newSources; 59 psAssert (sources, "missing sources?"); 60 61 if (!sources->n) { 62 psLogMsg ("psphot", PS_LOG_INFO, "no sources, skipping rough classification"); 63 return true; 64 } 17 65 18 66 // we make this measurement on a NxM grid of regions across the readout … … 37 85 } 38 86 } 39 psMetadataAddS32 (re cipe, PS_LIST_TAIL, "PSF.CLUMP.NREGIONS", PS_META_REPLACE, "psf clump regions", nRegion);87 psMetadataAddS32 (readout->analysis, PS_LIST_TAIL, "PSF.CLUMP.NREGIONS", PS_META_REPLACE, "psf clump regions", nRegion); 40 88 41 89 // optional printout of source moments only … … 51 99 } 52 100 53 bool psphotRoughClassRegion (int nRegion, psRegion *region, psArray *sources, psMetadata * target, psMetadata *recipe, const bool havePSF) {101 bool psphotRoughClassRegion (int nRegion, psRegion *region, psArray *sources, psMetadata *analysis, psMetadata *recipe, const bool havePSF) { 54 102 55 103 bool status; … … 61 109 assert (maskSat); 62 110 111 // the regions are saved on the readout->analysis metadata folder (passed to us as analysis) 63 112 snprintf (regionName, 64, "PSF.CLUMP.REGION.%03d", nRegion); 64 psMetadata *regionMD = psMetadataLookupPtr (&status, target, regionName);113 psMetadata *regionMD = psMetadataLookupPtr (&status, analysis, regionName); 65 114 if (!regionMD) { 66 115 // allocate the region metadata folder and add this region to it. 67 116 regionMD = psMetadataAlloc(); 68 psMetadataAddMetadata ( target, PS_LIST_TAIL, regionName, PS_META_REPLACE, "psf clump region", regionMD);117 psMetadataAddMetadata (analysis, PS_LIST_TAIL, regionName, PS_META_REPLACE, "psf clump region", regionMD); 69 118 psFree (regionMD); 70 119 } … … 74 123 // determine the PSF parameters from the source moment values 75 124 // XXX why not save the psfClump as a PTR? 76 psfClump = pmSourcePSFClump (region, sources, target); 125 126 float PSF_SN_LIM = psMetadataLookupF32(&status, recipe, "PSF_SN_LIM"); psAssert (status, "missing PSF_SN_LIM"); 127 float MOMENTS_AR_MAX = psMetadataLookupF32(&status, recipe, "MOMENTS_AR_MAX"); psAssert (status, "missing MOMENTS_AR_MAX"); 128 129 float PSF_CLUMP_GRID_SCALE = psMetadataLookupF32(&status, analysis, "PSF_CLUMP_GRID_SCALE"); 130 if (!status) { 131 PSF_CLUMP_GRID_SCALE = psMetadataLookupF32(&status, recipe, "PSF_CLUMP_GRID_SCALE"); 132 psAssert (status, "missing PSF_CLUMP_GRID_SCALE"); 133 } 134 float MOMENTS_SX_MAX = psMetadataLookupF32(&status, analysis, "MOMENTS_SX_MAX"); 135 if (!status) { 136 MOMENTS_SX_MAX = psMetadataLookupF32(&status, recipe, "MOMENTS_SX_MAX"); 137 psAssert (status, "missing MOMENTS_SX_MAX"); 138 } 139 float MOMENTS_SY_MAX = psMetadataLookupF32(&status, analysis, "MOMENTS_SY_MAX"); 140 if (!status) { 141 MOMENTS_SY_MAX = psMetadataLookupF32(&status, recipe, "MOMENTS_SY_MAX"); 142 psAssert (status, "missing MOMENTS_SY_MAX"); 143 } 144 145 psfClump = pmSourcePSFClump (NULL, region, sources, PSF_SN_LIM, PSF_CLUMP_GRID_SCALE, MOMENTS_SX_MAX, MOMENTS_SY_MAX, MOMENTS_AR_MAX); 146 77 147 psMetadataAddF32 (regionMD, PS_LIST_TAIL, "PSF.CLUMP.X", PS_META_REPLACE, "psf clump center", psfClump.X); 78 148 psMetadataAddF32 (regionMD, PS_LIST_TAIL, "PSF.CLUMP.Y", PS_META_REPLACE, "psf clump center", psfClump.Y); … … 102 172 psLogMsg ("psphot", 3, "psf clump DX, DY: %f, %f\n", psfClump.dX, psfClump.dY); 103 173 174 // get basic parameters, or set defaults 175 float PSF_SN_LIM = psMetadataLookupF32 (&status, recipe, "PSF_SN_LIM"); psAssert (status, "missing PSF_SN_LIM"); 176 float PSF_CLUMP_NSIGMA = psMetadataLookupF32 (&status, recipe, "PSF_CLUMP_NSIGMA"); psAssert (status, "missing PSF_CLUMP_NSIGMA"); 177 104 178 // group into STAR, COSMIC, EXTENDED, SATURATED, etc. 105 if (!pmSourceRoughClass (region, sources, recipe, psfClump, maskSat)) {179 if (!pmSourceRoughClass (region, sources, PSF_SN_LIM, PSF_CLUMP_NSIGMA, psfClump, maskSat)) { 106 180 psError(PSPHOT_ERR_PROG, false, "programming error calling pmSourceRoughClass"); 107 181 return false;
Note:
See TracChangeset
for help on using the changeset viewer.
