IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 7, 2013, 4:01:35 PM (13 years ago)
Author:
bills
Message:

add new recipe options to ppImage to control application of an auxiliary
mask. This is intended to be a more selective mask that will be used by M31
and STS projects for their reprocessing. This masking is added to the
mask constructed during detrending after the cells have bee mosaiced.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppImage/src/ppImageAuxiliaryMask.c

    r35528 r35531  
    4040}
    4141
     42bool recordFileInHeader(pmChip *chip, psString tag, psString desc, psString filename)
     43{
     44    pmHDU *hdu = pmHDUGetHighest(chip->parent, chip, NULL);
     45
     46    // strip off the directories and nebulous bits
     47    char *base = filename;
     48    for (char *new = base; (new = strpbrk(base, "/:")); base = new + 1);
     49
     50    psMetadataAddStr(hdu->header, PS_LIST_TAIL, tag, PS_META_DUPLICATE_OK, desc, base);
     51    return true;
     52}
     53
    4254// In this function, we augment the mask with the more conservative auxiliary mask
    4355bool ppImageAuxiliaryMask(pmConfig *config, const pmFPAview *view, const ppImageOptions *options)
     
    5163    }
    5264
    53     bool status;                        // Status of MD lookup
     65    bool status;
     66    // Our target chip
    5467    pmFPAfile *input = psMetadataLookupPtr(&status, config->files, "PPIMAGE.CHIP"); // File to correct
    5568    if (!status) {
     
    5871    }
    5972
     73    // Find a suitable detRun with type AUXMASK
     74
    6075    psTime *time = psMetadataLookupPtr(NULL, input->fpa->concepts, "FPA.TIME");
    6176    if (time->sec == 0 && time->nsec == 0) {
     
    6378    }
    6479
    65     // XXX careful about this: is this set correctly in the camera.config files?
    6680    char *cameraName = psMetadataLookupStr(NULL, input->fpa->concepts, "FPA.CAMERA");
    6781    pmDetrendSelectOptions *detrendOptions = pmDetrendSelectOptionsAlloc(cameraName, *time, PM_DETREND_TYPE_AUXMASK);
     
    8094    }
    8195   
    82 #ifdef notdef
    83     psMetadata *ppImageRecipe = psMetadataLookupPtr(NULL, config->recipes, RECIPE_NAME);
    84     psAssert(ppImageRecipe, "Need PPIMAGE recipe");
    85     psMetadata *psphotRecipe = psMetadataLookupPtr(NULL, config->recipes, PSPHOT_RECIPE);
    86     psAssert(psphotRecipe, "Need PSPHOT recipe");
    87 
    88     // XXX Should this be options->maskValue or options->maskValue & ~options->satMask?
    89     //     The latter will leave saturated pixels high
    90     psImageMaskType maskVal = options->maskValue;
    91 
    92     // user-defined masks to test for good/bad pixels (build from recipe list if not yet set)
    93     psMetadataAddImageMask(psphotRecipe, PS_LIST_TAIL, "MASK.PSPHOT", PS_META_REPLACE, "user-defined mask", maskVal);
    94 #endif
    95 
     96    // Go find the readout
     97    // code to find the readouts was adapted from ppImageSubtractBackground
    9698    // XXX: shouldn't most of these psWarnings be psAsserts?
    9799
     
    129131    psImage *mask = ro->mask;
    130132
    131     // now read the mask file
     133    // now read the auxiliary mask file
    132134    psString class_id = psMetadataLookupStr(NULL, chip->concepts, "CHIP.NAME");
    133135
     
    139141
    140142    psFree(results);
     143    // record that we read this file in the config dump file.
     144    // Note: this value isn't used during updates though.
     145    pmConfigRunFilenameAddRead(config, "PPIMAGE.AUXMASK", auxMaskFileName);
     146    recordFileInHeader(chip, "DETREND.AUXMASK", "auxiliary mask", auxMaskFileName);
    141147
    142148    psImage *auxMask = readAuxiliaryMask(config, auxMaskFileName);
    143149    psFree(auxMaskFileName);
    144150    if (!auxMask) {
    145         // readAuxiliaryMask prints enough diagnostic information
     151        psError(PS_ERR_UNKNOWN, false, "failed to read auxiliary mask file");
    146152        return false;
    147153    }
     
    151157        psImage *videoMask = readAuxiliaryMask(config, options->auxVideoMask);
    152158        if (!videoMask) {
     159            psError(PS_ERR_UNKNOWN, false, "failed to read auxiliary video mask file");
    153160            return false;
    154161        }
    155         // auxMask *= videoMask
     162        pmConfigRunFilenameAddRead(config, "PPIMAGE.AUXVIDEOMASK", options->auxVideoMask);
     163        recordFileInHeader(chip, "DETREND.AUXVIDEOMASK", "auxiliary video mask", options->auxVideoMask);
     164
     165        // compute auxMask *= videoMask
    156166        if (!psBinaryOp(auxMask, auxMask, "*", videoMask)) {
    157167            psError(PS_ERR_UNKNOWN, false, "mulitplication of auxiliary mask and auxiliary video mask failed");
Note: See TracChangeset for help on using the changeset viewer.