IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 17, 2009, 2:31:20 PM (17 years ago)
Author:
Paul Price
Message:

Cleaning up. Had trouble getting the output photometry file written out, but works now.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppSub/src/ppSubSetMasks.c

    r21360 r21524  
    66 *
    77 *  @author IfA
    8  *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2009-02-06 01:37:17 $
     8 *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2009-02-18 00:31:20 $
    1010 *  Copyright 2009 Institute for Astronomy, University of Hawaii
    1111 */
    1212
     13#ifdef HAVE_CONFIG_H
     14#include <config.h>
     15#endif
     16
     17#include <stdio.h>
     18#include <pslib.h>
     19#include <psmodules.h>
     20#include <psphot.h>
     21
    1322#include "ppSub.h"
    1423
    15 /** this function generates (if needed) and sets or updates the masks for both the input and
    16  * reference images.  this function also has the code for interpolation over bad pixels, but it
    17  * is currently if-def-ed out
    18  */
     24bool ppSubSetMasks(pmConfig *config, const pmFPAview *view)
     25{
     26    psAssert(config, "Require configuration");
     27    psAssert(view, "Require view");
    1928
    20 bool ppSubSetMasks (pmConfig *config, const pmFPAview *view) {
    21 
    22     psImageMaskType maskValue;
    23     psImageMaskType markValue;
    24     bool mdok = false;
    25 
     29    psImageMaskType maskValue, markValue; // Mask values
    2630    if (!pmConfigMaskSetBits(&maskValue, &markValue, config)) {
    2731        psError(PS_ERR_UNKNOWN, false, "Unable to determine mask value.");
     
    2933    }
    3034
    31     // set the mask bits needed by psphot (in psphot recipe)
     35    // Set the mask bits needed by psphot (in psphot recipe)
    3236    psphotSetMaskRecipe (config, maskValue, markValue);
    3337
    3438    // Look up recipe values
    35     psMetadata *recipe = psMetadataLookupMetadata(&mdok, config->recipes, PPSUB_RECIPE); // Recipe for ppSim
     39    psMetadata *recipe = psMetadataLookupMetadata(NULL, config->recipes, PPSUB_RECIPE); // Recipe for ppSim
    3640    psAssert(recipe, "We checked this earlier, so it should be here.");
    3741
    3842    psImageMaskType satValue = pmConfigMaskGet("SAT", config);
    39     psAssert (satValue, "SAT must be non-zero");
     43    psAssert(satValue, "SAT must be non-zero");
    4044
    4145    psImageMaskType badValue = pmConfigMaskGet("BAD", config);
    42     psAssert (badValue, "BAD must be non-zero");
     46    psAssert(badValue, "BAD must be non-zero");
    4347
    4448    // input images
     
    4953    psImage *reference = refRO->image;  // Reference image
    5054    PS_ASSERT_IMAGES_SIZE_EQUAL(input, reference, false);
    51 
    52     // XXX use psImageCopy below to avoid caring about image dimensions
    53     int numCols = input->numCols;
    54     int numRows = input->numRows;
     55    int numCols = input->numCols, numRows = input->numRows; // Size of image
    5556
    5657    // Generate masks if they don't exist
     
    7879    }
    7980    if (!pmReadoutMaskNonfinite(refRO, satValue)) {
    80         psError(PS_ERR_UNKNOWN, false, "Unable to mask non-finite pixels in reference.");
    81         return false;
     81        psError(PS_ERR_UNKNOWN, false, "Unable to mask non-finite pixels in reference.");
     82        return false;
    8283    }
    8384
    84 #if (0)
    85     // Look up recipe values
    86     psMetadata *recipe = psMetadataLookupMetadata(NULL, config->recipes, PPSUB_RECIPE); // Recipe for ppSim
    87     psAssert(recipe, "We checked this earlier, so it should be here.");
    8885
     86#if 0
     87    // Interpolation over bad pixels: this takes a while!
    8988    bool mdok = false;
    90 
    9189    psString interpModeStr = psMetadataLookupStr(&mdok, recipe, "INTERPOLATION"); // Interpolation mode
    9290    psImageInterpolateMode interpMode = psImageInterpolateModeFromString(interpModeStr); // Interp
     
    102100    // Interpolate over bad pixels, so the bad pixels don't explode
    103101    if (!pmReadoutInterpolateBadPixels(inRO, maskVal, interpMode, poorFrac, maskPoor, maskBad)) {
    104         psError(PS_ERR_UNKNOWN, false, "Unable to interpolate bad pixels for input image.");
    105         return false;
     102        psError(PS_ERR_UNKNOWN, false, "Unable to interpolate bad pixels for input image.");
     103        return false;
    106104    }
    107105    if (!pmReadoutInterpolateBadPixels(refRO, maskVal, interpMode, poorFrac, maskPoor, maskBad)) {
    108         psError(PS_ERR_UNKNOWN, false, "Unable to interpolate bad pixels for reference image.");
    109         return false;
     106        psError(PS_ERR_UNKNOWN, false, "Unable to interpolate bad pixels for reference image.");
     107        return false;
    110108    }
    111109    maskVal |= maskBad;
Note: See TracChangeset for help on using the changeset viewer.