Changeset 18475
- Timestamp:
- Jul 11, 2008, 8:40:35 AM (18 years ago)
- Location:
- branches/eam_branch_20080706
- Files:
-
- 16 edited
-
ippconfig/cfh12k/ppMerge.config (modified) (1 diff)
-
ippconfig/lbc_red/ppMerge.config (modified) (1 diff)
-
ippconfig/recipes/filerules-split.mdc (modified) (1 diff)
-
ippconfig/recipes/masks.config (modified) (1 diff)
-
ippconfig/recipes/ppImage.config (modified) (1 diff)
-
ippconfig/recipes/ppMerge.config (modified) (3 diffs)
-
ippconfig/recipes/ppStats.config (modified) (1 diff)
-
ippconfig/recipes/psphot.config (modified) (1 diff)
-
ppMerge/src/ppMergeArguments.c (modified) (4 diffs)
-
ppMerge/src/ppMergeLoop.c (modified) (3 diffs)
-
ppMerge/src/ppMergeMask.c (modified) (14 diffs)
-
ppMerge/src/ppMergeScaleZero.c (modified) (1 diff)
-
ppStats/src/ppStatsFPA.c (modified) (1 diff)
-
ppStats/src/ppStatsMetadata.c (modified) (1 diff)
-
ppStats/src/ppStatsPixels.c (modified) (1 diff)
-
ppStats/src/ppStatsSetupFromRecipe.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branch_20080706/ippconfig/cfh12k/ppMerge.config
r12374 r18475 28 28 FRACLOW F32 0.1 # Fraction of low pixels to reject immediately 29 29 NKEEP S32 5 # Minimum number of pixels in stack to keep 30 MASKVAL S32 0xff # Mask value for input data31 30 WEIGHTS BOOL TRUE # Use image weights? 32 31 COMBINE STR MEAN # Statistic to use for combination: -
branches/eam_branch_20080706/ippconfig/lbc_red/ppMerge.config
r17154 r18475 28 28 FRACLOW F32 0.1 # Fraction of low pixels to reject immediately 29 29 NKEEP S32 5 # Minimum number of pixels in stack to keep 30 MASKVAL S32 0xff # Mask value for input data31 30 WEIGHTS BOOL TRUE # Use image weights? 32 31 COMBINE STR MEAN # Statistic to use for combination: -
branches/eam_branch_20080706/ippconfig/recipes/filerules-split.mdc
r18398 r18475 138 138 PSPHOT.OUT.CMF.SPL OUTPUT {OUTPUT}.{CHIP.NAME}.cmf CMF NONE CHIP TRUE NONE 139 139 PSPHOT.OUT.CMF.MEF OUTPUT {OUTPUT}.cmf CMF NONE FPA TRUE MEF 140 PSPHOT.PSF.SAVE OUTPUT {OUTPUT}. psfPSF NONE CHIP TRUE MEF140 PSPHOT.PSF.SAVE OUTPUT {OUTPUT}.{CHIP.NAME}.psf PSF NONE CHIP TRUE MEF 141 141 142 142 SOURCE.PLOT.MOMENTS OUTPUT {OUTPUT}.{CHIP.NAME}.mnt.png KAPA NONE CHIP TRUE NONE -
branches/eam_branch_20080706/ippconfig/recipes/masks.config
r13592 r18475 1 1 ### Recipe specifying values for various mask concepts 2 3 # this file defines bit values for various abstract mask concepts. It 4 # is not necessary for all bit values to be unique. Note that there 5 # are two main classes: detector-intrinsic and detector-extrinsic 6 # effects. The former will default to DETECTOR and the latter to 7 # RANGE if those values are not specifed 8 9 # Note that it is necessary to leave at least a single unassigned bit 10 # for internal marking (or ppImage will complain) 11 12 # these mask values are used for detector intrinsic effects 13 # BLANK and FLAT will be set to DETECTOR if not specified 14 DETECTOR U8 0x01 # Generic detector-intrinsic defect 2 15 BLANK U8 0x01 # The pixel is blank or has no (valid) data 16 DARK U8 0x02 # The pixel is not correctable for dark current 3 17 FLAT U8 0x02 # The pixel is non-positive in the flat-field 4 DETECTOR U8 0x02 # The detector pixel is bad (e.g., bad column, charge trap) 18 19 # these mask values are used for detector extrinsic effects 20 # SAT and BAD will be set to RANGE if not specified 21 RANGE U8 0x04 # The pixel is out of range in the image of interest 5 22 SAT U8 0x04 # The pixel is saturated in the image of interest 6 23 BAD U8 0x04 # The pixel is low in the image of interest 7 RANGE U8 0x04 # The pixel is out of range in the image of interest 24 8 25 CR U8 0x08 # The pixel is probably a CR 9 SUSPECT U8 0x40 # The pixel is suspected of being bad, but may not be 10 MARK U8 0x80 # The pixel is marked as temporarily ignored 26 GHOST U8 0x08 # The pixel is probably a CR -
branches/eam_branch_20080706/ippconfig/recipes/ppImage.config
r18372 r18475 11 11 FLAT BOOL TRUE # Flat-field normalisation 12 12 MASK BOOL FALSE # Mask bad pixels 13 MASK.VALUE STR SAT,BAD,DETECTOR # Mask pixels with these attributes 13 14 # XXX EAM : this is being deprecated 15 # MASK.VALUE STR SAT,BAD,DETECTOR # Mask pixels with these attributes 14 16 15 17 MASK.BUILD BOOL FALSE # Build internal mask image -
branches/eam_branch_20080706/ippconfig/recipes/ppMerge.config
r18253 r18475 20 20 MASK.CHIPSTATS BOOL TRUE # Measure stats for masking by chip (otherwise by readout)? 21 21 MASK.GROW S32 0 # Grow bad pixels by this radius 22 MASK. GROWVAL STR SUSPECT # Give grown mask pixels this value23 MASKVAL STR SAT,BAD # Mask value for input data 22 MASK.SET.VALUE STR FLAT # set this bit in the output mask 23 24 24 COMBINE STR CLIPPED # Statistic to use for combination 25 25 MEAN STR ROBUST_MEDIAN # Statistic to use to measure the mean … … 83 83 MASK.BAD F32 0.2 # Threshold for bad pixels (sigma) 84 84 MASK.MODE STR FRACTION # Mode for identifying bad pixels in the suspect map 85 MASK.SET.VALUE STR DARK # set this bit in the output mask 85 86 END 86 87 … … 90 91 MASK.BAD F32 0.2 # Threshold for bad pixels (sigma) 91 92 MASK.MODE STR FRACTION # Mode for identifying bad pixels in the suspect map 93 MASK.SET.VALUE STR FLAT # set this bit in the output mask 92 94 END 93 95 -
branches/eam_branch_20080706/ippconfig/recipes/ppStats.config
r17911 r18475 3 3 # Options governing statistics 4 4 SAMPLE F32 0.1 # Fraction of cell to sample 5 MASKVAL STR SAT,BAD # Mask value to use for statistics 5 6 # Mask value to use for statistics. this is only used for stand-alone 7 # operations. ppStats library calls pass a mask value as needed 8 MASKVAL STR SAT,BAD 9 6 10 7 11 # Define the outputs as MULTI -
branches/eam_branch_20080706/ippconfig/recipes/psphot.config
r18275 r18475 15 15 ZERO_POINT F32 25.000 # zero point used by DVO 16 16 ZERO_PT F32 25.000 # zero point used by DVO 17 18 MASKVAL STR SAT,BAD,BLANK # Mask these types of pixels19 17 20 18 OUTPUT.FORMAT STR PS1_DEV_1 -
branches/eam_branch_20080706/ppMerge/src/ppMergeArguments.c
r18365 r18475 138 138 psMetadataAddS32(arguments, PS_LIST_TAIL, "-nkeep", 0, "Minimum number of pixels in stack to keep", 0); 139 139 psMetadataAddBool(arguments, PS_LIST_TAIL, "-weights", 0, "Use image weights in combination?", false); 140 psMetadataAddStr(arguments, PS_LIST_TAIL, "-maskval", 0, "Mask value for input data", NULL); 140 141 // XXX EAM : not clear this should be allowed on the command line. 142 // psMetadataAddStr(arguments, PS_LIST_TAIL, "-maskval", 0, "Mask value for input data", NULL); 143 141 144 psMetadataAddStr(arguments, PS_LIST_TAIL, "-combine", 0, "Statistic to use for combination", NULL); 142 145 psMetadataAddStr(arguments, PS_LIST_TAIL, "-mean", 0, "Statistic to use to measure the mean", NULL); … … 159 162 psMetadataAddStr(arguments, PS_LIST_TAIL, "-mask-mode", 0, "Mode to identify bad pixels", NULL); 160 163 psMetadataAddS32(arguments, PS_LIST_TAIL, "-mask-grow", 0, "Number of pixels to grow final mask", 0); 161 psMetadataAddStr(arguments, PS_LIST_TAIL, "-mask- growval", 0, "Value to give grownmask pixels", NULL);164 psMetadataAddStr(arguments, PS_LIST_TAIL, "-mask-set-valud",0, "Value to set for output mask pixels", NULL); 162 165 psMetadataAddBool(arguments, PS_LIST_TAIL, "-mask-chip", 0, "Measure mask statistics by chip?", false); 163 166 … … 264 267 VALUE_ARG_RECIPE_INT("-nkeep", "NKEEP", S32, 0); 265 268 VALUE_ARG_RECIPE_BOOL("-weights", "WEIGHTS"); 266 VALUE_ARG_RECIPE_MASK("-maskval", "MASKVAL"); 269 270 // XXX we do not supply this on the command line 271 // VALUE_ARG_RECIPE_MASK("-maskval", "MASKVAL"); 272 267 273 VALUE_ARG_RECIPE_STAT("-combine", "COMBINE"); 268 274 VALUE_ARG_RECIPE_STAT("-mean", "MEAN"); … … 281 287 VALUE_ARG_RECIPE_FLOAT("-mask-suspect", "MASK.SUSPECT", F32); 282 288 VALUE_ARG_RECIPE_FLOAT("-mask-bad", "MASK.BAD", F32); 283 VALUE_ARG_RECIPE_INT("-mask-grow", "MASK.GROW", S32, -1);284 VALUE_ARG_RECIPE_ MASK("-mask-growval", "MASK.GROWVAL");289 VALUE_ARG_RECIPE_INT("-mask-grow", "MASK.GROW", S32, 0); 290 VALUE_ARG_RECIPE_STR("-mask-set-value", "MASK.SET.VALUE"); 285 291 VALUE_ARG_RECIPE_BOOL("-mask-chip", "MASK.CHIPSTATS"); 286 292 -
branches/eam_branch_20080706/ppMerge/src/ppMergeLoop.c
r18166 r18475 39 39 float frachigh = psMetadataLookupF32(NULL, arguments, "FRACHIGH"); // Reject fraction of hi pixels 40 40 int nKeep = psMetadataLookupS32(NULL, arguments, "NKEEP"); // Minimum number of values to keep 41 psMaskType maskVal = psMetadataLookupU8(NULL, arguments, "MASKVAL"); // Value to mask42 41 psStatsOptions combineStat = psMetadataLookupS32(NULL, arguments, "COMBINE"); // Combination statistic 43 42 bool useWeights = psMetadataLookupBool(NULL, arguments, "WEIGHTS"); // Use weights? … … 49 48 int fringeSmoothY = psMetadataLookupS32(NULL, arguments, "FRINGE.YSMOOTH"); // Smoothing regions in y 50 49 50 // set the mask and mark bit values based on the named masks 51 psMaskType maskVal; 52 psMaskType markVal; 53 if (!pmConfigMaskSetBits (&maskVal, &markVal, config)) { 54 psError (PS_ERR_UNKNOWN, true, "Unable to define the mask bit values"); 55 return false; 56 } 57 51 58 pmCombineParams *combination = pmCombineParamsAlloc(combineStat); // Combination parameters 52 59 combination->maskVal = maskVal; 53 combination->blank = pmConfigMask ("BLANK", config);60 combination->blank = pmConfigMaskGet("BLANK", config); 54 61 combination->nKeep = nKeep; 55 62 combination->fracHigh = frachigh; … … 294 301 } 295 302 296 if (!ppStatsFPA(stats, outFPA, view, maskVal | pmConfigMask("BLANK", config), config)) {303 if (!ppStatsFPA(stats, outFPA, view, maskVal, config)) { 297 304 psError(PS_ERR_UNKNOWN, true, "Unable to generate stats for image."); 298 305 goto ERROR; -
branches/eam_branch_20080706/ppMerge/src/ppMergeMask.c
r18365 r18475 18 18 psRandom *rng, // Random number generator 19 19 psMetadata *stats // Statistics output 20 )20 ) 21 21 { 22 22 assert(config); … … 28 28 psStatsOptions meanStat = psMetadataLookupS32(NULL, config->arguments, "MEAN"); // Statistic for mean 29 29 psStatsOptions stdevStat = psMetadataLookupS32(NULL, config->arguments, "STDEV"); // Statistic for stdev 30 psMaskType maskVal = psMetadataLookupU8(NULL, config->arguments, "MASKVAL"); // Value to mask31 30 int sample = psMetadataLookupS32(NULL, config->arguments, "SAMPLE"); // Size of sample for statistics 32 31 bool chipStats = psMetadataLookupBool(&mdok, config->arguments, "MASK.CHIPSTATS"); // Statistics on chip? … … 35 34 pmMaskIdentifyMode maskMode = psMetadataLookupS32(NULL, config->arguments, "MASK.MODE"); // Mode for identifying bad pixels 36 35 int maskGrow = psMetadataLookupS32(NULL, config->arguments, "MASK.GROW"); // Radius to grow mask 37 psMaskType maskGrowVal = psMetadataLookupU8(NULL, config->arguments, "MASK.GROWVAL"); // Value for grown mask38 36 39 37 bool smoothSuspect = psMetadataLookupBool(&mdok, config->arguments, "MASK.SMOOTH.SUSPECT"); // Radius to grow mask 40 38 float smoothScale = psMetadataLookupF32(&mdok, config->arguments, "MASK.SMOOTH.SCALE"); // Radius to grow mask 41 39 40 psMaskType markVal; 41 psMaskType maskValRaw; 42 if (!pmConfigMaskSetBits (&maskValRaw, &markVal, config)) { 43 psError (PS_ERR_UNKNOWN, true, "Unable to define the mask bit values"); 44 return false; 45 } 46 47 char *maskOutName = psMetadataLookupStr (&mdok, config->arguments, "MASK.SET.VALUE"); 48 psMaskType maskValOut = pmConfigMaskGet (maskOutName, config); 49 if (!maskValOut) { 50 psError (PS_ERR_UNKNOWN, true, "Undefined output mask bit value"); 51 return false; 52 } 53 42 54 psStats *statistics = psStatsAlloc(meanStat | stdevStat); // Statistics for background 43 55 … … 137 149 int x = pixel % numCols; 138 150 int y = pixel / numCols; 139 if ((mask && (mask->data.PS_TYPE_MASK_DATA[y][x] & maskVal)) || 140 !isfinite(image->data.F32[y][x]) || 141 (outMask && (outMask->data.PS_TYPE_MASK_DATA[y][x] & maskVal))) { 142 continue; 143 } 151 if (mask && (mask->data.PS_TYPE_MASK_DATA[y][x] & maskValRaw)) continue; 152 if (outMask && (outMask->data.PS_TYPE_MASK_DATA[y][x] & maskValOut)) continue; 153 if (!isfinite(image->data.F32[y][x])) continue; 144 154 145 155 values->data.F32[valueIndex++] = image->data.F32[y][x]; … … 155 165 } 156 166 157 if (!pmMaskFlagSuspectPixels(outRO, readout, psStatsGetValue(statistics, meanStat), 158 psStatsGetValue(statistics, stdevStat), maskSuspect, maskVal)) { 167 float mean = psStatsGetValue(statistics, meanStat); 168 float stdev = psStatsGetValue(statistics, stdevStat); 169 170 // this function increments the count for each suspect pixel in each input plane 171 // maskValRaw is used to test for valid input pixels 172 if (!pmMaskFlagSuspectPixels(outRO, readout, mean, stdev, maskSuspect, maskValRaw)) { 159 173 psError(PS_ERR_UNKNOWN, false, "Unable to find suspect values in file %d", i); 160 174 psFree(inView); … … 189 203 190 204 pmHDU *hdu = pmHDUFromCell(inCell); // HDU for cell 191 if (!hdu || hdu->blankPHU) { 192 // No data here 193 continue; 194 } 205 if (!hdu || hdu->blankPHU) continue; 206 195 207 pmReadout *readout = inCell->readouts->data[0]; // Readout of interest 196 208 … … 198 210 pmReadout *outRO = pmFPAfileThisReadout(config->files, inView, "PPMERGE.OUTPUT.MASK"); 199 211 200 if (!pmMaskFlagSuspectPixels(outRO, readout, psStatsGetValue(statistics, meanStat), 201 psStatsGetValue(statistics, stdevStat), maskSuspect, maskVal)) { 212 float mean = psStatsGetValue(statistics, meanStat); 213 float stdev = psStatsGetValue(statistics, stdevStat); 214 215 if (!pmMaskFlagSuspectPixels(outRO, readout, mean, stdev, maskSuspect, maskValRaw)) { 202 216 psError(PS_ERR_UNKNOWN, false, "Unable to find suspect values in file %d", i); 203 217 goto MERGE_MASK_ERROR; … … 229 243 while ((outCell = pmFPAviewNextCell(outView, outFPA, 1))) { 230 244 231 // skip pinactive cells245 // skip inactive cells 232 246 if (!outCell->process) continue; 233 247 234 248 pmHDU *hdu = pmHDUFromCell(outCell); // HDU for cell 235 if (!hdu || hdu->blankPHU) { 236 // No data here 237 continue; 238 } 249 if (!hdu || hdu->blankPHU) continue; 239 250 240 251 psTrace("ppMerge", 1, "Getting bad pixels for chip %d cell %d", outView->chip, outView->cell); … … 250 261 } 251 262 252 if (!pmMaskIdentifyBadPixels(outRO, maskVal, maskBad, maskMode)) { 263 // set the bad pixels to the value 'maskVal' 264 if (!pmMaskIdentifyBadPixels(outRO, maskValOut, maskBad, maskMode)) { 253 265 psError(PS_ERR_UNKNOWN, false, "Unable to mask bad pixels"); 254 266 goto MERGE_MASK_ERROR; … … 274 286 } 275 287 276 if (maskGrow Val> 0) {277 psImage *grown = psImageGrowMask(NULL, outRO->mask, maskVal , maskGrow, maskGrowVal); // Grown mask288 if (maskGrow > 0) { 289 psImage *grown = psImageGrowMask(NULL, outRO->mask, maskValOut, maskGrow, maskValOut); // Grown mask 278 290 psFree(outRO->mask); 279 291 outRO->mask = grown; … … 307 319 outRO->image = psImageAlloc(outRO->mask->numCols, outRO->mask->numRows, PS_TYPE_F32); 308 320 psImageInit(outRO->image, 1.0); 309 if (!ppStatsFPA(stats, outRO->parent->parent->parent, outView, 310 maskVal | pmConfigMask("BLANK", config), config)) { 321 if (!ppStatsFPA(stats, outRO->parent->parent->parent, outView, maskValOut, config)) { 311 322 psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to generate stats for image."); 312 323 psFree(outRO); … … 337 348 } 338 349 339 340 341 342 343 350 bool ppMergeMask(pmConfig *config) 344 351 { … … 381 388 goto PPMERGE_MASK_ERROR; 382 389 } 390 391 // XXX this function should use pmConfigMaskReadHeader () to get the named values defined 392 // for the input masks. 383 393 384 394 psString outName = ppMergeOutputFile(config); // Name of output file … … 414 424 psListAdd(inChips, PS_LIST_TAIL, chip); 415 425 } 426 427 // XXX I need to call pmConfigMaskWriteHeader for the PHU somewhere, after it is created! 428 416 429 if (!pmConceptsAverageChips(outChip, inChips, true)) { 417 430 psError(PS_ERR_UNKNOWN, false, "Unable to average Chip concepts."); -
branches/eam_branch_20080706/ppMerge/src/ppMergeScaleZero.c
r18218 r18475 21 21 psStatsOptions meanStat = psMetadataLookupS32(NULL, config->arguments, "MEAN"); // Statistic for mean 22 22 psStatsOptions stdevStat = psMetadataLookupS32(NULL, config->arguments, "STDEV"); // Statistic for stdev 23 psMaskType maskVal = psMetadataLookupU8(NULL, config->arguments, "MASKVAL"); // Value to mask24 23 int shutterSize = psMetadataLookupS32(NULL, config->arguments, "SHUTTER.SIZE"); // Size of shutter region 24 25 psMaskType maskVal = pmConfigMaskGet("MASK.VALUE", config); // Value to mask 25 26 26 27 psVector *gains = NULL; // Gains for each cell -
branches/eam_branch_20080706/ppStats/src/ppStatsFPA.c
r14010 r18475 21 21 } 22 22 23 // Override recipe mask value if one is provided 24 if (maskVal != 0) { 25 data->maskVal = maskVal; 26 } 23 // Override recipe mask value 24 data->maskVal = maskVal; 27 25 28 26 if (data->fpa) { -
branches/eam_branch_20080706/ppStats/src/ppStatsMetadata.c
r14010 r18475 29 29 data->doStats = false; 30 30 31 // Override recipe mask value if one is provided 32 if (maskVal != 0) { 33 data->maskVal = maskVal; 34 } 31 // Override recipe mask value 32 data->maskVal = maskVal; 35 33 36 34 if (data->fpa) { -
branches/eam_branch_20080706/ppStats/src/ppStatsPixels.c
r14010 r18475 28 28 data->concepts = psListAlloc(NULL); 29 29 30 // Override recipe mask value if one is provided 31 if (maskVal != 0) { 32 data->maskVal = maskVal; 33 } 30 // Override recipe mask value 31 data->maskVal = maskVal; 34 32 35 33 if (data->fpa) { -
branches/eam_branch_20080706/ppStats/src/ppStatsSetupFromRecipe.c
r13999 r18475 127 127 } 128 128 129 // set the mask value used for stand-alone analyses. 129 130 if (data->maskVal == 0) { 130 131 const char *names = psMetadataLookupStr(&mdok, recipe, "MASKVAL"); // Names for mask value 131 132 if (mdok) { 132 data->maskVal = pmConfigMask (names, config);133 data->maskVal = pmConfigMaskGet(names, config); 133 134 } else { 134 135 psWarning("MASKVAL in recipe is not of type STR --- retaining default.\n");
Note:
See TracChangeset
for help on using the changeset viewer.
