IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 42340


Ignore:
Timestamp:
Jan 30, 2023, 9:55:36 AM (3 years ago)
Author:
eugene
Message:

merge from branches/eam_branches/ppImage.20230123: add new non-linearity correction using new psSpline

Location:
trunk/ppImage
Files:
10 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/ppImage

  • trunk/ppImage/src/Makefile.am

    r41894 r42340  
    2323        ppImageDetrendRecord.c \
    2424        ppImageDetrendNonLinear.c \
     25        ppImageDetrendNewNonLinear.c \
    2526        ppImageDetrendFringe.c \
    2627        ppImageDetrendFree.c \
  • trunk/ppImage/src/ppImage.h

    r42293 r42340  
    3535    bool doAuxMask;                     // apply auxillary mask
    3636    bool doNonLin;                      // Non-linearity correction
     37    bool doNewNonLin;                   // Non-linearity correction
    3738    bool doOverscan;                    // Overscan subtraction
    3839    bool doNoiseMap;                    // Bias subtraction
     
    175176bool ppImageDetrendBias(pmReadout *inputReadout, pmReadout *bias, pmReadout *dark, ppImageOptions *options);
    176177
     178bool ppImageDetrendNewNonLinear(pmReadout *input, pmFPAview *linearity, pmConfig *config);
     179
    177180bool ppImageDetrendNonLinear(pmReadout *input, pmFPAview *linearity, pmConfig *config);
    178181bool ppImageDetrendNonLinearLookup(pmReadout *input, psMetadataItem *dataItem);
  • trunk/ppImage/src/ppImageArguments.c

    r41894 r42340  
    2525    fprintf(stderr, "\t-fringe/-fringelist: Fringe image and data.\n");
    2626    fprintf(stderr, "\t-linearity/-linearlist: linearity correction file.\n");
     27    fprintf(stderr, "\t-newnonlin/-newnonlinlist: non-linearity correction file (v 2023.01).\n");
    2728    fprintf(stderr, "\n");
    2829    exit (2);
     
    116117    pmConfigFileSetsMD (config->arguments, &argc, argv, "FRINGE", "-fringe", "-fringelist");
    117118    pmConfigFileSetsMD (config->arguments, &argc, argv, "LINEARITY", "-linearity", "-linearlist");
     119    pmConfigFileSetsMD (config->arguments, &argc, argv, "NEWNONLIN", "-newnonlin", "-newnonlinlist");
    118120    pmConfigFileSetsMD (config->arguments, &argc, argv, "PATTERN.ROW.AMP", "-pattern-row-amplitude", "-not-defined");
    119121
  • trunk/ppImage/src/ppImageDetrendFree.c

    r29833 r42340  
    1414    "PPIMAGE.SHUTTER",
    1515    "PPIMAGE.LINEARITY",
     16    "PPIMAGE.NEWNONLIN",
    1617    NULL
    1718};
  • trunk/ppImage/src/ppImageDetrendNonLinear.c

    r29833 r42340  
    1 #ifdef HAVE_CONFIG_H
    2 #include <config.h>
    3 #endif
    4 
    51#include "ppImage.h"
    62
  • trunk/ppImage/src/ppImageDetrendReadout.c

    r39501 r42340  
    124124      // psLogMsg ("ppImage", 6, "nonlinear correction: %f sec\n", psTimerMark ("detrend.readout"));
    125125    }
     126    // New Non-linearity correction (exclusive of the above)
     127    if (options->doNewNonLin) {
     128      if (!ppImageDetrendNewNonLinear(input, detview, config)) {
     129        psError(PS_ERR_UNKNOWN, false, "Unable to correct Non-Linearity with new version (2023)");
     130        psFree(detview);
     131        return(false);
     132      }
     133      // psLogMsg ("ppImage", 6, "nonlinear correction: %f sec\n", psTimerMark ("detrend.readout"));
     134    }
    126135
    127136    // set up the dark and bias
     
    188197            psImageUnbin (noiseImage, noiseMap->image, binning);
    189198            psFree (binning);
    190             // Stolen from pmSkySubtract.c
    191             // CZW: Unneeded, as psImageUnbin does the bilinear interpolation?  It still looks blocky.
    192 /*          psMetadata *recipe = psMetadataLookupMetadata(NULL, config->recipes, RECIPE_NAME); // Recipe */
    193 /*          psAssert(recipe, "Should be there!"); */
    194 
    195 /*          psS32 xBinFactor = psMetadataLookupS32(NULL,recipe,"NOISE.XBIN"); */
    196 /*          psS32 yBinFactor = psMetadataLookupS32(NULL,recipe,"NOISE.YBIN"); */
    197 /*          psImageInterpolateOptions *interp = psImageInterpolateOptionsAlloc(PS_INTERPOLATE_BILINEAR, */
    198 /*                                                                             noiseMap->image, */
    199 /*                                                                             NULL, NULL, */
    200 /*                                                                             0, 0.0, 0.0, 0, 0, 0.0); */
    201 /*          for (psS32 row = 0; row < input->image->numRows; row++) { */
    202 /*            for (psS32 col = 0; col < input->image->numCols; col++) { */
    203 /*              // We calculate the F32 value of the pixel coordinates in the */
    204 /*              // binned image and then use a pixel interpolation routine to */
    205 /*              // determine the value of the pixel at that location. */
    206 /*              psF32 binRowF64 = ((psF32) row) / ((psF32) yBinFactor); */
    207 /*              psF32 binColF64 = ((psF32) col) / ((psF32) xBinFactor); */
    208 /*              // We add 0.5 to the pixel locations since the pixel */
    209 /*              // interpolation routine defines the location of pixel */
    210 /*              // (i, j) as (i+0.5, j+0.5). */
    211 /*              binRowF64+= 0.5; */
    212 /*              binColF64+= 0.5; */
    213 
    214 /*              double binPixel; */
    215 /*              if (!psImagePixelInterpolate(&binPixel, NULL, NULL, binColF64, binRowF64, interp)) { */
    216 /*                psError(PS_ERR_UNKNOWN, false, "Unable to interpolate image."); */
    217 /*                psFree(interp); */
    218 /*                psFree(noiseImage); */
    219 /*                return NULL; */
    220 /*              } */
    221 /*              noiseImage->data.F32[row][col] = binPixel; */
    222 /*            } */
    223 /*          } */
    224 /*          psFree(interp); */
    225199        }
    226200
  • trunk/ppImage/src/ppImageDetrendRecord.c

    r35612 r42340  
    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");
     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)");
    7879
    7980    detrendRecord(options->doDark & options->useVideoDark, detrend, config, view, "PPIMAGE.VIDEODARK", "DETREND.VIDEODARK", "VideoDark filename");
  • trunk/ppImage/src/ppImageOptions.c

    r41918 r42340  
    2828    options->doAuxMask       = false;   // apply auxillary mask
    2929    options->doNonLin        = false;   // Non-linearity correction
     30    options->doNewNonLin     = false;   // New Non-linearity correction (v2023)
    3031    options->doOverscan      = false;   // Overscan subtraction
    3132    options->doNoiseMap      = false;   // Apply Read Noise Map
     
    175176    // XXX PAP: The overscan stuff needs to be updated following the reworked API
    176177
     178    // New Non-linearity (v 2023) recipe options
     179    // non-linearity corrections are loaded from a file defined in the detrend system or on the command-line
     180    if (psMetadataLookupBool(NULL, recipe, "NEWNONLIN")) {
     181        options->doNewNonLin = true;
     182    }
     183
     184    // XXX PAP: The overscan stuff needs to be updated following the reworked API
     185
    177186    // Overscan recipe options
    178187    // XXX EAM : we should abort on invalid options. default options?
  • trunk/ppImage/src/ppImageParseCamera.c

    r41894 r42340  
    104104
    105105    if (options->doNonLin) {
    106       if (!ppImageDefineFile(config, input->fpa, "PPIMAGE.LINEARITY", "LINEARITY",
    107                              PM_FPA_FILE_LINEARITY, PM_DETREND_TYPE_LINEARITY)) {
    108         psError(PS_ERR_IO, false, "Can't find a non-linearity correction source");
    109         psFree(options);
    110         return NULL;
    111       }
     106        if (!ppImageDefineFile(config, input->fpa, "PPIMAGE.LINEARITY", "LINEARITY",
     107                               PM_FPA_FILE_LINEARITY, PM_DETREND_TYPE_LINEARITY)) {
     108            psError(PS_ERR_IO, false, "Can't find a non-linearity correction source");
     109            psFree(options);
     110            return NULL;
     111        }
     112    }
     113    if (options->doNewNonLin) {
     114        // if the file has been specified on the command-line (-newnonlin file), then the file
     115        // is identified by the NEWNONLIN entry in config->arguments.  otherwise, load from the
     116        // detrend system as type NEWNONLIN
     117        if (!ppImageDefineFile(config, input->fpa, "PPIMAGE.NEWNONLIN", "NEWNONLIN",
     118                               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        }
    112123    }
    113124
Note: See TracChangeset for help on using the changeset viewer.