Changeset 12587 for trunk/psphot/src/psphotImageLoop.c
- Timestamp:
- Mar 24, 2007, 8:01:21 AM (19 years ago)
- File:
-
- 1 edited
-
trunk/psphot/src/psphotImageLoop.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psphot/src/psphotImageLoop.c
r11310 r12587 1 1 # include "psphot.h" 2 2 3 // XXX the errors in the pmFPAfileIOChecks could also be due to a programming or config error4 // XXX we need to either handle those errors or handle the error in pmFPAfileIOChecks and exit5 3 bool psphotImageLoop (pmConfig *config) { 6 4 … … 10 8 pmReadout *readout; 11 9 10 pmFPAfile *load = psMetadataLookupPtr (&status, config->files, "PSPHOT.LOAD"); 11 if (!status) { 12 psError(PSPHOT_ERR_PROG, false, "Can't find input data!"); 13 return false; 14 } 12 15 pmFPAfile *input = psMetadataLookupPtr (&status, config->files, "PSPHOT.INPUT"); 13 16 if (!status) { … … 25 28 } 26 29 27 while ((chip = pmFPAviewNextChip (view, input->fpa, 1)) != NULL) { 30 // for psphot, we force data to be read at the chip level 31 while ((chip = pmFPAviewNextChip (view, load->fpa, 1)) != NULL) { 28 32 psLogMsg ("psphot", 4, "Chip %d: %x %x\n", view->chip, chip->file_exists, chip->process); 29 33 if (! chip->process || ! chip->file_exists) { continue; } 34 35 // load just the input image data (image, mask, weight) 36 pmFPAfileActivate (config->files, false, NULL); 37 pmFPAfileActivate (config->files, true, "PSPHOT.LOAD"); 38 pmFPAfileActivate (config->files, true, "PSPHOT.MASK"); 39 pmFPAfileActivate (config->files, true, "PSPHOT.WEIGHT"); 30 40 if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) { 31 41 psError(PSPHOT_ERR_DATA, false, "failed IO for chip %d in psphot\n", view->chip); … … 33 43 return false; 34 44 } 45 pmFPAfileActivate (config->files, true, NULL); 35 46 47 // mosaic the cells of a chip into a single contiguous chip. 48 // this probably needs to return a new fpa? 49 if (!psphotMosaicChip(config, view, "PSPHOT.INPUT", "PSPHOT.LOAD")) { 50 psError(PS_ERR_UNKNOWN, false, "Unable to mosaic chip.\n"); 51 return false; 52 } 53 54 // try to load the data 55 if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) { 56 psError(PSPHOT_ERR_DATA, false, "failed IO for chip %d in psphot\n", view->chip); 57 psFree (view); 58 return false; 59 } 60 61 // there is now only a single chip (multiple readouts?). loop over it and process 62 // XXX activate / de-activate files? no I/O here? 36 63 while ((cell = pmFPAviewNextCell (view, input->fpa, 1)) != NULL) { 37 64 psLogMsg ("psphot", 4, "Cell %d: %x %x\n", view->cell, cell->file_exists, cell->process); 38 if (! cell->process || ! cell->file_exists) { continue; } 39 if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) { 40 psError(PSPHOT_ERR_DATA, false, "failed IO for chip %d, cell %d in psphot\n", view->chip, view->cell); 41 psFree (view); 42 return false; 43 } 65 // if (! cell->process || ! cell->file_exists) { continue; } 66 if (! cell->process) { continue; } 44 67 45 68 // process each of the readouts 46 69 while ((readout = pmFPAviewNextReadout (view, input->fpa, 1)) != NULL) { 47 if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) { 48 psError(PSPHOT_ERR_DATA, false, "failed IO for chip %d, cell %d, readout %d in psphot\n", view->chip, view->cell, view->readout); 49 psFree (view); 50 return false; 51 } 52 70 psLogMsg ("psphot", 4, "Cell %d: %x %x\n", view->cell, cell->file_exists, cell->process); 53 71 if (! readout->data_exists) { continue; } 54 72 55 73 // run the actual photometry analysis 74 // XXX calling psphotReadout here will operate on the mosaic'ed chips (for each readout) 56 75 if (!psphotReadout (config, view)) { 57 76 psError(psErrorCodeLast(), false, "failure in psphotReadout for chip %d, cell %d, readout %d\n", view->chip, view->cell, view->readout); … … 59 78 return false; 60 79 } 61 62 if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) {63 psError(PSPHOT_ERR_DATA, false, "failed IO for chip %d, cell %d, readout %d in psphot\n", view->chip, view->cell, view->readout);64 psFree (view);65 return false;66 }67 }68 if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) {69 psError(PSPHOT_ERR_DATA, false, "failed IO for chip %d, cell %d in psphot\n", view->chip, view->cell);70 psFree (view);71 return false;72 80 } 73 81 } 82 83 // save output which is saved at the chip level 74 84 if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) { 75 85 psError(PSPHOT_ERR_DATA, false, "failed IO for chip %d in psphot\n", view->chip); … … 78 88 } 79 89 } 90 // save output which is saved at the fpa level 80 91 if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) { 81 92 psError(PSPHOT_ERR_DATA, false, "failed IO for fpa in psphot\n"); … … 101 112 // PSPHOT.PSF : sample PSF images 102 113 114 // PSPHOT.MASK 115 // PSPHOT.WEIGHT 116 //
Note:
See TracChangeset
for help on using the changeset viewer.
