Changeset 32677
- Timestamp:
- Nov 16, 2011, 11:00:18 AM (14 years ago)
- Location:
- tags/ipp-20111110/ppSub/src
- Files:
-
- 3 edited
-
ppSubLoop.c (modified) (10 diffs, 1 prop)
-
ppSubMakePSF.c (modified) (1 diff, 1 prop)
-
ppSubMatchPSFs.c (modified) (3 diffs, 1 prop)
Legend:
- Unmodified
- Added
- Removed
-
tags/ipp-20111110/ppSub/src/ppSubLoop.c
- Property svn:mergeinfo set to
r31435 r32677 23 23 bool dumpout(pmConfig *config, char *name) 24 24 { 25 pmFPAview *view = ppSubViewReadout(); // View to readout26 pmReadout *out = pmFPAfileThisReadout(config->files, view, "PPSUB.OUTPUT");27 psphotSaveImage (NULL, out->image, name);28 psFree(view);29 return true;25 pmFPAview *view = ppSubViewReadout(); // View to readout 26 pmReadout *out = pmFPAfileThisReadout(config->files, view, "PPSUB.OUTPUT"); 27 psphotSaveImage (NULL, out->image, name); 28 psFree(view); 29 return true; 30 30 } 31 31 … … 33 33 bool ppSubLoop(ppSubData *data) 34 34 { 35 bool mdok = false; 36 bool success = true; 37 35 38 psAssert(data, "Require processing data"); 36 39 pmConfig *config = data->config; // Configuration 37 40 psAssert(config, "Require configuration."); 38 41 39 bool success = true; 42 psMetadata *recipe = psMetadataLookupMetadata(NULL, config->recipes, PPSUB_RECIPE); // Recipe for ppSim 43 psAssert(recipe, "We checked this earlier, so it should be here."); 44 bool noConvolve = psMetadataLookupBool(&mdok, recipe, "NOCONVOLVE"); // Do not use convolved images. 40 45 41 46 pmConfigCamerasCull(config, NULL); 42 47 pmConfigRecipesCull(config, "PPSUB,PPSTATS,PSPHOT,PSASTRO,MASKS,JPEG"); 43 44 48 45 49 pmFPAfile *input = psMetadataLookupPtr(NULL, config->files, "PPSUB.INPUT"); … … 75 79 if (data->forcedPhot2) { 76 80 // Change the recipe to use a higher nsigma limit and quit after pass1 77 psMetadata *recipe = psMetadataLookupPtr (NULL, config->recipes, PSPHOT_RECIPE); 78 79 psF32 nsigma_peak_save = psMetadataLookupF32 (NULL, recipe, "PEAKS_NSIGMA_LIMIT"); 80 char *breakPt_save = psMetadataLookupStr (NULL, recipe, "BREAK_POINT"); 81 82 bool mdok; 83 psF32 pos2_nsigma_peak = psMetadataLookupF32 (&mdok, recipe, "PEAKS_POS2_NSIGMA_LIMIT"); 81 psMetadata *psphotRecipe = psMetadataLookupPtr (NULL, config->recipes, PSPHOT_RECIPE); 82 83 psF32 nsigma_peak_save = psMetadataLookupF32 (NULL, psphotRecipe, "PEAKS_NSIGMA_LIMIT"); 84 char *breakPt_save = psMetadataLookupStr (NULL, psphotRecipe, "BREAK_POINT"); 85 86 psF32 pos2_nsigma_peak = psMetadataLookupF32 (&mdok, psphotRecipe, "PEAKS_POS2_NSIGMA_LIMIT"); 84 87 if (!mdok) { 85 psWarning("PEAKS_POS2_NSIGMA_LIMIT not found in recipe. Will use 25.\n");88 psWarning("PEAKS_POS2_NSIGMA_LIMIT not found in psphotRecipe. Will use 25.\n"); 86 89 pos2_nsigma_peak = 25.; 87 90 } 88 psMetadataAddF32( recipe, PS_LIST_TAIL, "PEAKS_NSIGMA_LIMIT", PS_META_REPLACE, "", pos2_nsigma_peak);89 psMetadataAddStr( recipe, PS_LIST_TAIL, "BREAK_POINT", PS_META_REPLACE, "", "PASS1");91 psMetadataAddF32(psphotRecipe, PS_LIST_TAIL, "PEAKS_NSIGMA_LIMIT", PS_META_REPLACE, "", pos2_nsigma_peak); 92 psMetadataAddStr(psphotRecipe, PS_LIST_TAIL, "BREAK_POINT", PS_META_REPLACE, "", "PASS1"); 90 93 91 94 bool foundDetections = false; 92 95 if (!ppSubInputDetections(&foundDetections, "PPSUB.POS2.SOURCES", "PPSUB.REF", data)) { 93 96 psError(psErrorCodeLast(), false, "Unable to measure positive detections (2)"); 94 psMetadataAddF32( recipe, PS_LIST_TAIL, "PEAKS_NSIGMA_LIMIT", PS_META_REPLACE, "", nsigma_peak_save);95 psMetadataAddStr( recipe, PS_LIST_TAIL, "BREAK_POINT", PS_META_REPLACE, "", breakPt_save);96 success = false; 97 goto ESCAPE; 98 } 99 psMetadataAddF32( recipe, PS_LIST_TAIL, "PEAKS_NSIGMA_LIMIT", PS_META_REPLACE, "", nsigma_peak_save);100 psMetadataAddStr( recipe, PS_LIST_TAIL, "BREAK_POINT", PS_META_REPLACE, "", breakPt_save);97 psMetadataAddF32(psphotRecipe, PS_LIST_TAIL, "PEAKS_NSIGMA_LIMIT", PS_META_REPLACE, "", nsigma_peak_save); 98 psMetadataAddStr(psphotRecipe, PS_LIST_TAIL, "BREAK_POINT", PS_META_REPLACE, "", breakPt_save); 99 success = false; 100 goto ESCAPE; 101 } 102 psMetadataAddF32(psphotRecipe, PS_LIST_TAIL, "PEAKS_NSIGMA_LIMIT", PS_META_REPLACE, "", nsigma_peak_save); 103 psMetadataAddStr(psphotRecipe, PS_LIST_TAIL, "BREAK_POINT", PS_META_REPLACE, "", breakPt_save); 101 104 // if nothing was found, don't bother doing the forced photometry below 102 105 if (!foundDetections) { … … 107 110 108 111 // XXX if it exists, use the POS1, POS2 successs for the FWHMs 109 psMetadata *recipe = psMetadataLookupPtr(NULL, config->recipes, PPSUB_RECIPE); 110 bool noConvolve = psMetadataLookupBool(NULL, recipe, "NOCONVOLVE"); // Do not use convolved images. 111 if (noConvolve) { 112 psWarning("not matching PSFs because NOCONVOLVE is TRUE\n"); 113 } else { 114 if (!ppSubMatchPSFs(data)) { 115 psError(psErrorCodeLast(), false, "Unable to match PSFs."); 116 success = false; 117 goto ESCAPE; 118 } 119 } 120 112 if (!ppSubMatchPSFs(data)) { 113 psError(psErrorCodeLast(), false, "Unable to match PSFs."); 114 success = false; 115 goto ESCAPE; 116 } 121 117 122 118 if (data->quality) { … … 138 134 psTimerClear("PPSUB_MATCH")); 139 135 140 // Close input files 136 // Close input files (freeing up space) : for the noConvolve case, we cannot close the 137 // inputs since we will use them for subtraction below. wait until later to do the work 141 138 if (!noConvolve) { 142 if (!ppSubFilesIterateUp(config, PPSUB_FILES_INPUT)) {143 psError(PPSUB_ERR_IO, false, "Unable to close input files.");144 success = false;145 goto ESCAPE;146 }139 if (!ppSubFilesIterateUp(config, PPSUB_FILES_INPUT)) { 140 psError(PPSUB_ERR_IO, false, "Unable to close input files."); 141 success = false; 142 goto ESCAPE; 143 } 147 144 } 148 145 if (!ppSubLowThreshold(data)) { … … 165 162 } 166 163 167 if (!noConvolve) {168 164 if (!data->quality && !ppSubMakePSF(data)) { 169 165 psError(psErrorCodeLast(), false, "Unable to generate PSF."); … … 171 167 goto ESCAPE; 172 168 } 173 } 169 174 170 // Now we've got a PSF, blow away detections in case they're confused with real output detections 175 171 { … … 197 193 // dumpout(config, "diff.2a.fits"); 198 194 if (noConvolve) { 199 if (!ppSubFilesIterateUp(config, PPSUB_FILES_INPUT)) {200 psError(PPSUB_ERR_IO, false, "Unable to close input files.");201 success = false;202 goto ESCAPE;203 }195 if (!ppSubFilesIterateUp(config, PPSUB_FILES_INPUT)) { 196 psError(PPSUB_ERR_IO, false, "Unable to close input files."); 197 success = false; 198 goto ESCAPE; 199 } 204 200 } 205 201 … … 271 267 // Do Mask Stats 272 268 { 273 pmFPAview *view = ppSubViewReadout(); // View to readout274 if (!ppSubMaskStats(config, view,data->stats)) {275 psError(psErrorCodeLast(), false, "Unable to generate mask statistics");276 success = false;277 psFree(view);278 goto ESCAPE;279 }280 psFree(view);269 pmFPAview *view = ppSubViewReadout(); // View to readout 270 if (!ppSubMaskStats(config, view,data->stats)) { 271 psError(psErrorCodeLast(), false, "Unable to generate mask statistics"); 272 success = false; 273 psFree(view); 274 goto ESCAPE; 275 } 276 psFree(view); 281 277 } 282 278 // dumpout(config, "diff.4.fits"); … … 344 340 } 345 341 346 ESCAPE:342 ESCAPE: 347 343 pmFPAfileDropInternal(config->files, "PSPHOT.BACKGND"); 348 344 pmFPAfileDropInternal(config->files, "PSPHOT.BACKMDL"); -
tags/ipp-20111110/ppSub/src/ppSubMakePSF.c
- Property svn:mergeinfo set to
r31435 r32677 46 46 bool noConvolve = psMetadataLookupBool(&mdok, recipe, "NOCONVOLVE"); // Do not use convolved images. 47 47 48 if (!noConvolve) { 49 printf("Using Convolved images because NOCONVOLVE is FALSE\n"); 50 if (reverse) { 51 minuend = pmFPAfileThisReadout(config->files, view, "PPSUB.REF.CONV"); 52 minuendFile = psMetadataLookupPtr(&mdok, config->files, "PPSUB.REF.CONV"); 53 } else { 54 minuend = pmFPAfileThisReadout(config->files, view, "PPSUB.INPUT.CONV"); 55 minuendFile = psMetadataLookupPtr(&mdok, config->files, "PPSUB.INPUT.CONV"); 56 } 57 } 58 else { 59 psWarning("Not using Convolved images because NOCONVOLVE is TRUE\n"); 60 if (reverse) { 61 minuend = pmFPAfileThisReadout(config->files, view, "PPSUB.REF"); 62 minuendFile = psMetadataLookupPtr(&mdok, config->files, "PPSUB.REF"); 63 } else { 64 minuend = pmFPAfileThisReadout(config->files, view, "PPSUB.INPUT"); 65 minuendFile = psMetadataLookupPtr(&mdok, config->files, "PPSUB.INPUT"); 66 } 48 if (noConvolve) { 49 // if we do not convolve, we need to copy the detections to the image for analysis 50 pmReadout *psfSourcesRO = NULL; // readout containing loaded sources for psf model 51 psWarning("Not using Convolved images because NOCONVOLVE is TRUE\n"); 52 if (reverse) { 53 minuend = pmFPAfileThisReadout(config->files, view, "PPSUB.REF"); 54 minuendFile = psMetadataLookupPtr(&mdok, config->files, "PPSUB.REF"); 55 psfSourcesRO = pmFPAfileThisReadout(config->files, view, "PPSUB.REF.SOURCES"); 56 } else { 57 minuend = pmFPAfileThisReadout(config->files, view, "PPSUB.INPUT"); 58 minuendFile = psMetadataLookupPtr(&mdok, config->files, "PPSUB.INPUT"); 59 psfSourcesRO = pmFPAfileThisReadout(config->files, view, "PPSUB.INPUT.SOURCES"); 60 } 61 psAssert (psfSourcesRO, "missing readout with sources"); 62 pmDetections *psfDetections = psMetadataLookupPtr(&mdok, psfSourcesRO->analysis, "PSPHOT.DETECTIONS"); 63 psMetadataAddPtr(minuend->analysis, PS_LIST_TAIL, "PSPHOT.DETECTIONS", PS_META_REPLACE | PS_DATA_UNKNOWN, "Merged source list", psfDetections); 64 } else { 65 printf("Using Convolved images because NOCONVOLVE is FALSE\n"); 66 if (reverse) { 67 minuend = pmFPAfileThisReadout(config->files, view, "PPSUB.REF.CONV"); 68 minuendFile = psMetadataLookupPtr(&mdok, config->files, "PPSUB.REF.CONV"); 69 } else { 70 minuend = pmFPAfileThisReadout(config->files, view, "PPSUB.INPUT.CONV"); 71 minuendFile = psMetadataLookupPtr(&mdok, config->files, "PPSUB.INPUT.CONV"); 72 } 67 73 } 68 74 -
tags/ipp-20111110/ppSub/src/ppSubMatchPSFs.c
- Property svn:mergeinfo set to
r31672 r32677 201 201 bool ppSubMatchPSFs(ppSubData *data) 202 202 { 203 bool mdok = false; 204 203 205 psAssert(data, "Require processing data"); 204 206 pmConfig *config = data->config; // Configuration … … 208 210 psMetadata *recipe = psMetadataLookupMetadata(NULL, config->recipes, PPSUB_RECIPE); // Recipe for ppSim 209 211 psAssert(recipe, "We checked this earlier, so it should be here."); 212 213 bool noConvolve = psMetadataLookupBool(&mdok, recipe, "NOCONVOLVE"); // Do not use convolved images. 214 if (noConvolve) { 215 psWarning("not matching PSFs because NOCONVOLVE is TRUE\n"); 216 return true; 217 } 210 218 211 219 pmFPAview *view = ppSubViewReadout(); // View to readout … … 228 236 psFree(refConv); 229 237 } 230 231 bool mdok; // Status of MD lookup232 238 233 239 // Load pre-calculated kernel, if available
Note:
See TracChangeset
for help on using the changeset viewer.
