Changeset 19123
- Timestamp:
- Aug 18, 2008, 2:53:41 PM (18 years ago)
- Location:
- trunk/ppStack/src
- Files:
-
- 2 edited
-
ppStackArguments.c (modified) (2 diffs)
-
ppStackMatch.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppStack/src/ppStackArguments.c
r19045 r19123 175 175 psMetadataAddBool(arguments, PS_LIST_TAIL, "-temp-delete", 0, 176 176 "Delete temporary files on completion?", false); 177 psMetadataAddS32(arguments, PS_LIST_TAIL, "-threads", 0, "Number of threads to use", 0); 177 178 178 179 if (argc == 1 || !psArgumentParse(arguments, &argc, argv) || argc != 3) { … … 194 195 195 196 valueArgStr(arguments, "-stats", "STATS", arguments); 197 198 int numThreads = psMetadataLookupS32(NULL, arguments, "-threads"); // Number of threads 199 if (numThreads > 0 && !psThreadPoolInit(numThreads)) { 200 psError(PS_ERR_UNKNOWN, false, "Unable to setup %d threads", numThreads); 201 return false; 202 } 196 203 197 204 return true; -
trunk/ppStack/src/ppStackMatch.c
r18918 r19123 43 43 int renormWidth = psMetadataLookupS32(&mdok, recipe, "RENORM.WIDTH"); // Width for renormalisation box 44 44 float penalty = psMetadataLookupF32(NULL, ppsub, "PENALTY"); // Penalty for wideness 45 int threads = psMetadataLookupS32(NULL, config->arguments, "-threads"); // Number of threads 45 46 46 47 if (!pmReadoutMaskNonfinite(readout, maskIn)) { … … 83 84 } 84 85 86 float minFlux = INFINITY; // Minimum flux for fake image 87 { 88 psStats *bg = psStatsAlloc(PS_STAT_ROBUST_MEDIAN | PS_STAT_ROBUST_STDEV); // Statistics for bg 89 if (!psImageBackground(bg, NULL, readout->image, readout->mask, maskIn, rng)) { 90 psWarning("Can't measure background for image."); 91 psErrorClear(); 92 } else { 93 minFlux = bg->robustStdev; 94 } 95 psFree(bg); 96 } 97 85 98 // Generate a fake image to match to 86 float maxMag = -INFINITY; // Maximum magnitude of sources 87 for (int i = 0; i < sources->n; i++) { 88 pmSource *source = sources->data[i]; // Source of interest 89 if (source->psfMag > maxMag && source->psfMag <= MAG_IGNORE && !(source->mode & SOURCE_MASK)) { 90 maxMag = source->psfMag; 99 if (!isfinite(minFlux)) { 100 float maxMag = -INFINITY; // Maximum magnitude of sources 101 for (int i = 0; i < sources->n; i++) { 102 pmSource *source = sources->data[i]; // Source of interest 103 if (source->psfMag > maxMag && source->psfMag <= MAG_IGNORE && 104 !(source->mode & SOURCE_MASK)) { 105 maxMag = source->psfMag; 106 } 91 107 } 108 minFlux = 0.1 * powf(10.0, -0.4 * maxMag); 92 109 } 93 110 … … 95 112 96 113 if (!pmReadoutFakeFromSources(fake, readout->image->numCols, readout->image->numRows, sources, NULL, 97 NULL, psf, powf(10.0, -0.4 * maxMag), 0, false)) {114 NULL, psf, minFlux, 0, false)) { 98 115 psError(PS_ERR_UNKNOWN, false, "Unable to generate fake image with target PSF."); 99 116 psFree(fake); … … 110 127 } 111 128 #endif 129 130 if (threads > 0) { 131 pmSubtractionThreadsInit(output, NULL, readout, fake); 132 } 112 133 113 134 // Do the image matching … … 124 145 psFree(fake); 125 146 psFree(optWidths); 147 148 if (threads > 0) { 149 pmSubtractionThreadsFinalize(output, NULL, readout, fake); 150 } 126 151 127 152 // Set the variance factor
Note:
See TracChangeset
for help on using the changeset viewer.
