IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 25, 2009, 2:00:56 PM (17 years ago)
Author:
eugene
Message:

merging changes from head

Location:
branches/eam_branches/20090522
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/20090522

  • branches/eam_branches/20090522/psModules

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/eam_branches/20090522/psModules/src/camera/pmFPAMaskWeight.c

    r23989 r24557  
    199199}
    200200
    201 bool pmReadoutSetVariance(pmReadout *readout, bool poisson)
     201bool pmReadoutSetVariance(pmReadout *readout, const psImage *noiseMap, bool poisson)
    202202{
    203203    PS_ASSERT_PTR_NON_NULL(readout, false);
     204    // check that the noiseMap (if it exists) matches the readout variance size)
    204205
    205206    pmCell *cell = readout->parent;     // The parent cell
     
    228229
    229230        // a negative variance is non-sensical. if the image value drops below 1, the variance must be 1.
     231        // XXX this calculation is wrong: limit is 1 e-, but this is in DN
    230232        readout->variance = (psImage*)psUnaryOp(readout->variance, readout->variance, "abs");
    231233        readout->variance = (psImage*)psBinaryOp(readout->variance, readout->variance, "max",
     
    239241    }
    240242
    241     readout->variance = (psImage*)psBinaryOp(readout->variance, readout->variance, "+",
    242                                            psScalarAlloc(readnoise*readnoise/gain/gain, PS_TYPE_F32));
     243    // apply a supplied readnoise map (NOTE: in DN, not electrons):
     244    if (noiseMap) {
     245        psImage *rdVar = (psImage*)psBinaryOp(NULL, (const psPtr) noiseMap, "*", (const psPtr) noiseMap);
     246        readout->variance = (psImage*)psBinaryOp(readout->variance, readout->variance, "+", rdVar);
     247        psFree (rdVar);
     248    } else {
     249        readout->variance = (psImage*)psBinaryOp(readout->variance, readout->variance, "+", psScalarAlloc(readnoise*readnoise/gain/gain, PS_TYPE_F32));
     250    }
    243251
    244252    return true;
     
    247255// this function creates the variance pixels, or uses the existing variance pixels.  it will set
    248256// the noise pixel values only if the variance image is not supplied
    249 bool pmReadoutGenerateVariance(pmReadout *readout, bool poisson)
     257bool pmReadoutGenerateVariance(pmReadout *readout, const psImage *noiseMap, bool poisson)
    250258{
    251259    PS_ASSERT_PTR_NON_NULL(readout, false);
     
    291299    readout->variance = variance;
    292300
    293     return pmReadoutSetVariance(readout, poisson);
    294 }
    295 
    296 bool pmReadoutGenerateMaskVariance(pmReadout *readout, psImageMaskType satMask, psImageMaskType badMask, bool poisson)
     301    return pmReadoutSetVariance(readout, noiseMap, poisson);
     302}
     303
     304bool pmReadoutGenerateMaskVariance(pmReadout *readout, psImageMaskType satMask, psImageMaskType badMask, const psImage *noiseMap, bool poisson)
    297305{
    298306    PS_ASSERT_PTR_NON_NULL(readout, false);
     
    301309
    302310    success &= pmReadoutGenerateMask(readout, satMask, badMask);
    303     success &= pmReadoutGenerateVariance(readout, poisson);
     311    success &= pmReadoutGenerateVariance(readout, noiseMap, poisson);
    304312
    305313    return success;
    306314}
    307315
    308 bool pmCellGenerateMaskVariance(pmCell *cell, psImageMaskType satMask, psImageMaskType badMask, bool poisson)
     316bool pmCellGenerateMaskVariance(pmCell *cell, psImageMaskType satMask, psImageMaskType badMask, const psImage *noiseMap, bool poisson)
    309317{
    310318    PS_ASSERT_PTR_NON_NULL(cell, false);
     
    314322    for (int i = 0; i < readouts->n; i++) {
    315323        pmReadout *readout = readouts->data[i]; // The readout
    316         success &= pmReadoutGenerateMaskVariance(readout, poisson, satMask, badMask);
     324        success &= pmReadoutGenerateMaskVariance(readout, satMask, badMask, noiseMap, poisson);
    317325    }
    318326
Note: See TracChangeset for help on using the changeset viewer.