IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jul 7, 2009, 10:32:49 AM (17 years ago)
Author:
eugene
Message:

working version of censorReadout

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/magic/censorObjects/src/censorReadout.c

    r24692 r24695  
    11/** @file censorReadout.c
    22 *
    3  *  @brief reject detections that land within the magic mask regions
     3 *  @brief reject detections that land within the streak mask regions
    44 *
    55 *  @ingroup censor
     
    2424    }
    2525
    26     psImageMaskType magicMaskValue = pmConfigMaskGet("MAGIC", config); // Mask value for magic pixels
     26    psImageMaskType streakMaskValue = pmConfigMaskGet("STREAK", config); // Mask value for streak pixels
    2727
    2828    psLogMsg ("censor", PS_LOG_INFO, "generating a bright-star mask");
     
    3737    // XXX why not do this?
    3838    pmReadout *readoutMask = pmFPAviewThisReadout (view, inMask->fpa);
    39     if (!readoutMask) continue;
     39    if (!readoutMask) {
     40        psError(CENSOR_ERR_CONFIG, true, "Can't find mask for this readout");
     41        return false;
     42    }
    4043
    4144    // select the raw objects for this readout, flag is they fall in a mask
    4245    psArray *inSources = psMetadataLookupPtr (&status, readout->analysis, "PSPHOT.SOURCES");
    43     if (inSources == NULL) continue;
     46    if (inSources == NULL) {
     47        psError(CENSOR_ERR_CONFIG, true, "Can't find sources for this readout");
     48        return false;
     49    }
    4450               
    4551    // create a replacement output array:
    46     psArray *outSources = psAllocArrayEmpty(100);
     52    psArray *outSources = psArrayAllocEmpty(100);
    4753
    4854    // only keep sources that do not match the specified mask bit
     
    6167        if (onChip) {
    6268            psImageMaskType value = readoutMask->mask->data.PS_TYPE_IMAGE_MASK_DATA[yChip][xChip];
    63             if (value & magicMaskValue) {
    64                 // skip sources on magic masks
     69            if (value & streakMaskValue) {
     70                // skip sources on streak masks
    6571                continue;
    6672            }
     
    6975    }
    7076
     77    psLogMsg ("censor", PS_LOG_INFO, "keeping %ld of %ld sources", outSources->n, inSources->n);
     78
    7179    // remove the inSources and replace with the outSources
    72     psMetadataRemove (readout->analysis, "PSPHOT.SOURCES");
     80    psMetadataRemoveKey (readout->analysis, "PSPHOT.SOURCES");
    7381    psMetadataAdd (readout->analysis, PS_LIST_TAIL, "PSPHOT.SOURCES", PS_DATA_ARRAY, "sources", outSources);
     82    psFree (outSources);
    7483
    7584    return true;
Note: See TracChangeset for help on using the changeset viewer.