IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 21364


Ignore:
Timestamp:
Feb 5, 2009, 4:36:52 PM (17 years ago)
Author:
Paul Price
Message:

Merging pap_branch_20090128. Resolved a small number of conflicts. Compiles, but not tested in detail.

Location:
trunk/ppImage/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppImage/src/ppImage.h

    r21183 r21364  
    2525    // actions which ppImage should perform
    2626    bool doMaskBuild;                   // Build internal mask
    27     bool doWeightBuild;                   // Build internal mask
     27    bool doVarianceBuild;               // Build internal variance map
    2828    bool doMask;                        // Mask bad pixels
    2929    bool doNonLin;                      // Non-linearity correction
     
    4444    bool BaseFITS;
    4545    bool BaseMaskFITS;
    46     bool BaseWeightFITS;
     46    bool BaseVarianceFITS;
    4747
    4848    bool ChipFITS;
    4949    bool ChipMaskFITS;
    50     bool ChipWeightFITS;
     50    bool ChipVarianceFITS;
    5151
    5252    bool FPA1FITS;
     
    5858
    5959    // make values for abstract concepts of masking
    60     psImageMaskType maskValue;               // apply this bit-mask to choose masked bits
    61     psImageMaskType markValue;               // apply this bit-mask to choose masked bits
    62     psImageMaskType satMask;                 // Mask value to give saturated pixels
    63     psImageMaskType badMask;                 // Mask value to give bad pixels
    64     psImageMaskType flatMask;                // Mask value to give bad flat pixels
    65     psImageMaskType blankMask;               // Mask value to give blank pixels
     60    psImageMaskType maskValue;          // apply this bit-mask to choose masked bits
     61    psImageMaskType markValue;          // apply this bit-mask to choose masked bits
     62    psImageMaskType satMask;            // Mask value to give saturated pixels
     63    psImageMaskType badMask;            // Mask value to give bad pixels
     64    psImageMaskType flatMask;           // Mask value to give bad flat pixels
     65    psImageMaskType blankMask;          // Mask value to give blank pixels
    6666
    6767    // non-linear correction parameters
  • trunk/ppImage/src/ppImageDetrendReadout.c

    r20626 r21364  
    5959
    6060    // Weight on the basis of pixel value needs to be done after the overscan has been subtracted
    61     if (options->doWeightBuild) {
    62         // create the target mask and weight images
    63         pmReadoutGenerateWeight(input, true);
     61    if (options->doVarianceBuild) {
     62        // create the target mask and variance images
     63        pmReadoutGenerateVariance(input, true);
    6464    }
    6565
  • trunk/ppImage/src/ppImageFileCheck.c

    r14001 r21364  
    2020        if (fpa->hdu) {
    2121            if (fpa->hdu->images) fprintf (stderr, "  (%d,%d) images\n", -1, -1);
    22             if (fpa->hdu->weights) fprintf (stderr, "  (%d,%d) weights\n", -1, -1);
     22            if (fpa->hdu->variances) fprintf (stderr, "  (%d,%d) variances\n", -1, -1);
    2323            if (fpa->hdu->masks) fprintf (stderr, "  (%d,%d) masks\n", -1, -1);
    2424            if (fpa->hdu->header) fprintf (stderr, "  (%d,%d) header\n", -1, -1);
     
    3030            if (chip->hdu) {
    3131                if (chip->hdu->images) fprintf (stderr, "  (%d,%d) images\n", i, -1);
    32                 if (chip->hdu->weights) fprintf (stderr, "  (%d,%d) weights\n", i, -1);
     32                if (chip->hdu->variances) fprintf (stderr, "  (%d,%d) variances\n", i, -1);
    3333                if (chip->hdu->masks) fprintf (stderr, "  (%d,%d) masks\n", i, -1);
    3434                if (chip->hdu->header) fprintf (stderr, "  (%d,%d) header\n", i, -1);
     
    4040                if (cell->hdu) {
    4141                    if (cell->hdu->images) fprintf (stderr, "  (%d,%d) images\n", i, j);
    42                     if (cell->hdu->weights) fprintf (stderr, "  (%d,%d) weights\n", i, j);
     42                    if (cell->hdu->variances) fprintf (stderr, "  (%d,%d) variances\n", i, j);
    4343                    if (cell->hdu->masks) fprintf (stderr, "  (%d,%d) masks\n", i, j);
    4444                    if (cell->hdu->header) fprintf (stderr, "  (%d,%d) header\n", i, j);
     
    5050                    if (readout) {
    5151                        if (readout->image) fprintf (stderr, "  (%d,%d,%d) image\n", i, j, k);
    52                         if (readout->weight) fprintf (stderr, "  (%d,%d,%d) weight\n", i, j, k);
     52                        if (readout->variance) fprintf (stderr, "  (%d,%d,%d) variance\n", i, j, k);
    5353                        if (readout->mask) fprintf (stderr, "  (%d,%d,%d) masks\n", i, j, k);
    5454                    }
  • trunk/ppImage/src/ppImageOptions.c

    r20626 r21364  
    1919    // actions which ppImage should perform
    2020    options->doMaskBuild     = false;   // Build internal mask
    21     options->doWeightBuild   = false;   // Build internal weight
     21    options->doVarianceBuild   = false;   // Build internal variance
    2222    options->doMask          = false;   // Mask bad pixels
    2323    options->doNonLin        = false;   // Non-linearity correction
     
    3737    options->BaseFITS        = false;   // create output image
    3838    options->BaseMaskFITS    = false;   // create output mask image
    39     options->BaseWeightFITS  = false;   // create output weight image
     39    options->BaseVarianceFITS  = false;   // create output variance image
    4040
    4141    options->ChipFITS        = false;   // create output chip-mosaic image
    4242    options->ChipMaskFITS    = false;   // create output chip-mosaic mask image
    43     options->ChipWeightFITS  = false;   // create output chip-mosaic weight image
     43    options->ChipVarianceFITS  = false;   // create output chip-mosaic variance image
    4444
    4545    options->FPA1FITS        = false;   // create fpa-mosaic binned image (scale 1)
     
    194194    // for these images, even if not required otherwise
    195195    options->doMaskBuild = psMetadataLookupBool(NULL, recipe, "MASK.BUILD");
    196     options->doWeightBuild = psMetadataLookupBool(NULL, recipe, "WEIGHT.BUILD");
     196    options->doVarianceBuild = psMetadataLookupBool(NULL, recipe, "VARIANCE.BUILD");
    197197
    198198    // Mask recipe options (note that mask bit values are set in ppImageSetMaskBits.c)
     
    236236    options->BaseFITS       = psMetadataLookupBool(NULL, recipe, "BASE.FITS");
    237237    options->BaseMaskFITS   = psMetadataLookupBool(NULL, recipe, "BASE.MASK.FITS");
    238     options->BaseWeightFITS = psMetadataLookupBool(NULL, recipe, "BASE.WEIGHT.FITS");
     238    options->BaseVarianceFITS = psMetadataLookupBool(NULL, recipe, "BASE.VARIANCE.FITS");
    239239
    240240    options->ChipFITS       = psMetadataLookupBool(NULL, recipe, "CHIP.FITS");
    241241    options->ChipMaskFITS   = psMetadataLookupBool(NULL, recipe, "CHIP.MASK.FITS");
    242     options->ChipWeightFITS = psMetadataLookupBool(NULL, recipe, "CHIP.WEIGHT.FITS");
     242    options->ChipVarianceFITS = psMetadataLookupBool(NULL, recipe, "CHIP.VARIANCE.FITS");
    243243
    244244    options->FPA1FITS       = psMetadataLookupBool(NULL, recipe, "FPA1.FITS");
     
    255255    options->doBG           = psMetadataLookupBool(NULL, recipe, "BACKGROUND");
    256256
    257     // even if not requested explicitly, if any of these are set, build an internal mask and weight:
     257    // even if not requested explicitly, if any of these are set, build an internal mask and variance:
    258258    if (options->doBias || options->doOverscan || options->doDark || options->doShutter || options->doFlat ||
    259259        options->doPhotom) {
    260260        options->doMaskBuild = true;
    261         options->doWeightBuild = true;
     261        options->doVarianceBuild = true;
    262262    } else if (options->doMask || options->doBG) {
    263263        options->doMaskBuild = true;
  • trunk/ppImage/src/ppImageParseCamera.c

    r20647 r21364  
    2020    }
    2121
    22     // if MASK or WEIGHT was supplied on command line, bind files to 'input'.
    23     // the mask and weight will be mosaicked with the image
     22    // if MASK or VARIANCE was supplied on command line, bind files to 'input'.
     23    // the mask and variance will be mosaicked with the image
    2424    pmFPAfile *inputMask = pmFPAfileBindFromArgs(&status, input, config, "PPIMAGE.INPUT.MASK", "PPIMAGE.INPUT.MASK");
    2525    if (!status) {
     
    3434    }
    3535
    36     pmFPAfile *inputWeight = pmFPAfileBindFromArgs(&status, input, config, "PPIMAGE.INPUT.WEIGHT", "PPIMAGE.INPUT.WEIGHT");
     36    pmFPAfile *inputVariance = pmFPAfileBindFromArgs(&status, input, config, "PPIMAGE.INPUT.VARIANCE", "PPIMAGE.INPUT.VARIANCE");
    3737    if (!status) {
    3838        psError (PS_ERR_UNKNOWN, false, "failed to load find definition");
    3939        return NULL;
    4040    }
    41     if (inputWeight && inputWeight->type != PM_FPA_FILE_WEIGHT) {
    42         psError(PS_ERR_IO, true, "PPIMAGE.INPUT.WEIGHT is not of type WEIGHT");
     41    if (inputVariance && inputVariance->type != PM_FPA_FILE_VARIANCE) {
     42        psError(PS_ERR_IO, true, "PPIMAGE.INPUT.VARIANCE is not of type VARIANCE");
    4343        return NULL;
    4444    }
     
    195195        return NULL;
    196196    }
    197     pmFPAfile *outWeight = pmFPAfileDefineOutput(config, input->fpa, "PPIMAGE.OUTPUT.WEIGHT");
    198     if (!outWeight) {
    199         psError(PS_ERR_IO, false, _("Unable to generate output file from PPIMAGE.OUTPUT.WEIGHT"));
    200         psFree(options);
    201         return NULL;
    202     }
    203     if (outWeight->type != PM_FPA_FILE_WEIGHT) {
    204         psError(PS_ERR_IO, true, "PPIMAGE.OUTPUT.WEIGHT is not of type WEIGHT");
     197    pmFPAfile *outVariance = pmFPAfileDefineOutput(config, input->fpa, "PPIMAGE.OUTPUT.VARIANCE");
     198    if (!outVariance) {
     199        psError(PS_ERR_IO, false, _("Unable to generate output file from PPIMAGE.OUTPUT.VARIANCE"));
     200        psFree(options);
     201        return NULL;
     202    }
     203    if (outVariance->type != PM_FPA_FILE_VARIANCE) {
     204        psError(PS_ERR_IO, true, "PPIMAGE.OUTPUT.VARIANCE is not of type VARIANCE");
    205205        psFree(options);
    206206        return NULL;
     
    230230        return NULL;
    231231    }
    232     pmFPAfile *chipWeight = pmFPAfileDefineOutput(config, chipImage->fpa, "PPIMAGE.CHIP.WEIGHT");
    233     if (!chipWeight) {
    234         psError(PS_ERR_IO, false, _("Unable to generate output file from PPIMAGE.CHIP.WEIGHT"));
    235         psFree(options);
    236         return NULL;
    237     }
    238     if (chipWeight->type != PM_FPA_FILE_WEIGHT) {
    239         psError(PS_ERR_IO, true, "PPIMAGE.CHIP.WEIGHT is not of type WEIGHT");
     232    pmFPAfile *chipVariance = pmFPAfileDefineOutput(config, chipImage->fpa, "PPIMAGE.CHIP.VARIANCE");
     233    if (!chipVariance) {
     234        psError(PS_ERR_IO, false, _("Unable to generate output file from PPIMAGE.CHIP.VARIANCE"));
     235        psFree(options);
     236        return NULL;
     237    }
     238    if (chipVariance->type != PM_FPA_FILE_VARIANCE) {
     239        psError(PS_ERR_IO, true, "PPIMAGE.CHIP.VARIANCE is not of type VARIANCE");
    240240        psFree(options);
    241241        return NULL;
     
    315315    outImage->save   = options->BaseFITS;
    316316    outMask->save    = options->BaseMaskFITS;
    317     outWeight->save  = options->BaseWeightFITS;
     317    outVariance->save  = options->BaseVarianceFITS;
    318318
    319319    chipImage->save  = options->ChipFITS;
    320320    chipMask->save   = options->ChipMaskFITS;
    321     chipWeight->save = options->ChipWeightFITS;
     321    chipVariance->save = options->ChipVarianceFITS;
    322322
    323323    byFPA1->save     = options->FPA1FITS;
     
    329329    outImage->fileLevel = PS_MIN (outImage->fileLevel, outImage->dataLevel);
    330330
    331     // outMask and outWeight must be freed at the same level as outImage (all freed by pmFPAFreeData)
     331    // outMask and outVariance must be freed at the same level as outImage (all freed by pmFPAFreeData)
    332332    outMask->freeLevel   = outImage->freeLevel;
    333     outWeight->freeLevel = outImage->freeLevel;
     333    outVariance->freeLevel = outImage->freeLevel;
    334334    outMask->dataLevel   = outImage->dataLevel;
    335     outWeight->dataLevel = outImage->dataLevel;
     335    outVariance->dataLevel = outImage->dataLevel;
    336336
    337337    // Ditto for the chip-mosaicked version
    338338    chipMask->freeLevel   = chipImage->freeLevel;
    339     chipWeight->freeLevel = chipImage->freeLevel;
     339    chipVariance->freeLevel = chipImage->freeLevel;
    340340    chipMask->dataLevel   = chipImage->dataLevel;
    341     chipWeight->dataLevel = chipImage->dataLevel;
     341    chipVariance->dataLevel = chipImage->dataLevel;
    342342
    343343    // the input data is the same as the outImage data : force the free levels to match
     
    434434    }
    435435
    436     // Turn off mask and weight output if we're not doing anything interesting
     436    // Turn off mask and variance output if we're not doing anything interesting
    437437    if (!options->doMaskBuild && outMask->save) {
    438438        psWarning("output mask image (BASE.MASK.FITS) requested, but not generated: skipping.\n");
    439439        outMask->save = false;
    440440    }
    441     if (!options->doWeightBuild && outWeight->save) {
    442         psWarning("output weight image (BASE.WEIGHT.FITS) requested, but not generated: skipping.\n");
    443         outWeight->save = false;
     441    if (!options->doVarianceBuild && outVariance->save) {
     442        psWarning("output variance image (BASE.VARIANCE.FITS) requested, but not generated: skipping.\n");
     443        outVariance->save = false;
    444444    }
    445445    if (!options->doMaskBuild && chipMask->save) {
     
    447447        chipMask->save = false;
    448448    }
    449     if (!options->doWeightBuild && chipWeight->save) {
    450         psWarning("output weight image (CHIP.WEIGHT.FITS) requested, but not generated: skipping.\n");
    451         chipWeight->save = false;
     449    if (!options->doVarianceBuild && chipVariance->save) {
     450        psWarning("output variance image (CHIP.VARIANCE.FITS) requested, but not generated: skipping.\n");
     451        chipVariance->save = false;
    452452    }
    453453
  • trunk/ppImage/src/ppImageSetMaskBits.c

    r21183 r21364  
    77bool ppImageSetMaskBits (pmConfig *config, ppImageOptions *options) {
    88
    9     if (!pmConfigMaskSetBits (&options->maskValue, &options->markValue, config)) {
    10         psError (PS_ERR_UNKNOWN, true, "Unable to define the mask bit values");
    11         return false;
     9    if (!pmConfigMaskSetBits(&options->maskValue, &options->markValue, config)) {
     10        psError (PS_ERR_UNKNOWN, true, "Unable to define the mask bit values");
     11        return false;
    1212    }
    1313
     
    1515
    1616    // mask for non-linear flat corrections
    17     options->flatMask = pmConfigMaskGet("FLAT", config); 
     17    options->flatMask = pmConfigMaskGet("FLAT", config);
    1818    psAssert (options->flatMask, "flat mask not set");
    1919
    2020    // mask for non-existent data  (default to DETECTOR if not defined)
    21     options->blankMask = pmConfigMaskGet("BLANK", config); 
     21    options->blankMask = pmConfigMaskGet("BLANK", config);
    2222    psAssert (options->blankMask, "blank mask not set");
    2323
     
    2525    options->satMask = pmConfigMaskGet("SAT", config);
    2626    psAssert (options->satMask, "sat mask not set");
    27    
     27
    2828    // mask for below-range data  (default to RANGE if not defined)
    2929    options->badMask = pmConfigMaskGet("BAD", config);
     
    3838
    3939    // set maskValue and markValue in the psphot recipe
    40     psMetadataAddImageMask (recipe, PS_LIST_TAIL, "MASK.PSPHOT", PS_META_REPLACE, "user-defined mask", options->maskValue);
    41     psMetadataAddImageMask (recipe, PS_LIST_TAIL, "MARK.PSPHOT", PS_META_REPLACE, "user-defined mask", options->markValue);
     40    psMetadataAddImageMask(recipe, PS_LIST_TAIL, "MASK.PSPHOT", PS_META_REPLACE, "user-defined mask",
     41                           options->maskValue);
     42    psMetadataAddImageMask(recipe, PS_LIST_TAIL, "MARK.PSPHOT", PS_META_REPLACE, "user-defined mask",
     43                           options->markValue);
    4244
    4345    return true;
Note: See TracChangeset for help on using the changeset viewer.