Changeset 36855 for trunk/ppStack
- Timestamp:
- Jun 12, 2014, 11:52:06 PM (12 years ago)
- Location:
- trunk/ppStack/src
- Files:
-
- 9 edited
-
ppStack.h (modified) (1 diff)
-
ppStackCombineFinal.c (modified) (2 diffs)
-
ppStackLoop.c (modified) (3 diffs)
-
ppStackLoop.h (modified) (1 diff)
-
ppStackOptions.c (modified) (2 diffs)
-
ppStackOptions.h (modified) (1 diff)
-
ppStackPrepare.c (modified) (2 diffs)
-
ppStackReadout.c (modified) (4 diffs)
-
ppStackThread.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
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.
