Changeset 36855
- Timestamp:
- Jun 12, 2014, 11:52:06 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 11 edited
-
ippconfig/gpc1/ppStack.config (modified) (3 diffs)
-
ippconfig/recipes/ppStack.config (modified) (1 diff)
-
ppStack/src/ppStack.h (modified) (1 diff)
-
ppStack/src/ppStackCombineFinal.c (modified) (2 diffs)
-
ppStack/src/ppStackLoop.c (modified) (3 diffs)
-
ppStack/src/ppStackLoop.h (modified) (1 diff)
-
ppStack/src/ppStackOptions.c (modified) (2 diffs)
-
ppStack/src/ppStackOptions.h (modified) (1 diff)
-
ppStack/src/ppStackPrepare.c (modified) (2 diffs)
-
ppStack/src/ppStackReadout.c (modified) (4 diffs)
-
ppStack/src/ppStackThread.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippconfig/gpc1/ppStack.config
r36773 r36855 160 160 STACK.TYPE STR DEEP_STACK ## needed? 161 161 PSF.INPUT.CLIP.SIMPLE BOOL True 162 PSF.INPUT.MAX F32 6.0 # never really want >6 pixels in refstack, even on edges162 PSF.INPUT.MAX F32 7.0 # center/edge can vary 1-2 pix, prefer <6 pix but needs to be <7 pix for edges 163 163 PSF.INPUT.CLIP.NSIGMA F32 1.0 # sample typically on rising side of distribution (set even smaller?) 164 164 PSF.INPUT.THRESH F32 NAN … … 168 168 PSF.TARGET.AS.MAX BOOL TRUE # Set the target PSF FWHM as the maximum of accepted input FWHM values. 169 169 PSF.TARGET.AS.MAX.EPSILON F32 0.1 # Amount to set the target PSF FWHM larger than the maximum input. Target = eps + max(input) 170 THRESHOLD.MASK F32 0.1 # Threshold for mask deconvolution (0..1) 171 COMBINE.ITER F32 0.5 # Number of rejection iterations per input 172 COMBINE.REJ F32 3.0 # Rejection threshold in combination (sigma) 173 COMBINE.SYS F32 0.1 # Relative systematic error in combination 174 COMBINE.DISCARD F32 0.2 # Discard fraction for Olympic weighted mean 175 IMAGE.REJ F32 0.1 # Rejected pixel fraction threshold for rejecting entire image 176 NMINPIX S32 4 # Minimum input per pixel 177 MASK.VAL STR SUSPECT,MASK.VALUE,CONV.BAD,GHOST # Mask value of input bad pixels 178 MASK.BLANKBORDER S32 20 # Mask blank border in final stack output 179 BSCALEOFFSET BOOL TRUE # HACK for removing bscale offset from input warps because of compression (0.5*BSCALE) 170 180 END 171 181 … … 193 203 MASK.VAL STR SUSPECT,MASK.VALUE,CONV.BAD,GHOST # Mask value of input bad pixels 194 204 MASK.BLANKBORDER S32 20 # Mask blank border in final stack output 205 BSCALEOFFSET BOOL TRUE # HACK for removing bscale offset from input warps because of compression (0.5*BSCALE) 195 206 END 196 207 -
trunk/ippconfig/recipes/ppStack.config
r36773 r36855 34 34 TARGET.MINMAG F32 3.0 # Minimum magnitude difference to tolerate in stamp 35 35 NMINPIX S32 1 # Minimum input per pixel 36 BSCALEOFFSET BOOL FALSE # HACK for removing offset from input warps because of compression (0.5*BSCALE) 36 37 37 38 BACKGROUND.MODEL BOOL FALSE # Construct a stacked version of the warp stage background -
trunk/ppStack/src/ppStack.h
r34849 r36855 108 108 const psVector *addVariance, // Additional variance for rejection 109 109 bool safety, // Enable safety switch? 110 const psVector *norm // Normalisations to apply 110 const psVector *norm, // Normalisations to apply 111 const psVector *bscaleApplyOffset // hack for offset based on bscale 111 112 ); 112 113 -
trunk/ppStack/src/ppStackCombineFinal.c
r36717 r36855 44 44 45 45 bool ppStackCombineFinal(ppStackThreadData *stack, psArray *covariances, ppStackOptions *options, 46 pmConfig *config, bool safe, bool normalise, bool grow )46 pmConfig *config, bool safe, bool normalise, bool grow, bool bscaleoffset) 47 47 { 48 48 psAssert(stack, "Require stack"); … … 107 107 PS_ARRAY_ADD_SCALAR(job->args, safe, PS_TYPE_U8); 108 108 PS_ARRAY_ADD_SCALAR(job->args, normalise, PS_TYPE_U8); 109 PS_ARRAY_ADD_SCALAR(job->args, bscaleoffset, PS_TYPE_U8); 109 110 if (!psThreadJobAddPending(job)) { 110 111 psFree(reject); -
trunk/ppStack/src/ppStackLoop.c
r36365 r36855 120 120 psTrace("ppStack", 2, "Final stack of convolved images....\n"); 121 121 if (options->convolve) { 122 if (!ppStackCombineFinal(stack, options->convCovars, options, config, false, false, true )) {122 if (!ppStackCombineFinal(stack, options->convCovars, options, config, false, false, true, false)) { 123 123 psError(psErrorCodeLast(), false, "Unable to perform final combination."); 124 124 psFree(stack); … … 128 128 else { 129 129 // Since we haven't convolved, I believe we do need to normalize here. 130 if (!ppStackCombineFinal(stack, options->convCovars, options, config, false, true, true)) { 130 //MEH -- see below for comment on ppStackCombineFinal and bscaleOffset 131 if (!ppStackCombineFinal(stack, options->convCovars, options, config, false, true, true, true)) { 131 132 psError(psErrorCodeLast(), false, "Unable to perform final combination."); 132 133 psFree(stack); … … 207 208 // generate the unconvolved stack. NOTE: this one must be normalized since the inputs have not been 208 209 psTrace("ppStack", 2, "Stack of unconvolved images....\n"); 209 if (!ppStackCombineFinal(stack, options->origCovars, options, config, false, true, false)) { 210 //MEH -- terrible hack for bscale offset to input warps -- treat like normalization 211 // -- if BSCALEOFFSET TRUE, 0.5*bscale for offset values, otherwise value 0.0 212 // -- bscaleOffset set when files read in and applied in CombineFinal (if arg true, only valid for unconv case) 213 if (!ppStackCombineFinal(stack, options->origCovars, options, config, false, true, false, true)) { 210 214 psError(psErrorCodeLast(), false, "Unable to perform unconvolved combination."); 211 215 psFree(stack); -
trunk/ppStack/src/ppStackLoop.h
r34800 r36855 65 65 bool safe, // Allow safe combination? 66 66 bool norm, // Normalise images? 67 bool grow // Grow rejection masks? 67 bool grow, // Grow rejection masks? 68 bool bscaleoffset // Apply bscale offset? 68 69 ); 69 70 -
trunk/ppStack/src/ppStackOptions.c
r35167 r36855 19 19 psFree(options->inputMask); 20 20 psFree(options->sourceLists); 21 psFree(options->bscaleOffset); 21 22 psFree(options->norm); 22 23 psFree(options->sources); … … 65 66 options->inputMask = NULL; 66 67 options->sourceLists = NULL; 68 options->bscaleOffset = NULL; 67 69 options->norm = NULL; 68 70 options->sources = NULL; -
trunk/ppStack/src/ppStackOptions.h
r35167 r36855 35 35 float clippedMean; // clipped mean of input fwhm 36 36 float clippedStdev; // clipped stdev of input fwhm 37 psVector *bscaleOffset; // hack offset of bzero using 0.5*bscale if option, 0.0 if not 37 38 // Convolve 38 39 psArray *cells; // Cells for convolved images --- a handle for reading again -
trunk/ppStack/src/ppStackPrepare.c
r35931 r36855 148 148 } 149 149 150 //MEH -- bscale offset hack for warps 151 options->bscaleOffset = psVectorAlloc(options->num, PS_TYPE_F32); 152 psVectorInit(options->bscaleOffset, 0.0); 153 bool setbscaleoffset = psMetadataLookupBool(NULL,recipe, "BSCALEOFFSET"); 154 150 155 psArray *psfs = psArrayAlloc(num); // PSFs for PSF envelope 151 156 int numCols = 0, numRows = 0; // Size of image … … 162 167 } 163 168 options->sumExposure += options->exposures->data.F32[i]; 169 170 //MEH -- hdu get redefn again below if conv (lots of this happening..) 171 if (setbscaleoffset) { 172 pmHDU *hdu = pmHDUFromCell(cell); 173 assert(hdu && hdu->header); 174 float bscale = psMetadataLookupF32(NULL, hdu->header, "BSCALE"); 175 options->bscaleOffset->data.F32[i] = 0.5*bscale; 176 } 177 psLogMsg("ppStack", PS_LOG_INFO, "bscaleOffset: %d %f", i,options->bscaleOffset->data.F32[i]); 164 178 165 179 // Get list of PSFs, to determine target PSF -
trunk/ppStack/src/ppStackReadout.c
r36710 r36855 34 34 bool safety = PS_SCALAR_VALUE(args->data[4], U8); // Safety switch on? 35 35 bool normalise = PS_SCALAR_VALUE(args->data[5], U8); // Normalise images? 36 bool bscaleoffset = PS_SCALAR_VALUE(args->data[6], U8); // Apply bscale offset? 36 37 37 38 psVector *mask = options->inputMask; // Mask for inputs … … 40 41 psVector *addVariance = options->matchChi2; // Additional variance when rejecting 41 42 psVector *norm = normalise ? options->norm : NULL; // Normalisations to apply to images 43 psVector *bscaleApplyOffset = bscaleoffset ? options->bscaleOffset : NULL; // BSCALE offset to apply to images 42 44 43 45 bool status = ppStackReadoutFinal(config, options->outRO, options->expRO, thread->readouts, mask, reject, 44 weightings, exposures, addVariance, safety, norm ); // Status of operation46 weightings, exposures, addVariance, safety, norm, bscaleApplyOffset); // Status of operation 45 47 46 48 thread->busy = false; … … 201 203 const psVector *mask, const psArray *rejected, const psVector *weightings, 202 204 const psVector *exposures, const psVector *addVariance, bool safety, 203 const psVector *norm )205 const psVector *norm, const psVector *bscaleApplyOffset) 204 206 { 205 207 assert(config); … … 271 273 stack->data[i] = data; 272 274 275 //MEH -- apply bscale offset before norm 276 if (bscaleApplyOffset) { 277 psLogMsg("ppStack", PS_LOG_INFO, "bscaleApplyOffset: %d %f", i, bscaleApplyOffset->data.F32[i]); 278 psBinaryOp(ro->image, ro->image, "-", psScalarAlloc(bscaleApplyOffset->data.F32[i], PS_TYPE_F32)); 279 } 280 273 281 if (norm) { 274 282 float normalise = powf(10.0, -0.4 * norm->data.F32[i]); // Normalisation -
trunk/ppStack/src/ppStackThread.c
r34800 r36855 277 277 278 278 { 279 psThreadTask *task = psThreadTaskAlloc("PPSTACK_FINAL_COMBINE", 6);279 psThreadTask *task = psThreadTaskAlloc("PPSTACK_FINAL_COMBINE", 7); 280 280 task->function = &ppStackReadoutFinalThread; 281 281 psThreadTaskAdd(task);
Note:
See TracChangeset
for help on using the changeset viewer.
