Changeset 28304 for branches/czw_branch/20100519/ppSub/src/ppSubMaskStats.c
- Timestamp:
- Jun 10, 2010, 6:28:51 PM (16 years ago)
- Location:
- branches/czw_branch/20100519
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
ppSub/src/ppSubMaskStats.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/czw_branch/20100519
- Property svn:mergeinfo changed
-
branches/czw_branch/20100519/ppSub/src/ppSubMaskStats.c
r28043 r28304 9 9 10 10 11 bool ppSubMaskStats(pmConfig *config, pmFPAview *view, psMetadata *stats) { 11 bool ppSubMaskStats(pmConfig *config, pmFPAview *view, psMetadata *stats) 12 { 12 13 PS_ASSERT_PTR_NON_NULL(view, false); 13 14 PS_ASSERT_PTR_NON_NULL(config, false); 15 16 pmReadout *readout = pmFPAfileThisReadout(config->files, view, "PPSUB.OUTPUT"); 17 if (!stats || !readout || !readout->data_exists) { 18 // Nothing to process 19 return(true); 20 } 14 21 15 22 bool status; 16 23 17 24 psMetadata *recipe = psMetadataLookupMetadata(&status, config->recipes, PPSUB_RECIPE); 18 ps U16 staticMaskVal = psMetadataLookupU32(&status, recipe, "MASKSTAT.STATIC");19 ps U16 magicMaskVal = psMetadataLookupU32(&status, recipe, "MASKSTAT.MAGIC");20 ps U16 dynamicMaskVal = psMetadataLookupU32(&status, recipe, "MASKSTAT.DYNAMIC");21 ps U16 advisoryMaskVal = psMetadataLookupU32(&status, recipe, "MASKSTAT.ADVISORY");25 psImageMaskType staticMaskVal = psMetadataLookupImageMask(&status, recipe, "MASKSTAT.STATIC"); 26 psImageMaskType magicMaskVal = psMetadataLookupImageMask(&status, recipe, "MASKSTAT.MAGIC"); 27 psImageMaskType dynamicMaskVal = psMetadataLookupImageMask(&status, recipe, "MASKSTAT.DYNAMIC"); 28 psImageMaskType advisoryMaskVal = psMetadataLookupImageMask(&status, recipe, "MASKSTAT.ADVISORY"); 22 29 23 30 psS32 Npix_valid = 0; … … 27 34 psS32 Npix_advisory = 0; 28 35 29 psWarning("ppSubMaskStats: %d %d %d %d\n",staticMaskVal,magicMaskVal,dynamicMaskVal,advisoryMaskVal);30 31 pmReadout *readout = pmFPAfileThisReadout(config->files, view, "PPSUB.OUTPUT");32 if (!readout || !readout->data_exists) {33 // Nothing to process34 return(true);35 }36 36 psImage *mask = readout->mask; // Mask of interest; 37 37 if (!pmSingleImageMaskStats(mask,&Npix_valid,&Npix_static,&Npix_magic, 38 &Npix_dynamic,&Npix_advisory,39 staticMaskVal,magicMaskVal,40 dynamicMaskVal,advisoryMaskVal)) {38 &Npix_dynamic,&Npix_advisory, 39 staticMaskVal,magicMaskVal, 40 dynamicMaskVal,advisoryMaskVal)) { 41 41 psError(PS_ERR_UNKNOWN, false, "Unable to calculate masks for readout."); 42 42 return(false); 43 43 } 44 44 psMetadataAddS32(stats, PS_LIST_TAIL,"MASKFRAC_NPIX", 0, 45 "Number of valid pixels", Npix_valid);45 "Number of valid pixels", Npix_valid); 46 46 psMetadataAddF32(stats,PS_LIST_TAIL, "MASKFRAC_STATIC", 0, 47 "Fraction of pixels statically masked", (float) Npix_static / Npix_valid);47 "Fraction of pixels statically masked", (float) Npix_static / Npix_valid); 48 48 psMetadataAddF32(stats,PS_LIST_TAIL, "MASKFRAC_DYNAMIC", 0, 49 "Fraction of pixels dynamically masked", (float) Npix_dynamic / Npix_valid);49 "Fraction of pixels dynamically masked", (float) Npix_dynamic / Npix_valid); 50 50 psMetadataAddF32(stats,PS_LIST_TAIL, "MASKFRAC_MAGIC", 0, 51 "Fraction of pixels magically masked", (float) Npix_magic / Npix_valid);51 "Fraction of pixels magically masked", (float) Npix_magic / Npix_valid); 52 52 psMetadataAddF32(stats,PS_LIST_TAIL, "MASKFRAC_ADVISORY", 0, 53 "Fraction of pixels masked as an advisory", (float) Npix_advisory / Npix_valid);53 "Fraction of pixels masked as an advisory", (float) Npix_advisory / Npix_valid); 54 54 return(true); 55 55 }
Note:
See TracChangeset
for help on using the changeset viewer.
