IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 43038 for trunk/ppImage


Ignore:
Timestamp:
May 28, 2026, 9:38:40 PM (7 weeks ago)
Author:
eugene
Message:

add code to mask bad cells based on their overscan values compared with a reference table

Location:
trunk/ppImage/src
Files:
1 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppImage/src/Makefile.am

    r42382 r43038  
    3333        ppImageMosaicBackground.c \
    3434        ppImageMaskStats.c \
     35        ppImageMaskBadOverscan.c \
    3536        ppImagePhotom.c \
    3637        ppImageAstrom.c \
  • trunk/ppImage/src/ppImage.h

    r42890 r43038  
    3636    bool doNonLin;                      // Non-linearity correction
    3737    bool doNewNonLin;                   // Non-linearity correction
     38    bool doMaskBadOverscan;             // Mask cells/readouts with out-of-range overscan
    3839    bool doOverscan;                    // Overscan subtraction
    3940    bool doNoiseMap;                    // Bias subtraction
     
    180181bool ppImageDetrendBias(pmReadout *inputReadout, pmReadout *bias, pmReadout *dark, ppImageOptions *options);
    181182
     183bool ppImageMaskBadOverscan(pmReadout *input, pmConfig  *config);
     184
    182185bool ppImageDetrendNewNonLinear(pmReadout *input, pmFPAview *linearity, pmConfig *config);
    183186
  • trunk/ppImage/src/ppImageArguments.c

    r42382 r43038  
    2626    fprintf(stderr, "\t-linearity/-linearlist: linearity correction file.\n");
    2727    fprintf(stderr, "\t-newnonlin/-newnonlinlist: non-linearity correction file (v 2023.01).\n");
     28    fprintf(stderr, "\t-valid-overscan/-valid-overscan-list: overscan valid range file.\n");
    2829    fprintf(stderr, "\n");
    2930    exit (2);
     
    118119    pmConfigFileSetsMD (config->arguments, &argc, argv, "LINEARITY", "-linearity", "-linearlist");
    119120    pmConfigFileSetsMD (config->arguments, &argc, argv, "NEWNONLIN", "-newnonlin", "-newnonlinlist");
     121    pmConfigFileSetsMD (config->arguments, &argc, argv, "VALID.OVERSCAN", "-valid-overscan", "-valid-overscan-list");
    120122    pmConfigFileSetsMD (config->arguments, &argc, argv, "PATTERN.ROW.AMP", "-pattern-row-amplitude", "-not-defined");
    121123    pmConfigFileSetsMD (config->arguments, &argc, argv, "PATTERN.DEAD.CELLS", "-pattern-dead-cells", "-not-defined");
  • trunk/ppImage/src/ppImageDetrendFree.c

    r42340 r43038  
    1515    "PPIMAGE.LINEARITY",
    1616    "PPIMAGE.NEWNONLIN",
     17    "PPIMAGE.VALID.OVERSCAN",
    1718    NULL
    1819};
  • trunk/ppImage/src/ppImageDetrendReadout.c

    r42964 r43038  
    167167    }
    168168
     169    // Mask bad cells based on the overscan values
     170    if (options->doMaskBadOverscan) {
     171      if (!ppImageMaskBadOverscan(input, config)) {
     172        psError(PS_ERR_UNKNOWN, false, "Unable to mask readout based on overscan");
     173        psFree(detview);
     174        return(false);
     175      }
     176    }
     177
    169178    // measure the overscan-subtracted readoutBackground here (or subtract the overscan value?)
    170179    // XXX this is the measurements and should be independent of the pattern masking
  • trunk/ppImage/src/ppImageDetrendRecord.c

    r42340 r43038  
    7575    detrendRecord(options->doFringe,   detrend, config, view, "PPIMAGE.FRINGE",   "DETREND.FRINGE",   "Fringe filename");
    7676
    77     detrendRecord(options->doNonLin,    detrend, config, view, "PPIMAGE.LINEARITY","DETREND.NONLIN",   "Non-linearity table filename");
    78     detrendRecord(options->doNewNonLin, detrend, config, view, "PPIMAGE.NEWNONLIN","DETREND.NEWNONLIN","Non-linearity table filename (v2023)");
     77    detrendRecord(options->doNonLin,          detrend, config, view, "PPIMAGE.LINEARITY",      "DETREND.NONLIN",         "Non-linearity table filename");
     78    detrendRecord(options->doNewNonLin,       detrend, config, view, "PPIMAGE.NEWNONLIN",      "DETREND.NEWNONLIN",      "Non-linearity table filename (v2023)");
     79    detrendRecord(options->doMaskBadOverscan, detrend, config, view, "PPIMAGE.VALID.OVERSCAN", "DETREND.VALID.OVERSCAN", "Valid Overscan table filename");
    7980
    8081    detrendRecord(options->doDark & options->useVideoDark, detrend, config, view, "PPIMAGE.VIDEODARK", "DETREND.VIDEODARK", "VideoDark filename");
  • trunk/ppImage/src/ppImageOptions.c

    r42890 r43038  
    2929    options->doNonLin        = false;   // Non-linearity correction
    3030    options->doNewNonLin     = false;   // New Non-linearity correction (v2023)
     31    options->doMaskBadOverscan = false; // Mask cells / readouts if overscan is out of bounds
    3132    options->doOverscan      = false;   // Overscan subtraction
    3233    options->doNoiseMap      = false;   // Apply Read Noise Map
     
    182183    }
    183184
     185    // Mask cells/readouts with out-of-range overscan
     186    // nominal overscan ranges are loaded from a file defined in the detrend system or on the command-line
     187    if (psMetadataLookupBool(NULL, recipe, "MASK.BAD.OVERSCAN")) {
     188        options->doMaskBadOverscan = true;
     189    }
     190
    184191    // XXX PAP: The overscan stuff needs to be updated following the reworked API
    185192
  • trunk/ppImage/src/ppImageParseCamera.c

    r42382 r43038  
    117117        if (!ppImageDefineFile(config, input->fpa, "PPIMAGE.NEWNONLIN", "NEWNONLIN",
    118118                               PM_FPA_FILE_NEWNONLIN, PM_DETREND_TYPE_NEWNONLIN)) {
     119            psError(PS_ERR_IO, false, "Can't find a new non-linearity correction source");
     120            psFree(options);
     121            return NULL;
     122        }
     123    }
     124    if (options->doMaskBadOverscan) {
     125        // if the file has been specified on the command-line (-valid-overscan file), then the file
     126        // is identified by the VALID.OVERSCAN entry in config->arguments.  otherwise, load from the
     127        // detrend system as type VALID.OVERSCAN
     128        if (!ppImageDefineFile(config, input->fpa, "PPIMAGE.VALID.OVERSCAN", "VALID.OVERSCAN",
     129                               PM_FPA_FILE_VALID_OVERSCAN, PM_DETREND_TYPE_VALID_OVERSCAN)) {
    119130            psError(PS_ERR_IO, false, "Can't find a new non-linearity correction source");
    120131            psFree(options);
Note: See TracChangeset for help on using the changeset viewer.