IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 5, 2025, 3:34:33 PM (14 months ago)
Author:
tdeboer
Message:

updates to ppImage functions for 2D overscan correction

File:
1 edited

Legend:

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

    r42382 r42890  
    44
    55#include "ppImage.h"
     6
     7#define ESCAPE(STATUS, ...)                           \
     8    {                                                 \
     9        psError(PS_ERR_UNKNOWN, STATUS, __VA_ARGS__); \
     10        psFree(view);                                 \
     11        return false;                                 \
     12    }
    613
    714bool ppImageDetrendReadout(pmConfig *config, ppImageOptions *options, pmFPAview *view)
     
    117124    // Subtract the overscan
    118125    if (options->doOverscan) {
    119       if (!pmOverscanSubtract (input, options->overscan)) {
    120         psError(PS_ERR_UNKNOWN, false, "Unable to subtract overscan.");
    121         psFree(detview);
    122         return false;
    123       }
    124       // psLogMsg ("ppImage", 6, "subtract overscan: %f sec\n", psTimerMark ("detrend.readout"));
     126        bool doTwoDOverscan = false;
     127        if (options->overscan->TwoD) {
     128            pmChip *chip = pmFPAfileThisChip(config->files, view, "PPIMAGE.INPUT");
     129            if (!ppImageDoPatternForView(&doTwoDOverscan, config, chip, view, RECIPE_NAME, "OVERSCAN.2D.SUBSET"))
     130            {
     131                ESCAPE(false, "Unable to determine whether 2D Overscan subtraction should be applied.");
     132            }
     133            // set doTwoDOverscan to False if the cell background is larger than 500 ADU or smaller than zero (peculiar)
     134            if (doTwoDOverscan) {
     135                float backest = psMetadataLookupF32(NULL, input->parent->concepts, "CELL.BACKEST");
     136                if (!isfinite(backest) || backest > 500 || backest < 0) {
     137                    doTwoDOverscan = false;
     138                }
     139            }
     140        }
     141        if (!pmOverscanSubtract(input, options->overscan, doTwoDOverscan)) {
     142            psError(PS_ERR_UNKNOWN, false, "Unable to subtract overscan.");
     143            psFree(detview);
     144            return false;
     145        }
     146        // psLogMsg ("ppImage", 6, "subtract overscan: %f sec\n", psTimerMark ("detrend.readout"));
    125147    }
    126148
Note: See TracChangeset for help on using the changeset viewer.