IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 10, 2012, 6:07:30 PM (14 years ago)
Author:
watersc1
Message:

Implementation of PATTERN.CONTINUITY correction, which replaces the PATTERN.CELL correction and ensures that the cell-to-cell variations are minimized, and that background fitting code has a smooth background to work with. Includes ippconfig files to enable this by default across all of GPC1. Tested, and memory leaks fixed.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppImage/src/ppImageDetrendPattern.c

    r31066 r33243  
    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
Note: See TracChangeset for help on using the changeset viewer.