Changeset 21458 for trunk/psphot/src/psphotImageLoop.c
- Timestamp:
- Feb 12, 2009, 10:05:21 AM (17 years ago)
- File:
-
- 1 edited
-
trunk/psphot/src/psphotImageLoop.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psphot/src/psphotImageLoop.c
r20769 r21458 16 16 pmFPAfile *load = psMetadataLookupPtr (&status, config->files, "PSPHOT.LOAD"); 17 17 if (!status) { 18 psError(PSPHOT_ERR_PROG, false, "Can't find input data!");19 return false;18 psError(PSPHOT_ERR_PROG, false, "Can't find input data!"); 19 return false; 20 20 } 21 21 pmFPAfile *input = psMetadataLookupPtr (&status, config->files, "PSPHOT.INPUT"); 22 22 if (!status) { 23 psError(PSPHOT_ERR_PROG, false, "Can't find input data!");24 return false;23 psError(PSPHOT_ERR_PROG, false, "Can't find input data!"); 24 return false; 25 25 } 26 26 27 27 pmFPAview *view = pmFPAviewAlloc (0); 28 28 29 29 // files associated with the science image 30 30 if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) ESCAPE ("failed input for fpa in psphot."); 31 31 32 // for psphot, we force data to be read at the chip level 32 // for psphot, we force data to be read at the chip level 33 33 while ((chip = pmFPAviewNextChip (view, load->fpa, 1)) != NULL) { 34 34 psLogMsg ("psphot", 4, "Chip %d: %x %x\n", view->chip, chip->file_exists, chip->process); 35 35 if (! chip->process || ! chip->file_exists) { continue; } 36 36 37 // load just the input image data (image, mask, weight)38 pmFPAfileActivate (config->files, false, NULL);39 pmFPAfileActivate (config->files, true, "PSPHOT.LOAD");40 pmFPAfileActivate (config->files, true, "PSPHOT.MASK");41 pmFPAfileActivate (config->files, true, "PSPHOT.WEIGHT");42 if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) ESCAPE ("failed input for Chip in psphot.");37 // load just the input image data (image, mask, weight) 38 pmFPAfileActivate (config->files, false, NULL); 39 pmFPAfileActivate (config->files, true, "PSPHOT.LOAD"); 40 pmFPAfileActivate (config->files, true, "PSPHOT.MASK"); 41 pmFPAfileActivate (config->files, true, "PSPHOT.VARIANCE"); 42 if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) ESCAPE ("failed input for Chip in psphot."); 43 43 44 // mosaic the cells of a chip into a single contiguous (trimmed) chip44 // mosaic the cells of a chip into a single contiguous (trimmed) chip 45 45 if (!psphotMosaicChip(config, view, "PSPHOT.INPUT", "PSPHOT.LOAD")) ESCAPE ("Unable to mosaic chip."); 46 46 47 // try to load other supporting data (PSF, SRC, etc).48 // do not re-load the following three files49 pmFPAfileActivate (config->files, true, NULL);50 pmFPAfileActivate (config->files, false, "PSPHOT.LOAD");51 pmFPAfileActivate (config->files, false, "PSPHOT.MASK");52 pmFPAfileActivate (config->files, false, "PSPHOT.WEIGHT");53 if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) ESCAPE ("failed input for Chip in psphot.");47 // try to load other supporting data (PSF, SRC, etc). 48 // do not re-load the following three files 49 pmFPAfileActivate (config->files, true, NULL); 50 pmFPAfileActivate (config->files, false, "PSPHOT.LOAD"); 51 pmFPAfileActivate (config->files, false, "PSPHOT.MASK"); 52 pmFPAfileActivate (config->files, false, "PSPHOT.VARIANCE"); 53 if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) ESCAPE ("failed input for Chip in psphot."); 54 54 55 // re-activate files so they will be closed and freed below56 pmFPAfileActivate (config->files, true, NULL);55 // re-activate files so they will be closed and freed below 56 pmFPAfileActivate (config->files, true, NULL); 57 57 58 // there is now only a single chip (multiple readouts?). loop over it and process59 while ((cell = pmFPAviewNextCell (view, input->fpa, 1)) != NULL) {58 // there is now only a single chip (multiple readouts?). loop over it and process 59 while ((cell = pmFPAviewNextCell (view, input->fpa, 1)) != NULL) { 60 60 psLogMsg ("psphot", 5, "Cell %d: %x %x\n", view->cell, cell->file_exists, cell->process); 61 61 62 // process each of the readouts63 while ((readout = pmFPAviewNextReadout (view, input->fpa, 1)) != NULL) {64 psLogMsg ("psphot", 6, "Cell %d: %x %x\n", view->cell, cell->file_exists, cell->process);65 if (! readout->data_exists) { continue; }62 // process each of the readouts 63 while ((readout = pmFPAviewNextReadout (view, input->fpa, 1)) != NULL) { 64 psLogMsg ("psphot", 6, "Cell %d: %x %x\n", view->cell, cell->file_exists, cell->process); 65 if (! readout->data_exists) { continue; } 66 66 67 // run the actual photometry analysis on this chip/cell/readout68 if (!psphotReadout (config, view)) {69 psError(psErrorCodeLast(), false, "failure in psphotReadout for chip %d, cell %d, readout %d\n", view->chip, view->cell, view->readout);70 psFree (view);71 return false;72 }73 }67 // run the actual photometry analysis on this chip/cell/readout 68 if (!psphotReadout (config, view)) { 69 psError(psErrorCodeLast(), false, "failure in psphotReadout for chip %d, cell %d, readout %d\n", view->chip, view->cell, view->readout); 70 psFree (view); 71 return false; 72 } 73 } 74 74 75 status = true;76 status &= pmFPAfileDropInternal (config->files, "PSPHOT.BACKMDL");77 status &= pmFPAfileDropInternal (config->files, "PSPHOT.BACKMDL.STDEV");78 status &= pmFPAfileDropInternal (config->files, "PSPHOT.BACKGND");79 if (!status) {80 psError(PSPHOT_ERR_PROG, false, "trouble dropping internal files");81 psFree (view);82 return false;83 }84 }75 status = true; 76 status &= pmFPAfileDropInternal (config->files, "PSPHOT.BACKMDL"); 77 status &= pmFPAfileDropInternal (config->files, "PSPHOT.BACKMDL.STDEV"); 78 status &= pmFPAfileDropInternal (config->files, "PSPHOT.BACKGND"); 79 if (!status) { 80 psError(PSPHOT_ERR_PROG, false, "trouble dropping internal files"); 81 psFree (view); 82 return false; 83 } 84 } 85 85 86 // save output which is saved at the chip level87 if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) ESCAPE ("failed output for Chip in psphot.");86 // save output which is saved at the chip level 87 if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) ESCAPE ("failed output for Chip in psphot."); 88 88 } 89 89 // save output which is saved at the fpa level … … 108 108 109 109 // PSPHOT.MASK 110 // PSPHOT. WEIGHT111 // 110 // PSPHOT.VARIANCE 111 //
Note:
See TracChangeset
for help on using the changeset viewer.
