Changeset 28304 for branches/czw_branch/20100519/psphot/src
- Timestamp:
- Jun 10, 2010, 6:28:51 PM (16 years ago)
- Location:
- branches/czw_branch/20100519
- Files:
-
- 4 edited
-
. (modified) (1 prop)
-
psphot/src/psphotReadout.c (modified) (18 diffs)
-
psphot/src/psphotStackOptions.c (modified) (2 diffs)
-
psphot/src/psphotVisual.c (modified) (19 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/czw_branch/20100519
- Property svn:mergeinfo changed
-
branches/czw_branch/20100519/psphot/src/psphotReadout.c
r28013 r28304 14 14 // by the multiple threads, not the total time used by all threads. 15 15 psTimerStart ("psphotReadout"); 16 16 printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast())); 17 17 pmModelClassSetLimits(PM_MODEL_LIMITS_LAX); 18 18 … … 26 26 char *breakPt = psMetadataLookupStr (NULL, recipe, "BREAK_POINT"); 27 27 psAssert (breakPt, "configuration error: set BREAK_POINT"); 28 28 printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast())); 29 29 // set the photcode for this image 30 30 if (!psphotAddPhotcode (config, view, "PSPHOT.INPUT")) { … … 32 32 return false; 33 33 } 34 34 printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast())); 35 35 // Generate the mask and weight images, including the user-defined analysis region of interest 36 36 if (!psphotSetMaskAndVariance (config, view, "PSPHOT.INPUT")) { … … 40 40 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT"); 41 41 } 42 42 printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast())); 43 43 // generate a background model (median, smoothed image) 44 44 if (!psphotModelBackground (config, view, "PSPHOT.INPUT")) { 45 45 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT"); 46 46 } 47 printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast())); 47 48 if (!psphotSubtractBackground (config, view, "PSPHOT.INPUT")) { 48 49 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT"); … … 51 52 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT"); 52 53 } 53 54 printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast())); 54 55 // load the psf model, if suppled. FWHM_X,FWHM_Y,etc are determined and saved on 55 56 // readout->analysis XXX this function currently only works with a single PSPHOT.INPUT … … 58 59 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT"); 59 60 } 60 61 printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast())); 61 62 // find the detections (by peak and/or footprint) in the image. 62 63 if (!psphotFindDetections (config, view, "PSPHOT.INPUT", true)) { // pass 1 … … 65 66 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT"); 66 67 } 67 68 printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast())); 68 69 // construct sources and measure basic stats (saved on detections->newSources) 69 70 if (!psphotSourceStats (config, view, "PSPHOT.INPUT", true)) { // pass 1 … … 74 75 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT"); 75 76 } 76 77 printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast())); 77 78 // find blended neighbors of very saturated stars (detections->newSources) 78 79 if (!psphotDeblendSatstars (config, view, "PSPHOT.INPUT")) { … … 80 81 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT"); 81 82 } 82 83 printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast())); 83 84 // mark blended peaks PS_SOURCE_BLEND (detections->newSources) 84 85 if (!psphotBasicDeblend (config, view, "PSPHOT.INPUT")) { … … 86 87 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT"); 87 88 } 88 89 printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast())); 89 90 // classify sources based on moments, brightness. if a PSF model has been loaded, the PSF 90 91 // clump defined for it is used not measured (detections->newSources) … … 93 94 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT"); 94 95 } 96 printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast())); 95 97 // if we were not supplied a PSF model, determine the IQ stats here (detections->newSources) 96 98 if (!psphotImageQuality (config, view, "PSPHOT.INPUT")) { // pass 1 … … 101 103 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT"); 102 104 } 103 105 printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast())); 104 106 // use bright stellar objects to measure PSF if we were supplied a PSF for any input file, 105 107 // this step is skipped … … 115 117 // XXX fix this in the new multi-input context 116 118 // psphotLoadExtSources (config, view, "PSPHOT.INPUT"); // pass 1 117 119 printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast())); 118 120 // construct an initial model for each object, set the radius to fitRadius, set circular 119 121 // fit mask (detections->newSources) 120 122 psphotGuessModels (config, view, "PSPHOT.INPUT"); // pass 1 121 123 printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast())); 122 124 // merge the newly selected sources into the existing list 123 125 // NOTE: merge OLD and NEW 124 126 psphotMergeSources (config, view, "PSPHOT.INPUT"); 125 127 printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast())); 126 128 // linear PSF fit to source peaks, subtract the models from the image (in PSF mask) 127 129 psphotFitSourcesLinear (config, view, "PSPHOT.INPUT", false); // pass 1 (detections->allSources) 128 130 printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast())); 129 131 // identify CRs and extended sources (only unmeasured sources are measured) 130 132 psphotSourceSize (config, view, "PSPHOT.INPUT", true); // pass 1 (detections->allSources) … … 132 134 goto finish; 133 135 } 134 136 printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast())); 135 137 // non-linear PSF and EXT fit to brighter sources 136 138 // replace model flux, adjust mask as needed, fit, subtract the models (full stamp) 137 139 psphotBlendFit (config, view, "PSPHOT.INPUT"); // pass 1 (detections->allSources) 138 140 printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast())); 139 141 // replace all sources 140 142 psphotReplaceAllSources (config, view, "PSPHOT.INPUT"); // pass 1 (detections->allSources) 141 143 printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast())); 142 144 // linear fit to include all sources (subtract again) 143 145 // NOTE : apply to ALL sources (extended + psf) 144 146 psphotFitSourcesLinear (config, view, "PSPHOT.INPUT", true); // pass 2 (detections->allSources) 145 147 printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast())); 146 148 // if we only do one pass, skip to extended source analysis 147 149 if (!strcasecmp (breakPt, "PASS1")) goto pass1finish; 148 150 printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast())); 149 151 // NOTE: possibly re-measure background model here with objects subtracted / or masked 150 152 151 153 // add noise for subtracted objects 152 154 psphotAddNoise (config, view, "PSPHOT.INPUT"); // pass 1 (detections->allSources) 153 155 printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast())); 154 156 // find fainter sources 155 157 // NOTE: finds new peaks and new footprints, OLD and FULL set are saved on detections 156 158 psphotFindDetections (config, view, "PSPHOT.INPUT", false); // pass 2 (detections->peaks, detections->footprints) 157 159 printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast())); 158 160 // remove noise for subtracted objects (ie, return to normal noise level) 159 161 // NOTE: this needs to operate only on the OLD sources 160 162 psphotSubNoise (config, view, "PSPHOT.INPUT"); // pass 1 (detections->allSources) 161 163 printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast())); 162 164 // define new sources based on only the new peaks 163 165 // NOTE: new sources are saved on detections->newSources 164 166 psphotSourceStats (config, view, "PSPHOT.INPUT", false); // pass 2 (detections->newSources) 165 167 printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast())); 166 168 // set source type 167 169 // NOTE: apply only to detections->newSources … … 170 172 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT"); 171 173 } 172 174 printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast())); 173 175 // create full input models, set the radius to fitRadius, set circular fit mask 174 176 // NOTE: apply only to detections->newSources 175 177 psphotGuessModels (config, view, "PSPHOT.INPUT"); // pass 2 (detections->newSources) 176 178 printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast())); 177 179 // replace all sources so fit below applies to all at once 178 180 // NOTE: apply only to OLD sources (which have been subtracted) 179 181 psphotReplaceAllSources (config, view, "PSPHOT.INPUT"); // pass 2 180 182 printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast())); 181 183 // merge the newly selected sources into the existing list 182 184 // NOTE: merge OLD and NEW 183 185 // XXX check on free of sources... 184 186 psphotMergeSources (config, view, "PSPHOT.INPUT"); // (detections->newSources + detections->allSources -> detections->allSources) 185 187 printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast())); 186 188 // NOTE: apply to ALL sources 187 189 psphotFitSourcesLinear (config, view, "PSPHOT.INPUT", true); // pass 3 (detections->allSources) 188 190 printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast())); 189 191 pass1finish: 190 192 … … 192 194 // NOTE: applies only to NEW (unmeasured) sources 193 195 psphotSourceSize (config, view, "PSPHOT.INPUT", false); // pass 2 (detections->allSources) 194 196 printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast())); 195 197 psphotExtendedSourceAnalysis (config, view, "PSPHOT.INPUT"); // pass 1 (detections->allSources) 196 198 psphotExtendedSourceFits (config, view, "PSPHOT.INPUT"); // pass 1 (detections->allSources) 197 199 printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast())); 198 200 finish: 199 201 200 202 // plot positive sources 201 203 // psphotSourcePlots (readout, sources, recipe); 202 204 printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast())); 203 205 // measure aperture photometry corrections 204 206 if (!psphotApResid (config, view, "PSPHOT.INPUT")) { // pass 1 (detections->allSources) … … 206 208 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT"); 207 209 } 208 210 printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast())); 209 211 // calculate source magnitudes 210 psphotMagnitudes(config, view, "PSPHOT.INPUT"); // pass 1 (detections->allSources) 211 212 if (!psphotMagnitudes(config, view, "PSPHOT.INPUT")) { // pass 1 (detections->allSources) 213 psErrorStackPrint(stderr, "Unable to do magnitudes."); 214 psErrorClear(); 215 } 212 216 if (!psphotEfficiency(config, view, "PSPHOT.INPUT")) { // pass 1 213 217 psErrorStackPrint(stderr, "Unable to determine detection efficiencies from fake sources"); … … 219 223 220 224 // replace background in residual image 221 psphotSkyReplace (config, view, "PSPHOT.INPUT"); // pass 1 222 225 if (!psphotSkyReplace (config, view, "PSPHOT.INPUT")) { // pass 1 226 psErrorStackPrint(stderr, "Unable to replace sky"); 227 psErrorClear(); 228 229 /* psLogMsg("psphot", 3, "failed on psphotSkyReplace"); */ 230 /* return(psphotReadoutCleanup(config, view, "PSPHOT.INPUT")); */ 231 } 223 232 // drop the references to the image pixels held by each source 224 psphotSourceFreePixels (config, view, "PSPHOT.INPUT"); // pass 1 225 233 if (!psphotSourceFreePixels (config, view, "PSPHOT.INPUT")) { // pass 1 234 psErrorStackPrint(stderr, "Unable to free source pixels"); 235 psErrorClear(); 236 237 /* psLogMsg ("psphot", 3, "failed on psphotSourceFreePixels"); */ 238 /* return(psphotReadoutCleanup(config, view, "PSPHOT.INPUT")); */ 239 } 226 240 // create the exported-metadata and free local data 227 241 return psphotReadoutCleanup(config, view, "PSPHOT.INPUT"); -
branches/czw_branch/20100519/psphot/src/psphotStackOptions.c
r28013 r28304 40 40 options->psfs = psArrayAlloc(num); 41 41 options->sourceLists = psArrayAlloc(num); // Individual lists of sources for matching 42 options->kernels = psArrayAlloc(num); 43 options->regions = psArrayAlloc(num); 42 options->kernels = psArrayAlloc(num); 43 options->regions = psArrayAlloc(num); 44 44 45 45 options->inputMask = psVectorAlloc(num, PS_TYPE_VECTOR_MASK); // Mask for inputs … … 77 77 switch (options->convolveSource) { 78 78 case PSPHOT_CNV_SRC_AUTO: 79 fileSrc = fileCnv ? fileCnv : fileRaw;80 break;79 fileSrc = fileCnv ? fileCnv : fileRaw; 80 break; 81 81 82 82 case PSPHOT_CNV_SRC_RAW: 83 fileSrc = fileRaw;84 break;83 fileSrc = fileRaw; 84 break; 85 85 86 86 case PSPHOT_CNV_SRC_CNV: 87 fileSrc = fileCnv;88 break;87 fileSrc = fileCnv; 88 break; 89 89 90 90 default: 91 psAbort("impossible case");91 psAbort("impossible case"); 92 92 } 93 93 if (!fileSrc) { 94 psError(PSPHOT_ERR_CONFIG, true, "desired convolution source is missing (cnv : %llx, raw : %llx)", (long long) fileCnv, (long long)fileRaw);94 psError(PSPHOT_ERR_CONFIG, true, "desired convolution source is missing (cnv : %p, raw : %p)", fileCnv, fileRaw); 95 95 } 96 96 97 97 return fileSrc; 98 98 } -
branches/czw_branch/20100519/psphot/src/psphotVisual.c
r27819 r28304 15 15 # include <kapa.h> 16 16 17 # define DEBUG 0 18 17 19 bool pmVisualLimitsFromVectors (Graphdata *graphdata, psVector *xVec, psVector *yVec); 18 20 … … 197 199 pmReadout *backgnd; 198 200 199 if (! pmVisualIsVisual()) return true;201 if (!DEBUG && !pmVisualIsVisual()) return true; 200 202 201 203 int kapa = psphotKapaChannel (1); … … 220 222 bool psphotVisualShowSignificance (psImage *image, float min, float max) { 221 223 222 if (! pmVisualIsVisual()) return true;224 if (!DEBUG && !pmVisualIsVisual()) return true; 223 225 224 226 int kapa = psphotKapaChannel (1); … … 236 238 KiiOverlay *overlay; 237 239 238 if (! pmVisualIsVisual()) return true;240 if (!DEBUG && !pmVisualIsVisual()) return true; 239 241 240 242 int kapa = psphotKapaChannel (1); … … 275 277 KiiOverlay *overlay; 276 278 277 if (! pmVisualIsVisual()) return true;279 if (!DEBUG && !pmVisualIsVisual()) return true; 278 280 279 281 int kapa = psphotKapaChannel (1); … … 385 387 psEllipseAxes axes; 386 388 387 if (! pmVisualIsVisual()) return true;389 if (!DEBUG && !pmVisualIsVisual()) return true; 388 390 389 391 int kapa = psphotKapaChannel (1); … … 437 439 KapaSection section; 438 440 439 if (! pmVisualIsVisual()) return true;441 if (!DEBUG && !pmVisualIsVisual()) return true; 440 442 441 443 int myKapa = psphotKapaChannel (2); … … 753 755 bool psphotVisualShowRoughClass (psArray *sources) { 754 756 755 if (! pmVisualIsVisual()) return true;757 if (!DEBUG && !pmVisualIsVisual()) return true; 756 758 757 759 int myKapa = psphotKapaChannel (1); … … 774 776 bool psphotVisualShowPSFModel (pmReadout *readout, pmPSF *psf) { 775 777 776 if (! pmVisualIsVisual()) return true;778 if (!DEBUG && !pmVisualIsVisual()) return true; 777 779 778 780 int myKapa = psphotKapaChannel (3); … … 840 842 bool status; 841 843 842 if (! pmVisualIsVisual()) return true;844 if (!DEBUG && !pmVisualIsVisual()) return true; 843 845 844 846 int myKapa = psphotKapaChannel (3); … … 992 994 bool status; 993 995 994 if (! pmVisualIsVisual()) return true;996 if (!DEBUG && !pmVisualIsVisual()) return true; 995 997 996 998 int myKapa = psphotKapaChannel (3); … … 1356 1358 KapaSection section; // put the positive profile in one and the residuals in another? 1357 1359 1358 if (! pmVisualIsVisual()) return true;1360 if (!DEBUG && !pmVisualIsVisual()) return true; 1359 1361 1360 1362 int myKapa = psphotKapaChannel (2); … … 1427 1429 return true; 1428 1430 1429 if (! pmVisualIsVisual()) return true;1431 if (!DEBUG && !pmVisualIsVisual()) return true; 1430 1432 1431 1433 int myKapa = psphotKapaChannel (1); … … 1568 1570 bool psphotVisualShowSourceSize (pmReadout *readout, psArray *sources) { 1569 1571 1570 if (! pmVisualIsVisual()) return true;1572 if (!DEBUG && !pmVisualIsVisual()) return true; 1571 1573 1572 1574 int myKapa = psphotKapaChannel (1); … … 1595 1597 KapaSection section; 1596 1598 1597 if (! pmVisualIsVisual()) return true;1599 if (!DEBUG && !pmVisualIsVisual()) return true; 1598 1600 1599 1601 int myKapa = psphotKapaChannel (2); … … 2106 2108 bool psphotVisualShowResidualImage (pmReadout *readout) { 2107 2109 2108 if (! pmVisualIsVisual()) return true;2110 if (!DEBUG && !pmVisualIsVisual()) return true; 2109 2111 2110 2112 int myKapa = psphotKapaChannel (1); … … 2122 2124 float lineX[2], lineY[2]; 2123 2125 2124 if (! pmVisualIsVisual()) return true;2126 if (!DEBUG && !pmVisualIsVisual()) return true; 2125 2127 2126 2128 int myKapa = psphotKapaChannel (2); … … 2240 2242 Graphdata graphdata; 2241 2243 2242 if (! pmVisualIsVisual()) return true;2244 if (!DEBUG && !pmVisualIsVisual()) return true; 2243 2245 2244 2246 int myKapa = psphotKapaChannel (2); … … 2324 2326 KiiOverlay *overlay; 2325 2327 2326 if (! pmVisualIsVisual()) return true;2328 if (!DEBUG && !pmVisualIsVisual()) return true; 2327 2329 2328 2330 int kapa = psphotKapaChannel (1);
Note:
See TracChangeset
for help on using the changeset viewer.
