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