IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 24078


Ignore:
Timestamp:
May 5, 2009, 6:27:23 PM (17 years ago)
Author:
Paul Price
Message:

Give bad dark pixels the 'flatMask' mask value, rather than the maskValue (which is indistinguishable).

File:
1 edited

Legend:

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

    r23825 r24078  
    1717    // Masking on the basis of pixel value needs to be done before anything else, so the values are pristine.
    1818    if (options->doMaskBuild) {
    19         psImageMaskType satMask = options->doMaskSat ? options->satMask : 0;
    20         psImageMaskType lowMask = options->doMaskLow ? options->lowMask : 0;
     19        psImageMaskType satMask = options->doMaskSat ? options->satMask : 0;
     20        psImageMaskType lowMask = options->doMaskLow ? options->lowMask : 0;
    2121        pmReadoutGenerateMask(input, satMask, lowMask);
    2222    }
     
    5656        if (!pmBiasSubtract(input, options->overscan, bias, oldDark, view)) {
    5757            psError(PS_ERR_UNKNOWN, false, "Unable to subtract bias.");
    58             psFree(detview);
     58            psFree(detview);
    5959            return false;
    6060        }
     
    6868
    6969    if (options->doDark && dark) {
    70         if (!pmDarkApply(input, dark, options->maskValue)) {
     70        if (!pmDarkApply(input, dark, options->flatMask)) {
    7171            psError(PS_ERR_UNKNOWN, false, "Unable to subtract dark.");
    72             psFree(detview);
     72            psFree(detview);
    7373            return false;
    7474        }
     
    7979                        options->remnanceSize, options->remnanceThresh)) {
    8080            psError(PS_ERR_UNKNOWN, false, "Unable to mask remnance.");
    81             psFree(detview);
     81            psFree(detview);
    8282            return false;
    8383        }
     
    8888        pmReadout *shutter = pmFPAfileThisReadout(config->files, detview, "PPIMAGE.SHUTTER");
    8989        if (!pmShutterCorrectionApply(input, shutter, pmConfigMaskGet("FLAT", config))) {
    90             psFree(detview);
     90            psFree(detview);
    9191            return false;
    9292        }
     
    9797        pmReadout *flat = pmFPAfileThisReadout(config->files, detview, "PPIMAGE.FLAT");
    9898        if (!pmFlatField(input, flat, options->flatMask)) {
    99             psFree(detview);
     99            psFree(detview);
    100100            return false;
    101101        }
     
    119119    psMetadata *normlist = psMetadataLookupMetadata(&mdok, config->arguments, "NORMALIZATION.TABLE");
    120120    if (normlist) {
    121         pmFPAfile *inputFile = psMetadataLookupPtr(&mdok, config->files, "PPIMAGE.INPUT");
     121        pmFPAfile *inputFile = psMetadataLookupPtr(&mdok, config->files, "PPIMAGE.INPUT");
    122122
    123         // get the menu of class IDs
    124         psMetadata *menu = psMetadataLookupMetadata(&mdok, inputFile->camera, "CLASSID"); 
     123        // get the menu of class IDs
     124        psMetadata *menu = psMetadataLookupMetadata(&mdok, inputFile->camera, "CLASSID");
    125125        if (!menu) {
    126126            psError(PS_ERR_IO, false, "Unable to find CLASSID metadata in camera configuration");
    127             psFree(detview);
     127            psFree(detview);
    128128            return false;
    129129        }
    130         // get the rule for class_id for the desired class
    131         const char *rule = psMetadataLookupStr(&mdok, menu, options->normClass); 
     130        // get the rule for class_id for the desired class
     131        const char *rule = psMetadataLookupStr(&mdok, menu, options->normClass);
    132132        if (!rule) {
    133133            psError(PS_ERR_IO, false, "Unable to find NORM.CLASS value %s in CLASSID in camera configuration", options->normClass);
    134             psFree(detview);
     134            psFree(detview);
    135135            return false;
    136136        }
    137         // get the class_id from the rule
     137        // get the class_id from the rule
    138138        char *classID = pmFPAfileNameFromRule(rule, inputFile, view);
    139139        if (!classID) {
    140140            psError(PS_ERR_IO, false, "error converting CLASSID rule %s to name\n", rule);
    141             psFree(detview);
     141            psFree(detview);
    142142            return false;
    143143        }
    144144
    145         // get normalization from the class_id
    146         float norm = psMetadataLookupF32 (&mdok, normlist, classID);
    147         if (!mdok) {
    148             psError(PS_ERR_IO, false, "failed to find class ID %s in normalization table\n", classID);
    149             psFree(detview);
    150             return false;
    151         }
     145        // get normalization from the class_id
     146        float norm = psMetadataLookupF32 (&mdok, normlist, classID);
     147        if (!mdok) {
     148            psError(PS_ERR_IO, false, "failed to find class ID %s in normalization table\n", classID);
     149            psFree(detview);
     150            return false;
     151        }
    152152
    153153        pmHDU *hdu = pmHDUFromReadout(input); // HDU of interest
     
    157157        psFree(comment);
    158158
    159         // apply the normalization
     159        // apply the normalization
    160160        psBinaryOp(input->image, input->image, "*", psScalarAlloc(norm, PS_TYPE_F32));
    161161
    162         psFree (classID);
     162        psFree (classID);
    163163    }
    164164# endif
     
    167167        pmCell *fringe = pmFPAfileThisCell(config->files, detview, "PPIMAGE.FRINGE");
    168168        if (!ppImageDetrendFringeMeasure(input, fringe, false, options)) {
    169             psFree(detview);
     169            psFree(detview);
    170170            return false;
    171171        }
Note: See TracChangeset for help on using the changeset viewer.