Changeset 21244 for trunk/ppMerge/src/ppMergeLoop_Threaded.c
- Timestamp:
- Feb 1, 2009, 11:43:05 AM (17 years ago)
- File:
-
- 1 edited
-
trunk/ppMerge/src/ppMergeLoop_Threaded.c (modified) (18 diffs)
Legend:
- Unmodified
- Added
- Removed
-
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 }
Note:
See TracChangeset
for help on using the changeset viewer.
