Changeset 26076 for trunk/ppStack/src/ppStackThread.c
- Timestamp:
- Nov 9, 2009, 2:53:12 PM (17 years ago)
- Location:
- trunk/ppStack
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
src/ppStackThread.c (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppStack
-
Property svn:mergeinfo
set to (toggle deleted branches)
/branches/czw_branch/cleanup/ppStack merged eligible /branches/eam_branches/20090522/ppStack merged eligible /branches/eam_branches/20090715/ppStack merged eligible /branches/eam_branches/20090820/ppStack merged eligible /branches/pap/ppStack merged eligible /branches/pap_mops/ppStack 25137-25255
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
trunk/ppStack/src/ppStackThread.c
r24796 r26076 56 56 } 57 57 58 ppStackThreadData *ppStackThreadDataSetup(const ppStackOptions *options, const pmConfig *config )58 ppStackThreadData *ppStackThreadDataSetup(const ppStackOptions *options, const pmConfig *config, bool conv) 59 59 { 60 60 psAssert(options, "Require options"); … … 62 62 63 63 const psArray *cells = options->cells; // Array of input cells 64 const psArray *imageNames = options->imageNames; // Names of images to read65 const psArray *maskNames = options->maskNames; // Names of masks to read66 const psArray *varianceNames = options->varianceNames; // Names of variance maps to read67 const psArray *covariances = options->covariances; // Covariance matrices (already read)64 const psArray *imageNames = conv ? options->convImages : options->origImages; // Names of images to read 65 const psArray *maskNames = conv ? options->convMasks : options->origMasks; // Names of masks to read 66 const psArray *varianceNames = conv ? options->convVariances : options->origVariances; // Variance names 67 const psArray *covariances = conv ? options->convCovars : options->origCovars; // Covariance matrices 68 68 69 69 PS_ASSERT_ARRAY_NON_NULL(cells, NULL); 70 PS_ASSERT_ARRAYS_SIZE_EQUAL(cells, imageNames, NULL); 71 PS_ASSERT_ARRAYS_SIZE_EQUAL(cells, maskNames, NULL); 72 PS_ASSERT_ARRAYS_SIZE_EQUAL(cells, varianceNames, NULL); 73 PS_ASSERT_ARRAYS_SIZE_EQUAL(cells, covariances, NULL); 70 if (imageNames) { 71 PS_ASSERT_ARRAYS_SIZE_EQUAL(cells, imageNames, NULL); 72 } 73 if (maskNames) { 74 PS_ASSERT_ARRAYS_SIZE_EQUAL(cells, maskNames, NULL); 75 } 76 if (varianceNames) { 77 PS_ASSERT_ARRAYS_SIZE_EQUAL(cells, varianceNames, NULL); 78 } 79 if (covariances) { 80 PS_ASSERT_ARRAYS_SIZE_EQUAL(cells, covariances, NULL); 81 } 74 82 75 83 ppStackThreadData *stack = psAlloc(sizeof(ppStackThreadData)); // Thread data, to return … … 87 95 continue; 88 96 } 89 // Resolved names 90 psString imageResolved = pmConfigConvertFilename(imageNames->data[i], config, false, false); 91 psString maskResolved = pmConfigConvertFilename(maskNames->data[i], config, false, false); 92 psString varianceResolved = pmConfigConvertFilename(varianceNames->data[i], config, false, false); 93 stack->imageFits->data[i] = psFitsOpen(imageResolved, "r"); 94 stack->maskFits->data[i] = psFitsOpen(maskResolved, "r"); 95 stack->varianceFits->data[i] = psFitsOpen(varianceResolved, "r"); 96 psFree(imageResolved); 97 psFree(maskResolved); 98 psFree(varianceResolved); 99 if (!stack->imageFits->data[i] || !stack->maskFits->data[i] || !stack->varianceFits->data[i]) { 100 psError(PS_ERR_UNKNOWN, false, "Unable to open convolved files %s, %s, %s", 101 (char*)imageNames->data[i], (char*)maskNames->data[i], (char*)varianceNames->data[i]); 102 return NULL; 103 } 97 98 // Open an image 99 #define IMAGE_OPEN(NAMES, FITS, INDEX) \ 100 if (NAMES) { \ 101 psString resolved = pmConfigConvertFilename((NAMES)->data[INDEX], config, false, false); \ 102 (FITS)->data[INDEX] = psFitsOpen(resolved, "r"); \ 103 if (!(FITS)->data[INDEX]) { \ 104 psError(PS_ERR_IO, false, "Unable to open file %s", (char*)(NAMES)->data[INDEX]); \ 105 psFree(resolved); \ 106 return NULL; \ 107 } \ 108 psFree(resolved); \ 109 } 110 111 IMAGE_OPEN(imageNames, stack->imageFits, i); 112 IMAGE_OPEN(maskNames, stack->maskFits, i); 113 IMAGE_OPEN(varianceNames, stack->varianceFits, i); 104 114 } 105 115 … … 116 126 } 117 127 pmReadout *ro = pmReadoutAlloc(cell); // Readout for thread 118 ro->covariance = psMemIncrRefCounter(covariances->data[j]); 128 if (covariances) { 129 ro->covariance = psMemIncrRefCounter(covariances->data[j]); 130 } 119 131 readouts->data[j] = ro; 120 132 } … … 186 198 psFits *varianceFits = stack->varianceFits->data[i]; // FITS file for variance 187 199 188 189 int zMax = 0; 200 int zMax = 0; 190 201 bool keepReading = false; 191 if (pmReadoutMore(ro, imageFits, 0, &zMax, rows, config)) { 202 203 if (imageFits && pmReadoutMore(ro, imageFits, 0, &zMax, rows, config)) { 192 204 keepReading = true; 193 205 if (!pmReadoutReadChunk(ro, imageFits, 0, NULL, rows, overlap, config)) { … … 199 211 } 200 212 201 if ( pmReadoutMoreMask(ro, maskFits, 0, &zMax, rows, config)) {213 if (maskFits && pmReadoutMoreMask(ro, maskFits, 0, &zMax, rows, config)) { 202 214 keepReading = true; 203 215 if (!pmReadoutReadChunkMask(ro, maskFits, 0, NULL, rows, overlap, config)) { … … 209 221 } 210 222 211 if ( pmReadoutMoreVariance(ro, varianceFits, 0, &zMax, rows, config)) {223 if (varianceFits && pmReadoutMoreVariance(ro, varianceFits, 0, &zMax, rows, config)) { 212 224 keepReading = true; 213 225 if (!pmReadoutReadChunkVariance(ro, varianceFits, 0, NULL, rows, overlap, config)) { … … 263 275 264 276 { 265 psThreadTask *task = psThreadTaskAlloc("PPSTACK_INSPECT", 2);277 psThreadTask *task = psThreadTaskAlloc("PPSTACK_INSPECT", 3); 266 278 task->function = &ppStackInspect; 267 279 psThreadTaskAdd(task); … … 270 282 271 283 { 272 psThreadTask *task = psThreadTaskAlloc("PPSTACK_FINAL_COMBINE", 3);284 psThreadTask *task = psThreadTaskAlloc("PPSTACK_FINAL_COMBINE", 6); 273 285 task->function = &ppStackReadoutFinalThread; 274 286 psThreadTaskAdd(task);
Note:
See TracChangeset
for help on using the changeset viewer.
