Changeset 20180 for trunk/dvoTools/src/dvoMakeCorrLoop.c
- Timestamp:
- Oct 15, 2008, 5:51:49 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/dvoTools/src/dvoMakeCorrLoop.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/dvoTools/src/dvoMakeCorrLoop.c
r11804 r20180 5 5 #include "dvoMakeCorr.h" 6 6 7 // XXX currently, the input image (the grid map generated by relphot) does not supply enough 8 // header information so the camera and format can be identified. 9 7 10 bool dvoMakeCorrLoop (pmConfig *config, dvoMakeCorrOptions *options) { 8 11 … … 10 13 pmChip *chip; 11 14 pmCell *cell; 12 p mReadout *readout;15 psRegion fullImage = {0, 0, 0, 0}; 13 16 14 17 // psMetadata *recipe = psMetadataLookupMetadata(&status, config->recipes, RECIPE_NAME); 18 19 // use the reference image to identify the desired extension from DVOCORR.INPUT 20 pmFPAfile *refhead = psMetadataLookupPtr(&status, config->files, "DVOCORR.REFHEAD"); 21 if (!status) { 22 psErrorStackPrint(stderr, "Can't find reference image\n"); 23 exit(EXIT_FAILURE); 24 } 15 25 16 26 pmFPAfile *input = psMetadataLookupPtr(&status, config->files, "DVOCORR.INPUT"); … … 29 39 } 30 40 41 // XXX for now, do not use the I/O system to read this file; do it manually 42 if (!pmFPAfileOpen (input, view, config)) { 43 psError(PS_ERR_UNKNOWN, false, "failed to open grid file\n"); 44 psFree (view); 45 return false; 46 } 47 input->state = PM_FPA_STATE_INACTIVE; 48 31 49 // process each chip in the FPA 32 while ((chip = pmFPAviewNextChip(view, input->fpa, 1)) != NULL) {50 while ((chip = pmFPAviewNextChip(view, refhead->fpa, 1)) != NULL) { 33 51 psLogMsg ("dvoMakeCorrLoop", 4, "Chip %d: %x %x\n", view->chip, chip->file_exists, chip->process); 34 52 if (!chip->process || !chip->file_exists) continue; … … 39 57 } 40 58 59 // load the input data for this extension 60 pmChip *inChip = pmFPAviewThisChip (view, input->fpa); 61 char *inName = psMetadataLookupStr (&status, inChip->concepts, "CHIP.NAME"); 62 psFitsMoveExtName (input->fits, inName); 63 psImage *inImage = psFitsReadImage (input->fits, fullImage, 0); 64 assert (inImage); 65 41 66 // process each cell in the Chip 42 while ((cell = pmFPAviewNextCell(view, input->fpa, 1)) != NULL) {67 while ((cell = pmFPAviewNextCell(view, refhead->fpa, 1)) != NULL) { 43 68 psLogMsg ("dvoMakeCorrLoop", 4, "Cell %d: %x %x\n", view->cell, cell->file_exists, cell->process); 44 69 if (!cell->process || !cell->file_exists) continue; … … 49 74 } 50 75 51 // process each of the readouts 52 while ((readout = pmFPAviewNextReadout (view, input->fpa, 1)) != NULL) { 53 if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) { 54 psError(PS_ERR_UNKNOWN, false, "failed IO for chip %d, cell %d, readout %d in dvoMakeCorr\n", view->chip, view->cell, view->readout); 55 psFree (view); 56 return false; 57 } 58 if (!readout->data_exists) continue; 76 // XXX put the function here which unbins the input image 77 dvoMakeCorrUnbin (config, view, "DVOCORR.OUTPUT", inImage, inChip, "DVOCORR.REFHEAD"); 59 78 60 // XXX put the function here which unbins the input image61 dvoMakeCorrUnbin (config, view, "DVOCORR.OUTPUT", "DVOCORR.INPUT", "DVOCORR.REFHEAD");62 63 if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) {64 psError(PS_ERR_UNKNOWN, false, "failed IO for chip %d, cell %d, readout %d in dvoMakeCorr\n", view->chip, view->cell, view->readout);65 psFree (view);66 return false;67 }68 }69 79 if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) { 70 80 psError(PS_ERR_UNKNOWN, false, "failed IO for chip %d, cell %d in dvoMakeCorr\n", view->chip, view->cell); … … 73 83 } 74 84 } 85 psFree (inImage); 86 75 87 if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) { 76 88 psError(PS_ERR_UNKNOWN, false, "failed IO for chip %d in dvoMakeCorr\n", view->chip); … … 85 97 } 86 98 99 pmFPAfileClose (input, view); 87 100 psFree (view); 88 101
Note:
See TracChangeset
for help on using the changeset viewer.
