Changeset 21244
- Timestamp:
- Feb 1, 2009, 11:43:05 AM (17 years ago)
- Location:
- trunk
- Files:
-
- 24 edited
-
ppArith/src/ppArith.c (modified) (2 diffs)
-
ppArith/src/ppArith.h (modified) (1 diff)
-
ppArith/src/ppArithArguments.c (modified) (8 diffs)
-
ppArith/src/ppArithLoop.c (modified) (7 diffs)
-
ppArith/src/ppArithReadout.c (modified) (4 diffs)
-
ppArith/src/ppArithVersion.c (modified) (4 diffs)
-
ppMerge/src/ppMerge.c (modified) (6 diffs)
-
ppMerge/src/ppMerge.h (modified) (2 diffs)
-
ppMerge/src/ppMergeArguments.c (modified) (21 diffs)
-
ppMerge/src/ppMergeCamera.c (modified) (11 diffs)
-
ppMerge/src/ppMergeErrorCodes.c.in (modified) (4 diffs)
-
ppMerge/src/ppMergeErrorCodes.h.in (modified) (1 diff)
-
ppMerge/src/ppMergeFileGroup.c (modified) (1 diff)
-
ppMerge/src/ppMergeFiles.c (modified) (1 diff)
-
ppMerge/src/ppMergeLoop.c (modified) (17 diffs)
-
ppMerge/src/ppMergeLoop_Threaded.c (modified) (18 diffs)
-
ppMerge/src/ppMergeMask.c (modified) (20 diffs)
-
ppMerge/src/ppMergeReadChunk.c (modified) (3 diffs)
-
ppMerge/src/ppMergeScaleZero.c (modified) (7 diffs)
-
ppMerge/src/ppMergeScaleZero.h (modified) (2 diffs)
-
ppMerge/src/ppMergeSetThreads.c (modified) (1 diff)
-
ppMerge/src/ppMergeThreadLauncher.c (modified) (1 diff)
-
ppMerge/src/ppMergeVersion.c (modified) (4 diffs)
-
ppMerge/src/ppMergeVersion.h (modified) (1 diff)
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); -
trunk/ppMerge/src/ppMerge.c
r18839 r21244 1 /** @file ppMerge.c 2 * 3 * @brief 4 * 5 * @ingroup ppMerge 6 * 7 * @author IfA 8 * @version $Revision: 1.26 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2009-02-01 21:43:05 $ 10 * Copyright 2009 Institute for Astronomy, University of Hawaii 11 */ 12 1 13 #include "ppMerge.h" 2 14 … … 12 24 psTimerStart(TIMERNAME); 13 25 14 psExit exitValue = PS_EXIT_SUCCESS; // Exit value for program26 psExit exitValue = PS_EXIT_SUCCESS; ///< Exit value for program 15 27 16 pmConfig *config = pmConfigRead(&argc, argv, PPMERGE_RECIPE); // Configuration28 pmConfig *config = pmConfigRead(&argc, argv, PPMERGE_RECIPE); ///< Configuration 17 29 if (!config) { 18 30 psErrorStackPrint(stderr, "Error reading configuration."); … … 27 39 } 28 40 29 ppMergeType type = psMetadataLookupS32(NULL, config->arguments, "TYPE"); // Type of frame41 ppMergeType type = psMetadataLookupS32(NULL, config->arguments, "TYPE"); ///< Type of frame 30 42 switch (type) { 31 43 case PPMERGE_TYPE_MASK: … … 58 70 59 71 // Output the statistics 60 bool mdok; // Status of MD lookup61 psString statsName = psMetadataLookupStr(&mdok, config->arguments, "STATS.NAME"); // Statistics file name72 bool mdok; ///< Status of MD lookup 73 psString statsName = psMetadataLookupStr(&mdok, config->arguments, "STATS.NAME"); ///< Statistics file name 62 74 if (mdok && statsName && strlen(statsName) > 0) { 63 psString resolved = pmConfigConvertFilename(statsName, config, true, true); // Resolved filename64 FILE *statsFile = fopen(resolved, "w"); // Output statistics file75 psString resolved = pmConfigConvertFilename(statsName, config, true, true); ///< Resolved filename 76 FILE *statsFile = fopen(resolved, "w"); ///< Output statistics file 65 77 if (!statsFile) { 66 78 psError(PS_ERR_IO, true, "Unable to open statistics file %s for writing.", resolved); … … 70 82 } 71 83 psFree(resolved); 72 psMetadata *stats = psMetadataLookupMetadata(&mdok, config->arguments, "STATS.DATA"); // Statistics84 psMetadata *stats = psMetadataLookupMetadata(&mdok, config->arguments, "STATS.DATA"); ///< Statistics 73 85 if (!stats) { 74 86 psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to find statistics"); … … 76 88 goto die; 77 89 } 78 psString statsOut = psMetadataConfigFormat(stats); // String to write out90 psString statsOut = psMetadataConfigFormat(stats); ///< String to write out 79 91 fprintf(statsFile, "%s", statsOut); 80 92 psFree(statsOut); -
trunk/ppMerge/src/ppMerge.h
r18967 r21244 1 /** @file ppMerge.h 2 * 3 * @brief 4 * 5 * @ingroup ppMerge 6 * 7 * @author IfA 8 * @version $Revision: 1.13 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2009-02-01 21:43:05 $ 10 * Copyright 2009 Institute for Astronomy, University of Hawaii 11 */ 12 1 13 #ifndef PP_MERGE_H 2 14 #define PP_MERGE_H … … 13 25 #include <ppStats.h> 14 26 15 #define TIMERNAME "ppMerge" // Name for timer 16 #define PPMERGE_RECIPE "PPMERGE" // Recipe name 17 #define THREADED 1 // Compile with threads? 27 /// @addtogroup ppArith 28 /// @{ 18 29 19 // Type of frame to merge 30 #define TIMERNAME "ppMerge" ///< Name for timer 31 #define PPMERGE_RECIPE "PPMERGE" ///< Recipe name 32 #define THREADED 1 ///< Compile with threads? 33 34 /** 35 * Type of frame to merge 36 */ 20 37 typedef enum { 21 PPMERGE_TYPE_UNKNOWN, // Unknown type22 PPMERGE_TYPE_BIAS, // Bias frame23 PPMERGE_TYPE_DARK, // (Multi-)Dark frame24 PPMERGE_TYPE_MASK, // Mask frame25 PPMERGE_TYPE_SHUTTER, // Shutter frame26 PPMERGE_TYPE_FLAT, // Flat-field frame (dome or sky)27 PPMERGE_TYPE_FRINGE, // Fringe frame38 PPMERGE_TYPE_UNKNOWN, ///< Unknown type 39 PPMERGE_TYPE_BIAS, ///< Bias frame 40 PPMERGE_TYPE_DARK, ///< (Multi-)Dark frame 41 PPMERGE_TYPE_MASK, ///< Mask frame 42 PPMERGE_TYPE_SHUTTER, ///< Shutter frame 43 PPMERGE_TYPE_FLAT, ///< Flat-field frame (dome or sky) 44 PPMERGE_TYPE_FRINGE, ///< Fringe frame 28 45 } ppMergeType; 29 46 30 // Files, for activation 47 /** 48 * Files, for activation 49 */ 31 50 typedef enum { 32 PPMERGE_FILES_ALL, // All files33 PPMERGE_FILES_INPUT, // Input files34 PPMERGE_FILES_OUTPUT // Output files51 PPMERGE_FILES_ALL, ///< All files 52 PPMERGE_FILES_INPUT, ///< Input files 53 PPMERGE_FILES_OUTPUT ///< Output files 35 54 } ppMergeFiles; 36 55 37 // Group of files to read 38 // 39 // Each file contributes a readout, into which is read a chunk from that file 56 /** 57 * \brief Group of files to read 58 * 59 * Each file contributes a readout, into which is read a chunk from that file 60 */ 40 61 typedef struct { 41 psArray *readouts; // Input readouts42 bool read; // Has the scan been read?43 bool busy; // Is the scan being processed?44 int firstScan; // First row of the chunk to be read for this group45 int lastScan; // Last row of the chunk to be read for this group62 psArray *readouts; ///< Input readouts 63 bool read; ///< Has the scan been read? 64 bool busy; ///< Is the scan being processed? 65 int firstScan; ///< First row of the chunk to be read for this group 66 int lastScan; ///< Last row of the chunk to be read for this group 46 67 } ppMergeFileGroup; 47 68 48 // Parse command-line arguments and recipe 49 bool ppMergeArguments(int argc, char *argv[], // Command-line arguments 50 pmConfig *config // Configuration 69 /** 70 * Parse command-line arguments and recipe 71 */ 72 bool ppMergeArguments(int argc, char *argv[], ///< Command-line arguments 73 pmConfig *config ///< Configuration 51 74 ); 52 75 53 // Set up camera files 54 bool ppMergeCamera(pmConfig *config // Configuration 76 /** 77 * Set up camera files 78 */ 79 bool ppMergeCamera(pmConfig *config ///< Configuration 55 80 ); 56 81 57 // Measure scale and zero-points 58 bool ppMergeScaleZero(pmConfig *config // Configuration 82 /** 83 * Measure scale and zero-points 84 */ 85 bool ppMergeScaleZero(pmConfig *config ///< Configuration 59 86 ); 60 87 61 // Main loop to do the merging 62 bool ppMergeLoop(pmConfig *config // Configuration 88 /** 89 * Main loop to do the merging 90 */ 91 bool ppMergeLoop(pmConfig *config ///< Configuration 63 92 ); 64 93 65 // Main loop for masks 66 bool ppMergeMask(pmConfig *config // Configuration 94 /** 95 * Main loop for masks 96 */ 97 bool ppMergeMask(pmConfig *config ///< Configuration 67 98 ); 68 99 69 // Read nominated input file 70 bool ppMergeFileReadInput(pmConfig *config, // Configuration 71 pmReadout *readout, // Readout into which to read 72 int num, // Number of file in sequence 73 int rows // Number of rows to read at once 100 /** 101 * Read nominated input file 102 */ 103 bool ppMergeFileReadInput(pmConfig *config, ///< Configuration 104 pmReadout *readout, ///< Readout into which to read 105 int num, ///< Number of file in sequence 106 int rows ///< Number of rows to read at once 74 107 ); 75 108 76 // Open nominated input file 77 bool ppMergeFileOpenInput(pmConfig *config, // Configuration 78 const pmFPAview *view, // View to open 79 int num // Number of file in sequence 109 /** 110 * Open nominated input file 111 */ 112 bool ppMergeFileOpenInput(pmConfig *config, ///< Configuration 113 const pmFPAview *view, ///< View to open 114 int num ///< Number of file in sequence 80 115 ); 81 116 82 // Set the data level for files specified by name; return an array of the files 83 psArray *ppMergeFileDataLevel(const pmConfig *config, // Configuration 84 const char *name, // Name of files 85 pmFPALevel level // Level for file data level 117 /** 118 * Set the data level for files specified by name; return an array of the files 119 */ 120 psArray *ppMergeFileDataLevel(const pmConfig *config, ///< Configuration 121 const char *name, ///< Name of files 122 pmFPALevel level ///< Level for file data level 86 123 ); 87 124 88 // Activate/deactivate a list of files 89 bool ppMergeFileActivate(const pmConfig *config, // Configuration 90 ppMergeFiles files, // Files to turn on/off 91 bool state // Activation state 125 /** 126 * Activate/deactivate a list of files 127 */ 128 bool ppMergeFileActivate(const pmConfig *config, ///< Configuration 129 ppMergeFiles files, ///< Files to turn on/off 130 bool state ///< Activation state 92 131 ); 93 132 94 // Activate/deactivate a single element for a list; return array of files 95 psArray *ppMergeFileActivateSingle(const pmConfig *config, // Configuration 96 ppMergeFiles files, // Files to turn on/off 97 bool state, // Activation state 98 int num // Number of file in sequence 133 /** 134 * Activate/deactivate a single element for a list; return array of files 135 */ 136 psArray *ppMergeFileActivateSingle(const pmConfig *config, ///< Configuration 137 ppMergeFiles files, ///< Files to turn on/off 138 bool state, ///< Activation state 139 int num ///< Number of file in sequence 99 140 ); 100 141 101 // Return name of output pmFPAfile 102 psString ppMergeOutputFile(const pmConfig *config // Configuration 142 /** 143 * Return name of output pmFPAfile 144 */ 145 psString ppMergeOutputFile(const pmConfig *config ///< Configuration 103 146 ); 104 147 105 148 106 // Allocator for group of files 149 /** 150 * Allocator for group of files 151 */ 107 152 ppMergeFileGroup *ppMergeFileGroupAlloc(void); 108 153 109 // Read chunk into the first available file group 110 ppMergeFileGroup *ppMergeReadChunk(bool *status, // Status of read 111 psArray *fileGroups, // All groups 112 pmConfig *config, // Configuration 113 int numChunk // Chunk number (only for interest) 154 /** 155 * Read chunk into the first available file group 156 */ 157 ppMergeFileGroup *ppMergeReadChunk(bool *status, ///< Status of read 158 psArray *fileGroups, ///< All groups 159 pmConfig *config, ///< Configuration 160 int numChunk ///< Chunk number (only for interest) 114 161 ); 115 162 116 // Set up thread handling 163 /** 164 * Set up thread handling 165 */ 117 166 bool ppMergeSetThreads(void); 118 167 168 ///@} 119 169 #endif -
trunk/ppMerge/src/ppMergeArguments.c
r21183 r21244 1 /** @file ppMergeArguments.c 2 * 3 * @brief 4 * 5 * @ingroup ppMerge 6 * 7 * @author IfA 8 * @version $Revision: 1.16 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2009-02-01 21:43:05 $ 10 * Copyright 2009 Institute for Astronomy, University of Hawaii 11 */ 12 1 13 #include "ppMerge.h" 2 14 3 // Print usage information and die 4 static void usage(const char *program, // Name of the program 5 psMetadata *arguments // Command-line arguments 15 /** 16 * Print usage information and die 17 */ 18 static void usage(const char *program, ///< Name of the program 19 psMetadata *arguments ///< Command-line arguments 6 20 ) 7 21 { … … 18 32 } 19 33 20 // Get a float-point value from the command-line or recipe, and add it to the arguments 34 /** 35 * Get a float-point value from the command-line or recipe, and add it to the arguments 36 */ 21 37 #define VALUE_ARG_RECIPE_FLOAT(ARGNAME, RECIPENAME, TYPE) { \ 22 38 ps##TYPE value = psMetadataLookup##TYPE(NULL, arguments, ARGNAME); \ … … 33 49 } 34 50 35 // Get an integer value from the command-line or recipe, and add it to the arguments 51 /** 52 * Get an integer value from the command-line or recipe, and add it to the arguments 53 */ 36 54 #define VALUE_ARG_RECIPE_INT(ARGNAME, RECIPENAME, TYPE, UNSET) { \ 37 55 ps##TYPE value = psMetadataLookup##TYPE(NULL, arguments, ARGNAME); \ … … 48 66 } 49 67 50 // Get a boolean from the command-line or recipe, and add it to the arguments if either is set 68 /** 69 * Get a boolean from the command-line or recipe, and add it to the arguments if either is set 70 */ 51 71 #define VALUE_ARG_RECIPE_BOOL(ARGNAME, RECIPENAME) { \ 52 72 bool value = (psMetadataLookupBool(NULL, arguments, ARGNAME) || \ … … 55 75 } 56 76 57 // Get a statistic name from the command-line or recipe, and add the enum to the arguments 77 /** 78 * Get a statistic name from the command-line or recipe, and add the enum to the arguments 79 */ 58 80 #define VALUE_ARG_RECIPE_STAT(ARGNAME, RECIPENAME) { \ 59 81 const char *stat = psMetadataLookupStr(NULL, arguments, ARGNAME); \ … … 69 91 } 70 92 71 // Get a string from the command-line or recipe, and add to the arguments 93 /** 94 * Get a string from the command-line or recipe, and add to the arguments 95 */ 72 96 #define VALUE_ARG_RECIPE_STR(ARGNAME, RECIPENAME) { \ 73 97 const char *str = psMetadataLookupStr(NULL, arguments, ARGNAME); \ … … 83 107 } 84 108 85 // Get a string from the command-line or recipe, and add the appropriate mask value to the arguments 109 /** 110 * Get a string from the command-line or recipe, and add the appropriate mask value to the arguments 111 */ 86 112 #define VALUE_ARG_RECIPE_MASK(ARGNAME, RECIPENAME) { \ 87 113 const char *str = psMetadataLookupStr(NULL, arguments, ARGNAME); \ … … 98 124 } 99 125 100 // Get a string value from the command-line and add it to the target 101 static bool valueArgStr(psMetadata *arguments, // Command-line arguments 102 const char *argName, // Argument name in the command-line arguments 103 const char *mdName, // Name for value in the metadata 104 psMetadata *target // Target metadata to which to add value 126 /** 127 * Get a string value from the command-line and add it to the target 128 */ 129 static bool valueArgStr(psMetadata *arguments, ///< Command-line arguments 130 const char *argName, ///< Argument name in the command-line arguments 131 const char *mdName, ///< Name for value in the metadata 132 psMetadata *target ///< Target metadata to which to add value 105 133 ) 106 134 { 107 psString value = psMetadataLookupStr(NULL, arguments, argName); // Value of interest135 psString value = psMetadataLookupStr(NULL, arguments, argName); ///< Value of interest 108 136 if (value && strlen(value) > 0) { 109 137 return psMetadataAddStr(target, PS_LIST_TAIL, mdName, 0, NULL, value); … … 116 144 assert(config); 117 145 118 psMetadata *arguments = psMetadataAlloc(); // Command-line arguments146 psMetadata *arguments = psMetadataAlloc(); ///< Command-line arguments 119 147 psMetadataAddStr(arguments, PS_LIST_TAIL, "-type", 0, "Type of calibration frame", NULL); 120 148 psMetadataAddStr(arguments, PS_LIST_TAIL, "-stats", 0, "MDC file to hold statistics ", NULL); … … 136 164 psMetadataAddStr(arguments, PS_LIST_TAIL, "-stdev", 0, "Statistic to use to measure the stdev", NULL); 137 165 138 / / Fringe construction parameters166 /** Fringe construction parameters */ 139 167 psMetadataAddS32(arguments, PS_LIST_TAIL, "-fringe-num", 0, "Number of fringe regions", 0); 140 168 psMetadataAddS32(arguments, PS_LIST_TAIL, "-fringe-size", 0, "Half-size of fringe regions", 0); … … 142 170 psMetadataAddS32(arguments, PS_LIST_TAIL, "-fringe-ysmooth", 0, "Number of smoothing regions in y", 0); 143 171 144 / / Shutter construction parameters172 /** Shutter construction parameters */ 145 173 psMetadataAddS32(arguments, PS_LIST_TAIL, "-shutter-size", 0, "Size for shutter measurement regions", 0); 146 174 psMetadataAddS32(arguments, PS_LIST_TAIL, "-shutter-iter", 0, "Number of iterations for shutter", 0); 147 175 psMetadataAddF32(arguments, PS_LIST_TAIL, "-shutter-rej", 0, "Rejection limit for shutter", NAN); 148 176 149 / / Mask construction parameters177 /** Mask construction parameters */ 150 178 psMetadataAddF32(arguments, PS_LIST_TAIL, "-mask-suspect", 0, "Threshold for suspect pixels (sigma)", NAN); 151 179 psMetadataAddF32(arguments, PS_LIST_TAIL, "-mask-bad", 0, "Threshold for bad pixels (sigma)", NAN); … … 189 217 } 190 218 191 unsigned int numBad = 0; // Number of bad lines192 psMetadata *inputs = psMetadataConfigRead(NULL, &numBad, argv[1], false); // Information about inputs219 unsigned int numBad = 0; ///< Number of bad lines 220 psMetadata *inputs = psMetadataConfigRead(NULL, &numBad, argv[1], false); ///< Information about inputs 193 221 if (!inputs || numBad > 0) { 194 222 psError(PS_ERR_BAD_PARAMETER_VALUE, false, "Unable to cleanly read MDC file with inputs."); … … 205 233 206 234 // Set the type of calibration frame 207 const char *typeStr = psMetadataLookupStr(NULL, arguments, "-type"); // Type of calibration235 const char *typeStr = psMetadataLookupStr(NULL, arguments, "-type"); ///< Type of calibration 208 236 if (!typeStr || strlen(typeStr) <= 0) { 209 237 psError(PS_ERR_UNKNOWN, false, "No -type specified."); 210 238 goto ERROR; 211 239 } 212 ppMergeType type = PPMERGE_TYPE_UNKNOWN; // Enumerated type for frame type240 ppMergeType type = PPMERGE_TYPE_UNKNOWN; ///< Enumerated type for frame type 213 241 if (strcasecmp(typeStr, "BIAS") == 0) { 214 242 type = PPMERGE_TYPE_BIAS; … … 258 286 } 259 287 260 psMetadata *recipe = psMetadataLookupMetadata(NULL, config->recipes, PPMERGE_RECIPE); // Recipe for ppSim288 psMetadata *recipe = psMetadataLookupMetadata(NULL, config->recipes, PPMERGE_RECIPE); ///< Recipe for ppSim 261 289 if (!recipe) { 262 290 psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to find recipe %s", PPMERGE_RECIPE); … … 264 292 } 265 293 266 / / Standard combination parameters294 /** Standard combination parameters */ 267 295 VALUE_ARG_RECIPE_INT("-rows", "ROWS", S32, 0); 268 296 VALUE_ARG_RECIPE_INT("-sample", "SAMPLE", S32, 0); … … 281 309 VALUE_ARG_RECIPE_STAT("-stdev", "STDEV"); 282 310 283 / / Fringe construction parameters311 /** Fringe construction parameters */ 284 312 VALUE_ARG_RECIPE_INT("-fringe-num", "FRINGE.NUM", S32, 0); 285 313 VALUE_ARG_RECIPE_INT("-fringe-size", "FRINGE.SIZE", S32, 0); … … 287 315 VALUE_ARG_RECIPE_INT("-fringe-ysmooth", "FRINGE.YSMOOTH", S32, 0); 288 316 289 / / Shutter construction parameters317 /** Shutter construction parameters */ 290 318 VALUE_ARG_RECIPE_INT("-shutter-size", "SHUTTER.SIZE", S32, 0); 291 319 292 / / Mask construction parameters320 /** Mask construction parameters */ 293 321 VALUE_ARG_RECIPE_FLOAT("-mask-suspect", "MASK.SUSPECT", F32); 294 322 VALUE_ARG_RECIPE_FLOAT("-mask-bad", "MASK.BAD", F32); … … 300 328 VALUE_ARG_RECIPE_FLOAT("-mask-smooth-scale", "MASK.SMOOTH.SCALE", F32); 301 329 302 const char *maskModeStr = psMetadataLookupStr(NULL, arguments, "-mask-mode"); // Mode to identify bad pix330 const char *maskModeStr = psMetadataLookupStr(NULL, arguments, "-mask-mode"); ///< Mode to identify bad pix 303 331 if (!maskModeStr) { 304 332 maskModeStr = psMetadataLookupStr(NULL, recipe, "MASK.MODE"); … … 318 346 319 347 if (type == PPMERGE_TYPE_DARK) { 320 psMetadata *ordinates = psMetadataLookupMetadata(NULL, recipe, "DARK.ORDINATES"); // Ordinates info321 psArray *translated = psArrayAllocEmpty(psListLength(ordinates->list)); // Translated version322 323 psMetadataIterator *iter = psMetadataIteratorAlloc(ordinates, PS_LIST_HEAD, NULL); // Iterator324 psMetadataItem *item; // Item from iteration348 psMetadata *ordinates = psMetadataLookupMetadata(NULL, recipe, "DARK.ORDINATES"); ///< Ordinates info 349 psArray *translated = psArrayAllocEmpty(psListLength(ordinates->list)); ///< Translated version 350 351 psMetadataIterator *iter = psMetadataIteratorAlloc(ordinates, PS_LIST_HEAD, NULL); ///< Iterator 352 psMetadataItem *item; ///< Item from iteration 325 353 while ((item = psMetadataGetAndIncrement(iter))) { 326 int order = 0; // Polynomial order327 bool scale = false; // Scale values?328 float min = NAN, max = NAN; // Minimum and maximum values for scaling354 int order = 0; ///< Polynomial order 355 bool scale = false; ///< Scale values? 356 float min = NAN, max = NAN; ///< Minimum and maximum values for scaling 329 357 switch (item->type) { 330 358 case PS_TYPE_S32: … … 333 361 case PS_DATA_METADATA: 334 362 order = psMetadataLookupS32(NULL, item->data.md, "ORDER"); 335 bool mdok; // Status of MD lookup363 bool mdok; ///< Status of MD lookup 336 364 scale = psMetadataLookupBool(&mdok, item->data.md, "SCALE"); 337 365 min = psMetadataLookupF32(&mdok, item->data.md, "MIN"); … … 361 389 psMetadataAddArray(config->arguments, PS_LIST_TAIL, "DARK.ORDINATES", 0, 362 390 "Ordinates to fit for dark", translated); 363 psFree(translated); // Drop reference364 365 psString darkNorm = psMetadataLookupStr(NULL, recipe, "DARK.NORM"); // Normalisation concept391 psFree(translated); ///< Drop reference 392 393 psString darkNorm = psMetadataLookupStr(NULL, recipe, "DARK.NORM"); ///<Normalisation concept 366 394 if (darkNorm && strcmp(darkNorm, "NONE") != 0) { 367 395 psMetadataAddStr(config->arguments, PS_LIST_TAIL, "DARK.NORM", 0, -
trunk/ppMerge/src/ppMergeCamera.c
r18967 r21244 1 /** @file ppMergeCamera.c 2 * 3 * @brief 4 * 5 * @ingroup ppMerge 6 * 7 * @author IfA 8 * @version $Revision: 1.8 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2009-02-01 21:43:05 $ 10 * Copyright 2009 Institute for Astronomy, University of Hawaii 11 */ 12 1 13 #include "ppMerge.h" 2 14 3 // Define an output file, with its own FPA 4 bool outputFile(pmConfig *config, // Configuration 5 const char *name, // Name of output file 6 pmFPAfileType type, // Type of file 7 const char *description, // Description of file 8 psMetadata *format, // Camera format 9 pmFPAview *view // View for PHU 15 /** 16 * Define an output file, with its own FPA 17 */ 18 bool outputFile(pmConfig *config, ///< Configuration 19 const char *name, ///< Name of output file 20 pmFPAfileType type, ///< Type of file 21 const char *description, ///< Description of file 22 psMetadata *format, ///< Camera format 23 pmFPAview *view ///< View for PHU 10 24 ) 11 25 { … … 15 29 16 30 // Output image 17 pmFPA *fpa = pmFPAConstruct(config->camera, config->cameraName); // FPA to contain the output31 pmFPA *fpa = pmFPAConstruct(config->camera, config->cameraName); ///< FPA to contain the output 18 32 if (!fpa) { 19 33 psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to construct an FPA from camera configuration."); … … 84 98 bool haveWeights = false; // Do we have weight maps? 85 99 86 ppMergeType type = psMetadataLookupS32(NULL, config->arguments, "TYPE"); // Type of frame87 psMetadata *inputs = psMetadataLookupMetadata(NULL, config->arguments, "INPUTS"); // The inputs info88 psMetadataIterator *iter = psMetadataIteratorAlloc(inputs, PS_LIST_HEAD, NULL); // Iterator89 psMetadataItem *item; // Item from iteration90 int numFiles = 0; // Number of files100 ppMergeType type = psMetadataLookupS32(NULL, config->arguments, "TYPE"); ///< Type of frame 101 psMetadata *inputs = psMetadataLookupMetadata(NULL, config->arguments, "INPUTS"); ///< The inputs info 102 psMetadataIterator *iter = psMetadataIteratorAlloc(inputs, PS_LIST_HEAD, NULL); ///< Iterator 103 psMetadataItem *item; ///< Item from iteration 104 int numFiles = 0; ///< Number of files 91 105 while ((item = psMetadataGetAndIncrement(iter))) { 92 106 if (item->type != PS_DATA_METADATA) { … … 97 111 } 98 112 99 psMetadata *input = item->data.md; // The input metadata of interest100 101 psString image = psMetadataLookupStr(NULL, input, "IMAGE"); // Name of image113 psMetadata *input = item->data.md; ///< The input metadata of interest 114 115 psString image = psMetadataLookupStr(NULL, input, "IMAGE"); ///< Name of image 102 116 if (!image || strlen(image) == 0) { 103 117 psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Component %s lacks IMAGE of type STR", item->name); … … 107 121 108 122 bool mdok; 109 psString mask = psMetadataLookupStr(&mdok, input, "MASK"); // Name of mask110 psString weight = psMetadataLookupStr(&mdok, input, "WEIGHT"); // Name of weight map123 psString mask = psMetadataLookupStr(&mdok, input, "MASK"); ///< Name of mask 124 psString weight = psMetadataLookupStr(&mdok, input, "WEIGHT"); ///< Name of weight map 111 125 112 126 // Add the image file 113 psArray *imageFiles = psArrayAlloc(1); // Array of filenames for this FPA127 psArray *imageFiles = psArrayAlloc(1); ///< Array of filenames for this FPA 114 128 imageFiles->data[0] = psMemIncrRefCounter(image); 115 129 psMetadataAddArray(config->arguments, PS_LIST_TAIL, "IMAGE.FILENAMES", PS_META_REPLACE, … … 130 144 // Optionally add the mask file 131 145 if (mask && strlen(mask) > 0) { 132 psArray *maskFiles = psArrayAlloc(1); // Array of filenames for this FPA146 psArray *maskFiles = psArrayAlloc(1); ///< Array of filenames for this FPA 133 147 maskFiles->data[0] = psMemIncrRefCounter(mask); 134 148 psMetadataAddArray(config->arguments, PS_LIST_TAIL, "MASK.FILENAMES", PS_META_REPLACE, … … 153 167 if (weight && strlen(weight) > 0) { 154 168 haveWeights = true; 155 psArray *weightFiles = psArrayAlloc(1); // Array of filenames for this FPA169 psArray *weightFiles = psArrayAlloc(1); ///< Array of filenames for this FPA 156 170 weightFiles->data[0] = psMemIncrRefCounter(weight); 157 171 psMetadataAddArray(config->arguments, PS_LIST_TAIL, "WEIGHT.FILENAMES", PS_META_REPLACE, … … 219 233 } 220 234 221 psMetadata *format = NULL; // Camera format222 pmFPAview *phuView = NULL; // View to PHU235 psMetadata *format = NULL; ///< Camera format 236 pmFPAview *phuView = NULL; ///< View to PHU 223 237 for (int i = 0; i < numFiles; i++) { 224 pmFPAfile *input = pmFPAfileSelectSingle(config->files, "PPMERGE.INPUT", i); // File of interest225 pmFPA *fpa = input->fpa; // FPA of interest238 pmFPAfile *input = pmFPAfileSelectSingle(config->files, "PPMERGE.INPUT", i); ///< File of interest 239 pmFPA *fpa = input->fpa; ///< FPA of interest 226 240 CHECK_LEVEL(fpa->hdu, -1, -1); 227 psArray *chips = fpa->chips; // Array of chips241 psArray *chips = fpa->chips; ///< Array of chips 228 242 for (int j = 0; j < chips->n; j++) { 229 pmChip *chip = chips->data[j]; // Chip of interest243 pmChip *chip = chips->data[j]; ///< Chip of interest 230 244 CHECK_LEVEL(chip->hdu, j, -1); 231 psArray *cells = chip->cells; // Array of cells245 psArray *cells = chip->cells; ///< Array of cells 232 246 for (int k = 0; k < cells->n; k++) { 233 pmCell *cell = cells->data[k]; // Cell of interest247 pmCell *cell = cells->data[k]; ///< Cell of interest 234 248 CHECK_LEVEL(cell->hdu, j, k); 235 249 } … … 245 259 // Otherwise the abundance of metadata in the concepts (esp. for GPC) can overload the memory 246 260 for (int i = 0; i < numFiles; i++) { 247 pmFPAfile *input = pmFPAfileSelectSingle(config->files, "PPMERGE.INPUT", i); // File of interest248 pmFPA *fpa = input->fpa; // FPA of interest249 psArray *chips = fpa->chips; // Array of chips in output261 pmFPAfile *input = pmFPAfileSelectSingle(config->files, "PPMERGE.INPUT", i); ///< File of interest 262 pmFPA *fpa = input->fpa; ///< FPA of interest 263 psArray *chips = fpa->chips; ///< Array of chips in output 250 264 for (int i = 0; i < chips->n; i++) { 251 pmChip *chip = chips->data[i]; // Chip of interest252 psArray *cells = chip->cells; // Array of cells253 int culled = 0; // Number of culled cells265 pmChip *chip = chips->data[i]; ///< Chip of interest 266 psArray *cells = chip->cells; ///< Array of cells 267 int culled = 0; ///< Number of culled cells 254 268 for (int j = 0; j < cells->n; j++) { 255 269 pmCell *cell = cells->data[j]; 256 pmHDU *hdu = pmHDUGetLowest(fpa, chip, cell); // HDU for cell270 pmHDU *hdu = pmHDUGetLowest(fpa, chip, cell); ///< HDU for cell 257 271 if (!hdu || hdu->blankPHU) { 258 272 cell->data_exists = false; … … 278 292 // Count the cells 279 293 { 280 int numCells = 0; // Number of cells281 pmFPAfile *input = pmFPAfileSelectSingle(config->files, "PPMERGE.INPUT", 0); // Representative file282 pmFPA *fpa = input->fpa; // FPA for file283 psArray *chips = fpa->chips; // Array of chips294 int numCells = 0; ///< Number of cells 295 pmFPAfile *input = pmFPAfileSelectSingle(config->files, "PPMERGE.INPUT", 0); ///< Representative file 296 pmFPA *fpa = input->fpa; ///< FPA for file 297 psArray *chips = fpa->chips; ///< Array of chips 284 298 for (int i = 0; i < chips->n; i++) { 285 pmChip *chip = chips->data[i]; // Chip of interest286 psArray *cells = chip->cells; // Array of cells299 pmChip *chip = chips->data[i]; ///< Chip of interest 300 psArray *cells = chip->cells; ///< Array of cells 287 301 for (int j = 0; j < cells->n; j++) { 288 pmCell *cell = cells->data[j]; // Cell of interest289 pmHDU *hdu = pmHDUGetLowest(fpa, chip, cell); // HDU that would have data302 pmCell *cell = cells->data[j]; ///< Cell of interest 303 pmHDU *hdu = pmHDUGetLowest(fpa, chip, cell); ///< HDU that would have data 290 304 if (hdu && !hdu->blankPHU) { 291 305 numCells++; … … 298 312 } 299 313 300 psString outName = ppMergeOutputFile(config); // Name of output file301 302 pmFPAfileType fileType = PM_FPA_FILE_NONE; // Type of output file314 psString outName = ppMergeOutputFile(config); ///< Name of output file 315 316 pmFPAfileType fileType = PM_FPA_FILE_NONE; ///< Type of output file 303 317 switch (type) { 304 318 case PPMERGE_TYPE_BIAS: -
trunk/ppMerge/src/ppMergeErrorCodes.c.in
r11259 r21244 1 /** @file ppMergeErrorCodes.c.in 2 * 3 * @brief 4 * 5 * @ingroup ppMerge 6 * 7 * @author IfA 8 * @version $Revision: 1.2 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2009-02-01 21:43:05 $ 10 * Copyright 2009 Institute for Astronomy, University of Hawaii 11 */ 12 13 #include "pslib.h" 14 #include "ppMergeErrorCodes.h" 15 1 16 /* 2 17 * The line … … 5 20 * will be replaced by values from errorCodes.dat 6 21 */ 7 #include "pslib.h"8 #include "ppMergeErrorCodes.h"9 10 22 void ppMergeErrorRegister(void) 11 23 { … … 14 26 { PPMERGE_ERR_${ErrorCode}, "${ErrorDescription}"}, 15 27 }; 16 static int nerror = PPMERGE_ERR_NERROR - PPMERGE_ERR_BASE; // number of values in enum28 static int nerror = PPMERGE_ERR_NERROR - PPMERGE_ERR_BASE; ///< number of values in enum 17 29 18 30 for (int i = 0; i < nerror; i++) { … … 21 33 *tmp = errors[i]; 22 34 psErrorRegister(tmp, 1); 23 psFree(tmp); / * it's on the internal list */35 psFree(tmp); // it's on the internal list 24 36 } 25 37 nerror = 0; // don't register more than once -
trunk/ppMerge/src/ppMergeErrorCodes.h.in
r11260 r21244 1 /** @file ppMergeErrorCodes.h.in 2 * 3 * @brief 4 * 5 * @ingroup ppMerge 6 * 7 * @author IfA 8 * @version $Revision: 1.2 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2009-02-01 21:43:05 $ 10 * Copyright 2009 Institute for Astronomy, University of Hawaii 11 */ 12 1 13 #if !defined(PPMERGE_ERROR_CODES_H) 2 14 #define PPMERGE_ERROR_CODES_H -
trunk/ppMerge/src/ppMergeFileGroup.c
r19288 r21244 1 /** @file ppMergeFileGroup.c 2 * 3 * @brief 4 * 5 * @ingroup ppMerge 6 * 7 * @author IfA 8 * @version $Revision: 1.3 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2009-02-01 21:43:05 $ 10 * Copyright 2009 Institute for Astronomy, University of Hawaii 11 */ 12 1 13 # include "ppMerge.h" 2 14 -
trunk/ppMerge/src/ppMergeFiles.c
r20887 r21244 1 /** @file ppMergeFiles.c 2 * 3 * @brief 4 * 5 * @ingroup ppMerge 6 * 7 * @author IfA 8 * @version $Revision: 1.7 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2009-02-01 21:43:05 $ 10 * Copyright 2009 Institute for Astronomy, University of Hawaii 11 */ 12 1 13 #include "ppMerge.h" 2 14 3 15 const char *allFiles[] = { "PPMERGE.INPUT", "PPMERGE.INPUT.MASK", "PPMERGE.INPUT.WEIGHT", 4 16 "PPMERGE.OUTPUT", "PPMERGE.OUTPUT.COUNT", "PPMERGE.OUTPUT.SIGMA", 5 NULL }; // All files17 NULL }; ///< All files 6 18 const char *inputFiles[] = { "PPMERGE.INPUT", "PPMERGE.INPUT.MASK", "PPMERGE.INPUT.WEIGHT", 7 NULL }; // Input files19 NULL }; ///< Input files 8 20 const char *outputFiles[] = { "PPMERGE.OUTPUT", "PPMERGE.OUTPUT.COUNT", "PPMERGE.OUTPUT.SIGMA", 9 NULL }; // Output files 10 11 // Select file list based on enum 21 NULL }; ///< Output files 22 23 /** 24 * Select file list based on enum 25 */ 12 26 static const char **selectFiles(ppMergeFiles files) 13 27 { -
trunk/ppMerge/src/ppMergeLoop.c
r21183 r21244 1 /** @file ppMergeLoop.c 2 * 3 * @brief 4 * 5 * @ingroup ppMerge 6 * 7 * @author IfA 8 * @version $Revision: 1.14 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2009-02-01 21:43:05 $ 10 * Copyright 2009 Institute for Astronomy, University of Hawaii 11 */ 12 1 13 #include "ppMerge.h" 2 14 … … 5 17 assert(config); 6 18 7 psMetadata *arguments = config->arguments; // Arguments8 ppMergeType type = psMetadataLookupS32(NULL, config->arguments, "TYPE"); // Type of frame9 int numFiles = psMetadataLookupS32(NULL, arguments, "INPUTS.NUM"); // Number of input files10 bool mdok; // Status of MD lookup11 bool haveMasks = psMetadataLookupBool(&mdok, arguments, "INPUTS.MASKS"); // Do we have masks?12 bool haveWeights = psMetadataLookupBool(&mdok, arguments, "INPUTS.WEIGHTS"); // Do we have weights?13 14 psArray *inputs = ppMergeFileDataLevel(config, "PPMERGE.INPUT", PM_FPA_LEVEL_READOUT); // Input images15 psArray *masks = NULL, *weights = NULL; // Input masks and weights19 psMetadata *arguments = config->arguments; ///< Arguments 20 ppMergeType type = psMetadataLookupS32(NULL, config->arguments, "TYPE"); ///< Type of frame 21 int numFiles = psMetadataLookupS32(NULL, arguments, "INPUTS.NUM"); ///< Number of input files 22 bool mdok; ///< Status of MD lookup 23 bool haveMasks = psMetadataLookupBool(&mdok, arguments, "INPUTS.MASKS"); ///< Do we have masks? 24 bool haveWeights = psMetadataLookupBool(&mdok, arguments, "INPUTS.WEIGHTS"); ///< Do we have weights? 25 26 psArray *inputs = ppMergeFileDataLevel(config, "PPMERGE.INPUT", PM_FPA_LEVEL_READOUT); ///< Input images 27 psArray *masks = NULL, *weights = NULL; ///< Input masks and weights 16 28 if (haveMasks) { 17 29 masks = ppMergeFileDataLevel(config, "PPMERGE.INPUT.MASK", PM_FPA_LEVEL_READOUT); … … 21 33 } 22 34 23 / / General combination parameters24 int rows = psMetadataLookupS32(NULL, arguments, "ROWS"); // Number of rows to read per chunk25 int iter = psMetadataLookupS32(NULL, arguments, "ITER"); // Number of rejection iterations26 float rej = psMetadataLookupF32(NULL, arguments, "REJ"); // Rejection level27 float fraclow = psMetadataLookupF32(NULL, arguments, "FRACLOW"); // Reject fraction of low pixels28 float frachigh = psMetadataLookupF32(NULL, arguments, "FRACHIGH"); // Reject fraction of hi pixels29 int nKeep = psMetadataLookupS32(NULL, arguments, "NKEEP"); // Minimum number of values to keep30 psStatsOptions combineStat = psMetadataLookupS32(NULL, arguments, "COMBINE"); // Combination statistic31 bool useWeights = psMetadataLookupBool(NULL, arguments, "WEIGHTS"); // Use weights?32 33 / / Fringe parameters34 int fringeNum = psMetadataLookupS32(NULL, arguments, "FRINGE.NUM"); // Number of fringe points35 int fringeSize = psMetadataLookupS32(NULL, arguments, "FRINGE.SIZE"); // Size of fringe regions36 int fringeSmoothX = psMetadataLookupS32(NULL, arguments, "FRINGE.XSMOOTH"); // Smoothing regions in x37 int fringeSmoothY = psMetadataLookupS32(NULL, arguments, "FRINGE.YSMOOTH"); // Smoothing regions in y35 /** General combination parameters */ 36 int rows = psMetadataLookupS32(NULL, arguments, "ROWS"); ///< Number of rows to read per chunk 37 int iter = psMetadataLookupS32(NULL, arguments, "ITER"); ///< Number of rejection iterations 38 float rej = psMetadataLookupF32(NULL, arguments, "REJ"); ///< Rejection level 39 float fraclow = psMetadataLookupF32(NULL, arguments, "FRACLOW"); ///< Reject fraction of low pixels 40 float frachigh = psMetadataLookupF32(NULL, arguments, "FRACHIGH"); ///< Reject fraction of hi pixels 41 int nKeep = psMetadataLookupS32(NULL, arguments, "NKEEP"); ///< Minimum number of values to keep 42 psStatsOptions combineStat = psMetadataLookupS32(NULL, arguments, "COMBINE"); ///< Combination statistic 43 bool useWeights = psMetadataLookupBool(NULL, arguments, "WEIGHTS"); ///< Use weights? 44 45 /** Fringe parameters */ 46 int fringeNum = psMetadataLookupS32(NULL, arguments, "FRINGE.NUM"); ///* Number of fringe points 47 int fringeSize = psMetadataLookupS32(NULL, arguments, "FRINGE.SIZE"); ///* Size of fringe regions 48 int fringeSmoothX = psMetadataLookupS32(NULL, arguments, "FRINGE.XSMOOTH"); ///< Smoothing regions in x 49 int fringeSmoothY = psMetadataLookupS32(NULL, arguments, "FRINGE.YSMOOTH"); ///< Smoothing regions in y 38 50 39 51 // set the mask and mark bit values based on the named masks … … 45 57 } 46 58 47 pmCombineParams *combination = pmCombineParamsAlloc(combineStat); // Combination parameters59 pmCombineParams *combination = pmCombineParamsAlloc(combineStat); ///< Combination parameters 48 60 combination->maskVal = maskVal; 49 61 combination->blank = pmConfigMaskGet("BLANK", config); … … 55 67 combination->weights = useWeights; 56 68 57 psMetadata *stats = NULL; // Statistics for output69 psMetadata *stats = NULL; ///< Statistics for output 58 70 if (psMetadataLookup(config->arguments, "STATS.NAME")) { 59 71 stats = psMetadataAlloc(); … … 61 73 } 62 74 63 pmFPAview *view = pmFPAviewAlloc(0); // View to component of interest75 pmFPAview *view = pmFPAviewAlloc(0); ///< View to component of interest 64 76 65 77 // Retrieve data placed on analysis 66 psVector *scales = NULL, *zeros = NULL; // Scale and zeroes for combination67 psArray *shutters = NULL; // Shutter correction data78 psVector *scales = NULL, *zeros = NULL; ///< Scale and zeroes for combination 79 psArray *shutters = NULL; ///< Shutter correction data 68 80 switch (type) { 69 81 case PPMERGE_TYPE_FRINGE: … … 97 109 98 110 // Dark parameters 99 psArray *darkOrdinates = psMetadataLookupPtr(NULL, arguments, "DARK.ORDINATES"); // Dark info100 psString darkNorm = psMetadataLookupStr(&mdok, arguments, "DARK.NORM"); // Dark normalisation111 psArray *darkOrdinates = psMetadataLookupPtr(NULL, arguments, "DARK.ORDINATES"); ///< Dark info 112 psString darkNorm = psMetadataLookupStr(&mdok, arguments, "DARK.NORM"); ///< Dark normalisation 101 113 102 114 … … 105 117 goto ERROR; 106 118 } 107 psString outName = ppMergeOutputFile(config); // Name of output file108 pmFPAfile *output = psMetadataLookupPtr(NULL, config->files, outName); // Output file119 psString outName = ppMergeOutputFile(config); ///< Name of output file 120 pmFPAfile *output = psMetadataLookupPtr(NULL, config->files, outName); ///< Output file 109 121 psFree(outName); 110 122 assert(output && output->fpa); 111 pmFPA *outFPA = output->fpa; // Output FPA112 int cellNum = 0; // Index of cell123 pmFPA *outFPA = output->fpa; ///< Output FPA 124 int cellNum = 0; ///< Index of cell 113 125 if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) { 114 126 goto ERROR; 115 127 } 116 pmChip *outChip; // Chip of interest128 pmChip *outChip; ///< Chip of interest 117 129 while ((outChip = pmFPAviewNextChip(view, outFPA, 1))) { 118 130 if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) { 119 131 goto ERROR; 120 132 } 121 pmCell *outCell; // Cell of interest133 pmCell *outCell; ///< Cell of interest 122 134 while ((outCell = pmFPAviewNextCell(view, outFPA, 1))) { 123 135 if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) { … … 125 137 } 126 138 127 pmHDU *hdu = pmHDUGetLowest(outFPA, outChip, outCell); // HDU for cell139 pmHDU *hdu = pmHDUGetLowest(outFPA, outChip, outCell); ///< HDU for cell 128 140 if (!hdu || hdu->blankPHU) { 129 141 // No data here … … 133 145 pmReadout *outRO = pmReadoutAlloc(outCell); 134 146 135 psArray *readouts = psArrayAlloc(numFiles); // Input readouts147 psArray *readouts = psArrayAlloc(numFiles); ///< Input readouts 136 148 for (int i = 0; i < numFiles; i++) { 137 149 // We need to do some of the opening ourselves … … 142 154 143 155 pmFPAfile *input = pmFPAfileSelectSingle(config->files, "PPMERGE.INPUT", i); 144 pmCell *inCell = pmFPAviewThisCell(view, input->fpa); // Input cell156 pmCell *inCell = pmFPAviewThisCell(view, input->fpa); ///< Input cell 145 157 readouts->data[i] = pmReadoutAlloc(inCell); 146 158 } 147 159 148 float shutterRef = NAN; // Reference shutter correction160 float shutterRef = NAN; ///< Reference shutter correction 149 161 if (type == PPMERGE_TYPE_SHUTTER) { 150 162 shutterRef = pmShutterCorrectionReference(shutters->data[cellNum]); … … 156 168 psTrace("ppStack", 2, "Initial stack of chunk %d....\n", numChunk); 157 169 for (int i = 0; i < numFiles; i++) { 158 pmReadout *inRO = readouts->data[i]; // Input readout170 pmReadout *inRO = readouts->data[i]; ///< Input readout 159 171 160 172 // Read a chunk from a file … … 229 241 230 242 // Get list of cells for concepts averaging 231 psList *inCells = psListAlloc(NULL); // List of cells243 psList *inCells = psListAlloc(NULL); ///< List of cells 232 244 for (int i = 0; i < numFiles; i++) { 233 pmReadout *readout = readouts->data[i]; // Readout of interest245 pmReadout *readout = readouts->data[i]; ///< Readout of interest 234 246 psListAdd(inCells, PS_LIST_TAIL, readout->parent); 235 247 } … … 247 259 { 248 260 pmCell *countsCell = pmFPAfileThisCell(config->files, view, "PPMERGE.OUTPUT.COUNT"); 249 pmReadout *countsRO = pmReadoutAlloc(countsCell); // Readout with count of inputs per pixel261 pmReadout *countsRO = pmReadoutAlloc(countsCell); ///< Readout with count of inputs per pixel 250 262 psImage *counts = psMetadataLookupPtr(NULL, outRO->analysis, PM_READOUT_STACK_ANALYSIS_COUNT); 251 263 countsRO->image = psImageCopy(countsRO->image, counts, PS_TYPE_F32); … … 263 275 264 276 pmCell *sigmaCell = pmFPAfileThisCell(config->files, view, "PPMERGE.OUTPUT.SIGMA"); 265 pmReadout *sigmaRO = pmReadoutAlloc(sigmaCell); // Readout with stdev per pixel277 pmReadout *sigmaRO = pmReadoutAlloc(sigmaCell); ///< Readout with stdev per pixel 266 278 psImage *sigma = psMetadataLookupPtr(NULL, outRO->analysis, PM_READOUT_STACK_ANALYSIS_SIGMA); 267 279 sigmaRO->image = psImageCopy(sigmaRO->image, sigma, PS_TYPE_F32); … … 297 309 } 298 310 299 psArray *fringes = psArrayAlloc(1); // Array of fringes311 psArray *fringes = psArrayAlloc(1); ///< Array of fringes 300 312 fringes->data[0] = fringe; 301 313 … … 336 348 337 349 // Get list of FPAs for concepts averaging 338 psList *inFPAs = psListAlloc(NULL); // List of FPAs350 psList *inFPAs = psListAlloc(NULL); ///< List of FPAs 339 351 for (int i = 0; i < numFiles; i++) { 340 pmFPAfile *input = inputs->data[i]; // Input file352 pmFPAfile *input = inputs->data[i]; ///< Input file 341 353 psListAdd(inFPAs, PS_LIST_TAIL, input->fpa); 342 354 } -
trunk/ppMerge/src/ppMergeLoop_Threaded.c
r21183 r21244 1 /** @file ppMergeLoop_Threaded.c 2 * 3 * @brief 4 * 5 * @ingroup ppMerge 6 * 7 * @author IfA 8 * @version $Revision: 1.8 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2009-02-01 21:43:05 $ 10 * Copyright 2009 Institute for Astronomy, University of Hawaii 11 */ 12 1 13 #ifdef HAVE_CONFIG_H 2 14 #include <config.h> … … 19 31 assert(config); 20 32 21 psMetadata *arguments = config->arguments; // Arguments22 ppMergeType type = psMetadataLookupS32(NULL, config->arguments, "TYPE"); // Type of frame23 int numFiles = psMetadataLookupS32(NULL, arguments, "INPUTS.NUM"); // Number of input files24 bool mdok; // Status of MD lookup33 psMetadata *arguments = config->arguments; ///< Arguments 34 ppMergeType type = psMetadataLookupS32(NULL, config->arguments, "TYPE"); ///< Type of frame 35 int numFiles = psMetadataLookupS32(NULL, arguments, "INPUTS.NUM"); ///< Number of input files 36 bool mdok; ///< Status of MD lookup 25 37 bool haveMasks = psMetadataLookupBool(&mdok, arguments, "INPUTS.MASKS"); // Do we have masks? 26 bool haveWeights = psMetadataLookupBool(&mdok, arguments, "INPUTS.WEIGHTS"); // Do we have weights?27 28 psArray *inputs = ppMergeFileDataLevel(config, "PPMERGE.INPUT", PM_FPA_LEVEL_READOUT); // Input images29 psArray *masks = NULL, *weights = NULL; // Input masks and weights38 bool haveWeights = psMetadataLookupBool(&mdok, arguments, "INPUTS.WEIGHTS"); ///< Do we have weights? 39 40 psArray *inputs = ppMergeFileDataLevel(config, "PPMERGE.INPUT", PM_FPA_LEVEL_READOUT); ///< Input images 41 psArray *masks = NULL, *weights = NULL; ///< Input masks and weights 30 42 if (haveMasks) { 31 43 masks = ppMergeFileDataLevel(config, "PPMERGE.INPUT.MASK", PM_FPA_LEVEL_READOUT); … … 38 50 if (!mdok) nThreads = 0; 39 51 40 / / General combination parameters41 int iter = psMetadataLookupS32(NULL, arguments, "ITER"); // Number of rejection iterations42 float rej = psMetadataLookupF32(NULL, arguments, "REJ"); // Rejection level43 float fraclow = psMetadataLookupF32(NULL, arguments, "FRACLOW"); // Reject fraction of low pixels44 float frachigh = psMetadataLookupF32(NULL, arguments, "FRACHIGH"); // Reject fraction of hi pixels45 int nKeep = psMetadataLookupS32(NULL, arguments, "NKEEP"); // Minimum number of values to keep46 psStatsOptions combineStat = psMetadataLookupS32(NULL, arguments, "COMBINE"); // Combination statistic47 bool useWeights = psMetadataLookupBool(NULL, arguments, "WEIGHTS"); // Use weights?48 49 / / Fringe parameters50 int fringeNum = psMetadataLookupS32(NULL, arguments, "FRINGE.NUM"); // Number of fringe points51 int fringeSize = psMetadataLookupS32(NULL, arguments, "FRINGE.SIZE"); // Size of fringe regions52 int fringeSmoothX = psMetadataLookupS32(NULL, arguments, "FRINGE.XSMOOTH"); // Smoothing regions in x53 int fringeSmoothY = psMetadataLookupS32(NULL, arguments, "FRINGE.YSMOOTH"); // Smoothing regions in y52 /** General combination parameters */ 53 int iter = psMetadataLookupS32(NULL, arguments, "ITER"); ///< Number of rejection iterations 54 float rej = psMetadataLookupF32(NULL, arguments, "REJ"); ///< Rejection level 55 float fraclow = psMetadataLookupF32(NULL, arguments, "FRACLOW"); ///< Reject fraction of low pixels 56 float frachigh = psMetadataLookupF32(NULL, arguments, "FRACHIGH"); ///< Reject fraction of hi pixels 57 int nKeep = psMetadataLookupS32(NULL, arguments, "NKEEP"); ///< Minimum number of values to keep 58 psStatsOptions combineStat = psMetadataLookupS32(NULL, arguments, "COMBINE"); ///< Combination statistic 59 bool useWeights = psMetadataLookupBool(NULL, arguments, "WEIGHTS"); ///< Use weights? 60 61 /** Fringe parameters */ 62 int fringeNum = psMetadataLookupS32(NULL, arguments, "FRINGE.NUM"); ///< Number of fringe points 63 int fringeSize = psMetadataLookupS32(NULL, arguments, "FRINGE.SIZE"); ///< Size of fringe regions 64 int fringeSmoothX = psMetadataLookupS32(NULL, arguments, "FRINGE.XSMOOTH"); ///< Smoothing regions in x 65 int fringeSmoothY = psMetadataLookupS32(NULL, arguments, "FRINGE.YSMOOTH"); ///< Smoothing regions in y 54 66 55 67 // set the mask and mark bit values based on the named masks … … 61 73 } 62 74 63 pmCombineParams *combination = pmCombineParamsAlloc(combineStat); // Combination parameters75 pmCombineParams *combination = pmCombineParamsAlloc(combineStat); ///< Combination parameters 64 76 combination->maskVal = maskVal; 65 77 combination->blank = pmConfigMaskGet("BLANK", config); … … 71 83 combination->weights = useWeights; 72 84 73 psMetadata *stats = NULL; // Statistics for output85 psMetadata *stats = NULL; ///< Statistics for output 74 86 if (psMetadataLookup(config->arguments, "STATS.NAME")) { 75 87 stats = psMetadataAlloc(); … … 80 92 81 93 // Retrieve data placed on analysis 82 psVector *scales = NULL, *zeros = NULL; // Scale and zeroes for combination83 psArray *shutters = NULL; // Shutter correction data94 psVector *scales = NULL, *zeros = NULL; ///< Scale and zeroes for combination 95 psArray *shutters = NULL; ///< Shutter correction data 84 96 switch (type) { 85 97 case PPMERGE_TYPE_FRINGE: … … 113 125 114 126 // Dark parameters 115 psArray *darkOrdinates = psMetadataLookupPtr(NULL, arguments, "DARK.ORDINATES"); // Dark info116 psString darkNorm = psMetadataLookupStr(&mdok, arguments, "DARK.NORM"); // Dark normalisation127 psArray *darkOrdinates = psMetadataLookupPtr(NULL, arguments, "DARK.ORDINATES"); ///< Dark info 128 psString darkNorm = psMetadataLookupStr(&mdok, arguments, "DARK.NORM"); ///< Dark normalisation 117 129 118 130 … … 121 133 goto ERROR; 122 134 } 123 psString outName = ppMergeOutputFile(config); // Name of output file124 pmFPAfile *output = psMetadataLookupPtr(NULL, config->files, outName); // Output file135 psString outName = ppMergeOutputFile(config); ///< Name of output file 136 pmFPAfile *output = psMetadataLookupPtr(NULL, config->files, outName); ///< Output file 125 137 psFree(outName); 126 138 assert(output && output->fpa); 127 pmFPA *outFPA = output->fpa; // Output FPA128 int cellNum = 0; // Index of cell139 pmFPA *outFPA = output->fpa; ///< Output FPA 140 int cellNum = 0; ///< Index of cell 129 141 if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) { 130 142 goto ERROR; 131 143 } 132 pmChip *outChip; // Chip of interest144 pmChip *outChip; ///< Chip of interest 133 145 while ((outChip = pmFPAviewNextChip(view, outFPA, 1))) { 134 146 if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) { 135 147 goto ERROR; 136 148 } 137 pmCell *outCell; // Cell of interest149 pmCell *outCell; ///< Cell of interest 138 150 while ((outCell = pmFPAviewNextCell(view, outFPA, 1))) { 139 151 if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) { … … 141 153 } 142 154 143 pmHDU *hdu = pmHDUGetLowest(outFPA, outChip, outCell); // HDU for cell155 pmHDU *hdu = pmHDUGetLowest(outFPA, outChip, outCell); ///< HDU for cell 144 156 if (!hdu || hdu->blankPHU) { 145 157 // No data here … … 147 159 } 148 160 149 float shutterRef = NAN; // Reference shutter correction161 float shutterRef = NAN; ///< Reference shutter correction 150 162 pmReadout *pattern = NULL; 151 163 if (type == PPMERGE_TYPE_SHUTTER) { … … 169 181 // Generate readouts for each input file in each file group 170 182 for (int i = 0; i < fileGroups->n; i++) { 171 psArray *readouts = psArrayAlloc(numFiles); // Input readouts183 psArray *readouts = psArrayAlloc(numFiles); ///< Input readouts 172 184 for (int j = 0; j < numFiles; j++) { 173 185 pmFPAfile *input = pmFPAfileSelectSingle(config->files, "PPMERGE.INPUT", j); 174 pmCell *inCell = pmFPAviewThisCell(view, input->fpa); // Input cell186 pmCell *inCell = pmFPAviewThisCell(view, input->fpa); ///< Input cell 175 187 readouts->data[j] = pmReadoutAlloc(inCell); 176 188 } … … 234 246 case PPMERGE_TYPE_FLAT: 235 247 case PPMERGE_TYPE_FRINGE: { 236 psThreadJob *job = psThreadJobAlloc("PPMERGE_READOUT_COMBINE"); // Job to start248 psThreadJob *job = psThreadJobAlloc("PPMERGE_READOUT_COMBINE"); ///< Job to start 237 249 238 250 // Construct the arguments for this job … … 250 262 } 251 263 case PPMERGE_TYPE_DARK: { 252 psThreadJob *job = psThreadJobAlloc ("PPMERGE_DARK_COMBINE"); // Job to start264 psThreadJob *job = psThreadJobAlloc ("PPMERGE_DARK_COMBINE"); ///< Job to start 253 265 254 266 // construct the arguments for this job … … 311 323 for (int i = 0; i < numFiles; i++) { 312 324 pmFPAfile *input = pmFPAfileSelectSingle(config->files, "PPMERGE.INPUT", i); 313 pmCell *inCell = pmFPAviewThisCell(view, input->fpa); // Input cell325 pmCell *inCell = pmFPAviewThisCell(view, input->fpa); ///< Input cell 314 326 psListAdd(inCells, PS_LIST_TAIL, inCell); 315 327 } … … 325 337 { 326 338 pmCell *countsCell = pmFPAfileThisCell(config->files, view, "PPMERGE.OUTPUT.COUNT"); 327 pmReadout *countsRO = pmReadoutAlloc(countsCell); // Readout with count of inputs per pixel339 pmReadout *countsRO = pmReadoutAlloc(countsCell); ///< Readout with count of inputs per pixel 328 340 psImage *counts = psMetadataLookupPtr(NULL, outRO->analysis, PM_READOUT_STACK_ANALYSIS_COUNT); 329 341 countsRO->image = psImageCopy(countsRO->image, counts, PS_TYPE_F32); … … 341 353 342 354 pmCell *sigmaCell = pmFPAfileThisCell(config->files, view, "PPMERGE.OUTPUT.SIGMA"); 343 pmReadout *sigmaRO = pmReadoutAlloc(sigmaCell); // Readout with stdev per pixel355 pmReadout *sigmaRO = pmReadoutAlloc(sigmaCell); ///< Readout with stdev per pixel 344 356 psImage *sigma = psMetadataLookupPtr(NULL, outRO->analysis, PM_READOUT_STACK_ANALYSIS_SIGMA); 345 357 sigmaRO->image = psImageCopy(sigmaRO->image, sigma, PS_TYPE_F32); … … 375 387 } 376 388 377 psArray *fringes = psArrayAlloc(1); // Array of fringes389 psArray *fringes = psArrayAlloc(1); ///< Array of fringes 378 390 fringes->data[0] = fringe; 379 391 … … 414 426 415 427 // Get list of FPAs for concepts averaging 416 psList *inFPAs = psListAlloc(NULL); // List of FPAs428 psList *inFPAs = psListAlloc(NULL); ///< List of FPAs 417 429 for (int i = 0; i < numFiles; i++) { 418 pmFPAfile *input = inputs->data[i]; // Input file430 pmFPAfile *input = inputs->data[i]; ///< Input file 419 431 psListAdd(inFPAs, PS_LIST_TAIL, input->fpa); 420 432 } -
trunk/ppMerge/src/ppMergeMask.c
r21183 r21244 1 /** @file ppMergeMask.c 2 * 3 * @brief 4 * 5 * @ingroup ppMerge 6 * 7 * @author IfA 8 * @version $Revision: 1.17 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2009-02-01 21:43:05 $ 10 * Copyright 2009 Institute for Astronomy, University of Hawaii 11 */ 12 1 13 #include "ppMerge.h" 2 14 3 static bool mergeMask(pmConfig *config, // Configuration4 const pmFPAview *view, // View to chip5 bool writeOut, // Write output?6 psRandom *rng, // Random number generator7 psMetadata *stats // Statistics output15 static bool mergeMask(pmConfig *config, ///< Configuration 16 const pmFPAview *view, ///< View to chip 17 bool writeOut, ///< Write output? 18 psRandom *rng, ///< Random number generator 19 psMetadata *stats ///< Statistics output 8 20 ) 9 21 { … … 12 24 assert(view->chip != -1 && view->cell == -1 && view->readout == -1); 13 25 14 bool mdok; // Status of MD lookup15 int numFiles = psMetadataLookupS32(NULL, config->arguments, "INPUTS.NUM"); // Number of input files16 psStatsOptions meanStat = psMetadataLookupS32(NULL, config->arguments, "MEAN"); // Statistic for mean17 psStatsOptions stdevStat = psMetadataLookupS32(NULL, config->arguments, "STDEV"); // Statistic for stdev18 int sample = psMetadataLookupS32(NULL, config->arguments, "SAMPLE"); // Size of sample for statistics19 bool chipStats = psMetadataLookupBool(&mdok, config->arguments, "MASK.CHIPSTATS"); // Statistics on chip?20 float maskSuspect = psMetadataLookupF32(NULL, config->arguments, "MASK.SUSPECT"); // Threshold for suspect pixels21 float maskBad = psMetadataLookupF32(NULL, config->arguments, "MASK.BAD"); // Threshold for bad pixels22 pmMaskIdentifyMode maskMode = psMetadataLookupS32(NULL, config->arguments, "MASK.MODE"); // Mode for identifying bad pixels23 int maskGrow = psMetadataLookupS32(NULL, config->arguments, "MASK.GROW"); // Radius to grow mask24 25 bool smoothSuspect = psMetadataLookupBool(&mdok, config->arguments, "MASK.SMOOTH.SUSPECT"); // Radius to grow mask26 float smoothScale = psMetadataLookupF32(&mdok, config->arguments, "MASK.SMOOTH.SCALE"); // Radius to grow mask26 bool mdok; ///< Status of MD lookup 27 int numFiles = psMetadataLookupS32(NULL, config->arguments, "INPUTS.NUM"); ///< Number of input files 28 psStatsOptions meanStat = psMetadataLookupS32(NULL, config->arguments, "MEAN"); ///< Statistic for mean 29 psStatsOptions stdevStat = psMetadataLookupS32(NULL, config->arguments, "STDEV"); ///< Statistic for stdev 30 int sample = psMetadataLookupS32(NULL, config->arguments, "SAMPLE"); ///< Size of sample for statistics 31 bool chipStats = psMetadataLookupBool(&mdok, config->arguments, "MASK.CHIPSTATS"); ///< Statistics on chip? 32 float maskSuspect = psMetadataLookupF32(NULL, config->arguments, "MASK.SUSPECT"); ///< Threshold for suspect pixels 33 float maskBad = psMetadataLookupF32(NULL, config->arguments, "MASK.BAD"); ///< Threshold for bad pixels 34 pmMaskIdentifyMode maskMode = psMetadataLookupS32(NULL, config->arguments, "MASK.MODE"); ///< Mode for identifying bad pixels 35 int maskGrow = psMetadataLookupS32(NULL, config->arguments, "MASK.GROW"); ///< Radius to grow mask 36 37 bool smoothSuspect = psMetadataLookupBool(&mdok, config->arguments, "MASK.SMOOTH.SUSPECT"); ///< Radius to grow mask 38 float smoothScale = psMetadataLookupF32(&mdok, config->arguments, "MASK.SMOOTH.SCALE"); ///< Radius to grow mask 27 39 28 40 psImageMaskType markVal; … … 40 52 } 41 53 42 psStats *statistics = psStatsAlloc(meanStat | stdevStat); // Statistics for background43 44 psString outName = ppMergeOutputFile(config); // Name of output file45 pmChip *outChip = pmFPAfileThisChip(config->files, view, outName); // Output chip54 psStats *statistics = psStatsAlloc(meanStat | stdevStat); ///< Statistics for background 55 56 psString outName = ppMergeOutputFile(config); ///< Name of output file 57 pmChip *outChip = pmFPAfileThisChip(config->files, view, outName); ///< Output chip 46 58 psFree(outName); 47 59 … … 58 70 59 71 // For each input file, get the statistics, which can be calculated at the chip or cell levels 60 psVector *values = psVectorAlloc(sample, PS_TYPE_F32); // Pixel values for statistics61 pmFPAview *inView = pmFPAviewAlloc(0); // View for input72 psVector *values = psVectorAlloc(sample, PS_TYPE_F32); ///< Pixel values for statistics 73 pmFPAview *inView = pmFPAviewAlloc(0); ///< View for input 62 74 for (int i = 0; i < numFiles; i++) { 63 75 pmFPAfileActivate(config->files, false, NULL); 64 psArray *files = ppMergeFileActivateSingle(config, PPMERGE_FILES_INPUT, true, i); // Input files65 pmFPAfile *input = files->data[0]; // Input file76 psArray *files = ppMergeFileActivateSingle(config, PPMERGE_FILES_INPUT, true, i); ///< Input files 77 pmFPAfile *input = files->data[0]; ///< Input file 66 78 psFree(files); 67 pmFPA *inFPA = input->fpa; // Input FPA79 pmFPA *inFPA = input->fpa; ///< Input FPA 68 80 *inView = *view; 69 81 70 int valueIndex = 0; // Index for vector of pixel values71 72 pmCell *inCell; // Input cell82 int valueIndex = 0; ///< Index for vector of pixel values 83 84 pmCell *inCell; ///< Input cell 73 85 while ((inCell = pmFPAviewNextCell(inView, inFPA, 1))) { 74 86 75 87 // the output FPA structure carries the information about which cells to process 76 pmCell *outCell = pmFPAfileThisCell(config->files, inView, "PPMERGE.OUTPUT.MASK"); // Output cell88 pmCell *outCell = pmFPAfileThisCell(config->files, inView, "PPMERGE.OUTPUT.MASK"); ///< Output cell 77 89 if (!outCell->process) continue; 78 90 79 pmHDU *hdu = pmHDUFromCell(inCell); // HDU for cell91 pmHDU *hdu = pmHDUFromCell(inCell); ///< HDU for cell 80 92 if (!hdu || hdu->blankPHU) { 81 93 // No data here … … 106 118 pmReadout *readout; 107 119 if (inCell->readouts && inCell->readouts->n == 1) { 108 readout = psMemIncrRefCounter(inCell->readouts->data[0]); // Input readout120 readout = psMemIncrRefCounter(inCell->readouts->data[0]); ///< Input readout 109 121 } else { 110 122 readout = pmReadoutAlloc(inCell); … … 118 130 } 119 131 120 pmReadout *outRO = NULL; // Output readout132 pmReadout *outRO = NULL; ///< Output readout 121 133 if (outCell->readouts && outCell->readouts->n == 1) { 122 134 outRO = psMemIncrRefCounter(outCell->readouts->data[0]); … … 124 136 outRO = pmReadoutAlloc(outCell); 125 137 } 126 psImage *outMask = outRO->mask; // Output mask image (for iterative generation of mask)127 128 psImage *image = readout->image, *mask = readout->mask; // Image and mask129 int numCols = readout->image->numCols, numRows = readout->image->numRows; // Image size130 int numPix = numCols * numRows; // Number of pixels131 int num = PS_MIN(numPix, sample / numCells); // Number of values to add138 psImage *outMask = outRO->mask; ///< Output mask image (for iterative generation of mask) 139 140 psImage *image = readout->image, *mask = readout->mask; ///< Image and mask 141 int numCols = readout->image->numCols, numRows = readout->image->numRows; ///< Image size 142 int numPix = numCols * numRows; ///< Number of pixels 143 int num = PS_MIN(numPix, sample / numCells); ///< Number of values to add 132 144 if (!chipStats) { 133 145 valueIndex = 0; … … 187 199 188 200 // the output FPA structure carries the information about which cells to process 189 pmCell *outCell = pmFPAfileThisCell(config->files, inView, "PPMERGE.OUTPUT.MASK"); // Output cell201 pmCell *outCell = pmFPAfileThisCell(config->files, inView, "PPMERGE.OUTPUT.MASK"); ///< Output cell 190 202 if (!outCell->process) continue; 191 203 192 pmHDU *hdu = pmHDUFromCell(inCell); // HDU for cell204 pmHDU *hdu = pmHDUFromCell(inCell); ///< HDU for cell 193 205 if (!hdu || hdu->blankPHU) continue; 194 206 195 pmReadout *readout = inCell->readouts->data[0]; // Readout of interest207 pmReadout *readout = inCell->readouts->data[0]; ///< Readout of interest 196 208 197 209 inView->readout = 0; … … 225 237 ppMergeFileActivate(config, PPMERGE_FILES_OUTPUT, true); 226 238 } 227 pmFPA *outFPA = outChip->parent; // Output FPA228 pmCell *outCell; // Output cell229 pmFPAview *outView = pmFPAviewAlloc(0); // View into output FPA239 pmFPA *outFPA = outChip->parent; ///< Output FPA 240 pmCell *outCell; ///< Output cell 241 pmFPAview *outView = pmFPAviewAlloc(0); ///< View into output FPA 230 242 *outView = *view; 231 243 while ((outCell = pmFPAviewNextCell(outView, outFPA, 1))) { … … 234 246 if (!outCell->process) continue; 235 247 236 pmHDU *hdu = pmHDUFromCell(outCell); // HDU for cell248 pmHDU *hdu = pmHDUFromCell(outCell); ///< HDU for cell 237 249 if (!hdu || hdu->blankPHU) continue; 238 250 … … 240 252 241 253 assert(outCell->readouts && outCell->readouts->n == 1); 242 pmReadout *outRO = outCell->readouts->data[0]; // Output readout254 pmReadout *outRO = outCell->readouts->data[0]; ///< Output readout 243 255 244 256 if (smoothSuspect) { 245 257 // XXX test output of suspect pixel image 246 psImage *suspects = psMetadataLookupPtr(NULL, outRO->analysis, PM_MASK_ANALYSIS_SUSPECT); // Suspect img258 psImage *suspects = psMetadataLookupPtr(NULL, outRO->analysis, PM_MASK_ANALYSIS_SUSPECT); ///< Suspect img 247 259 assert (suspects); 248 psImageSmooth (suspects, smoothScale, 3); // extend smoothing region to 3-sigma260 psImageSmooth (suspects, smoothScale, 3); ///< extend smoothing region to 3-sigma 249 261 } 250 262 … … 259 271 // The counts image is fairly useless, but it preserves the model 260 272 pmCell *countsCell = pmFPAfileThisCell(config->files, outView, "PPMERGE.OUTPUT.COUNT"); 261 pmReadout *countsRO = pmReadoutAlloc(countsCell); // Readout with count of inputs per pixel273 pmReadout *countsRO = pmReadoutAlloc(countsCell); ///< Readout with count of inputs per pixel 262 274 countsRO->image = psImageAlloc(outRO->mask->numCols, outRO->mask->numRows, PS_TYPE_F32); 263 275 psImageInit(countsRO->image, numFiles); … … 266 278 267 279 pmCell *sigmaCell = pmFPAfileThisCell(config->files, outView, "PPMERGE.OUTPUT.SIGMA"); 268 pmReadout *sigmaRO = pmReadoutAlloc(sigmaCell); // Readout with suspect image280 pmReadout *sigmaRO = pmReadoutAlloc(sigmaCell); ///< Readout with suspect image 269 281 psImage *suspect = psMetadataLookupPtr(NULL, outRO->analysis, PM_MASK_ANALYSIS_SUSPECT); 270 282 sigmaRO->image = psImageCopy(sigmaRO->image, suspect, PS_TYPE_F32); … … 275 287 276 288 if (maskGrow > 0) { 277 psImage *grown = psImageGrowMask(NULL, outRO->mask, maskValOut, maskGrow, maskValOut); // Grown mask289 psImage *grown = psImageGrowMask(NULL, outRO->mask, maskValOut, maskGrow, maskValOut); ///< Grown mask 278 290 psFree(outRO->mask); 279 291 outRO->mask = grown; … … 289 301 290 302 // Average concepts 291 psList *cells = psListAlloc(NULL); // List of cells, for concept averaging303 psList *cells = psListAlloc(NULL); ///< List of cells, for concept averaging 292 304 for (int i = 0; i < numFiles; i++) { 293 pmFPAfile *inFile = pmFPAfileSelectSingle(config->files, "PPMERGE.INPUT", i); // Input file294 pmCell *inCell = pmFPAviewThisCell(outView, inFile->fpa); // Input cell305 pmFPAfile *inFile = pmFPAfileSelectSingle(config->files, "PPMERGE.INPUT", i); ///< Input file 306 pmCell *inCell = pmFPAviewThisCell(outView, inFile->fpa); ///< Input cell 295 307 psListAdd(cells, PS_LIST_TAIL, inCell); 296 308 } … … 340 352 assert(config); 341 353 342 bool mdok; // Status of MD lookup343 int numFiles = psMetadataLookupS32(NULL, config->arguments, "INPUTS.NUM"); // Number of inputs344 bool haveMasks = psMetadataLookupBool(&mdok, config->arguments, "INPUTS.MASKS"); // Do we have masks?345 bool haveWeights = psMetadataLookupBool(&mdok, config->arguments, "INPUTS.WEIGHTS"); // Do we have weights?346 int iter = psMetadataLookupS32(NULL, config->arguments, "ITER"); // Number of rejection iterations354 bool mdok; ///< Status of MD lookup 355 int numFiles = psMetadataLookupS32(NULL, config->arguments, "INPUTS.NUM"); ///< Number of inputs 356 bool haveMasks = psMetadataLookupBool(&mdok, config->arguments, "INPUTS.MASKS"); ///< Do we have masks? 357 bool haveWeights = psMetadataLookupBool(&mdok, config->arguments, "INPUTS.WEIGHTS"); ///< Do we have weights? 358 int iter = psMetadataLookupS32(NULL, config->arguments, "ITER"); ///< Number of rejection iterations 347 359 348 360 PS_ASSERT_INT_POSITIVE(iter, false); 349 361 350 pmFPAview *view = pmFPAviewAlloc(0); // View to component of interest351 psRandom *rng = psRandomAlloc(PS_RANDOM_TAUS, 0); // Random number generator352 353 psMetadata *stats = NULL; // Statistics for output362 pmFPAview *view = pmFPAviewAlloc(0); ///< View to component of interest 363 psRandom *rng = psRandomAlloc(PS_RANDOM_TAUS, 0); ///< Random number generator 364 365 psMetadata *stats = NULL; ///< Statistics for output 354 366 if (psMetadataLookup(config->arguments, "STATS.NAME")) { 355 367 stats = psMetadataAlloc(); … … 357 369 } 358 370 359 psArray *inputs = ppMergeFileDataLevel(config, "PPMERGE.INPUT", PM_FPA_LEVEL_READOUT); // Input images371 psArray *inputs = ppMergeFileDataLevel(config, "PPMERGE.INPUT", PM_FPA_LEVEL_READOUT); ///< Input images 360 372 psFree(inputs); 361 373 if (haveMasks) { … … 380 392 // for the input masks. 381 393 382 psString outName = ppMergeOutputFile(config); // Name of output file383 pmFPAfile *output = psMetadataLookupPtr(NULL, config->files, outName); // Output file394 psString outName = ppMergeOutputFile(config); ///< Name of output file 395 pmFPAfile *output = psMetadataLookupPtr(NULL, config->files, outName); ///< Output file 384 396 psFree(outName); 385 397 assert(output && output->fpa); 386 pmFPA *outFPA = output->fpa; // Output FPA398 pmFPA *outFPA = output->fpa; ///< Output FPA 387 399 388 400 if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) { 389 401 goto PPMERGE_MASK_ERROR; 390 402 } 391 pmChip *outChip; // Chip of interest403 pmChip *outChip; ///< Chip of interest 392 404 while ((outChip = pmFPAviewNextChip(view, outFPA, 1))) { 393 405 … … 408 420 psList *inChips = psListAlloc(NULL); 409 421 for (int i=0; i < numFiles; i++) { 410 pmFPAfile *file = pmFPAfileSelectSingle(config->files, "PPMERGE.INPUT", i); // Input file422 pmFPAfile *file = pmFPAfileSelectSingle(config->files, "PPMERGE.INPUT", i); ///< Input file 411 423 pmChip *chip = pmFPAviewThisChip(view, file->fpa); 412 424 psListAdd(inChips, PS_LIST_TAIL, chip); … … 427 439 } 428 440 429 psList *fpaList = psListAlloc(NULL);// List of FPAs for concept averaging441 psList *fpaList = psListAlloc(NULL);///< List of FPAs for concept averaging 430 442 for (int i = 0; i < numFiles; i++) { 431 pmFPAfile *file = pmFPAfileSelectSingle(config->files, "PPMERGE.INPUT", i); // Input file443 pmFPAfile *file = pmFPAfileSelectSingle(config->files, "PPMERGE.INPUT", i); ///< Input file 432 444 psListAdd(fpaList, PS_LIST_TAIL, file->fpa); 433 445 } -
trunk/ppMerge/src/ppMergeReadChunk.c
r19014 r21244 1 /** @file ppMergeReadChunk.c 2 * 3 * @brief 4 * 5 * @ingroup ppMerge 6 * 7 * @author IfA 8 * @version $Revision: 1.5 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2009-02-01 21:43:05 $ 10 * Copyright 2009 Institute for Astronomy, University of Hawaii 11 */ 12 1 13 # include "ppMerge.h" 2 14 3 #define THREAD_WAIT 10000 // Microseconds to wait if thread is not available15 #define THREAD_WAIT 10000 ///< Microseconds to wait if thread is not available 4 16 5 17 ppMergeFileGroup *ppMergeReadChunk(bool *status, psArray *fileGroups, pmConfig *config, int numChunk) … … 8 20 9 21 bool mdok; 10 bool haveMasks = psMetadataLookupBool(&mdok, config->arguments, "INPUTS.MASKS"); // Do we have masks?11 bool haveWeights = psMetadataLookupBool(&mdok, config->arguments, "INPUTS.WEIGHTS");// Do we have weights?12 int rows = psMetadataLookupS32(NULL, config->arguments, "ROWS"); // Number of rows to read per chunk22 bool haveMasks = psMetadataLookupBool(&mdok, config->arguments, "INPUTS.MASKS"); ///< Do we have masks? 23 bool haveWeights = psMetadataLookupBool(&mdok, config->arguments, "INPUTS.WEIGHTS");///< Do we have weights? 24 int rows = psMetadataLookupS32(NULL, config->arguments, "ROWS"); ///< Number of rows to read per chunk 13 25 14 26 // select an available fileGroup … … 36 48 psTrace("ppStack", 2, "Reading data for chunk %d into fileGroup %d....n", numChunk, j); 37 49 for (int i = 0; i < readouts->n; i++) { 38 pmReadout *inRO = readouts->data[i]; // Input readout50 pmReadout *inRO = readouts->data[i]; ///< Input readout 39 51 40 52 // override the recorded last scan -
trunk/ppMerge/src/ppMergeScaleZero.c
r21183 r21244 1 /** @file ppMergeScaleZero.c 2 * 3 * @brief 4 * 5 * @ingroup ppMerge 6 * 7 * @author IfA 8 * @version $Revision: 1.29 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2009-02-01 21:43:05 $ 10 * Copyright 2009 Institute for Astronomy, University of Hawaii 11 */ 12 1 13 #include "ppMerge.h" 2 14 3 // Get the scale and zero for each chip of each input 15 /** 16 * Get the scale and zero for each chip of each input 17 */ 4 18 bool ppMergeScaleZero(pmConfig *config) 5 19 { 6 20 assert(config); 7 21 8 ppMergeType type = psMetadataLookupS32(NULL, config->arguments, "TYPE"); // Type of frame9 int numInputs = psMetadataLookupS32(NULL, config->arguments, "INPUTS.NUM"); // Number of inputs10 int numCells = psMetadataLookupS32(NULL, config->arguments, "INPUTS.CELLS"); // Number of cells11 psStatsOptions meanStat = psMetadataLookupS32(NULL, config->arguments, "MEAN"); // Statistic for mean12 psStatsOptions stdevStat = psMetadataLookupS32(NULL, config->arguments, "STDEV"); // Statistic for stdev13 int shutterSize = psMetadataLookupS32(NULL, config->arguments, "SHUTTER.SIZE"); // Size of shutter region14 15 psVector *gains = NULL; // Gains for each cell16 psArray *shutters = NULL; // Shutter data for each cell17 psStats *stats = NULL; // Statistics for background18 psImage *background = NULL; // Background measurements per cell per file22 ppMergeType type = psMetadataLookupS32(NULL, config->arguments, "TYPE"); ///< Type of frame 23 int numInputs = psMetadataLookupS32(NULL, config->arguments, "INPUTS.NUM"); ///< Number of inputs 24 int numCells = psMetadataLookupS32(NULL, config->arguments, "INPUTS.CELLS"); ///< Number of cells 25 psStatsOptions meanStat = psMetadataLookupS32(NULL, config->arguments, "MEAN"); ///< Statistic for mean 26 psStatsOptions stdevStat = psMetadataLookupS32(NULL, config->arguments, "STDEV"); ///< Statistic for stdev 27 int shutterSize = psMetadataLookupS32(NULL, config->arguments, "SHUTTER.SIZE"); ///< Size of shutter region 28 29 psVector *gains = NULL; ///< Gains for each cell 30 psArray *shutters = NULL; ///< Shutter data for each cell 31 psStats *stats = NULL; ///< Statistics for background 32 psImage *background = NULL; ///< Background measurements per cell per file 19 33 20 34 switch (type) { … … 37 51 break; 38 52 } 39 psRandom *rng = psRandomAlloc(PS_RANDOM_TAUS, 0); // Random number generator40 pmFPAview *view = NULL; // View into FPA53 psRandom *rng = psRandomAlloc(PS_RANDOM_TAUS, 0); ///< Random number generator 54 pmFPAview *view = NULL; ///< View into FPA 41 55 42 56 for (int i = 0; i < numInputs; i++) { 43 57 pmFPAfileActivate(config->files, false, NULL); 44 psArray *files = ppMergeFileActivateSingle(config, PPMERGE_FILES_INPUT, true, i); // Activated files45 pmFPAfile *input = files->data[0]; // Representative file; should be the image (not mask or weight)46 pmFPA *fpa = input->fpa; // FPA of interest47 view = pmFPAviewAlloc(0); // View to component of interest48 int cellNum = 0; // Index for cell58 psArray *files = ppMergeFileActivateSingle(config, PPMERGE_FILES_INPUT, true, i); ///< Activated files 59 pmFPAfile *input = files->data[0]; ///< Representative file; should be the image (not mask or weight) 60 pmFPA *fpa = input->fpa; ///< FPA of interest 61 view = pmFPAviewAlloc(0); ///< View to component of interest 62 int cellNum = 0; ///< Index for cell 49 63 if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) { 50 64 goto ERROR; 51 65 } 52 pmChip *chip; // Chip of interest66 pmChip *chip; ///< Chip of interest 53 67 while ((chip = pmFPAviewNextChip(view, fpa, 1))) { 54 68 if (!chip->file_exists) { … … 59 73 } 60 74 61 pmCell *cell; // Cell of interest75 pmCell *cell; ///< Cell of interest 62 76 while ((cell = pmFPAviewNextCell(view, fpa, 1))) { 63 77 if (!cell->file_exists) { … … 78 92 goto ERROR; 79 93 } 80 pmReadout *readout = cell->readouts->data[0]; // Readout of interest 81 82 psImageMaskType maskVal = pmConfigMaskGet("MASK.VALUE", config); // Value to mask 94 pmReadout *readout = cell->readouts->data[0]; ///< Readout of interest 95 96 psImageMaskType maskVal = pmConfigMaskGet("MASK.VALUE", config); ///< Value to mask 97 psImageMaskType maskVal = pmConfigMaskGet("MASK.VALUE", config); 83 98 84 99 switch (type) { … … 86 101 case PPMERGE_TYPE_FRINGE: { 87 102 // Extract the gain 88 float gain = psMetadataLookupF32(NULL, cell->concepts, "CELL.GAIN"); // Cell gain103 float gain = psMetadataLookupF32(NULL, cell->concepts, "CELL.GAIN"); ///< Cell gain 89 104 if (!isfinite(gain)) { 90 105 // psError(PS_ERR_BAD_PARAMETER_VALUE, false, … … 110 125 } 111 126 case PPMERGE_TYPE_SHUTTER: { 112 pmShutterCorrectionData *shutter = shutters->data[cellNum]; // Shutter correction data127 pmShutterCorrectionData *shutter = shutters->data[cellNum]; ///< Shutter correction data 113 128 if (!shutter) { 114 129 shutter = pmShutterCorrectionDataAlloc(readout->image->numCols, … … 174 189 } 175 190 } 176 psVector *fluxes = NULL; // Solution to fluxes191 psVector *fluxes = NULL; ///< Solution to fluxes 177 192 if (!pmFlatNormalize(&fluxes, &gains, background)) { 178 193 psError(PS_ERR_UNKNOWN, false, "Normalisation failed to converge --- continuing anyway."); -
trunk/ppMerge/src/ppMergeScaleZero.h
r13873 r21244 1 /** @file ppMergeScaleZero.h 2 * 3 * @brief 4 * 5 * @ingroup ppMerge 6 * 7 * @author IfA 8 * @version $Revision: 1.4 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2009-02-01 21:43:05 $ 10 * Copyright 2009 Institute for Astronomy, University of Hawaii 11 */ 12 1 13 #ifndef PP_MERGE_SCALE_ZERO_H 2 14 #define PP_MERGE_SCALE_ZERO_H … … 8 20 #include "ppMergeOptions.h" 9 21 10 // Get the scale and zero for each chip of each input 11 bool ppMergeScaleZero(psImage **scales, // The scales for each integration/cell 12 psImage **zeros, // The zeroes for each integration/cell 13 psArray **shutter,// The shutter correction data for each cell 14 ppMergeData *data,// The data 15 const ppMergeOptions *options, // The options 16 const pmConfig *config // The configuration 22 /** 23 * Get the scale and zero for each chip of each input 24 */ 25 bool ppMergeScaleZero(psImage **scales, ///< The scales for each integration/cell 26 psImage **zeros, ///< The zeroes for each integration/cell 27 psArray **shutter,///< The shutter correction data for each cell 28 ppMergeData *data,///< The data 29 const ppMergeOptions *options, ///< The options 30 const pmConfig *config ///< The configuration 17 31 ); 18 32 -
trunk/ppMerge/src/ppMergeSetThreads.c
r21183 r21244 1 /** @file ppMergeSetThreads.c 2 * 3 * @brief 4 * 5 * @ingroup ppMerge 6 * 7 * @author IfA 8 * @version $Revision: 1.7 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2009-02-01 21:43:05 $ 10 * Copyright 2009 Institute for Astronomy, University of Hawaii 11 */ 12 1 13 # include "ppMerge.h" 2 14 -
trunk/ppMerge/src/ppMergeThreadLauncher.c
r21183 r21244 1 /** @file ppMergeThreadLauncher.c 2 * 3 * @brief 4 * 5 * @ingroup ppMerge 6 * 7 * @author IfA 8 * @version $Revision: 1.4 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2009-02-01 21:43:05 $ 10 * Copyright 2009 Institute for Astronomy, University of Hawaii 11 */ 12 1 13 # include "ppMerge.h" 2 14 3 // each thread runs this function, starting a new job when it finished with an old one 4 // it is called with a (void *) pointer to its own thread pointer 15 /** 16 * each thread runs this function, starting a new job when it finished with an old one 17 * it is called with a (void *) pointer to its own thread pointer 18 */ 5 19 void *ppMergeThreadLauncher (void *data) { 6 20 -
trunk/ppMerge/src/ppMergeVersion.c
r10294 r21244 1 /** @file ppMergeVersion.c 2 * 3 * @brief 4 * 5 * @ingroup ppMerge 6 * 7 * @author IfA 8 * @version $Revision: 1.2 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2009-02-01 21:43:05 $ 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 "ppMergeVersion.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 ppMergeVersion(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 ppMergeVersionLong(void) 22 34 { 23 psString version = ppMergeVersion(); // Version, to return24 psString tag = psStringStripCVS(cvsTag, "Name"); // CVS tag35 psString version = ppMergeVersion(); ///< 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 ppMerge = ppMergeVersionLong(); // ppMerge version47 psString pslib = psLibVersionLong();///< psLib version 48 psString psmodules = psModulesVersionLong(); ///< psModules version 49 psString ppStats = ppStatsVersionLong(); ///< ppStats version 50 psString ppMerge = ppMergeVersionLong(); ///< ppMerge 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, "ppMerge processing at %s. Component information:", timeString); 45 57 psFree(timeString); -
trunk/ppMerge/src/ppMergeVersion.h
r10294 r21244 1 /** @file ppMergeVersion.h 2 * 3 * @brief 4 * 5 * @ingroup ppMerge 6 * 7 * @author IfA 8 * @version $Revision: 1.2 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2009-02-01 21:43:05 $ 10 * Copyright 2009 Institute for Astronomy, University of Hawaii 11 */ 12 1 13 #ifndef PP_MERGE_VERSION_H 2 14 #define PP_MERGE_VERSION_H 3 15 4 /// Return short version information 16 /** 17 * Return short version information 18 */ 5 19 psString ppMergeVersion(void); 6 20 7 /// Return long version information 21 /** 22 * Return long version information 23 */ 8 24 psString ppMergeVersionLong(void); 9 25 10 /// Update the metadata with version information for all dependencies 26 /** 27 * Update the metadata with version information for all dependencies 28 */ 11 29 void ppMergeVersionMetadata(psMetadata *metadata ///< Metadata to update with version information 12 30 );
Note:
See TracChangeset
for help on using the changeset viewer.
