IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 41842


Ignore:
Timestamp:
Oct 15, 2021, 8:20:12 AM (5 years ago)
Author:
eugene
Message:

ppStack builds with percentile combination

Location:
branches/eam_branches/ppStack.20211015/src
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ppStack.20211015/src/Makefile.am

    r38034 r41842  
    2929        ppStackPrepare.c        \
    3030        ppStackConvolve.c       \
     31        ppStackLoopByPercent.c  \
     32        ppStackCombinePercent.c \
    3133        ppStackCombinePrepare.c \
    3234        ppStackCombineInitial.c \
  • branches/eam_branches/ppStack.20211015/src/ppStack.h

    r36855 r41842  
    115115bool ppStackReadoutFinalThread(psThreadJob *job // Job to process
    116116    );
     117
     118// Thread entry point for ppStackReadoutPercent
     119bool ppStackReadoutPercentThread(psThreadJob *job);
     120
     121bool ppStackReadoutPercent(const pmConfig *config,
     122                           pmReadout *outRO,
     123                           const psArray *readouts,
     124                           const psVector *mask,
     125                           const psVector *weightings,
     126                           const psVector *exposures,
     127                           const psVector *addVariance);
     128
    117129// Perform median stacking for background
    118130bool ppStackCombineBackground(ppStackThreadData *stack, ppStackOptions *options, pmConfig *config);
  • branches/eam_branches/ppStack.20211015/src/ppStackCombinePercent.c

    r41841 r41842  
    11#include "ppStack.h"
    2 
    3 // This is the doomsday switch.
    4 // #define TESTING                         // Enable test output
    52
    63bool ppStackCombinePercent(ppStackThreadData *stack, ppStackOptions *options, pmConfig *config)
     
    4037    }
    4138
    42     // Harvest the jobs, gathering the inspection lists
    43     options->inspect = psArrayAlloc(options->num);
    44     options->rejected = psArrayAlloc(options->num);
    45     for (int i = 0; i < options->num; i++) {
    46         if (options->inputMask->data.PS_TYPE_VECTOR_MASK_DATA[i]) {
    47             continue;
    48         }
    49         options->inspect->data[i] = psArrayAllocEmpty(numChunk);
    50         options->rejected->data[i] = psArrayAllocEmpty(numChunk);
    51     }
    52 
    5339    psThreadJob *job;               // Completed job
    5440    while ((job = psThreadJobGetDone())) {
  • branches/eam_branches/ppStack.20211015/src/ppStackLoopByPercent.c

    r41841 r41842  
    55    assert(config);
    66
    7     // Convolve inputs (this must be called even if the convolution is turned off)
     7    // Convolve inputs (this must be called even if the convolution is turned off because
     8    // it performs the normalization of the inputs). 
    89    psTrace("ppStack", 1, "Convolving inputs to target PSF....\n");
    910    if (!ppStackConvolve(options, config)) {
     
    1516    if (options->quality) return true; // Can't do anything else
    1617
    17     psMetadata *recipe = psMetadataLookupMetadata(NULL, config->recipes, PPSTACK_RECIPE); // ppStack recipe
    18 
    1918    // Define threading elements
    2019    ppStackThreadData *stack = ppStackThreadDataSetup(options, config, true);
     
    2423    }
    2524
    26     // Prepare for combination
     25    // Prepare for combination (define outputs, generate output cells)
    2726    if (!ppStackCombinePrepare("PPSTACK.OUTPUT", "PPSTACK.OUTPUT.EXP", options->doBackground ? "PPSTACK.OUTPUT.BKGMODEL" : NULL, PPSTACK_FILES_STACK, stack, options, config)) {
    2827        psError(psErrorCodeLast(), false, "Unable to prepare for combination.");
  • branches/eam_branches/ppStack.20211015/src/ppStackOptions.c

    r41841 r41842  
    5858
    5959    options->clipPercent = false;
    60     options->clipMinRange = 0.16; // 1-sigma default
    61     options->clipMaxRange = 0.84; // 1-sigma default
    6260
    6361    options->psf = NULL;
  • branches/eam_branches/ppStack.20211015/src/ppStackOptions.h

    r41841 r41842  
    1818
    1919    bool clipPercent;                   // use percentile range to clip?
    20     psF32 clipMinRange;                 // min percentile
    21     psF32 clipMaxRange;                 // max percentile
    2220
    2321    // Prepare
  • branches/eam_branches/ppStack.20211015/src/ppStackReadout.c

    r41841 r41842  
    6868    psVector *addVariance = options->matchChi2; // Additional variance when rejecting
    6969
    70     job->results = ppStackReadoutInitial(config, outRO, thread->readouts, mask,
    71                                          weightings, exposures, addVariance);
     70    job->results = ppStackReadoutInitial(config, outRO, thread->readouts, mask, weightings, exposures, addVariance);
    7271    thread->busy = false;
    7372
     
    340339}
    341340
    342 psArray *ppStackReadoutPercent(const pmConfig *config, pmReadout *outRO, const psArray *readouts,
     341bool pmStackCombineByPercentile(pmReadout *outRO, psArray *stack, float minRange, float maxRange, psImageMaskType maskBad, psImageMaskType maskSuspect, psImageMaskType maskBlank);
     342
     343bool ppStackReadoutPercent(const pmConfig *config, pmReadout *outRO, const psArray *readouts,
    343344                               const psVector *mask, const psVector *weightings, const psVector *exposures,
    344345                               const psVector *addVariance)
     
    357358
    358359    bool mdok;                          // Status of MD lookup
    359     float iter = psMetadataLookupF32(NULL, recipe, "COMBINE.ITER"); // Rejection iterations
    360     float minRange = psMetadataLookupF32(NULL, recipe, "COMBINE.MIN.RANGE"); // Combination threshold
    361     float maxRange = psMetadataLookupF32(NULL, recipe, "COMBINE.MAX.RANGE"); // Combination threshold
    362 
    363     psMetadata *ppsub = psMetadataLookupMetadata(NULL, config->recipes, "PPSUB"); // PPSUB recipe
    364     int kernelSize = psMetadataLookupS32(NULL, ppsub, "KERNEL.SIZE"); // Kernel half-size
    365 
    366     psString maskBadStr = psMetadataLookupStr(NULL, recipe, "MASK.VAL"); // Name of bits to mask for bad
    367     psImageMaskType maskBad = pmConfigMaskGet(maskBadStr, config); // Bits to mask for bad pixels
    368 
    369     psString maskSuspectStr = psMetadataLookupStr(NULL, recipe, "MASK.SUSPECT"); // Name of suspect mask bits
     360    float minRange = psMetadataLookupF32(&mdok, recipe, "COMBINE.MIN.RANGE"); // Combination threshold
     361    float maxRange = psMetadataLookupF32(&mdok, recipe, "COMBINE.MAX.RANGE"); // Combination threshold
     362
     363    char defaultBlankStr[16] = "BLANK";
     364
     365    psString maskBadStr     = psMetadataLookupStr(&mdok, recipe, "MASK.VAL"); // Name of bits to mask for bad
     366    psString maskSuspectStr = psMetadataLookupStr(&mdok, recipe, "MASK.SUSPECT"); // Name of suspect mask bits
     367    psString maskBlankStr   = psMetadataLookupStr(&mdok, recipe, "MASK.BLANK"); // Name of bits to set for empty pixels
     368    if (!maskBlankStr) {
     369      maskBlankStr = psMetadataLookupStr(&mdok, recipe, "MASK.BAD"); // Old name for MASK.BLANK
     370    }
     371    if (!maskBlankStr) {
     372      maskBlankStr = defaultBlankStr; // this is statically allocated above
     373    }
     374
     375    psImageMaskType maskBad     = pmConfigMaskGet(maskBadStr, config); // Bits to mask for bad pixels
    370376    psImageMaskType maskSuspect = pmConfigMaskGet(maskSuspectStr, config); // Suspect bits
    371 
    372     bool status = false;
    373     psImageMaskType maskBlank;
    374     psString maskBlankStr = psMetadataLookupStr(&status, recipe, "MASK.BLANK"); // Name of bits to set for empty pixels
    375     if (maskBlankStr) {
    376       maskBlank = pmConfigMaskGet(maskBlankStr, config); // Bits to mask for bad pixels
    377     } else {
    378       maskBlankStr = psMetadataLookupStr(&status, recipe, "MASK.BAD"); // Old name for MASK.BLANK
    379       if (maskBlankStr) {
    380         maskBlank = pmConfigMaskGet(maskBlankStr, config); // Bits to mask for bad pixels
    381       } else {
    382         maskBlank = pmConfigMaskGet("BLANK", config); // Bits to mask for bad pixels
    383       }
    384     }
     377    psImageMaskType maskBlank   = pmConfigMaskGet(maskBlankStr, config); // Bits to mask for bad pixels
    385378
    386379    int num = readouts->n;              // Number of inputs
     
    412405    sectionNum++;
    413406
    414     psArray *results = psArrayAlloc(2); // Array of results
    415     results->data[0] = inspect;
    416     results->data[1] = reject;
    417 
    418     return results;
    419 }
    420 
    421 
     407    return true;
     408}
     409
     410
  • branches/eam_branches/ppStack.20211015/src/ppStackSetup.c

    r41841 r41842  
    2020
    2121    options->clipPercent  = psMetadataLookupBool(NULL, recipe, "COMBINE.PERCENT"); // use percentile range to clip?
    22     options->clipMinRange = psMetadataLookupF32 (NULL, recipe, "COMBINE.MIN.RANGE"); // min percentile
    23     options->clipMaxRange = psMetadataLookupF32 (NULL, recipe, "COMBINE.MAX.RANGE"); // max percentile
    24 
    2522
    2623    if (!psMetadataLookupBool(NULL, config->arguments, "HAVE.PSF")) {
Note: See TracChangeset for help on using the changeset viewer.