IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 30, 2012, 2:49:37 PM (14 years ago)
Author:
eugene
Message:

merge changes from trunk

Location:
branches/eam_branches/ipp-20111122/ppImage/src
Files:
7 edited
1 copied

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20111122/ppImage/src

  • branches/eam_branches/ipp-20111122/ppImage/src/Makefile.am

    r30655 r33638  
    5959        ppImageParityFlip.c \
    6060        ppImageCheckCTE.c \
     61        ppImageCheckNoise.c \
    6162        ppImageFileCheck.c \
    6263        ppImageVersion.c \
  • branches/eam_branches/ipp-20111122/ppImage/src/ppImage.h

    r30655 r33638  
    4040    bool doPatternRow;                  // Row pattern correction
    4141    bool doPatternCell;                 // Cell pattern correction
     42    bool doPatternContinuity;           // Cell continuity correction
    4243    bool doFringe;                      // Fringe subtraction
    4344    bool doPhotom;                      // Source identification and photometry
     
    4748    bool doStats;                       // call ppStats on the image
    4849    bool checkCTE;                      // measure pixel-based variance
     50    bool checkNoise;                    // measure cell-level variance
    4951    bool applyParity;                   // Apply Cell parities
    5052
     
    109111    psStatsOptions patternCellMean;        // Statistic for mean
    110112
     113  int patternContinuityEdgeWidth;        // Size of box to use for edge matching.
     114 
    111115    int remnanceSize;                   // Size for remnance detection
    112116    float remnanceThresh;               // Threshold for remnance detection
     
    169173bool ppImageCheckCTE(pmConfig *config, ppImageOptions *options, pmFPAview *view);
    170174
     175bool ppImageCheckNoise(pmConfig *config, ppImageOptions *options, pmFPAview *view);
     176
    171177bool ppImageBurntoolMask(pmConfig *config, ppImageOptions *options, pmFPAview *view, pmReadout *mask);
    172178
  • branches/eam_branches/ipp-20111122/ppImage/src/ppImageDetrendPattern.c

    r31066 r33638  
    1818    pmCell *cell = NULL;
    1919
    20     assert(options->doPatternRow || options->doPatternCell); // do not call if not needed
     20    assert(options->doPatternRow || options->doPatternCell || options->doPatternContinuity); // do not call if not needed
    2121    assert(inputView->chip != -1);
    2222    assert(inputView->cell == -1);
     
    4040        if (psMetadataLookupBool(NULL,hdu->header,"PTRN_ROW")) {
    4141          psLogMsg("ppImage", PS_LOG_INFO, "Not performing row pattern correction as it has already been done.");
    42           goto pattern_cell;
     42          goto pattern_continuity;
    4343        }
    4444
     
    9898    }
    9999
     100 pattern_continuity:
     101
     102    // see the comment for PATTERN.ROW; the same rules apply for PATTERN.CELL
     103
     104    if (options->doPatternContinuity) {
     105        int numCells = chip->cells->n;       // Number of cells
     106        psVector *tweak = psVectorAlloc(numCells, PS_TYPE_U8); // Tweak cell?
     107        pmFPAview *view = pmFPAviewAlloc(0); // View for local processing
     108        *view = *inputView;
     109
     110        pmHDU *hdu = pmHDUFromChip(chip);
     111        if (psMetadataLookupBool(NULL,hdu->header,"PTRN_CON")) {
     112          psLogMsg("ppImage", PS_LOG_INFO, "Not performing cell continuity correction as it has already been done.");
     113          goto pattern_cell;
     114        }
     115
     116        for (int i = 0; i < chip->cells->n; i++) {
     117            view->cell = i;
     118
     119            pmCell *cell = chip->cells->data[i]; // Cell of interest
     120
     121            if (cell->readouts->n > 1) {
     122                psLogMsg("ppImage", PS_LOG_INFO, "Not performing cell continuity correction on video cell.");
     123                continue;
     124            }
     125
     126            bool doPattern = false;
     127            if (!doPatternForView(&doPattern, config, chip, view, RECIPE_NAME, "PATTERN.CONTINUITY.SUBSET")) {
     128                ESCAPE(false, "Unable to determine whether row pattern matching should be applied.");
     129            }
     130            if (doPattern) {
     131                tweak->data.U8[i] = 0xFF;
     132            }
     133        }
     134
     135        // Tweak the cells
     136        if (!pmPatternContinuity(chip, tweak, options->patternCellBG, options->patternCellMean,
     137                                 options->maskValue, options->darkMask,options->patternContinuityEdgeWidth)) {
     138            psFree(tweak);
     139            psFree(view);
     140            return false;
     141        }
     142        psFree(tweak);
     143        psFree(view);
     144
     145        psMetadataAddBool(hdu->header, PS_LIST_TAIL, "PTRN_CON",PS_META_REPLACE,"PATTERN.CONTINUITY correction applied",true);
     146    }
     147
    100148 pattern_cell:
    101 
    102     // see the comment for PATTERN.ROW; the same rules apply for PATTERN.CELL
    103 
     149   
    104150    if (options->doPatternCell) {
    105151        int numCells = chip->cells->n;       // Number of cells
     
    131177                tweak->data.U8[i] = 0xFF;
    132178            }
    133 
    134179        }
    135180
  • branches/eam_branches/ipp-20111122/ppImage/src/ppImageDetrendReadout.c

    r29926 r33638  
    110110            // offset information, we are not really getting exactly the right mapping from the
    111111            // original file.
     112            // CZW 2012-03-21: I do not believe this is true anymore.  In any case, this seems to be what
     113            //                 ppImageReplaceBackground does to do sky subtraction.
    112114            psImageBinning *binning = psImageBinningAlloc();
    113115            binning->nXruff = noiseMap->image->numCols;
     
    119121            psImageUnbin (noiseImage, noiseMap->image, binning);
    120122            psFree (binning);
     123            // Stolen from pmSkySubtract.c
     124            // CZW: Unneeded, as psImageUnbin does the bilinear interpolation?  It still looks blocky.
     125/*          psMetadata *recipe = psMetadataLookupMetadata(NULL, config->recipes, RECIPE_NAME); // Recipe */
     126/*          psAssert(recipe, "Should be there!"); */
     127
     128/*          psS32 xBinFactor = psMetadataLookupS32(NULL,recipe,"NOISE.XBIN"); */
     129/*          psS32 yBinFactor = psMetadataLookupS32(NULL,recipe,"NOISE.YBIN"); */
     130/*          psImageInterpolateOptions *interp = psImageInterpolateOptionsAlloc(PS_INTERPOLATE_BILINEAR, */
     131/*                                                                             noiseMap->image, */
     132/*                                                                             NULL, NULL, */
     133/*                                                                             0, 0.0, 0.0, 0, 0, 0.0); */
     134/*          for (psS32 row = 0; row < input->image->numRows; row++) { */
     135/*            for (psS32 col = 0; col < input->image->numCols; col++) { */
     136/*              // We calculate the F32 value of the pixel coordinates in the */
     137/*              // binned image and then use a pixel interpolation routine to */
     138/*              // determine the value of the pixel at that location. */
     139/*              psF32 binRowF64 = ((psF32) row) / ((psF32) yBinFactor); */
     140/*              psF32 binColF64 = ((psF32) col) / ((psF32) xBinFactor); */
     141/*              // We add 0.5 to the pixel locations since the pixel */
     142/*              // interpolation routine defines the location of pixel */
     143/*              // (i, j) as (i+0.5, j+0.5). */
     144/*              binRowF64+= 0.5; */
     145/*              binColF64+= 0.5; */
     146
     147/*              double binPixel; */
     148/*              if (!psImagePixelInterpolate(&binPixel, NULL, NULL, binColF64, binRowF64, interp)) { */
     149/*                psError(PS_ERR_UNKNOWN, false, "Unable to interpolate image."); */
     150/*                psFree(interp); */
     151/*                psFree(noiseImage); */
     152/*                return NULL; */
     153/*              } */
     154/*              noiseImage->data.F32[row][col] = binPixel; */
     155/*            } */
     156/*          } */
     157/*          psFree(interp); */
    121158        }
    122159
  • branches/eam_branches/ipp-20111122/ppImage/src/ppImageLoop.c

    r30655 r33638  
    126126                }
    127127
     128                if (!ppImageCheckNoise (config, options, view)) {
     129                    ESCAPE("Unable to generate noisemap");
     130                }
     131               
    128132                // optionally degrade a MD image to 3pi exposure times
    129133                if (!ppImageAddNoise(config, options, view, input->fpa)){
     
    170174
    171175        // Apply the pattern correction
    172         if (options->doPatternRow || options->doPatternCell) {
     176        if (options->doPatternRow || options->doPatternCell || options->doPatternContinuity) {
    173177          if (!ppImageDetrendPatternApply(config,chip,view,options)) {
    174178            ESCAPE("Unable to apply pattern corrections");
  • branches/eam_branches/ipp-20111122/ppImage/src/ppImageOptions.c

    r31066 r33638  
    3434    options->doPatternRow    = false;   // Row pattern correction
    3535    options->doPatternCell   = false;   // Cell pattern correction
     36    options->doPatternContinuity = false; // Cell continuity correction
    3637    options->doFringe        = false;   // Fringe subtraction
    3738    options->doPhotom        = false;   // Source identification and photometry
     
    4041    options->doStats         = false;   // Measure and save image statistics
    4142    options->checkCTE        = false;   // Measure pixel-based variance
     43    options->checkNoise      = false;   // Measure cell-level variances.
    4244    options->applyParity     = false;   // Apply Cell parities
    4345    options->doMaskStats     = false;   // Calculate mask fractions
     
    253255    options->doPatternRow = psMetadataLookupBool(NULL, recipe, "PATTERN.ROW");
    254256    options->doPatternCell = psMetadataLookupBool(NULL, recipe, "PATTERN.CELL");
     257    options->doPatternContinuity = psMetadataLookupBool(NULL, recipe, "PATTERN.CONTINUITY");
    255258
    256259    options->doMaskStats = psMetadataLookupBool(NULL, recipe, "MASK.STATS");
     
    317320
    318321    options->checkCTE       = psMetadataLookupBool(NULL, recipe, "CHECK.CTE");
     322    options->checkNoise     = psMetadataLookupBool(NULL, recipe, "CHECK.NOISE");
    319323
    320324    /* doMaskBuild : there are some cases where we require a mask, so we force doMaskBuild to be set even if the user specified 'FALSE'
     
    408412    }
    409413
     414    if (psMetadataLookup(format, "PATTERN.CONTINUITY.WIDTH")) {
     415      options->patternContinuityEdgeWidth = psMetadataLookupS32(NULL, format, "PATTERN.CONTINUITY.WIDTH");
     416    }
     417    else {
     418      options->patternContinuityEdgeWidth = psMetadataLookupS32(NULL, recipe, "PATTERN.CONTINUITY.WIDTH");
     419    }
     420   
    410421
    411422    // Remnance options
Note: See TracChangeset for help on using the changeset viewer.