Changeset 21244 for trunk/ppArith
- Timestamp:
- Feb 1, 2009, 11:43:05 AM (17 years ago)
- Location:
- trunk/ppArith/src
- Files:
-
- 6 edited
-
ppArith.c (modified) (2 diffs)
-
ppArith.h (modified) (1 diff)
-
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
r15571 r21244 1 /** @file ppArith.c 2 * 3 * @brief 4 * 5 * @ingroup ppArith 6 * 7 * @author IfA 8 * @version $Revision: 1.5 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2009-02-01 21:40:52 $ 10 * Copyright 2009 Institute for Astronomy, University of Hawaii 11 */ 12 1 13 #ifdef HAVE_CONFIG_H 2 14 #include <config.h> … … 11 23 int main(int argc, char *argv[]) 12 24 { 13 psExit exitValue = PS_EXIT_SUCCESS; // Exit value25 psExit exitValue = PS_EXIT_SUCCESS; ///< Exit value 14 26 psTimerStart("ppArith"); 15 27 psLibInit(NULL); 16 28 17 pmConfig *config = pmConfigRead(&argc, argv, PPARITH_RECIPE); // Configuration29 pmConfig *config = pmConfigRead(&argc, argv, PPARITH_RECIPE); ///< Configuration 18 30 if (!config) { 19 31 psErrorStackPrint(stderr, "Error reading configuration."); -
trunk/ppArith/src/ppArith.h
r15571 r21244 1 /** @file ppArith.h 2 * 3 * @brief 4 * 5 * @ingroup ppArith 6 * 7 * @author IfA 8 * @version $Revision: 1.4 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2009-02-01 21:40:52 $ 10 * Copyright 2009 Institute for Astronomy, University of Hawaii 11 */ 12 13 1 14 #ifndef PP_ARITH_H 2 15 #define PP_ARITH_H 3 16 4 #define PPARITH_RECIPE "PPARITH" /// Name of the recipe to use 17 /// @addtogroup ppArith 18 /// @{ 19 #define PPARITH_RECIPE "PPARITH" ///< Name of the recipe to use 5 20 6 /// Parse the arguments 7 bool ppArithArguments(int argc, char *argv[], ///< Command-line arguments 8 pmConfig *config ///< Configuration 21 /** 22 * Parse the arguments 23 */ 24 bool ppArithArguments(int argc, char *argv[], ///< Command-line arguments 25 pmConfig *config ///< Configuration 9 26 ); 10 27 11 /// Parse the camera input 12 bool ppArithCamera(pmConfig *config ///< Configuration 28 /** 29 * Parse the camera input 30 */ 31 bool ppArithCamera(pmConfig *config ///< Configuration 13 32 ); 14 33 15 /// Loop over the FPA hierarchy 16 bool ppArithLoop(pmConfig *config ///< Configuration 34 /** 35 * Loop over the FPA hierarchy 36 */ 37 bool ppArithLoop(pmConfig *config ///< Configuration 17 38 ); 18 39 19 /// Perform arithmetic on the readout 20 bool ppArithReadout(pmReadout *output, ///< Output readout 21 const pmReadout *input1, ///< Input readout 22 const pmReadout *input2, ///< Input readout 23 const pmConfig *config, ///< Configuration 24 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 25 48 ); 26 49 27 /// Put the program version information into a metadata 50 /** 51 * Put the program version information into a metadata 52 */ 28 53 void ppArithVersionMetadata(psMetadata *metadata ///< Metadata to populate 29 54 ); 30 55 56 ///@} 31 57 32 58 #endif -
trunk/ppArith/src/ppArithArguments.c
r16189 r21244 1 /** @file ppArithArguments.c 2 * 3 * @brief 4 * 5 * @ingroup ppArith 6 * 7 * @author IfA 8 * @version $Revision: 1.5 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2009-02-01 21:40:52 $ 10 * Copyright 2009 Institute for Astronomy, University of Hawaii 11 */ 12 1 13 #ifdef HAVE_CONFIG_H 2 14 #include <config.h> … … 10 22 #include "ppArith.h" 11 23 12 // Print usage information and die 13 static void usage(const char *program, // Name of the program 14 psMetadata *arguments, // Command-line arguments 15 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 16 30 ) 17 31 { … … 28 42 } 29 43 30 // Get a string value from the command-line and add it to the target 31 static bool valueArgStr(psMetadata *arguments, // Command-line arguments 32 const char *argName, // Argument name in the command-line arguments 33 const char *mdName, // Name for value in the metadata 34 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 35 51 ) 36 52 { 37 psString value = psMetadataLookupStr(NULL, arguments, argName); // Value of interest53 psString value = psMetadataLookupStr(NULL, arguments, argName); ///< Value of interest 38 54 if (value && strlen(value) > 0) { 39 55 return psMetadataAddStr(target, PS_LIST_TAIL, mdName, 0, NULL, value); … … 42 58 } 43 59 44 // Add a single filename to the arguments as an array, so that it can be used with pmFPAfileBindFromArgs, etc 45 static void fileList(const char *file, // The symbolic name for the file 46 const char *name, // The name of the file 47 const char *comment, // Description of the file 48 pmConfig *config // Configuration 60 /** 61 * Add a single filename to the arguments as an array, so that it can be used with pmFPAfileBindFromArgs, etc 62 */ 63 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 49 67 ) 50 68 { 51 psArray *files = psArrayAlloc(1); // Array with file names69 psArray *files = psArrayAlloc(1); ///< Array with file names 52 70 files->data[0] = psStringCopy(name); 53 71 psMetadataAddArray(config->arguments, PS_LIST_TAIL, file, 0, comment, files); … … 60 78 assert(config); 61 79 62 psMetadata *arguments = psMetadataAlloc(); // Command-line arguments80 psMetadata *arguments = psMetadataAlloc(); ///< Command-line arguments 63 81 psMetadataAddStr(arguments, PS_LIST_TAIL, "-file1", 0, "First image", NULL); 64 82 psMetadataAddStr(arguments, PS_LIST_TAIL, "-op", 0, "Operation to perform", NULL); … … 73 91 bool isMask = psMetadataLookupBool(NULL, arguments, "-mask"); // Are we dealing with masks? 74 92 psMetadataAddBool(config->arguments, PS_LIST_TAIL, "MASK", 0, "Produce a mask image?", isMask); 75 const char *inFilerule = isMask ? "PPARITH.INPUT.MASK" : "PPARITH.INPUT.IMAGE"; // Input file rule76 const char *outFilerule = isMask ? "PPARITH.OUTPUT.MASK" : "PPARITH.OUTPUT.IMAGE"; // Output file rule93 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 77 95 psMetadataAddStr(config->arguments, PS_LIST_TAIL, "FILERULE.INPUT", 0, 78 96 "File rule for input", inFilerule); … … 80 98 "File rule for output", outFilerule); 81 99 82 bool status = false; // Status for file definition100 bool status = false; ///< Status for file definition 83 101 84 102 // First file 85 const char *name1 = psMetadataLookupStr(NULL, arguments, "-file1"); // Name of first image103 const char *name1 = psMetadataLookupStr(NULL, arguments, "-file1"); ///< Name of first image 86 104 if (!name1 || strlen(name1) == 0) { 87 105 psError(PS_ERR_UNEXPECTED_NULL, true, "No input image specified."); … … 100 118 101 119 // Second file is optional (won't be one for unary operations) 102 const char *name2 = psMetadataLookupStr(NULL, arguments, "-file2"); // Name of second image120 const char *name2 = psMetadataLookupStr(NULL, arguments, "-file2"); ///< Name of second image 103 121 if (name2 && strlen(name2) > 0) { 104 122 fileList("INPUT2", name2, "Name of the second input image", config); -
trunk/ppArith/src/ppArithLoop.c
r18070 r21244 1 /** @file ppArithLoop.c 2 * 3 * @brief 4 * 5 * @ingroup ppArith 6 * 7 * @author IfA 8 * @version $Revision: 1.7 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2009-02-01 21:40:52 $ 10 * Copyright 2009 Institute for Astronomy, University of Hawaii 11 */ 12 1 13 #ifdef HAVE_CONFIG_H 2 14 #include <config.h> … … 16 28 PS_ASSERT_PTR_NON_NULL(config, false); 17 29 18 bool mdok; // Status of MD lookup19 const char *statsName = psMetadataLookupStr(&mdok, config->arguments, "STATS"); // Filename for statistics20 psMetadata *stats = NULL; // Container for statistics21 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 22 34 if (statsName && strlen(statsName) > 0) { 23 psString resolved = pmConfigConvertFilename(statsName, config, true, true); // Resolved filename35 psString resolved = pmConfigConvertFilename(statsName, config, true, true); ///< Resolved filename 24 36 statsFile = fopen(resolved, "w"); 25 37 if (!statsFile) { … … 33 45 } 34 46 35 const char *outName = psMetadataLookupStr(NULL, config->arguments, "FILERULE.OUTPUT"); // Output filerule36 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 37 49 assert(output); // We added it earlier 38 50 39 const char *inName = psMetadataLookupStr(NULL, config->arguments, "FILERULE.INPUT"); // Input filerule40 pmFPAfile *input1 = NULL, *input2 = NULL; // Input files41 psString fileRegex = NULL; //Regular expression to find input files51 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 42 54 psStringAppend(&fileRegex, "^%s$", inName); 43 psMetadataIterator *iter = psMetadataIteratorAlloc(config->files, PS_LIST_HEAD, fileRegex); // Iterator44 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 45 57 input1 = item->data.V; 46 58 assert(input1); // It should be there! … … 51 63 psFree(iter); 52 64 53 pmFPAview *view = pmFPAviewAlloc(0); // Pointer into FPA hierarchy54 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 55 67 56 68 // Iterate over the FPA hierarchy … … 59 71 } 60 72 61 pmChip *outChip; // Output chip of interest73 pmChip *outChip; ///< Output chip of interest 62 74 while ((outChip = pmFPAviewNextChip(view, output->fpa, 1)) != NULL) { 63 pmChip *inChip1 = pmFPAviewThisChip(view, input1->fpa); // Input chip of interest64 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 65 77 if (inChip2 && ((!inChip1->file_exists && inChip2->file_exists) || 66 78 (inChip1->file_exists && !inChip2->file_exists))) { … … 78 90 } 79 91 80 pmCell *outCell; // Cell of interest92 pmCell *outCell; ///< Cell of interest 81 93 while ((outCell = pmFPAviewNextCell(view, output->fpa, 1)) != NULL) { 82 pmCell *inCell1 = pmFPAviewThisCell(view, input1->fpa); // Input cell of interest83 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 84 96 if (inCell2 && ((!inCell1->file_exists && inCell2->file_exists) || 85 97 (inCell1->file_exists && !inCell2->file_exists))) { … … 105 117 } 106 118 107 pmReadout *outRO; // Readout of interest119 pmReadout *outRO; ///< Readout of interest 108 120 while ((outRO = pmFPAviewNextReadout(view, output->fpa, 1))) { 109 121 if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) { 110 122 return false; 111 123 } 112 pmReadout *inRO1 = pmFPAviewThisReadout(view, input1->fpa);// Input readout of interest124 pmReadout *inRO1 = pmFPAviewThisReadout(view, input1->fpa);///< Input readout of interest 113 125 pmReadout *inRO2 = input2 ? pmFPAviewThisReadout(view, input2->fpa) : 114 NULL;// Input readout of interest126 NULL;///< Input readout of interest 115 127 116 128 if (inRO2 && ((!inRO1->data_exists && inRO2->data_exists) || -
trunk/ppArith/src/ppArithReadout.c
r21183 r21244 1 /** @file ppArithReadout.c 2 * 3 * @brief 4 * 5 * @ingroup ppArith 6 * 7 * @author IfA 8 * @version $Revision: 1.4 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2009-02-01 21:40:52 $ 10 * Copyright 2009 Institute for Astronomy, University of Hawaii 11 */ 12 1 13 #ifdef HAVE_CONFIG_H 2 14 #include <config.h> … … 17 29 PS_ASSERT_PTR_NON_NULL(view, false); 18 30 19 bool mdok; // Status of MD lookup31 bool mdok; ///< Status of MD lookup 20 32 bool isMask = psMetadataLookupBool(&mdok, config->arguments, "MASK"); 21 33 22 psImage *inImage1; // Input image 123 psImage *outImage; // Output image34 psImage *inImage1; ///< Input image 1 35 psImage *outImage; ///< Output image 24 36 if (isMask) { 25 37 inImage1 = input1->mask; … … 42 54 PS_ASSERT_IMAGE_NON_NULL(inImage1, false); 43 55 44 psImage *inImage2 = NULL; // Input image 256 psImage *inImage2 = NULL; ///< Input image 2 45 57 if (input2) { 46 58 inImage2 = isMask ? input2->mask : input2->image; … … 61 73 62 74 // Look up appropriate values 63 const char *op = psMetadataLookupStr(NULL, config->arguments, "OPERATION"); // Operation to perform75 const char *op = psMetadataLookupStr(NULL, config->arguments, "OPERATION"); ///< Operation to perform 64 76 65 77 if (input2) { -
trunk/ppArith/src/ppArithVersion.c
r15571 r21244 1 /** @file ppArithVersion.c 2 * 3 * @brief 4 * 5 * @ingroup ppArith 6 * 7 * @author IfA 8 * @version $Revision: 1.2 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2009-02-01 21:40:52 $ 10 * Copyright 2009 Institute for Astronomy, University of Hawaii 11 */ 12 1 13 #ifdef HAVE_CONFIG_H 2 14 #include <config.h> … … 10 22 #include "ppArith.h" 11 23 12 static const char *cvsTag = "$Name: not supported by cvs2svn $";// CVS tag name24 static const char *cvsTag = "$Name: not supported by cvs2svn $";///< CVS tag name 13 25 14 26 psString ppArithVersion(void) 15 27 { 16 psString version = NULL; // Version, to return28 psString version = NULL; ///< Version, to return 17 29 psStringAppend(&version, "%s-%s",PACKAGE_NAME,PACKAGE_VERSION); 18 30 return version; … … 21 33 psString ppArithVersionLong(void) 22 34 { 23 psString version = ppArithVersion(); // Version, to return24 psString tag = psStringStripCVS(cvsTag, "Name"); // CVS tag35 psString version = ppArithVersion(); ///< Version, to return 36 psString tag = psStringStripCVS(cvsTag, "Name"); ///< CVS tag 25 37 psStringAppend(&version, " (cvs tag %s) %s, %s", tag, __DATE__, __TIME__); 26 38 psFree(tag); … … 33 45 PS_ASSERT_METADATA_NON_NULL(metadata,); 34 46 35 psString pslib = psLibVersionLong();// psLib version36 psString psmodules = psModulesVersionLong(); // psModules version37 psString ppStats = ppStatsVersionLong(); // ppStats version38 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 39 51 40 psTime *time = psTimeGetNow(PS_TIME_TAI); // The time now41 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 42 54 psFree(time); 43 psString head = NULL; // Head string55 psString head = NULL; ///< Head string 44 56 psStringAppend(&head, "ppArith processing at %s. Component information:", timeString); 45 57 psFree(timeString);
Note:
See TracChangeset
for help on using the changeset viewer.
