Changeset 25027 for branches/pap/ppImage
- Timestamp:
- Aug 7, 2009, 4:08:25 PM (17 years ago)
- Location:
- branches/pap
- Files:
-
- 17 edited
- 1 copied
-
. (modified) (1 prop)
-
ppImage (modified) (1 prop)
-
ppImage/notes.txt (modified) (1 diff)
-
ppImage/src/Makefile.am (modified) (1 diff)
-
ppImage/src/ppImage.h (modified) (6 diffs)
-
ppImage/src/ppImageArguments.c (modified) (2 diffs)
-
ppImage/src/ppImageCheckCTE.c (modified) (2 diffs)
-
ppImage/src/ppImageDetrendFree.c (modified) (1 diff)
-
ppImage/src/ppImageDetrendFringe.c (modified) (5 diffs)
-
ppImage/src/ppImageDetrendReadout.c (modified) (9 diffs)
-
ppImage/src/ppImageDetrendRecord.c (modified) (1 diff)
-
ppImage/src/ppImageLoop.c (modified) (1 diff)
-
ppImage/src/ppImageMeasureCrosstalk.c (modified) (1 diff)
-
ppImage/src/ppImageOptions.c (modified) (10 diffs)
-
ppImage/src/ppImageParityFlip.c (copied) (copied from trunk/ppImage/src/ppImageParityFlip.c )
-
ppImage/src/ppImageParseCamera.c (modified) (2 diffs)
-
ppImage/src/ppImageReplaceBackground.c (modified) (1 diff)
-
ppImage/src/ppImageSetMaskBits.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/pap
- Property svn:mergeinfo changed
-
branches/pap/ppImage
- Property svn:mergeinfo deleted
-
branches/pap/ppImage/notes.txt
r14620 r25027 1 1 2 ppImage pmFPAfiles: 2 20090611 : adjusting things to allow the readnoise to be an image map for each cell 3 3 4 pmFPAfile *input = pmFPAfileDefineFromArgs (&status, config, "PPIMAGE.INPUT", "INPUT"); 5 pmFPAfile *inputMask = pmFPAfileBindFromArgs(&status, input, config, "PPIMAGE.INPUT.MASK", "INPUT.MASK"); 6 pmFPAfile *inputWeight = pmFPAfileBindFromArgs(&status, input, config, "PPIMAGE.INPUT.WEIGHT", "INPUT.WEIGHT"); 7 pmFPAfile *output = pmFPAfileDefineOutput(config, input->fpa, "PPIMAGE.OUTPUT"); 8 pmFPAfile *outMask = pmFPAfileDefineOutput(config, input->fpa, "PPIMAGE.OUTPUT.MASK"); 9 pmFPAfile *outWeight = pmFPAfileDefineOutput(config, input->fpa, "PPIMAGE.OUTPUT.WEIGHT"); 10 pmFPAfile *chipImage = pmFPAfileDefineChipMosaic(config, input->fpa, "PPIMAGE.CHIP"); 11 pmFPAfile *chipMask = pmFPAfileDefineOutput(config, chipImage->fpa, "PPIMAGE.CHIP.MASK"); 12 pmFPAfile *chipWeight = pmFPAfileDefineOutput(config, chipImage->fpa, "PPIMAGE.CHIP.WEIGHT"); 13 pmFPAfile *byFPA1 = pmFPAfileDefineFPAMosaic(config, input->fpa, "PPIMAGE.OUTPUT.FPA1"); 14 pmFPAfile *byFPA2 = pmFPAfileDefineFPAMosaic(config, input->fpa, "PPIMAGE.OUTPUT.FPA2"); 4 * pmReadoutSetVaraince : when variance is created, we are suppling a single CELL.READNOISE value -- change this to an optional image (carried through concepts?) 15 5 16 pmFPAfile *psphotInput = pmFPAfileDefineFromFPA (config, chipImage->fpa, 1, 1, "PSPHOT.INPUT"); 17 pmFPAfile *psphotOutput = psMetadataLookupPtr (&status, config->files, "PSPHOT.OUTPUT"); 18 pmFPAfile *psastroInput = pmFPAfileDefineInput (config, psphotOutput->fpa, "PSASTRO.INPUT"); 6 I need to: 19 7 20 pmFPAfile *bin1 = pmFPAfileDefineFromFPA (config, chipImage->fpa, options->xBin1, options->yBin1, "PPIMAGE.BIN1"); 21 pmFPAfile *bin2 = pmFPAfileDefineFromFPA (config, chipImage->fpa, options->xBin2, options->yBin2, "PPIMAGE.BIN2"); 22 pmFPAfile *jpg1 = pmFPAfileDefineOutput (config, byFPA1->fpa, "PPIMAGE.JPEG1"); 23 pmFPAfile *jpg2 = pmFPAfileDefineOutput (config, byFPA2->fpa, "PPIMAGE.JPEG2"); 8 * define a format for the readnoise map (image map in SPLIT/MEF format?) 9 * load the readnoise map 10 11 * supply the map for each cell to the pmReadoutSetVariance (pointer to ppImageMap?) 12 pmReadoutSetVariance -> add psImageMap to API (also pmReadoutGenerateVariance) 13 14 * add recipe information to define the source of the READNOISE info. 15 -
branches/pap/ppImage/src/Makefile.am
r23845 r25027 54 54 ppImageDefineFile.c \ 55 55 ppImageSetMaskBits.c \ 56 ppImageParityFlip.c \ 56 57 ppImageCheckCTE.c \ 57 58 ppImageFileCheck.c \ -
branches/pap/ppImage/src/ppImage.h
r23845 r25027 31 31 bool doNonLin; // Non-linearity correction 32 32 bool doOverscan; // Overscan subtraction 33 bool doNoiseMap; // Bias subtraction 33 34 bool doBias; // Bias subtraction 34 35 bool doDark; // Dark subtraction … … 36 37 bool doShutter; // Shutter correction 37 38 bool doFlat; // Flat-field normalisation 39 bool doPattern; // Pattern noise subtraction 38 40 bool doFringe; // Fringe subtraction 39 41 bool doPhotom; // Source identification and photometry … … 43 45 bool doStats; // call ppStats on the image 44 46 bool checkCTE; // measure pixel-based variance 45 46 bool doCrosstalkMeasure; // measure crosstalk signal 47 bool doCrosstalkCorrect; // apply crosstalk correction 47 bool applyParity; // Apply Cell parities 48 49 bool doCrosstalkMeasure; // measure crosstalk signal 50 bool doCrosstalkCorrect; // apply crosstalk correction 48 51 49 52 // output files requested … … 69 72 psImageMaskType lowMask; // Mask value to give bad pixels 70 73 psImageMaskType flatMask; // Mask value to give bad flat pixels 74 psImageMaskType darkMask; // Mask value to give bad dark pixels 71 75 psImageMaskType blankMask; // Mask value to give blank pixels 72 76 … … 89 93 int fringeIter; // Fringe iterations 90 94 float fringeKeep; // Fringe keep fraction 95 96 // Pattern noise subtraction 97 int patternOrder; // Polynomial order 98 int patternIter; // Clipping iterations 99 float patternRej; // Clipping threshold 100 float patternThresh; // Ignore threshold 101 psStatsOptions patternMean; // Statistic for mean 102 psStatsOptions patternStdev; // Statistic for stdev 91 103 92 104 int remnanceSize; // Size for remnance detection … … 117 129 bool ppImageSetMaskBits (pmConfig *config, ppImageOptions *options); 118 130 131 // apply the cell flips to the input data before analysis 132 bool ppImageParityFlip (pmConfig *config, const ppImageOptions *options, const pmFPAview *view); 133 119 134 // Loop over the input 120 135 bool ppImageLoop(pmConfig *config, ppImageOptions *options); -
branches/pap/ppImage/src/ppImageArguments.c
r23268 r25027 17 17 fprintf(stderr, "\n"); 18 18 fprintf(stderr, "Input options (single file / file list):\n"); 19 fprintf(stderr, "\t-noisemap/-noisemaplist: Noise Map image.\n"); 19 20 fprintf(stderr, "\t-bias/-biaslist: Bias image.\n"); 20 21 fprintf(stderr, "\t-dark/-darklist: Dark image.\n"); … … 112 113 // if these command-line options are supplied, load the file name lists into config->arguments 113 114 // override any configuration-specified source for these files 115 pmConfigFileSetsMD (config->arguments, &argc, argv, "NOISEMAP", "-noisemap", "-noisemaplist"); 114 116 pmConfigFileSetsMD (config->arguments, &argc, argv, "BIAS", "-bias", "-biaslist"); 115 117 pmConfigFileSetsMD (config->arguments, &argc, argv, "DARK", "-dark", "-darklist"); -
branches/pap/ppImage/src/ppImageCheckCTE.c
r23411 r25027 60 60 fineRegion = psImageBinningSetFineRegion (binning, ruffRegion); 61 61 fineRegion = psRegionForImage (image, fineRegion); 62 if (fineRegion.x0 >= image->numCols || fineRegion.x1 >= image->numCols || 63 fineRegion.y0 >= image->numRows || fineRegion.y1 >= image->numRows) { 64 continue; 65 } 62 if (fineRegion.x0 >= image->numCols) continue; 63 if (fineRegion.y0 >= image->numRows) continue; 66 64 67 65 psImage *subset = psImageSubset (image, fineRegion); … … 85 83 float normVariance = PS_SQR(stats->robustStdev) / cellMedian; 86 84 // float normVariance = PS_SQR(stats->sampleStdev) / cellMedian; 85 // if (!isfinite(normVariance)) fprintf (stderr, "** normVariance is nan **\n"); 87 86 88 87 // apply resulting value to the input pixels 89 88 for (int jy = fineRegion.y0; jy < fineRegion.y1; jy++) { 89 if (jy < 0) continue; 90 if (jy >= image->numRows) continue; 90 91 for (int jx = fineRegion.x0; jx < fineRegion.x1; jx++) { 92 if (jx < 0) continue; 93 if (jx >= image->numCols) continue; 91 94 image->data.F32[jy][jx] = normVariance; 92 95 } -
branches/pap/ppImage/src/ppImageDetrendFree.c
r20774 r25027 8 8 static char *detrendTypes[] = { 9 9 "PPIMAGE.MASK", 10 "PPIMAGE.NOISEMAP", 10 11 "PPIMAGE.BIAS", 11 12 "PPIMAGE.DARK", -
branches/pap/ppImage/src/ppImageDetrendFringe.c
r18969 r25027 11 11 PS_ASSERT_PTR_NON_NULL(options, false); 12 12 13 // Reference fringe measurements 14 psArray *references = psMemIncrRefCounter(psMetadataLookupPtr(NULL, fringe->analysis, 15 "FRINGE.MEASUREMENTS")); 13 // Reference fringe measurements (stored on the reference cell->analysis) 14 psArray *references = psMemIncrRefCounter(psMetadataLookupPtr(NULL, fringe->analysis, "FRINGE.MEASUREMENTS")); 16 15 if (!references) { 17 references = pmFringesParse(fringe); // Reference fringes 18 if (!references) { 19 psError(PS_ERR_IO, false, "Unable to find fringe references.\n"); 20 return false; 21 } 22 psMetadataAdd(fringe->analysis, PS_LIST_TAIL, "FRINGE.MEASUREMENTS", PS_DATA_UNKNOWN, 23 "Fringe measurements", references); 16 psError(PS_ERR_IO, false, "Unable to find fringe references.\n"); 17 return false; 24 18 } 25 19 … … 75 69 } 76 70 77 psMetadataAdd(readout->parent->analysis, PS_LIST_TAIL, scienceFringes, 78 PS_DATA_UNKNOWN | PS_META_REPLACE, "Fringe measurements", measurements); 71 psMetadataAdd(readout->parent->analysis, PS_LIST_TAIL, scienceFringes, PS_DATA_UNKNOWN | PS_META_REPLACE, "Fringe measurements", measurements); 79 72 psFree(measurements); 80 73 psFree(scienceFringes); … … 92 85 psArray *fringes = psArrayAlloc(cells->n); // Fringes, to return 93 86 for (int i = 0; i < cells->n; i++) { 87 fringes->data[i] = NULL; 88 94 89 pmCell *cell = cells->data[i]; // Cell of interest 95 90 96 91 // XXX for now, skip the video cells (cell->readouts->n > 1) 97 92 if (cell->readouts->n > 1) { 98 psWarning ("Skipping Video Cell for ppImageDetrendFringe.c:getFringes");99 continue;93 psWarning ("Skipping Video Cell (%d) for ppImageDetrendFringe.c:getFringes", i); 94 continue; 100 95 } 101 96 … … 197 192 } 198 193 assert(fringes->readouts->n == solution->nFringeFrames); 194 195 psImageMaskType maskVal = options->flatMask; 199 196 200 197 bool mdok; // Status of MD lookup … … 262 259 } 263 260 261 // subtract fringe and update mask if fringe value is NAN 262 for (int iy = 0; iy < readout->image->numRows; iy++) { 263 for (int ix = 0; ix < readout->image->numCols; ix++) { 264 readout->image->data.F32[iy][ix] -= sumFringe->data.F32[iy][ix]; 265 if (!isfinite(sumFringe->data.F32[iy][ix]) && readout->mask) { 266 readout->mask->data.PS_TYPE_IMAGE_MASK_DATA[iy][ix] |= maskVal; 267 } 268 } 269 } 270 264 271 // XXX: Make generic, so subregions may be subtracted as well 265 if (!psBinaryOp(readout->image, readout->image, "-", sumFringe)) {266 psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to subtract fringe.\n");267 return false;268 }272 // if (!psBinaryOp(readout->image, readout->image, "-", sumFringe)) { 273 // psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to subtract fringe.\n"); 274 // return false; 275 // } 269 276 270 277 // measure residual fringe amplitude. results go to FRINGE.RESIDUALS -
branches/pap/ppImage/src/ppImageDetrendReadout.c
r23825 r25027 17 17 // Masking on the basis of pixel value needs to be done before anything else, so the values are pristine. 18 18 if (options->doMaskBuild) { 19 psImageMaskType satMask = options->doMaskSat ? options->satMask : 0;20 psImageMaskType lowMask = options->doMaskLow ? options->lowMask : 0;19 psImageMaskType satMask = options->doMaskSat ? options->satMask : 0; 20 psImageMaskType lowMask = options->doMaskLow ? options->lowMask : 0; 21 21 pmReadoutGenerateMask(input, satMask, lowMask); 22 22 } … … 56 56 if (!pmBiasSubtract(input, options->overscan, bias, oldDark, view)) { 57 57 psError(PS_ERR_UNKNOWN, false, "Unable to subtract bias."); 58 psFree(detview);58 psFree(detview); 59 59 return false; 60 60 } … … 64 64 if (options->doVarianceBuild) { 65 65 // create the target mask and variance images 66 pmReadoutGenerateVariance(input, true); 66 psImage *noiseImage = NULL; 67 if (options->doNoiseMap) { 68 // XXX convert the noiseMap image to a binned image 69 pmReadout *noiseMap = NULL; 70 noiseMap = pmFPAfileThisReadout(config->files, detview, "PPIMAGE.NOISEMAP"); 71 noiseImage = psImageCopy (NULL, input->image, PS_TYPE_F32); 72 psImageInit (noiseImage, 0.0); 73 74 // XXX this works, but is not really quite right: the model shoud include the 75 // offset information, we are not really getting exactly the right mapping from the 76 // original file. 77 psImageBinning *binning = psImageBinningAlloc(); 78 binning->nXruff = noiseMap->image->numCols; 79 binning->nYruff = noiseMap->image->numRows; 80 binning->nXfine = input->image->numCols; 81 binning->nYfine = input->image->numRows; 82 psImageBinningSetScale(binning, PS_IMAGE_BINNING_LEFT); 83 84 psImageUnbin (noiseImage, noiseMap->image, binning); 85 psFree (binning); 86 } 87 pmReadoutGenerateVariance(input, noiseImage, true); 88 psFree (noiseImage); 67 89 } 68 90 69 91 if (options->doDark && dark) { 70 if (!pmDarkApply(input, dark, options-> maskValue)) {92 if (!pmDarkApply(input, dark, options->darkMask)) { 71 93 psError(PS_ERR_UNKNOWN, false, "Unable to subtract dark."); 72 psFree(detview);94 psFree(detview); 73 95 return false; 74 96 } … … 79 101 options->remnanceSize, options->remnanceThresh)) { 80 102 psError(PS_ERR_UNKNOWN, false, "Unable to mask remnance."); 81 psFree(detview);103 psFree(detview); 82 104 return false; 83 105 } … … 88 110 pmReadout *shutter = pmFPAfileThisReadout(config->files, detview, "PPIMAGE.SHUTTER"); 89 111 if (!pmShutterCorrectionApply(input, shutter, pmConfigMaskGet("FLAT", config))) { 90 psFree(detview);112 psFree(detview); 91 113 return false; 92 114 } … … 97 119 pmReadout *flat = pmFPAfileThisReadout(config->files, detview, "PPIMAGE.FLAT"); 98 120 if (!pmFlatField(input, flat, options->flatMask)) { 99 psFree(detview); 121 psFree(detview); 122 return false; 123 } 124 } 125 126 // Pattern noise correction 127 if (options->doPattern) { 128 if (!pmPatternRow(input, options->patternOrder, options->patternIter, options->patternRej, 129 options->patternThresh, options->patternMean, options->patternStdev, 130 options->maskValue, options->darkMask)) { 131 psFree(detview); 100 132 return false; 101 133 } … … 119 151 psMetadata *normlist = psMetadataLookupMetadata(&mdok, config->arguments, "NORMALIZATION.TABLE"); 120 152 if (normlist) { 121 pmFPAfile *inputFile = psMetadataLookupPtr(&mdok, config->files, "PPIMAGE.INPUT");122 123 // get the menu of class IDs124 psMetadata *menu = psMetadataLookupMetadata(&mdok, inputFile->camera, "CLASSID"); 153 pmFPAfile *inputFile = psMetadataLookupPtr(&mdok, config->files, "PPIMAGE.INPUT"); 154 155 // get the menu of class IDs 156 psMetadata *menu = psMetadataLookupMetadata(&mdok, inputFile->camera, "CLASSID"); 125 157 if (!menu) { 126 158 psError(PS_ERR_IO, false, "Unable to find CLASSID metadata in camera configuration"); 127 psFree(detview);128 return false; 129 } 130 // get the rule for class_id for the desired class131 const char *rule = psMetadataLookupStr(&mdok, menu, options->normClass); 159 psFree(detview); 160 return false; 161 } 162 // get the rule for class_id for the desired class 163 const char *rule = psMetadataLookupStr(&mdok, menu, options->normClass); 132 164 if (!rule) { 133 165 psError(PS_ERR_IO, false, "Unable to find NORM.CLASS value %s in CLASSID in camera configuration", options->normClass); 134 psFree(detview);135 return false; 136 } 137 // get the class_id from the rule166 psFree(detview); 167 return false; 168 } 169 // get the class_id from the rule 138 170 char *classID = pmFPAfileNameFromRule(rule, inputFile, view); 139 171 if (!classID) { 140 172 psError(PS_ERR_IO, false, "error converting CLASSID rule %s to name\n", rule); 141 psFree(detview);142 return false; 143 } 144 145 // get normalization from the class_id146 float norm = psMetadataLookupF32 (&mdok, normlist, classID);147 if (!mdok) {148 psError(PS_ERR_IO, false, "failed to find class ID %s in normalization table\n", classID);149 psFree(detview);150 return false;151 }173 psFree(detview); 174 return false; 175 } 176 177 // get normalization from the class_id 178 float norm = psMetadataLookupF32 (&mdok, normlist, classID); 179 if (!mdok) { 180 psError(PS_ERR_IO, false, "failed to find class ID %s in normalization table\n", classID); 181 psFree(detview); 182 return false; 183 } 152 184 153 185 pmHDU *hdu = pmHDUFromReadout(input); // HDU of interest … … 157 189 psFree(comment); 158 190 159 // apply the normalization191 // apply the normalization 160 192 psBinaryOp(input->image, input->image, "*", psScalarAlloc(norm, PS_TYPE_F32)); 161 193 162 psFree (classID);194 psFree (classID); 163 195 } 164 196 # endif … … 167 199 pmCell *fringe = pmFPAfileThisCell(config->files, detview, "PPIMAGE.FRINGE"); 168 200 if (!ppImageDetrendFringeMeasure(input, fringe, false, options)) { 169 psFree(detview);201 psFree(detview); 170 202 return false; 171 203 } -
branches/pap/ppImage/src/ppImageDetrendRecord.c
r20773 r25027 67 67 psMetadataAddMetadata(cell->analysis, PS_LIST_TAIL, "DETREND", 0, "Detrend information", detrend); 68 68 69 detrendRecord(options->doMask, detrend, config, view, "PPIMAGE.MASK", "DETREND.MASK", "Mask filename"); 70 detrendRecord(options->doBias, detrend, config, view, "PPIMAGE.BIAS", "DETREND.BIAS", "Bias filename"); 71 detrendRecord(options->doDark, detrend, config, view, "PPIMAGE.DARK", "DETREND.DARK", "Dark filename"); 72 detrendRecord(options->doShutter, detrend, config, view, "PPIMAGE.SHUTTER", "DETREND.SHUTTER", 73 "Shutter correction filename"); 74 detrendRecord(options->doFlat, detrend, config, view, "PPIMAGE.FLAT", "DETREND.FLAT", "Flat filename"); 75 detrendRecord(options->doFringe, detrend, config, view, "PPIMAGE.FRINGE", "DETREND.FRINGE", 76 "Fringe filename"); 69 detrendRecord(options->doMask, detrend, config, view, "PPIMAGE.MASK", "DETREND.MASK", "Mask filename"); 70 detrendRecord(options->doNoiseMap, detrend, config, view, "PPIMAGE.NOISEMAP", "DETREND.NOISEMAP", "Noise Map filename"); 71 detrendRecord(options->doBias, detrend, config, view, "PPIMAGE.BIAS", "DETREND.BIAS", "Bias filename"); 72 detrendRecord(options->doDark, detrend, config, view, "PPIMAGE.DARK", "DETREND.DARK", "Dark filename"); 73 detrendRecord(options->doShutter, detrend, config, view, "PPIMAGE.SHUTTER", "DETREND.SHUTTER", "Shutter correction filename"); 74 detrendRecord(options->doFlat, detrend, config, view, "PPIMAGE.FLAT", "DETREND.FLAT", "Flat filename"); 75 detrendRecord(options->doFringe, detrend, config, view, "PPIMAGE.FRINGE", "DETREND.FRINGE", "Fringe filename"); 77 76 78 77 psFree (detrend); -
branches/pap/ppImage/src/ppImageLoop.c
r23845 r25027 98 98 continue; 99 99 } 100 101 // perform the detrend analysis 102 if (!ppImageParityFlip(config, options, view)) { 103 ESCAPE("Unable to detrend readout"); 104 } 105 106 // XXX TEST: 107 // psphotSaveImage (NULL, readout->image, "test.image.fits"); 100 108 101 109 // XXX set the options->*Mask values here (after the mask images have been loaded -
branches/pap/ppImage/src/ppImageMeasureCrosstalk.c
r23903 r25027 149 149 150 150 psStatsInit (stats); 151 psVectorStats (stats, vector, NULL, NULL, 0); 151 if (!psVectorStats (stats, vector, NULL, NULL, 0)) { 152 psError(PS_ERR_UNKNOWN, false, "failure to measure stats"); 153 return false; 154 } 152 155 153 156 float background = psMetadataLookupF32 (&status, cell->analysis, "XTALK.REF"); -
branches/pap/ppImage/src/ppImageOptions.c
r23845 r25027 25 25 options->doNonLin = false; // Non-linearity correction 26 26 options->doOverscan = false; // Overscan subtraction 27 options->doNoiseMap = false; // Apply Read Noise Map 27 28 options->doBias = false; // Bias subtraction 28 29 options->doDark = false; // Dark subtraction … … 30 31 options->doShutter = false; // Shutter correction 31 32 options->doFlat = false; // Flat-field normalisation 33 options->doPattern = false; // Pattern noise subtraction 32 34 options->doFringe = false; // Fringe subtraction 33 35 options->doPhotom = false; // Source identification and photometry … … 36 38 options->doStats = false; // Measure and save image statistics 37 39 options->checkCTE = false; // Measure pixel-based variance 40 options->applyParity = false; // Apply Cell parities 38 41 39 42 // output files requested … … 58 61 options->lowMask = 0x00; // out-of-bounds (low) pixels (supplied to pmReadoutGenerateMask) 59 62 options->flatMask = 0x00; // Bad flat pixels (supplied to pmFlatField) 63 options->darkMask = 0x00; // Bad dark pixels (supplied to pmDarkApply) 60 64 options->blankMask = 0x00; // Blank (no data, cell gap) pixels (supplied to pmChipMosaic, pmFPAMosaic) 61 65 options->markValue = 0x00; // A safe bit for internal marking … … 83 87 options->fringeIter = 0; // Fringe iterations 84 88 options->fringeKeep = 1.0; // Fringe keep fraction 89 90 // Pattern noise values 91 92 options->patternOrder = 0; // Polynomial order 93 options->patternIter = 0; // Clipping iterations 94 options->patternRej = NAN; // Clipping rejection threshold 95 options->patternThresh = NAN; // Threshold for ignoring pixels 96 options->patternMean = PS_STAT_NONE; // Statistic for mean 97 options->patternStdev = PS_STAT_NONE; // Statistic for standard deviation 85 98 86 99 // Remnance values … … 215 228 options->doCrosstalkCorrect = psMetadataLookupBool(NULL, recipe, "CROSSTALK.CORRECT"); 216 229 230 options->doNoiseMap = psMetadataLookupBool(NULL, recipe, "NOISEMAP"); 217 231 options->doBias = psMetadataLookupBool(NULL, recipe, "BIAS"); 218 232 options->doDark = psMetadataLookupBool(NULL, recipe, "DARK"); … … 221 235 options->doFringe = psMetadataLookupBool(NULL, recipe, "FRINGE"); 222 236 options->doShutter = psMetadataLookupBool(NULL, recipe, "SHUTTER"); 237 options->doPattern = psMetadataLookupBool(NULL, recipe, "PATTERN"); 223 238 224 239 options->doStats = false; … … 228 243 } 229 244 245 options->applyParity = psMetadataLookupBool(NULL, recipe, "APPLY.CELL.PARITY"); 246 230 247 // binned image options 231 248 options->xBin1 = psMetadataLookupS32(&status, recipe, "BIN1.XBIN"); … … 274 291 275 292 // even if not requested explicitly, if any of these are set, build an internal mask and variance: 276 if (options->do Bias || options->doOverscan || options->doDark || options->doShutter || options->doFlat ||293 if (options->doNoiseMap || options->doBias || options->doOverscan || options->doDark || options->doShutter || options->doFlat || 277 294 options->doPhotom) { 278 295 options->doMaskBuild = true; … … 292 309 options->fringeKeep = psMetadataLookupF32(NULL, recipe, "FRINGE.KEEP"); 293 310 311 // Pattern noise 312 options->patternOrder = psMetadataLookupS32(NULL, recipe, "PATTERN.ORDER"); 313 options->patternIter = psMetadataLookupS32(NULL, recipe, "PATTERN.ITER"); 314 options->patternRej = psMetadataLookupF32(NULL, recipe, "PATTERN.REJ"); 315 options->patternThresh = psMetadataLookupF32(NULL, recipe, "PATTERN.THRESH"); 316 options->patternMean = psStatsOptionFromString(psMetadataLookupStr(NULL, recipe, "PATTERN.MEAN")); 317 options->patternStdev = psStatsOptionFromString(psMetadataLookupStr(NULL, recipe, "PATTERN.STDEV")); 318 294 319 // Remnance options 295 320 options->remnanceSize = psMetadataLookupF32(NULL, recipe, "REMNANCE.SIZE"); -
branches/pap/ppImage/src/ppImageParseCamera.c
r23411 r25027 25 25 // otherwise they revert to the config information 26 26 // not all input or output images are used in a given recipe 27 if (options->doNoiseMap) { 28 if (!ppImageDefineFile(config, input->fpa, "PPIMAGE.NOISEMAP", "NOISEMAP", 29 PM_FPA_FILE_IMAGE, PM_DETREND_TYPE_NOISEMAP)) { 30 psError(PS_ERR_IO, false, "Can't find a noise map image source"); 31 psFree(options); 32 return NULL; 33 } 34 } 27 35 if (options->doBias) { 28 36 if (!ppImageDefineFile(config, input->fpa, "PPIMAGE.BIAS", "BIAS", … … 48 56 return NULL; 49 57 } 50 51 #if 052 // I think this is now done automatically in the pmFPAfileDefine and pmFPAfileIOChecks -- PAP.53 54 // XXX have ppImageDefineFile return the pmFPAfile?55 pmFPAfile *mask = psMetadataLookupPtr(&status, config->files, "PPIMAGE.MASK");56 psAssert(mask, "Just defined the mask!");57 58 // Need to read the names of bit masks from the mask header and set them in the59 // recipe. If we are loading this from the detrend db, this action will happen60 // when the file is resolved.61 if (!mask->detrend) {62 // XXX need to load the mask bit names from one of the headers63 // this grabs the first available hdu : no guarantee that it will be valid, though64 pmHDU *hdu = pmHDUGetFirst(mask->fpa);65 if (!hdu) {66 psError(PS_ERR_IO, true, "no valid HDU for PPIMAGE.INPUT.MASK");67 return NULL;68 }69 // XXX is this consistent with the pmConfigMaskReadHeader call above?70 if (!pmConfigMaskReadHeader(config, hdu->header)) {71 psError(PS_ERR_IO, false, "error in mask bits");72 return NULL;73 }74 }75 #endif76 58 } 77 59 if (options->doShutter) { -
branches/pap/ppImage/src/ppImageReplaceBackground.c
r23825 r25027 144 144 for (int y = 0; y < numRows; y++) { 145 145 for (int x = 0; x < numCols; x++) { 146 float value = backData[y][x]; 147 if (!isfinite(value)) { 148 image->data.F32[y][x] = NAN; 149 mask->data.PS_TYPE_IMAGE_MASK_DATA[y][x] |= options->lowMask; 146 if (mask && mask->data.PS_TYPE_IMAGE_MASK_DATA[y][x] & maskVal) { 147 image->data.F32[y][x] = 0.0; 150 148 } else { 151 image->data.F32[y][x] -= value; 152 } 149 float value = backData[y][x]; 150 if (!isfinite(value)) { 151 image->data.F32[y][x] = NAN; 152 mask->data.PS_TYPE_IMAGE_MASK_DATA[y][x] |= options->lowMask; 153 } else { 154 image->data.F32[y][x] -= value; 155 } 156 } 153 157 } 154 158 } -
branches/pap/ppImage/src/ppImageSetMaskBits.c
r23825 r25027 14 14 // at this point we know we have valid values for required entries SAT, BAD, FLAT, BLANK: 15 15 16 // mask for non-linearflat corrections16 // mask for bad flat corrections 17 17 options->flatMask = pmConfigMaskGet("FLAT", config); 18 18 psAssert (options->flatMask, "flat mask not set"); 19 20 // mask for bad dark corrections 21 options->darkMask = pmConfigMaskGet("DARK", config); 22 psAssert (options->darkMask, "dark mask not set"); 19 23 20 24 // mask for non-existent data (default to DETECTOR if not defined)
Note:
See TracChangeset
for help on using the changeset viewer.
