Changeset 24695
- Timestamp:
- Jul 7, 2009, 10:32:49 AM (17 years ago)
- Location:
- trunk/magic/censorObjects/src
- Files:
-
- 6 edited
-
Makefile.am (modified) (1 diff)
-
censor.c (modified) (1 diff)
-
censor.h (modified) (2 diffs)
-
censorArguments.c (modified) (2 diffs)
-
censorLoop.c (modified) (1 diff)
-
censorReadout.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/magic/censorObjects/src/Makefile.am
r24692 r24695 31 31 censorLoop.c \ 32 32 censorReadout.c \ 33 censorErrorCodes.c \ 34 censorVersion.c \ 33 35 censorCleanup.c 34 36 -
trunk/magic/censorObjects/src/censor.c
r24692 r24695 29 29 30 30 // load configuration information 31 pmConfig *config = c onfig = censorArguments(argc, argv);31 pmConfig *config = censorArguments(argc, argv); 32 32 if (!config) { 33 33 usage(); -
trunk/magic/censorObjects/src/censor.h
r24692 r24695 14 14 # define CENSOR_H 15 15 16 # include <stdio.h> 17 # include <string.h> 18 # include <strings.h> // for strcasecmp 19 # include <unistd.h> // for unlink 20 # include <pslib.h> 21 # include <psmodules.h> 22 # include <ppStats.h> 16 23 # include "censorErrorCodes.h" 17 24 … … 21 28 # define CENSOR_RECIPE "CENSOR" ///< Name of the recipe to use 22 29 30 pmConfig *censorArguments (int argc, char **argv); 23 31 bool censorParseCamera (pmConfig *config); 24 32 bool censorLoop (pmConfig *config); 25 33 bool censorReadout (pmReadout *readout, pmConfig *config, const pmFPAview *view); 34 void censorCleanup (pmConfig *config); 26 35 27 36 // Return version strings. -
trunk/magic/censorObjects/src/censorArguments.c
r24692 r24695 11 11 */ 12 12 13 # include "censor StandAlone.h"13 # include "censor.h" 14 14 15 15 pmConfig *censorArguments (int argc, char **argv) { … … 31 31 return NULL; 32 32 } 33 34 // save the following additional recipe values based on command-line options35 // these options override the CENSOR recipe values loaded from recipe files36 psMetadata *options = pmConfigRecipeOptions (config, CENSOR_RECIPE);37 33 38 34 // define the input mask -
trunk/magic/censorObjects/src/censorLoop.c
r24692 r24695 63 63 if (!readout->data_exists) { continue; } 64 64 65 if (!censorReadout (readout, recipe)) ESCAPE;65 if (!censorReadout (readout, config, view)) ESCAPE; 66 66 67 67 if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) ESCAPE; -
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.
