- Timestamp:
- May 26, 2009, 1:59:32 PM (17 years ago)
- Location:
- branches/cnb_branches/cnb_branch_20090301
- Files:
-
- 4 edited
-
. (modified) (1 prop)
-
ppStack (modified) (1 prop)
-
ppStack/src (modified) (1 prop)
-
ppStack/src/ppStackSetup.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/cnb_branches/cnb_branch_20090301
- Property svn:mergeinfo changed
-
branches/cnb_branches/cnb_branch_20090301/ppStack
- Property svn:mergeinfo changed
/branches/pap/ppStack (added) merged: 23580,23597-23598,23648 /trunk/ppStack merged: 23601-23602,23688,23740,23753,23767-23769,23781,23790,23801,23808,23841,23958,23977,24174,24215-24216
- Property svn:mergeinfo changed
-
branches/cnb_branches/cnb_branch_20090301/ppStack/src
- Property svn:ignore
-
old new 9 9 config.h.in 10 10 stamp-h1 11 ppStackVersionDefinitions.h
-
- Property svn:ignore
-
branches/cnb_branches/cnb_branch_20090301/ppStack/src/ppStackSetup.c
r23594 r24244 13 13 #define BUFFER 16 // Buffer for name array 14 14 15 // Generate an array of input filenames16 static psArray *stackNameArray(const ppStackOptions *options, // Stack options17 pmConfig *config, // Configuration18 const char *name // Name of file19 )20 {21 psAssert(config, "Require configuration");22 psAssert(config, "Require file name");23 24 psArray *array = psArrayAllocEmpty(options->num); // Array with filenames25 pmFPAview *view = pmFPAviewAlloc(0);// View to readout26 view->chip = view->cell = view->readout = -1;27 28 for (int i = 0; i < options->num; i++) {29 pmFPAfile *file = pmFPAfileSelectSingle(config->files, name, i); // File of interest30 31 psString filename = pmFPAfileName(file, view, config); // Filename of interest32 psAssert(filename, "Can't determine filename");33 psArrayAdd(array, array->n, filename);34 psFree(filename); // Drop reference35 }36 37 return array;38 }39 40 15 41 16 bool ppStackSetup(ppStackOptions *options, pmConfig *config) … … 47 22 psAssert(recipe, "We've thrown an error on this before."); 48 23 49 options->convolve = psMetadataLookupBool(NULL, config->arguments, "CONVOLVE"); // Convolve images?24 options->convolve = psMetadataLookupBool(NULL, recipe, "CONVOLVE"); // Convolve images? 50 25 if (!psMetadataLookupBool(NULL, config->arguments, "HAVE.PSF")) { 51 26 psWarning("No PSFs provided --- unable to convolve to common PSF."); … … 68 43 psFree(resolved); 69 44 options->stats = psMetadataAlloc(); 45 psMetadataAddS32(options->stats, PS_LIST_TAIL, "QUALITY", 0, "No problems", 0); 70 46 } 71 47 72 48 // Generate temporary names for convolved images 73 if (options->convolve) { 74 const char *tempDir = psMetadataLookupStr(NULL, recipe, "TEMP.DIR"); // Directory for temporary images 75 if (!tempDir) { 76 psError(PS_ERR_BAD_PARAMETER_VALUE, false, "Unable to find TEMP.DIR in recipe"); 77 return false; 78 } 49 const char *tempDir = psMetadataLookupStr(NULL, recipe, "TEMP.DIR"); // Directory for temporary images 50 if (!tempDir) { 51 psError(PS_ERR_BAD_PARAMETER_VALUE, false, "Unable to find TEMP.DIR in recipe"); 52 return false; 53 } 79 54 80 psString outputName = psStringCopy(psMetadataLookupStr(NULL, config->arguments,81 "OUTPUT")); // Name for temporary files82 const char *tempName = basename(outputName);83 if (!tempName) {84 psError(PS_ERR_BAD_PARAMETER_VALUE, false, "Unable to construct basename for temporary files.");85 psFree(outputName);86 return false;87 }55 psString outputName = psStringCopy(psMetadataLookupStr(NULL, config->arguments, 56 "OUTPUT")); // Name for temporary files 57 const char *tempName = basename(outputName); 58 if (!tempName) { 59 psError(PS_ERR_BAD_PARAMETER_VALUE, false, "Unable to construct basename for temporary files."); 60 psFree(outputName); 61 return false; 62 } 88 63 89 const char *tempImage = psMetadataLookupStr(NULL, recipe, "TEMP.IMAGE"); // Suffix for images90 const char *tempMask = psMetadataLookupStr(NULL, recipe, "TEMP.MASK"); // Suffix for masks91 const char *tempVariance = psMetadataLookupStr(NULL, recipe, "TEMP.VARIANCE"); // Suffix for var maps92 if (!tempImage || !tempMask || !tempVariance) {93 psError(PS_ERR_BAD_PARAMETER_VALUE, false,94 "Unable to find TEMP.IMAGE, TEMP.MASK and TEMP.VARIANCE in recipe");95 psFree(outputName);96 return false;97 }64 const char *tempImage = psMetadataLookupStr(NULL, recipe, "TEMP.IMAGE"); // Suffix for images 65 const char *tempMask = psMetadataLookupStr(NULL, recipe, "TEMP.MASK"); // Suffix for masks 66 const char *tempVariance = psMetadataLookupStr(NULL, recipe, "TEMP.VARIANCE"); // Suffix for var maps 67 if (!tempImage || !tempMask || !tempVariance) { 68 psError(PS_ERR_BAD_PARAMETER_VALUE, false, 69 "Unable to find TEMP.IMAGE, TEMP.MASK and TEMP.VARIANCE in recipe"); 70 psFree(outputName); 71 return false; 72 } 98 73 99 options->imageNames = psArrayAlloc(num); 100 options->maskNames = psArrayAlloc(num); 101 options->varianceNames = psArrayAlloc(num); 102 for (int i = 0; i < num; i++) { 103 psString imageName = NULL, maskName = NULL, varianceName = NULL; // Names for convolved images 104 psStringAppend(&imageName, "%s/%s.%d.%s", tempDir, tempName, i, tempImage); 105 psStringAppend(&maskName, "%s/%s.%d.%s", tempDir, tempName, i, tempMask); 106 psStringAppend(&varianceName, "%s/%s.%d.%s", tempDir, tempName, i, tempVariance); 107 psTrace("ppStack", 5, "Temporary files: %s %s %s\n", imageName, maskName, varianceName); 108 options->imageNames->data[i] = imageName; 109 options->maskNames->data[i] = maskName; 110 options->varianceNames->data[i] = varianceName; 111 } 112 psFree(outputName); 113 } else { 114 options->imageNames = stackNameArray(options, config, "PPSTACK.INPUT"); 115 options->maskNames = stackNameArray(options, config, "PPSTACK.INPUT.MASK"); 116 options->varianceNames = stackNameArray(options, config, "PPSTACK.INPUT.VARIANCE"); 74 options->imageNames = psArrayAlloc(num); 75 options->maskNames = psArrayAlloc(num); 76 options->varianceNames = psArrayAlloc(num); 77 for (int i = 0; i < num; i++) { 78 psString imageName = NULL, maskName = NULL, varianceName = NULL; // Names for convolved images 79 psStringAppend(&imageName, "%s/%s.%d.%s", tempDir, tempName, i, tempImage); 80 psStringAppend(&maskName, "%s/%s.%d.%s", tempDir, tempName, i, tempMask); 81 psStringAppend(&varianceName, "%s/%s.%d.%s", tempDir, tempName, i, tempVariance); 82 psTrace("ppStack", 5, "Temporary files: %s %s %s\n", imageName, maskName, varianceName); 83 options->imageNames->data[i] = imageName; 84 options->maskNames->data[i] = maskName; 85 options->varianceNames->data[i] = varianceName; 117 86 } 87 psFree(outputName); 118 88 119 89 if (!pmConfigMaskSetBits(NULL, NULL, config)) {
Note:
See TracChangeset
for help on using the changeset viewer.
