IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 5, 2007, 5:38:16 PM (19 years ago)
Author:
Paul Price
Message:

Adding variance and mask output.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/pswarp/src/pswarpArguments.c

    r12567 r12771  
    4747    }
    4848
     49
    4950    psArray *array;
    5051
     
    5859    psFree (array);
    5960
     61
     62    // Parse the recipe and format into the arguments
     63    {
     64
     65        // Select the appropriate recipe
     66        psMetadata *recipe  = psMetadataLookupPtr (NULL, config->recipes, PSWARP_RECIPE);
     67        if (!recipe) {
     68            psError(PSWARP_ERR_CONFIG, true, "Can't find %s recipe!\n", PSWARP_RECIPE);
     69            return false;
     70        }
     71
     72        // Get grid size
     73        bool status;                        // Status of MD lookup
     74        int nGridX = psMetadataLookupS32 (&status, recipe, "GRID.NX");
     75        if (!status) nGridX = 128;
     76        int nGridY = psMetadataLookupS32 (&status, recipe, "GRID.NY");
     77        if (!status) nGridY = 128;
     78
     79        // Get interpolation mode
     80        psImageInterpolateMode interpolationMode; // Mode for interpolation
     81        const char *name = psMetadataLookupStr (&status, recipe, "INTERPOLATION.MODE"); // Name of interp mode
     82        if (!name) {
     83            interpolationMode = PS_INTERPOLATE_BILINEAR;
     84            psLogMsg ("pswarp", 3, "defaulting to bilinear interpolation\n");
     85        } else {
     86            interpolationMode = psImageInterpolateModeFromString (name);
     87            if (interpolationMode == PS_INTERPOLATE_NONE) {
     88                interpolationMode = PS_INTERPOLATE_BILINEAR;
     89                psLogMsg ("pswarp", 3,
     90                          "Unknown interpolation mode %s, defaulting to bilinear interpolation\n", name);
     91            }
     92        }
     93
     94        // Get mask parameters
     95        psMaskType maskIn = psMetadataLookupU8(&status, recipe, "MASK.IN"); // Mask for input data
     96        if (!status) {
     97            maskIn = 0x00;
     98            psWarning("MASK.IN is not set in the %s recipe --- defaulting to %x.", PSWARP_RECIPE, maskIn);
     99        }
     100        psMaskType maskPoor = psMetadataLookupU8(&status, recipe, "MASK.POOR"); // Mask for "poor" warped data
     101        if (!status) {
     102            maskPoor = 0x00;
     103            psWarning("MASK.POOR is not set in the %s recipe --- defaulting to %x.", PSWARP_RECIPE, maskPoor);
     104        }
     105        psMaskType maskBad = psMetadataLookupU8(&status, recipe, "MASK.IN"); // Mask for bad warped data
     106        if (!status) {
     107            maskBad = 0x00;
     108            psWarning("MASK.BAD is not set in the %s recipe --- defaulting to %x.", PSWARP_RECIPE, maskBad);
     109        }
     110        float poorFrac = psMetadataLookupF32(&status, recipe, "POOR.FRAC"); // Frac of bad flux for a "poor"
     111        if (!status) {
     112            poorFrac = 0.0;
     113            psWarning("POOR.FRAC is not set in the %s recipe --- defaulting to %f.", PSWARP_RECIPE, poorFrac);
     114        }
     115
     116        // Set recipe values in the arguments
     117        psMetadataAddS32(config->arguments, PS_LIST_TAIL, "GRID.NX", 0,
     118                         "Iso-astrom grid spacing in x", nGridX);
     119        psMetadataAddS32(config->arguments, PS_LIST_TAIL, "GRID.NY", 0,
     120                         "Iso-astrom grid spacing in x", nGridX);
     121        psMetadataAddS32(config->arguments, PS_LIST_TAIL, "INTERPOLATION.MODE", 0,
     122                         "Interpolation mode", interpolationMode);
     123        psMetadataAddU8(config->arguments, PS_LIST_TAIL, "MASK.IN", 0,
     124                         "Mask for input data", maskIn);
     125        psMetadataAddU8(config->arguments, PS_LIST_TAIL, "MASK.POOR", 0,
     126                         "Mask for poor warped data", maskPoor);
     127        psMetadataAddU8(config->arguments, PS_LIST_TAIL, "MASK.BAD", 0,
     128                         "Mask for bad warped data", maskBad);
     129        psMetadataAddF32(config->arguments, PS_LIST_TAIL, "POOR.FRAC", 0,
     130                         "Fraction of bad flux for a pixel to be marked as poor", poorFrac);
     131    }
     132
    60133    psTrace("pswarp", 1, "Done with pswarpArguments...\n");
    61134    return (config);
Note: See TracChangeset for help on using the changeset viewer.