Changeset 21378
- Timestamp:
- Feb 6, 2009, 9:45:30 AM (17 years ago)
- Location:
- trunk/ppArith/src
- Files:
-
- 5 edited
-
ppArith.c (modified) (2 diffs)
-
ppArithArguments.c (modified) (8 diffs)
-
ppArithLoop.c (modified) (7 diffs)
-
ppArithReadout.c (modified) (4 diffs)
-
ppArithVersion.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppArith/src/ppArith.c
r21244 r21378 6 6 * 7 7 * @author IfA 8 * @version $Revision: 1. 5$ $Name: not supported by cvs2svn $9 * @date $Date: 2009-02-0 1 21:40:52$8 * @version $Revision: 1.6 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2009-02-06 19:45:30 $ 10 10 * Copyright 2009 Institute for Astronomy, University of Hawaii 11 11 */ … … 23 23 int main(int argc, char *argv[]) 24 24 { 25 psExit exitValue = PS_EXIT_SUCCESS; // /<Exit value25 psExit exitValue = PS_EXIT_SUCCESS; // Exit value 26 26 psTimerStart("ppArith"); 27 27 psLibInit(NULL); 28 28 29 pmConfig *config = pmConfigRead(&argc, argv, PPARITH_RECIPE); // /<Configuration29 pmConfig *config = pmConfigRead(&argc, argv, PPARITH_RECIPE); // Configuration 30 30 if (!config) { 31 31 psErrorStackPrint(stderr, "Error reading configuration."); -
trunk/ppArith/src/ppArithArguments.c
r21244 r21378 6 6 * 7 7 * @author IfA 8 * @version $Revision: 1. 5$ $Name: not supported by cvs2svn $9 * @date $Date: 2009-02-0 1 21:40:52$8 * @version $Revision: 1.6 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2009-02-06 19:45:30 $ 10 10 * Copyright 2009 Institute for Astronomy, University of Hawaii 11 11 */ … … 25 25 * Print usage information and die 26 26 */ 27 static void usage(const char *program, // /<Name of the program28 psMetadata *arguments, // /<Command-line arguments29 pmConfig *config // /<Configuration27 static void usage(const char *program, // Name of the program 28 psMetadata *arguments, // Command-line arguments 29 pmConfig *config // Configuration 30 30 ) 31 31 { … … 45 45 * Get a string value from the command-line and add it to the target 46 46 */ 47 static bool valueArgStr(psMetadata *arguments, // /<Command-line arguments48 const char *argName, // /<Argument name in the command-line arguments49 const char *mdName, // /<Name for value in the metadata50 psMetadata *target // /<Target metadata to which to add value47 static bool valueArgStr(psMetadata *arguments, // Command-line arguments 48 const char *argName, // Argument name in the command-line arguments 49 const char *mdName, // Name for value in the metadata 50 psMetadata *target // Target metadata to which to add value 51 51 ) 52 52 { 53 psString value = psMetadataLookupStr(NULL, arguments, argName); // /<Value of interest53 psString value = psMetadataLookupStr(NULL, arguments, argName); // Value of interest 54 54 if (value && strlen(value) > 0) { 55 55 return psMetadataAddStr(target, PS_LIST_TAIL, mdName, 0, NULL, value); … … 61 61 * Add a single filename to the arguments as an array, so that it can be used with pmFPAfileBindFromArgs, etc 62 62 */ 63 static void fileList(const char *file, // /<The symbolic name for the file64 const char *name, // /<The name of the file65 const char *comment, // /<Description of the file66 pmConfig *config // /<Configuration63 static void fileList(const char *file, // The symbolic name for the file 64 const char *name, // The name of the file 65 const char *comment, // Description of the file 66 pmConfig *config // Configuration 67 67 ) 68 68 { 69 psArray *files = psArrayAlloc(1); // /<Array with file names69 psArray *files = psArrayAlloc(1); // Array with file names 70 70 files->data[0] = psStringCopy(name); 71 71 psMetadataAddArray(config->arguments, PS_LIST_TAIL, file, 0, comment, files); … … 78 78 assert(config); 79 79 80 psMetadata *arguments = psMetadataAlloc(); // /<Command-line arguments80 psMetadata *arguments = psMetadataAlloc(); // Command-line arguments 81 81 psMetadataAddStr(arguments, PS_LIST_TAIL, "-file1", 0, "First image", NULL); 82 82 psMetadataAddStr(arguments, PS_LIST_TAIL, "-op", 0, "Operation to perform", NULL); … … 92 92 psMetadataAddBool(config->arguments, PS_LIST_TAIL, "MASK", 0, "Produce a mask image?", isMask); 93 93 const char *inFilerule = isMask ? "PPARITH.INPUT.MASK" : "PPARITH.INPUT.IMAGE"; ///< Input file rule 94 const char *outFilerule = isMask ? "PPARITH.OUTPUT.MASK" : "PPARITH.OUTPUT.IMAGE"; // /<Output file rule94 const char *outFilerule = isMask ? "PPARITH.OUTPUT.MASK" : "PPARITH.OUTPUT.IMAGE"; // Output file rule 95 95 psMetadataAddStr(config->arguments, PS_LIST_TAIL, "FILERULE.INPUT", 0, 96 96 "File rule for input", inFilerule); … … 98 98 "File rule for output", outFilerule); 99 99 100 bool status = false; // /<Status for file definition100 bool status = false; // Status for file definition 101 101 102 102 // First file 103 const char *name1 = psMetadataLookupStr(NULL, arguments, "-file1"); // /<Name of first image103 const char *name1 = psMetadataLookupStr(NULL, arguments, "-file1"); // Name of first image 104 104 if (!name1 || strlen(name1) == 0) { 105 105 psError(PS_ERR_UNEXPECTED_NULL, true, "No input image specified."); … … 118 118 119 119 // Second file is optional (won't be one for unary operations) 120 const char *name2 = psMetadataLookupStr(NULL, arguments, "-file2"); // /<Name of second image120 const char *name2 = psMetadataLookupStr(NULL, arguments, "-file2"); // Name of second image 121 121 if (name2 && strlen(name2) > 0) { 122 122 fileList("INPUT2", name2, "Name of the second input image", config); -
trunk/ppArith/src/ppArithLoop.c
r21244 r21378 6 6 * 7 7 * @author IfA 8 * @version $Revision: 1. 7$ $Name: not supported by cvs2svn $9 * @date $Date: 2009-02-0 1 21:40:52$8 * @version $Revision: 1.8 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2009-02-06 19:45:30 $ 10 10 * Copyright 2009 Institute for Astronomy, University of Hawaii 11 11 */ … … 28 28 PS_ASSERT_PTR_NON_NULL(config, false); 29 29 30 bool mdok; // /<Status of MD lookup31 const char *statsName = psMetadataLookupStr(&mdok, config->arguments, "STATS"); // /<Filename for statistics32 psMetadata *stats = NULL; // /<Container for statistics33 FILE *statsFile = NULL; // /<File stream for statistics30 bool mdok; // Status of MD lookup 31 const char *statsName = psMetadataLookupStr(&mdok, config->arguments, "STATS"); // Filename for statistics 32 psMetadata *stats = NULL; // Container for statistics 33 FILE *statsFile = NULL; // File stream for statistics 34 34 if (statsName && strlen(statsName) > 0) { 35 psString resolved = pmConfigConvertFilename(statsName, config, true, true); // /<Resolved filename35 psString resolved = pmConfigConvertFilename(statsName, config, true, true); // Resolved filename 36 36 statsFile = fopen(resolved, "w"); 37 37 if (!statsFile) { … … 45 45 } 46 46 47 const char *outName = psMetadataLookupStr(NULL, config->arguments, "FILERULE.OUTPUT"); // /<Output filerule48 pmFPAfile *output = psMetadataLookupPtr(NULL, config->files, outName); // /<Output file47 const char *outName = psMetadataLookupStr(NULL, config->arguments, "FILERULE.OUTPUT"); // Output filerule 48 pmFPAfile *output = psMetadataLookupPtr(NULL, config->files, outName); // Output file 49 49 assert(output); // We added it earlier 50 50 51 51 const char *inName = psMetadataLookupStr(NULL, config->arguments, "FILERULE.INPUT"); ///< Input filerule 52 pmFPAfile *input1 = NULL, *input2 = NULL; // /<Input files53 psString fileRegex = NULL; // /<Regular expression to find input files52 pmFPAfile *input1 = NULL, *input2 = NULL; // Input files 53 psString fileRegex = NULL; // Regular expression to find input files 54 54 psStringAppend(&fileRegex, "^%s$", inName); 55 psMetadataIterator *iter = psMetadataIteratorAlloc(config->files, PS_LIST_HEAD, fileRegex); // /<Iterator56 psMetadataItem *item = psMetadataGetAndIncrement(iter); // /<Item from iteration55 psMetadataIterator *iter = psMetadataIteratorAlloc(config->files, PS_LIST_HEAD, fileRegex); // Iterator 56 psMetadataItem *item = psMetadataGetAndIncrement(iter); // Item from iteration 57 57 input1 = item->data.V; 58 58 assert(input1); // It should be there! … … 63 63 psFree(iter); 64 64 65 pmFPAview *view = pmFPAviewAlloc(0); // /<Pointer into FPA hierarchy66 pmHDU *lastHDU = NULL; // /<Last HDU that was updated65 pmFPAview *view = pmFPAviewAlloc(0); // Pointer into FPA hierarchy 66 pmHDU *lastHDU = NULL; // Last HDU that was updated 67 67 68 68 // Iterate over the FPA hierarchy … … 71 71 } 72 72 73 pmChip *outChip; // /<Output chip of interest73 pmChip *outChip; // Output chip of interest 74 74 while ((outChip = pmFPAviewNextChip(view, output->fpa, 1)) != NULL) { 75 pmChip *inChip1 = pmFPAviewThisChip(view, input1->fpa); // /<Input chip of interest76 pmChip *inChip2 = input2 ? pmFPAviewThisChip(view, input2->fpa) : NULL; // /<Input chip of interest75 pmChip *inChip1 = pmFPAviewThisChip(view, input1->fpa); // Input chip of interest 76 pmChip *inChip2 = input2 ? pmFPAviewThisChip(view, input2->fpa) : NULL; // Input chip of interest 77 77 if (inChip2 && ((!inChip1->file_exists && inChip2->file_exists) || 78 78 (inChip1->file_exists && !inChip2->file_exists))) { … … 90 90 } 91 91 92 pmCell *outCell; // /<Cell of interest92 pmCell *outCell; // Cell of interest 93 93 while ((outCell = pmFPAviewNextCell(view, output->fpa, 1)) != NULL) { 94 pmCell *inCell1 = pmFPAviewThisCell(view, input1->fpa); // /<Input cell of interest95 pmCell *inCell2 = input2 ? pmFPAviewThisCell(view, input2->fpa) : NULL; // /<Input cell of interest94 pmCell *inCell1 = pmFPAviewThisCell(view, input1->fpa); // Input cell of interest 95 pmCell *inCell2 = input2 ? pmFPAviewThisCell(view, input2->fpa) : NULL; // Input cell of interest 96 96 if (inCell2 && ((!inCell1->file_exists && inCell2->file_exists) || 97 97 (inCell1->file_exists && !inCell2->file_exists))) { … … 117 117 } 118 118 119 pmReadout *outRO; // /<Readout of interest119 pmReadout *outRO; // Readout of interest 120 120 while ((outRO = pmFPAviewNextReadout(view, output->fpa, 1))) { 121 121 if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) { 122 122 return false; 123 123 } 124 pmReadout *inRO1 = pmFPAviewThisReadout(view, input1->fpa);// /<Input readout of interest124 pmReadout *inRO1 = pmFPAviewThisReadout(view, input1->fpa);// Input readout of interest 125 125 pmReadout *inRO2 = input2 ? pmFPAviewThisReadout(view, input2->fpa) : 126 NULL;// /<Input readout of interest126 NULL;// Input readout of interest 127 127 128 128 if (inRO2 && ((!inRO1->data_exists && inRO2->data_exists) || -
trunk/ppArith/src/ppArithReadout.c
r21244 r21378 6 6 * 7 7 * @author IfA 8 * @version $Revision: 1. 4$ $Name: not supported by cvs2svn $9 * @date $Date: 2009-02-0 1 21:40:52$8 * @version $Revision: 1.5 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2009-02-06 19:45:30 $ 10 10 * Copyright 2009 Institute for Astronomy, University of Hawaii 11 11 */ … … 29 29 PS_ASSERT_PTR_NON_NULL(view, false); 30 30 31 bool mdok; // /<Status of MD lookup31 bool mdok; // Status of MD lookup 32 32 bool isMask = psMetadataLookupBool(&mdok, config->arguments, "MASK"); 33 33 34 psImage *inImage1; // /<Input image 135 psImage *outImage; // /<Output image34 psImage *inImage1; // Input image 1 35 psImage *outImage; // Output image 36 36 if (isMask) { 37 37 inImage1 = input1->mask; … … 54 54 PS_ASSERT_IMAGE_NON_NULL(inImage1, false); 55 55 56 psImage *inImage2 = NULL; // /<Input image 256 psImage *inImage2 = NULL; // Input image 2 57 57 if (input2) { 58 58 inImage2 = isMask ? input2->mask : input2->image; … … 73 73 74 74 // Look up appropriate values 75 const char *op = psMetadataLookupStr(NULL, config->arguments, "OPERATION"); // /<Operation to perform75 const char *op = psMetadataLookupStr(NULL, config->arguments, "OPERATION"); // Operation to perform 76 76 77 77 if (input2) { -
trunk/ppArith/src/ppArithVersion.c
r21244 r21378 6 6 * 7 7 * @author IfA 8 * @version $Revision: 1. 2$ $Name: not supported by cvs2svn $9 * @date $Date: 2009-02-0 1 21:40:52$8 * @version $Revision: 1.3 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2009-02-06 19:45:30 $ 10 10 * Copyright 2009 Institute for Astronomy, University of Hawaii 11 11 */ … … 26 26 psString ppArithVersion(void) 27 27 { 28 psString version = NULL; // /<Version, to return28 psString version = NULL; // Version, to return 29 29 psStringAppend(&version, "%s-%s",PACKAGE_NAME,PACKAGE_VERSION); 30 30 return version; … … 33 33 psString ppArithVersionLong(void) 34 34 { 35 psString version = ppArithVersion(); // /<Version, to return36 psString tag = psStringStripCVS(cvsTag, "Name"); // /<CVS tag35 psString version = ppArithVersion(); // Version, to return 36 psString tag = psStringStripCVS(cvsTag, "Name"); // CVS tag 37 37 psStringAppend(&version, " (cvs tag %s) %s, %s", tag, __DATE__, __TIME__); 38 38 psFree(tag); … … 45 45 PS_ASSERT_METADATA_NON_NULL(metadata,); 46 46 47 psString pslib = psLibVersionLong();// /<psLib version48 psString psmodules = psModulesVersionLong(); // /<psModules version49 psString ppStats = ppStatsVersionLong(); // /<ppStats version50 psString ppArith = ppArithVersionLong(); // /<ppArith version47 psString pslib = psLibVersionLong();// psLib version 48 psString psmodules = psModulesVersionLong(); // psModules version 49 psString ppStats = ppStatsVersionLong(); // ppStats version 50 psString ppArith = ppArithVersionLong(); // ppArith version 51 51 52 psTime *time = psTimeGetNow(PS_TIME_TAI); // /<The time now53 psString timeString = psTimeToISO(time); // /<The time in an ISO string52 psTime *time = psTimeGetNow(PS_TIME_TAI); // The time now 53 psString timeString = psTimeToISO(time); // The time in an ISO string 54 54 psFree(time); 55 psString head = NULL; // /<Head string55 psString head = NULL; // Head string 56 56 psStringAppend(&head, "ppArith processing at %s. Component information:", timeString); 57 57 psFree(timeString);
Note:
See TracChangeset
for help on using the changeset viewer.
