- Timestamp:
- May 3, 2010, 8:50:52 AM (16 years ago)
- Location:
- branches/simtest_nebulous_branches
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/simtest_nebulous_branches
- Property svn:mergeinfo changed
-
branches/simtest_nebulous_branches/magic
- Property svn:ignore
-
old new 1 1 magic 2 2 ssa-core-cpp 3 Makefile4 3 Makefile.bak
-
- Property svn:ignore
-
branches/simtest_nebulous_branches/magic/censorObjects/src/censorReadout.c
r24714 r27840 19 19 // if there is no mask file for this readout drop all sources 20 20 if (badMaskFile) { 21 psMetadataRemoveKey (readout->analysis, "PSPHOT. SOURCES");21 psMetadataRemoveKey (readout->analysis, "PSPHOT.DETECTIONS"); 22 22 return true; 23 23 } … … 41 41 } 42 42 43 // XXX why not do this? 43 // XXX why not do this? 44 44 pmReadout *readoutMask = pmFPAviewThisReadout (view, inMask->fpa); 45 45 if (!readoutMask) { 46 46 psError(CENSOR_ERR_CONFIG, true, "Can't find mask for this readout"); 47 return false;47 return false; 48 48 } 49 49 50 50 // select the raw objects for this readout, flag is they fall in a mask 51 p sArray *inSources = psMetadataLookupPtr (&status, readout->analysis, "PSPHOT.SOURCES");52 if ( inSources == NULL) {53 psError(CENSOR_ERR_CONFIG, true, "Can't find sources for this readout");54 return false;51 pmDetections *detections = psMetadataLookupPtr (&status, readout->analysis, "PSPHOT.DETECTIONS"); 52 if (detections == NULL) { 53 psError(CENSOR_ERR_CONFIG, true, "Can't find detections for this readout"); 54 return false; 55 55 } 56 56 psArray *inSources = detections->allSources; 57 psAssert (inSources, "missing sources?"); 58 57 59 // create a replacement output array: 58 60 psArray *outSources = psArrayAllocEmpty(100); … … 60 62 // only keep sources that do not match the specified mask bit 61 63 for (int i = 0; i < inSources->n; i++) { 62 pmSource *source = inSources->data[i];64 pmSource *source = inSources->data[i]; 63 65 64 int xChip = source->peak->x;65 int yChip = source->peak->y;66 int xChip = source->peak->x; 67 int yChip = source->peak->y; 66 68 67 bool onChip = true;68 onChip &= (xChip >= 0);69 onChip &= (xChip < readoutMask->mask->numCols);70 onChip &= (yChip >= 0);71 onChip &= (yChip < readoutMask->mask->numRows);69 bool onChip = true; 70 onChip &= (xChip >= 0); 71 onChip &= (xChip < readoutMask->mask->numCols); 72 onChip &= (yChip >= 0); 73 onChip &= (yChip < readoutMask->mask->numRows); 72 74 73 if (onChip) {74 psImageMaskType value = readoutMask->mask->data.PS_TYPE_IMAGE_MASK_DATA[yChip][xChip];75 if (value & streakMaskValue) {76 // skip sources on streak masks77 continue;78 }79 }80 psArrayAdd (outSources, 100, source);75 if (onChip) { 76 psImageMaskType value = readoutMask->mask->data.PS_TYPE_IMAGE_MASK_DATA[yChip][xChip]; 77 if (value & streakMaskValue) { 78 // skip sources on streak masks 79 continue; 80 } 81 } 82 psArrayAdd (outSources, 100, source); 81 83 } 82 84 83 85 psLogMsg ("censor", PS_LOG_INFO, "keeping %ld of %ld sources", outSources->n, inSources->n); 84 86 85 // remove the inSources and replace with the outSources 86 psMetadataRemoveKey (readout->analysis, "PSPHOT.SOURCES"); 87 psMetadataAdd (readout->analysis, PS_LIST_TAIL, "PSPHOT.SOURCES", PS_DATA_ARRAY, "sources", outSources); 88 psFree (outSources); 87 psFree (detections->allSources); 88 detections->allSources = outSources; 89 89 90 90 return true;
Note:
See TracChangeset
for help on using the changeset viewer.
