- Timestamp:
- May 3, 2010, 8:45:22 AM (16 years ago)
- Location:
- branches/simmosaic_branches
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
ppImage/src/ppImageDetrendReadout.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/simmosaic_branches
- Property svn:mergeinfo changed
-
branches/simmosaic_branches/ppImage/src/ppImageDetrendReadout.c
r24485 r27839 15 15 pmReadout *input = pmFPAfileThisReadout(config->files, view, "PPIMAGE.INPUT"); 16 16 17 // Check that the gain is set (this is used by both pmReadoutGenerateMask and pmReadoutGenerateVariance) 18 { 19 float gain = psMetadataLookupF32(NULL, input->parent->concepts, "CELL.GAIN"); // Gain for cell 20 if (!isfinite(gain)) { 21 psMetadata *recipe = psMetadataLookupMetadata(NULL, config->recipes, RECIPE_NAME); // Recipe 22 psAssert(recipe, "Should be there!"); 23 bool override = psMetadataLookupBool(NULL, recipe, "GAIN.OVERRIDE"); // Override the bad gain? 24 if (override) { 25 psWarning("CELL.GAIN is not set for readout (%d,%d,%d) --- setting to unity.", view->chip, view->cell, view->readout); 26 psMetadataItem *item = psMetadataLookup(input->parent->concepts, "CELL.GAIN"); // Gain item 27 psAssert(item, "Should be there!"); 28 item->data.F32 = 1.0; 29 30 // for unity gain, there is no modification for the readnoise, note that it has (effectively) been updated 31 psMetadataRemoveKey(input->parent->concepts, "CELL.READNOISE.UPDATE"); 32 } else { 33 psWarning("CELL.GAIN is NAN for readout (%d,%d,%d), image will be masked.", view->chip, view->cell, view->readout); 34 } 35 } 36 } 37 17 38 // Masking on the basis of pixel value needs to be done before anything else, so the values are pristine. 18 39 if (options->doMaskBuild) { … … 26 47 pmMaskBadPixels(input, mask, options->maskValue); 27 48 } 49 if (options->doMaskBurntool) { 50 ppImageBurntoolMask(config,options,view,input); 51 } 52 28 53 29 54 # if 0 … … 64 89 if (options->doVarianceBuild) { 65 90 // create the target mask and variance images 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 } 91 psImage *noiseImage = NULL; 92 if (options->doNoiseMap) { 93 // XXX convert the noiseMap image to a binned image 94 pmReadout *noiseMap = NULL; 95 noiseMap = pmFPAfileThisReadout(config->files, detview, "PPIMAGE.NOISEMAP"); 96 noiseImage = psImageCopy (NULL, input->image, PS_TYPE_F32); 97 psImageInit (noiseImage, 0.0); 98 99 // XXX this works, but is not really quite right: the model shoud include the 100 // offset information, we are not really getting exactly the right mapping from the 101 // original file. 102 psImageBinning *binning = psImageBinningAlloc(); 103 binning->nXruff = noiseMap->image->numCols; 104 binning->nYruff = noiseMap->image->numRows; 105 binning->nXfine = input->image->numCols; 106 binning->nYfine = input->image->numRows; 107 psImageBinningSetScale(binning, PS_IMAGE_BINNING_LEFT); 108 109 psImageUnbin (noiseImage, noiseMap->image, binning); 110 psFree (binning); 111 } 112 87 113 pmReadoutGenerateVariance(input, noiseImage, true); 88 psFree (noiseImage);114 psFree (noiseImage); 89 115 } 90 116 … … 123 149 } 124 150 } 151 152 /* // Pattern noise correction */ 153 /* if (options->doPattern) { */ 154 /* if (!pmPatternRow(input, options->patternOrder, options->patternIter, options->patternRej, */ 155 /* options->patternThresh, options->patternMean, options->patternStdev, */ 156 /* options->maskValue, options->darkMask)) { */ 157 /* psFree(detview); */ 158 /* return false; */ 159 /* } */ 160 /* } */ 125 161 126 162 // Normalization by a single (known) constant
Note:
See TracChangeset
for help on using the changeset viewer.
