Changeset 26784
- Timestamp:
- Feb 5, 2010, 1:31:49 PM (16 years ago)
- Location:
- branches/eam_branches/20091201/ppSub/src
- Files:
-
- 3 edited
-
ppSubMakePSF.c (modified) (2 diffs)
-
ppSubMatchPSFs.c (modified) (4 diffs)
-
ppSubReadoutPhotometry.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/20091201/ppSub/src/ppSubMakePSF.c
r26649 r26784 66 66 pmReadout *photRO = pmFPAviewThisReadout(view, photFile->fpa); // Readout to photometer 67 67 68 // we need to remove any existing PSPHOT. SOURCES (why not do this in psphot?)69 if (psMetadataLookup(photRO->analysis, "PSPHOT. SOURCES")) {70 psMetadataRemoveKey(photRO->analysis, "PSPHOT. SOURCES");68 // we need to remove any existing PSPHOT.DETECTIONS (why not do this in psphot?) 69 if (psMetadataLookup(photRO->analysis, "PSPHOT.DETECTIONS")) { 70 psMetadataRemoveKey(photRO->analysis, "PSPHOT.DETECTIONS"); 71 71 } 72 72 if (psMetadataLookup(photRO->parent->parent->analysis, "PSPHOT.PSF")) { … … 83 83 // Extract the loaded sources from the associated readout, and generate PSF 84 84 // Here, we assume the image is background-subtracted 85 psArray *sources = psMetadataLookupPtr(&mdok, minuend->analysis, "PSPHOT.SOURCES"); 85 pmDetections *detections = psMetadataLookupPtr(&mdok, minuend->analysis, "PSPHOT.DETECTIONS"); 86 psAssert(detections, "missing detections?"); 87 psArray *sources = detections->allSources; 88 psAssert(sources, "missing sources?"); 86 89 87 90 // XXX filter sources? limit the total number and return only brighter objects? -
branches/eam_branches/20091201/ppSub/src/ppSubMatchPSFs.c
r26769 r26784 63 63 pmReadout *photRO = pmFPAviewThisReadout(view, photFile->fpa); // Readout to photometer 64 64 65 if (psMetadataLookup(photRO->analysis, "PSPHOT. SOURCES")) {66 psMetadataRemoveKey(photRO->analysis, "PSPHOT. SOURCES");65 if (psMetadataLookup(photRO->analysis, "PSPHOT.DETECTIONS")) { 66 psMetadataRemoveKey(photRO->analysis, "PSPHOT.DETECTIONS"); 67 67 } 68 68 if (psMetadataLookup(photRO->parent->parent->analysis, "PSPHOT.PSF")) { … … 123 123 pmReadout *inSourceRO = pmFPAfileThisReadout(config->files, view, "PPSUB.INPUT.SOURCES"); 124 124 pmReadout *refSourceRO = pmFPAfileThisReadout(config->files, view, "PPSUB.REF.SOURCES"); 125 psArray *inSources = psMetadataLookupPtr(NULL, inSourceRO->analysis, "PSPHOT.SOURCES"); // Input sources 126 psArray *refSources = psMetadataLookupPtr(NULL, refSourceRO->analysis, "PSPHOT.SOURCES"); // Ref sources 125 // XXX assert on inSourcesRO and refSourcesRO? 126 127 pmDetections *inDetections = psMetadataLookupPtr(NULL, inSourceRO->analysis, "PSPHOT.DETECTIONS"); // Input sources 128 pmDetections *refDetections = psMetadataLookupPtr(NULL, refSourceRO->analysis, "PSPHOT.DETECTIONS"); // Ref sources 127 129 128 130 psFree(view); 129 131 130 if (!in Sources || !refSources) {132 if (!inDetections || !refDetections) { 131 133 psWarning("Unable to scale kernel, since no sources were provided."); 132 134 return true; 133 135 } 136 137 psArray *inSources = inDetections->allSources; 138 psAssert (inSources, "missing inSources?"); 139 140 psArray *refSources = refDetections->allSources; 141 psAssert (refSources, "missing refSources?"); 134 142 135 143 float inFWHM = subImagePSF(data, inRO, inSources); // FWHM for input … … 198 206 pmReadout *inSourceRO = pmFPAfileThisReadout(config->files, view, "PPSUB.INPUT.SOURCES"); 199 207 pmReadout *refSourceRO = pmFPAfileThisReadout(config->files, view, "PPSUB.REF.SOURCES"); 200 psArray *inSources = inSourceRO ? psMetadataLookupPtr(&mdok, inSourceRO->analysis, "PSPHOT.SOURCES") : 201 NULL; // Source list from input image 202 psArray *refSources = refSourceRO ? psMetadataLookupPtr(&mdok, refSourceRO->analysis, "PSPHOT.SOURCES") : 203 NULL ; // Source list from reference image 208 209 pmDetections *inDetections = inSourceRO ? psMetadataLookupPtr(&mdok, inSourceRO->analysis, "PSPHOT.DETECTIONS") : NULL; // Input sources 210 pmDetections *refDetections = refSourceRO ? psMetadataLookupPtr(&mdok, refSourceRO->analysis, "PSPHOT.DETECTIONS") : NULL; // Ref sources 204 211 205 212 psFree(view); 206 213 207 psArray *sources = NULL; // Merged list of sources 208 if (inSources && refSources) { 214 pmDetections *detections = NULL; // Merged detection set 215 if (inDetections && refDetections) { 216 psArray *inSources = inDetections->allSources; 217 psArray *refSources = refDetections->allSources; 218 219 psAssert (inSources, "missing in sources?"); 220 psAssert (refSources, "missing ref sources?"); 221 222 detections = pmDetectionsAlloc(); 209 223 float radius = psMetadataLookupF32(NULL, recipe, "SOURCE.RADIUS"); // Matching radius 210 224 psArray *lists = psArrayAlloc(2); // Source lists 211 225 lists->data[0] = psMemIncrRefCounter(inSources); 212 226 lists->data[1] = psMemIncrRefCounter(refSources); 213 sources = pmSourceMatchMerge(lists, radius);227 detections->allSources = pmSourceMatchMerge(lists, radius); 214 228 psFree(lists); 215 if (! sources) {229 if (!detections->allSources) { 216 230 psError(PS_ERR_UNKNOWN, false, "Unable to merge source lists"); 231 psFree(detections); 217 232 return false; 218 233 } 219 } else if (inSources) {220 sources = psMemIncrRefCounter(inSources);221 } else if (refSources) {222 sources = psMemIncrRefCounter(refSources);223 }224 225 psMetadataAddArray(inConv->analysis, PS_LIST_TAIL, "PSPHOT.SOURCES", PS_META_REPLACE,226 "Merged source list", sources); 227 psMetadataAdd Array(refConv->analysis, PS_LIST_TAIL, "PSPHOT.SOURCES", PS_META_REPLACE,228 "Merged source list", sources);229 psFree( sources); // Drop reference234 } 235 if (!detections && inDetections) { 236 detections = psMemIncrRefCounter(inDetections); 237 } 238 if (!detections && refDetections) { 239 detections = psMemIncrRefCounter(refDetections); 240 } 241 242 psMetadataAddPtr(inConv->analysis, PS_LIST_TAIL, "PSPHOT.DETECTIONS", PS_META_REPLACE | PS_DATA_UNKNOWN, "Merged source list", detections); 243 psMetadataAddPtr(refConv->analysis, PS_LIST_TAIL, "PSPHOT.DETECTIONS", PS_META_REPLACE | PS_DATA_UNKNOWN, "Merged source list", detections); 244 psFree(detections); // Drop reference 230 245 231 246 int footprint = psMetadataLookupS32(NULL, recipe, "STAMP.FOOTPRINT"); // Stamp half-size … … 326 341 } else { 327 342 success = pmSubtractionMatch(inConv, refConv, inRO, refRO, footprint, stride, regionSize, 328 spacing, threshold, sources, data->stamps, type, size, order,343 spacing, threshold, detections->allSources, data->stamps, type, size, order, 329 344 widths, orders, inner, ringsOrder, binning, penalty, optimum, 330 345 optWidths, optOrder, optThresh, iter, rej, normFrac, -
branches/eam_branches/20091201/ppSub/src/ppSubReadoutPhotometry.c
r26649 r26784 58 58 } 59 59 60 // drop references to PSPHOT. SOURCES on both of these (why is this needed for both??)60 // drop references to PSPHOT.DETECTIONS on both of these (why is this needed for both??) 61 61 pmReadout *photRO = pmFPAviewThisReadout(view, photFile->fpa); // Readout to photometer 62 if (psMetadataLookup(photRO->analysis, "PSPHOT. SOURCES")) {63 psMetadataRemoveKey(photRO->analysis, "PSPHOT. SOURCES");62 if (psMetadataLookup(photRO->analysis, "PSPHOT.DETECTIONS")) { 63 psMetadataRemoveKey(photRO->analysis, "PSPHOT.DETECTIONS"); 64 64 } 65 65 pmReadout *inRO = pmFPAfileThisReadout(config->files, view, name); // Readout with image and sources 66 if (psMetadataLookup(inRO->analysis, "PSPHOT. SOURCES")) {67 psMetadataRemoveKey(inRO->analysis, "PSPHOT. SOURCES");66 if (psMetadataLookup(inRO->analysis, "PSPHOT.DETECTIONS")) { 67 psMetadataRemoveKey(inRO->analysis, "PSPHOT.DETECTIONS"); 68 68 } 69 69 … … 90 90 91 91 // If no sources were found, there's no error, but we want to trigger 'bad quality' 92 p sArray *sources = psMetadataLookupPtr(NULL, photRO->analysis, "PSPHOT.SOURCES"); // Sources93 if (! sources) {92 pmDetections *detections = psMetadataLookupPtr(NULL, photRO->analysis, "PSPHOT.DETECTIONS"); // Sources 93 if (!detections) { 94 94 ppSubDataQuality(data, PSPHOT_ERR_DATA, PPSUB_FILES_PHOT_SUB | PPSUB_FILES_PHOT_INV); 95 95 } 96 psArray *sources = detections->allSources; 97 psAssert (sources, "missing sources?"); 96 98 97 99 if (data->stats) { … … 108 110 109 111 if (!data->quality) { 110 if (!psMetadataCopySingle(inRO->analysis, photRO->analysis, "PSPHOT. SOURCES")) {111 psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to copy PSPHOT. SOURCES");112 if (!psMetadataCopySingle(inRO->analysis, photRO->analysis, "PSPHOT.DETECTIONS")) { 113 psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to copy PSPHOT.DETECTIONS"); 112 114 return false; 113 115 } … … 132 134 { 133 135 pmReadout *photRO = pmFPAviewThisReadout(view, photFile->fpa); // Readout with the sources 134 psArray *sources = psMetadataLookupPtr(NULL, photRO->analysis, "PSPHOT.SOURCES"); // Sources 136 pmDetections *detections = psMetadataLookupPtr(NULL, photRO->analysis, "PSPHOT.DETECTIONS"); // Sources 137 psArray *sources = detections->allSources; 135 138 FILE *sourceFile = fopen("sources.dat", "w"); // File for sources 136 139 fprintf(sourceFile,
Note:
See TracChangeset
for help on using the changeset viewer.
