Changeset 24695 for trunk/magic/censorObjects/src/censorReadout.c
- Timestamp:
- Jul 7, 2009, 10:32:49 AM (17 years ago)
- File:
-
- 1 edited
-
trunk/magic/censorObjects/src/censorReadout.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/magic/censorObjects/src/censorReadout.c
r24692 r24695 1 1 /** @file censorReadout.c 2 2 * 3 * @brief reject detections that land within the magicmask regions3 * @brief reject detections that land within the streak mask regions 4 4 * 5 5 * @ingroup censor … … 24 24 } 25 25 26 psImageMaskType magicMaskValue = pmConfigMaskGet("MAGIC", config); // Mask value for magicpixels26 psImageMaskType streakMaskValue = pmConfigMaskGet("STREAK", config); // Mask value for streak pixels 27 27 28 28 psLogMsg ("censor", PS_LOG_INFO, "generating a bright-star mask"); … … 37 37 // XXX why not do this? 38 38 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 } 40 43 41 44 // select the raw objects for this readout, flag is they fall in a mask 42 45 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 } 44 50 45 51 // create a replacement output array: 46 psArray *outSources = psA llocArrayEmpty(100);52 psArray *outSources = psArrayAllocEmpty(100); 47 53 48 54 // only keep sources that do not match the specified mask bit … … 61 67 if (onChip) { 62 68 psImageMaskType value = readoutMask->mask->data.PS_TYPE_IMAGE_MASK_DATA[yChip][xChip]; 63 if (value & magicMaskValue) {64 // skip sources on magicmasks69 if (value & streakMaskValue) { 70 // skip sources on streak masks 65 71 continue; 66 72 } … … 69 75 } 70 76 77 psLogMsg ("censor", PS_LOG_INFO, "keeping %ld of %ld sources", outSources->n, inSources->n); 78 71 79 // remove the inSources and replace with the outSources 72 psMetadataRemove (readout->analysis, "PSPHOT.SOURCES");80 psMetadataRemoveKey (readout->analysis, "PSPHOT.SOURCES"); 73 81 psMetadataAdd (readout->analysis, PS_LIST_TAIL, "PSPHOT.SOURCES", PS_DATA_ARRAY, "sources", outSources); 82 psFree (outSources); 74 83 75 84 return true;
Note:
See TracChangeset
for help on using the changeset viewer.
