Changeset 26612
- Timestamp:
- Jan 14, 2010, 4:49:42 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/20091201/ppSub/src/ppSubMakePSF.c
r26432 r26612 21 21 22 22 #include "ppSub.h" 23 24 psArray *ppSubSelectPSFSources(psArray *sources); 23 25 24 26 bool ppSubMakePSF(ppSubData *data) … … 79 81 // Here, we assume the image is background-subtracted 80 82 psArray *sources = psMetadataLookupPtr(&mdok, minuend->analysis, "PSPHOT.SOURCES"); 81 if (!psphotReadoutFindPSF(config, view, sources)) { 83 84 // XXX filter sources? limit the total number and return only brighter objects? 85 // use flags to toss totally bogus entries? 86 psArray *goodSources = ppSubSelectPSFSources (sources); 87 if (!psphotReadoutFindPSF(config, view, goodSources)) { 82 88 // This is likely a data quality issue 83 89 // XXX Split into multiple cases using error codes? … … 86 92 ppSubDataQuality(data, PSPHOT_ERR_PSF, PPSUB_FILES_PHOT_SUB | PPSUB_FILES_PHOT_INV); 87 93 psFree(view); 94 psFree(goodSources); 88 95 return true; 89 96 } … … 100 107 psMetadataRemoveKey(photRO->analysis, "PSPHOT.HEADER"); 101 108 109 psFree(goodSources); 102 110 psFree(view); 103 111 … … 156 164 return true; 157 165 } 166 167 168 // XXX hardwired MAX for now 169 # define MAX_NPSF 500 170 171 psArray *ppSubSelectPSFSources(psArray *sources){ 172 173 sources = psArraySort (sources, pmSourceSortBySN); 174 175 psArray *subset = psArrayAllocEmpty(MAX_NPSF); 176 177 int nPSF = 0; 178 for (int i = 0; (nPSF < MAX_NPSF) && (i < sources->n); i++) { 179 180 pmSource *source = sources->data[i]; 181 if (!source) continue; 182 183 // skip non-astronomical objects (very likely defects) 184 if (source->type == PM_SOURCE_TYPE_DEFECT) continue; 185 if (source->type == PM_SOURCE_TYPE_SATURATED) continue; 186 if (source->mode & PM_SOURCE_MODE_SATSTAR) continue; 187 188 psArrayAdd (subset, 100, source); 189 nPSF++; 190 } 191 192 return subset; 193 }
Note:
See TracChangeset
for help on using the changeset viewer.
