Changeset 21109
- Timestamp:
- Jan 12, 2009, 4:19:18 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/pap_branch_20090108/ppStack/src/ppStackMatch.c
r21106 r21109 6 6 #include <pslib.h> 7 7 #include <psmodules.h> 8 #include <psphot.h> 8 9 9 10 #include "ppStack.h" … … 119 120 } 120 121 122 // Add background into the fake image 123 // Based on ppSubBackground() 124 static psImage *stackBackgroundModel(pmReadout *ro, // Readout for which to generate background model 125 const pmConfig *config // Configuration 126 ) 127 { 128 psAssert(ro && ro->image, "Need readout image"); 129 psAssert(config, "Need configuration"); 130 131 psImage *image = ro->image; // Image of interest 132 int numCols = image->numCols, numRows = image->numRows; // Size of image 133 134 psMetadata *ppStackRecipe = psMetadataLookupPtr(NULL, config->recipes, PPSTACK_RECIPE); 135 psAssert(ppStackRecipe, "Need PPSTACK recipe"); 136 psMetadata *psphotRecipe = psMetadataLookupPtr(NULL, config->recipes, PSPHOT_RECIPE); 137 psAssert(psphotRecipe, "Need PSPHOT recipe"); 138 139 psString maskBadStr = psMetadataLookupStr(NULL, ppStackRecipe, "MASK.BAD");// Name of bits to mask for bad 140 psMaskType maskBad = pmConfigMaskGet(maskBadStr, config); // Bits to mask for bad pixels 141 142 // user-defined masks to test for good/bad pixels (build from recipe list if not yet set) 143 psMetadataAddU8(psphotRecipe, PS_LIST_TAIL, "MASK.PSPHOT", PS_META_REPLACE, "user-defined mask", maskBad); 144 145 psImage *binned = psphotBackgroundModel(ro, config); // Binned background model 146 psImageBinning *binning = psMetadataLookupPtr(NULL, psphotRecipe, 147 "PSPHOT.BACKGROUND.BINNING"); // Binning for model 148 psAssert(binning, "Need binning parameters"); 149 psImage *unbinned = psImageAlloc(numCols, numRows, PS_TYPE_F32); // Unbinned background model 150 if (!psImageUnbin(unbinned, binned, binning)) { 151 psError(PS_ERR_UNKNOWN, false, "Unable to unbin background model"); 152 psFree(unbinned); 153 return NULL; 154 } 155 156 // XXX should these really be here?? (probably not...) 157 // pmFPAfileDropInternal(config->files, "PSPHOT.BACKMDL"); 158 // pmFPAfileDropInternal(config->files, "PSPHOT.BACKMDL.STDEV"); 159 160 return unbinned; 161 } 162 163 164 165 166 #if 0 121 167 #define BG_SIZE 64 // Large box half-size in which to measure background 122 168 … … 174 220 return bgImage; 175 221 } 222 #endif 223 176 224 177 225 bool ppStackMatch(pmReadout *readout, psArray **regions, psArray **kernels, float *chi2, float *weighting, … … 372 420 } 373 421 374 375 #if 0376 422 // Add the background into the target image 377 psImage *bgImage = stackBackgroundModel(readout, maskVal, stampSources, footprint); // Image of background423 psImage *bgImage = stackBackgroundModel(readout, config); // Image of background 378 424 psBinaryOp(fake->image, fake->image, "+", bgImage); 379 425 psFree(bgImage); 380 #endif381 382 426 383 427 #ifdef TESTING
Note:
See TracChangeset
for help on using the changeset viewer.
