Changeset 24714 for trunk/magic/censorObjects/src
- Timestamp:
- Jul 7, 2009, 7:10:01 PM (17 years ago)
- Location:
- trunk/magic/censorObjects/src
- Files:
-
- 3 edited
-
censor.h (modified) (1 diff)
-
censorLoop.c (modified) (3 diffs)
-
censorReadout.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/magic/censorObjects/src/censor.h
r24695 r24714 31 31 bool censorParseCamera (pmConfig *config); 32 32 bool censorLoop (pmConfig *config); 33 bool censorReadout (pmReadout *readout, pmConfig *config, const pmFPAview *view );33 bool censorReadout (pmReadout *readout, pmConfig *config, const pmFPAview *view, bool badMaskFile); 34 34 void censorCleanup (pmConfig *config); 35 bool censorBadFileByView (bool badFile, pmFPAfile *file, pmConfig *config, pmFPAview *view); 35 36 36 37 // Return version strings. -
trunk/magic/censorObjects/src/censorLoop.c
r24695 r24714 43 43 } 44 44 45 // select the input data sources 46 pmFPAfile *inMask = psMetadataLookupPtr (NULL, config->files, "CENSOR.INPUT.MASK"); 47 if (!inMask) { 48 psError(CENSOR_ERR_CONFIG, true, "Can't find input masks!\n"); 49 return false; 50 } 51 45 52 pmFPAview *view = pmFPAviewAlloc (0); 53 bool badMaskFile = false; 54 55 // check on the mask file at this level if possible 56 badMaskFile = censorBadFileByView(badMaskFile, inMask, config, view); 46 57 47 58 // files associated with the science image … … 49 60 50 61 while ((chip = pmFPAviewNextChip (view, input->fpa, 1)) != NULL) { 51 psTrace ("censor", 4, "Chip %d: %x %x\n", view->chip, chip->file_exists, chip->process); 52 if (!chip->process || !chip->file_exists) { continue; } 62 psTrace ("censor", 4, "Chip %d: %x %x\n", view->chip, chip->file_exists, chip->process); 63 if (!chip->process || !chip->file_exists) { continue; } 64 65 // check on the mask file at this level if possible 66 badMaskFile = censorBadFileByView(badMaskFile, inMask, config, view); 67 53 68 if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) ESCAPE; 54 69 55 70 while ((cell = pmFPAviewNextCell (view, input->fpa, 1)) != NULL) { 56 psTrace ("censor", 4, "Cell %d: %x %x\n", view->cell, cell->file_exists, cell->process); 57 if (!cell->process || !cell->file_exists) { continue; } 71 psTrace ("censor", 4, "Cell %d: %x %x\n", view->cell, cell->file_exists, cell->process); 72 if (!cell->process || !cell->file_exists) { continue; } 73 74 // check on the mask file at this level if possible 75 badMaskFile = censorBadFileByView(badMaskFile, inMask, config, view); 76 58 77 if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) ESCAPE; 59 78 60 79 // process each of the readouts 61 80 while ((readout = pmFPAviewNextReadout (view, input->fpa, 1)) != NULL) { 81 82 // check on the mask file at this level if possible 83 badMaskFile = censorBadFileByView(badMaskFile, inMask, config, view); 84 62 85 if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) ESCAPE; 63 86 if (!readout->data_exists) { continue; } 64 87 65 if (!censorReadout (readout, config, view )) ESCAPE;88 if (!censorReadout (readout, config, view, badMaskFile)) ESCAPE; 66 89 67 90 if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) ESCAPE; … … 78 101 return true; 79 102 } 103 104 bool censorBadFileByView (bool badFile, pmFPAfile *file, pmConfig *config, pmFPAview *view) { 105 106 // get the current level 107 pmFPALevel level = pmFPAviewLevel (view); 108 109 // can we try to open this file? (if not, leave the existing badView intact) 110 if (level != file->fileLevel) return badFile; 111 112 // free, and if needed, realloc badView below 113 badFile = false; 114 115 char *filename = pmFPAfileName(file, view, config); 116 if (filename) { 117 // activate the file 118 pmFPAfileActivate (config->files, true, file->name); 119 psFree (filename); 120 return false; 121 } 122 123 // de-activate the file 124 pmFPAfileActivate (config->files, false, file->name); 125 return true; 126 } -
trunk/magic/censorObjects/src/censorReadout.c
r24695 r24714 13 13 # include "censor.h" 14 14 15 bool censorReadout (pmReadout *readout, pmConfig *config, const pmFPAview *view ) {15 bool censorReadout (pmReadout *readout, pmConfig *config, const pmFPAview *view, bool badMaskFile) { 16 16 17 17 bool status; 18 19 // if there is no mask file for this readout drop all sources 20 if (badMaskFile) { 21 psMetadataRemoveKey (readout->analysis, "PSPHOT.SOURCES"); 22 return true; 23 } 18 24 19 25 // select the current recipe
Note:
See TracChangeset
for help on using the changeset viewer.
