Changeset 21239
- Timestamp:
- Jan 30, 2009, 12:00:45 PM (17 years ago)
- Location:
- branches/eam_branch_20081230/ppArith/src
- Files:
-
- 6 edited
-
ppArith.c (modified) (2 diffs)
-
ppArith.h (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
-
branches/eam_branch_20081230/ppArith/src/ppArith.c
r21229 r21239 6 6 * 7 7 * @author IfA 8 * @version $Revision: 1.4.32. 1$ $Name: not supported by cvs2svn $9 * @date $Date: 2009-01-30 01:38:08$8 * @version $Revision: 1.4.32.2 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2009-01-30 22:00:45 $ 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 value */25 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); / ** Configuration */29 pmConfig *config = pmConfigRead(&argc, argv, PPARITH_RECIPE); ///< Configuration 30 30 if (!config) { 31 31 psErrorStackPrint(stderr, "Error reading configuration."); -
branches/eam_branch_20081230/ppArith/src/ppArith.h
r21229 r21239 6 6 * 7 7 * @author IfA 8 * @version $Revision: 1.3.32. 1$ $Name: not supported by cvs2svn $9 * @date $Date: 2009-01-30 01:37:55 $8 * @version $Revision: 1.3.32.2 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2009-01-30 22:00:45 $ 10 10 * Copyright 2009 Institute for Astronomy, University of Hawaii 11 11 */ … … 17 17 /// @addtogroup ppArith 18 18 /// @{ 19 #define PPARITH_RECIPE "PPARITH" / ** Name of the recipe to use */19 #define PPARITH_RECIPE "PPARITH" ///< Name of the recipe to use 20 20 21 /// Parse the arguments 22 bool ppArithArguments(int argc, char *argv[], /**< Command-line arguments */ 23 pmConfig *config /**< Configuration */ 21 /** 22 * Parse the arguments 23 */ 24 bool ppArithArguments(int argc, char *argv[], ///< Command-line arguments 25 pmConfig *config ///< Configuration 24 26 ); 25 27 26 /// Parse the camera input 27 bool ppArithCamera(pmConfig *config /**< Configuration */ 28 /** 29 * Parse the camera input 30 */ 31 bool ppArithCamera(pmConfig *config ///< Configuration 28 32 ); 29 33 30 /// Loop over the FPA hierarchy 31 bool ppArithLoop(pmConfig *config /**< Configuration */ 34 /** 35 * Loop over the FPA hierarchy 36 */ 37 bool ppArithLoop(pmConfig *config ///< Configuration 32 38 ); 33 39 34 /// Perform arithmetic on the readout 35 bool ppArithReadout(pmReadout *output, /**< Output readout */ 36 const pmReadout *input1, /**< Input readout */ 37 const pmReadout *input2, /**< Input readout */ 38 const pmConfig *config, /**< Configuration */ 39 const pmFPAview *view /**< View of readout on which to operate */ 40 /** 41 * Perform arithmetic on the readout 42 */ 43 bool ppArithReadout(pmReadout *output, ///< Output readout 44 const pmReadout *input1, ///< Input readout 45 const pmReadout *input2, ///< Input readout 46 const pmConfig *config, ///< Configuration 47 const pmFPAview *view ///< View of readout on which to operate 40 48 ); 41 49 42 /// Put the program version information into a metadata 43 void ppArithVersionMetadata(psMetadata *metadata /**< Metadata to populate */ 50 /** 51 * Put the program version information into a metadata 52 */ 53 void ppArithVersionMetadata(psMetadata *metadata ///< Metadata to populate 44 54 ); 45 55 -
branches/eam_branch_20081230/ppArith/src/ppArithArguments.c
r21229 r21239 6 6 * 7 7 * @author IfA 8 * @version $Revision: 1.4.30. 1$ $Name: not supported by cvs2svn $9 * @date $Date: 2009-01-30 01:38:25 $8 * @version $Revision: 1.4.30.2 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2009-01-30 22:00:45 $ 10 10 * Copyright 2009 Institute for Astronomy, University of Hawaii 11 11 */ … … 22 22 #include "ppArith.h" 23 23 24 // Print usage information and die 25 static void usage(const char *program, // Name of the program 26 psMetadata *arguments, // Command-line arguments 27 pmConfig *config // Configuration 24 /** 25 * Print usage information and die 26 */ 27 static void usage(const char *program, ///< Name of the program 28 psMetadata *arguments, ///< Command-line arguments 29 pmConfig *config ///< Configuration 28 30 ) 29 31 { … … 40 42 } 41 43 42 // Get a string value from the command-line and add it to the target 43 static bool valueArgStr(psMetadata *arguments, // Command-line arguments 44 const char *argName, // Argument name in the command-line arguments 45 const char *mdName, // Name for value in the metadata 46 psMetadata *target // Target metadata to which to add value 44 /** 45 * Get a string value from the command-line and add it to the target 46 */ 47 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 47 51 ) 48 52 { 49 psString value = psMetadataLookupStr(NULL, arguments, argName); / ** Value of interest */53 psString value = psMetadataLookupStr(NULL, arguments, argName); ///< Value of interest 50 54 if (value && strlen(value) > 0) { 51 55 return psMetadataAddStr(target, PS_LIST_TAIL, mdName, 0, NULL, value); … … 55 59 56 60 /** 57 * \fn fileList58 61 * Add a single filename to the arguments as an array, so that it can be used with pmFPAfileBindFromArgs, etc 59 62 */ 60 static void fileList(const char *file, // The symbolic name for the file61 const char *name, // The name of the file62 const char *comment, // Description of the file63 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 64 67 ) 65 68 { 66 psArray *files = psArrayAlloc(1); // Array with file names69 psArray *files = psArrayAlloc(1); ///< Array with file names 67 70 files->data[0] = psStringCopy(name); 68 71 psMetadataAddArray(config->arguments, PS_LIST_TAIL, file, 0, comment, files); … … 75 78 assert(config); 76 79 77 psMetadata *arguments = psMetadataAlloc(); / ** Command-line arguments */80 psMetadata *arguments = psMetadataAlloc(); ///< Command-line arguments 78 81 psMetadataAddStr(arguments, PS_LIST_TAIL, "-file1", 0, "First image", NULL); 79 82 psMetadataAddStr(arguments, PS_LIST_TAIL, "-op", 0, "Operation to perform", NULL); … … 88 91 bool isMask = psMetadataLookupBool(NULL, arguments, "-mask"); // Are we dealing with masks? 89 92 psMetadataAddBool(config->arguments, PS_LIST_TAIL, "MASK", 0, "Produce a mask image?", isMask); 90 const char *inFilerule = isMask ? "PPARITH.INPUT.MASK" : "PPARITH.INPUT.IMAGE"; // Input file rule91 const char *outFilerule = isMask ? "PPARITH.OUTPUT.MASK" : "PPARITH.OUTPUT.IMAGE"; / ** Output file rule */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 rule 92 95 psMetadataAddStr(config->arguments, PS_LIST_TAIL, "FILERULE.INPUT", 0, 93 96 "File rule for input", inFilerule); … … 95 98 "File rule for output", outFilerule); 96 99 97 bool status = false; / ** Status for file definition */100 bool status = false; ///< Status for file definition 98 101 99 102 // First file 100 const char *name1 = psMetadataLookupStr(NULL, arguments, "-file1"); / ** Name of first image */103 const char *name1 = psMetadataLookupStr(NULL, arguments, "-file1"); ///< Name of first image 101 104 if (!name1 || strlen(name1) == 0) { 102 105 psError(PS_ERR_UNEXPECTED_NULL, true, "No input image specified."); … … 115 118 116 119 // Second file is optional (won't be one for unary operations) 117 const char *name2 = psMetadataLookupStr(NULL, arguments, "-file2"); / ** Name of second image */120 const char *name2 = psMetadataLookupStr(NULL, arguments, "-file2"); ///< Name of second image 118 121 if (name2 && strlen(name2) > 0) { 119 122 fileList("INPUT2", name2, "Name of the second input image", config); -
branches/eam_branch_20081230/ppArith/src/ppArithLoop.c
r21229 r21239 6 6 * 7 7 * @author IfA 8 * @version $Revision: 1.6.28. 1$ $Name: not supported by cvs2svn $9 * @date $Date: 2009-01-30 01:39:11$8 * @version $Revision: 1.6.28.2 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2009-01-30 22:00:45 $ 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 lookup */31 const char *statsName = psMetadataLookupStr(&mdok, config->arguments, "STATS"); // Filename for statistics32 psMetadata *stats = NULL; / ** Container for statistics */33 FILE *statsFile = NULL; / ** File stream for statistics */30 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 filename */35 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 filerule */48 pmFPAfile *output = psMetadataLookupPtr(NULL, config->files, outName); / ** Output file */47 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 const char *inName = psMetadataLookupStr(NULL, config->arguments, "FILERULE.INPUT"); / ** Input filerule */52 pmFPAfile *input1 = NULL, *input2 = NULL; / ** Input files */53 psString fileRegex = NULL; / ** Regular expression to find input files */51 const char *inName = psMetadataLookupStr(NULL, config->arguments, "FILERULE.INPUT"); ///< Input filerule 52 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 iteration */55 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 hierarchya */66 pmHDU *lastHDU = NULL; / ** Last HDU that was updated */65 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 interest */73 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 interest */76 pmChip *inChip2 = input2 ? pmFPAviewThisChip(view, input2->fpa) : NULL; / ** Input chip of interest */75 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 interest */92 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 interest */95 pmCell *inCell2 = input2 ? pmFPAviewThisCell(view, input2->fpa) : NULL; / ** Input cell of interest */94 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 interest */124 pmReadout *inRO1 = pmFPAviewThisReadout(view, input1->fpa);///< Input readout of interest 125 125 pmReadout *inRO2 = input2 ? pmFPAviewThisReadout(view, input2->fpa) : 126 NULL;/ ** Input readout of interest */126 NULL;///< Input readout of interest 127 127 128 128 if (inRO2 && ((!inRO1->data_exists && inRO2->data_exists) || -
branches/eam_branch_20081230/ppArith/src/ppArithReadout.c
r21229 r21239 6 6 * 7 7 * @author IfA 8 * @version $Revision: 1.2.32. 2$ $Name: not supported by cvs2svn $9 * @date $Date: 2009-01-30 01:39:32$8 * @version $Revision: 1.2.32.3 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2009-01-30 22:00:45 $ 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 lookup */31 bool mdok; ///< Status of MD lookup 32 32 bool isMask = psMetadataLookupBool(&mdok, config->arguments, "MASK"); 33 33 34 psImage *inImage1; / ** Input image 1 */35 psImage *outImage; / ** Output image */34 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 2 */56 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) { -
branches/eam_branch_20081230/ppArith/src/ppArithVersion.c
r21229 r21239 6 6 * 7 7 * @author IfA 8 * @version $Revision: 1.1.32. 1$ $Name: not supported by cvs2svn $9 * @date $Date: 2009-01-30 01:39:49$8 * @version $Revision: 1.1.32.2 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2009-01-30 22:00:45 $ 10 10 * Copyright 2009 Institute for Astronomy, University of Hawaii 11 11 */ … … 22 22 #include "ppArith.h" 23 23 24 static const char *cvsTag = "$Name: not supported by cvs2svn $";/ ** CVS tag name */24 static const char *cvsTag = "$Name: not supported by cvs2svn $";///< CVS tag name 25 25 26 26 psString ppArithVersion(void) 27 27 { 28 psString version = NULL; / ** Version, to return */28 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 return */36 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 version */48 psString psmodules = psModulesVersionLong(); / ** psModules version */49 psString ppStats = ppStatsVersionLong(); / ** ppStats version */50 psString ppArith = ppArithVersionLong(); / ** ppArith version */47 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 now */53 psString timeString = psTimeToISO(time); / ** The time in an ISO string */52 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 string */55 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.
