Changeset 29009
- Timestamp:
- Aug 20, 2010, 3:25:55 PM (16 years ago)
- Location:
- branches/haf_branches/ppMerge2010/psModules/src/detrend
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/haf_branches/ppMerge2010/psModules/src/detrend/pmDark.c
r28405 r29009 234 234 return false; 235 235 } 236 237 // } 236 238 if (!isfinite(value)) { 237 239 psWarning("Unable to find acceptable value of DARK.ORDINATE %s for readout %d", ord->name, i); … … 249 251 } 250 252 val->data.F32[i] = value; 253 // psTrace("psModules.detrend", 4, "thing %d, order %d, DARK.ORDINATE %s, DARK.RULE %s, value %f\n", i, j, ord->name, ord->rule, value); 254 251 255 } 252 256 } … … 255 259 for (int i = 0; i < inputs->n; i++) { 256 260 psVector *val = values->data[i]; 261 257 262 (void) val; // avoid unused variable message when tracing is compiled out 263 fprintf(stderr, "Image %d ",i); 258 264 for (int j = 0; j < ordinates->n; j++) { 259 psTrace("psModules.detrend", 9, "Image %d, ordinate %d: %f\n", i, j, val->data.F32[j]); 260 } 265 fprintf(stderr," ord %d: %f", j, val->data.F32[j]); 266 } 267 fprintf(stderr,"\n"); 261 268 } 262 269 } … … 341 348 342 349 // do the combine work for this portion of the output (range is set by input data) 343 bool pmDarkCombine(pmCell *output, const psArray *inputs, int iter, float rej, psImageMaskType maskVal )350 bool pmDarkCombine(pmCell *output, const psArray *inputs, int iter, float rej, psImageMaskType maskVal, int useVariances) 344 351 { 345 352 PS_ASSERT_PTR_NON_NULL(output, false); … … 390 397 psVector *pixels = psVectorAlloc(inputs->n, PS_TYPE_F32); // Stack of pixels 391 398 psVector *mask = psVectorAlloc(inputs->n, PS_TYPE_VECTOR_MASK); // Mask for stack 399 psVector *variance = psVectorAlloc(inputs->n, PS_TYPE_F32); // Variance for stack 400 392 401 for (int i = minInputRows; i < maxInputRows; i++) { 393 402 int yOut = i - outReadout->row0; // y position on output readout 394 395 403 #ifdef SHOW_BUSY 396 404 if (psTraceGetLevel("psModules.detrend") > 9) { … … 404 412 405 413 psVectorInit(mask, 0); 414 psVectorInit(variance, 0); 406 415 for (int r = 0; r < inputs->n; r++) { 407 416 if (roMask->data.PS_TYPE_VECTOR_MASK_DATA[r]) { … … 417 426 pixels->data.F32[r] *= norm->data.F32[r]; 418 427 } 419 if (readout->mask) { 420 mask->data.PS_TYPE_VECTOR_MASK_DATA[r] = (readout->mask->data.PS_TYPE_IMAGE_MASK_DATA[yIn][xIn] & maskVal); 421 } 422 423 } 424 425 if (!psPolynomialMDClipFit(poly, pixels, NULL, mask, 0xff, values, iter, rej)) { 428 if (readout->mask) { 429 mask->data.PS_TYPE_VECTOR_MASK_DATA[r] = (readout->mask->data.PS_TYPE_IMAGE_MASK_DATA[yIn][xIn] & maskVal); 430 } 431 if (useVariances) { 432 //fprintf (stderr, "variances xxx %f\n",readout->variance->data.F32[yIn][xIn]); 433 variance->data.F32[r] = readout->variance->data.F32[yIn][xIn]; 434 435 // mask->data.PS_TYPE_VECTOR_MASK_DATA[r] = (readout->variance->data.PS_TYPE_IMAGE_MASK_DATA[yIn][xIn] & maskVal); 436 } 437 438 } 439 440 if (!psPolynomialMDClipFit(poly, pixels, variance, mask, 0xff, values, iter, rej)) { 426 441 psErrorClear(); // Nothing we can do about it 442 psTrace("psModules.detrend", 3, "psPolynomial didn't fit?\n"); 427 443 psVectorInit(poly->coeff, NAN); 428 444 } 429 445 446 // fprintf(stderr, "got here\n"); 430 447 pmDarkVisualPixelFit(pixels, mask); 431 448 pmDarkVisualPixelModel(poly, values); … … 434 451 pmReadout *ro = output->readouts->data[k]; // Readout of interest 435 452 ro->image->data.F32[yOut][xOut] = poly->coeff->data.F64[k]; 453 // psTrace("psModules.detrend", 9, "k %d coeff %f \n", k, poly->coeff->data.F64[k]); 436 454 } 437 455 counts->data.U16[yOut][xOut] = poly->numFit; -
branches/haf_branches/ppMerge2010/psModules/src/detrend/pmDark.h
r24819 r29009 38 38 int iter, // Number of rejection iterations 39 39 float rej, // Rejection threshold (standard deviations) 40 psImageMaskType maskVal // Value to mask 40 psImageMaskType maskVal, // Value to mask 41 int useVariances 41 42 ); 42 43
Note:
See TracChangeset
for help on using the changeset viewer.
