IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 29009


Ignore:
Timestamp:
Aug 20, 2010, 3:25:55 PM (16 years ago)
Author:
heather
Message:

ppMerge changes to add variance

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  
    234234                return false;
    235235            }
     236           
     237            // }
    236238            if (!isfinite(value)) {
    237239                psWarning("Unable to find acceptable value of DARK.ORDINATE %s for readout %d", ord->name, i);
     
    249251            }
    250252            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           
    251255        }
    252256    }
     
    255259        for (int i = 0; i < inputs->n; i++) {
    256260            psVector *val = values->data[i];
     261           
    257262            (void) val; // avoid unused variable message when tracing is compiled out
     263            fprintf(stderr, "Image %d ",i);
    258264            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");
    261268        }
    262269    }
     
    341348
    342349// 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)
     350bool pmDarkCombine(pmCell *output, const psArray *inputs, int iter, float rej, psImageMaskType maskVal, int useVariances)
    344351{
    345352    PS_ASSERT_PTR_NON_NULL(output, false);
     
    390397    psVector *pixels = psVectorAlloc(inputs->n, PS_TYPE_F32); // Stack of pixels
    391398    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
    392401    for (int i = minInputRows; i < maxInputRows; i++) {
    393402        int yOut = i - outReadout->row0; // y position on output readout
    394 
    395403#ifdef SHOW_BUSY
    396404        if (psTraceGetLevel("psModules.detrend") > 9) {
     
    404412
    405413            psVectorInit(mask, 0);
     414            psVectorInit(variance, 0);
    406415            for (int r = 0; r < inputs->n; r++) {
    407416                if (roMask->data.PS_TYPE_VECTOR_MASK_DATA[r]) {
     
    417426                    pixels->data.F32[r] *= norm->data.F32[r];
    418427                }
    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)) {
    426441                psErrorClear();         // Nothing we can do about it
     442               psTrace("psModules.detrend", 3, "psPolynomial didn't fit?\n");
    427443                psVectorInit(poly->coeff, NAN);
    428444            }
    429 
     445           
     446            // fprintf(stderr, "got here\n");
    430447            pmDarkVisualPixelFit(pixels, mask);
    431448            pmDarkVisualPixelModel(poly, values);
     
    434451                pmReadout *ro = output->readouts->data[k]; // Readout of interest
    435452                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]);
    436454            }
    437455            counts->data.U16[yOut][xOut] = poly->numFit;
  • branches/haf_branches/ppMerge2010/psModules/src/detrend/pmDark.h

    r24819 r29009  
    3838                   int iter,            // Number of rejection iterations
    3939                   float rej,           // Rejection threshold (standard deviations)
    40                    psImageMaskType maskVal   // Value to mask
     40                   psImageMaskType maskVal,   // Value to mask
     41                   int useVariances
    4142    );
    4243
Note: See TracChangeset for help on using the changeset viewer.