Changeset 6715 for trunk/psphot/src/psphotImageLoop.c
- Timestamp:
- Mar 27, 2006, 4:31:17 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/psphot/src/psphotImageLoop.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psphot/src/psphotImageLoop.c
r6522 r6715 1 1 # include "psphot.h" 2 2 3 bool psphotImageLoop (psphotData *data, ppConfig *config) { 3 // XXX where do we load optional mask and weight input images? 4 4 5 pmFPA *fpa = data->input->fpa; 5 bool psphotImageLoop (pmConfig *config) { 6 6 7 psphotDataIO (data, config, -1, -1); 7 bool status; 8 pmChip *chip; 9 pmCell *cell; 10 pmReadout *readout; 8 11 9 for (int i = 0; i < fpa->chips->n; i++) { 10 pmChip *chip = fpa->chips->data[i]; // Chip of interest in input image 12 pmFPAfile *input = psMetadataLookupPtr (&status, config->files, "PSPHOT.INPUT"); 13 if (!status) { 14 psErrorStackPrint(stderr, "Can't find input data!\n"); 15 exit(EXIT_FAILURE); 16 } 11 17 12 psLogMsg ("psphot", 4, "Chip %d: %x %x\n", i, chip->exists, chip->process); 18 pmFPAview *view = pmFPAviewAlloc (0); 19 20 // files associated with the science image 21 pmFPAfileIOChecks (config->files, view, PM_FPA_BEFORE); 22 23 while ((chip = pmFPAviewNextChip (view, input->fpa, 1)) != NULL) { 24 psLogMsg ("psphot", 4, "Chip %d: %x %x\n", view->chip, chip->file_exists, chip->process); 13 25 if (! chip->process) { continue; } 26 if (! chip->file_exists) { continue; } 27 pmFPAfileIOChecks (config->files, view, PM_FPA_BEFORE); 14 28 15 psphotDataIO (data, config, i, -1); 16 17 for (int j = 0; j < chip->cells->n; j++) { 18 pmCell *cell = chip->cells->data[j]; // Cell of interest in input image 19 20 psLogMsg ("psphot", 4, "Cell %d: %x %x\n", j, cell->exists, cell->process); 29 while ((cell = pmFPAviewNextCell (view, input->fpa, 1)) != NULL) { 30 continue; 31 psLogMsg ("psphot", 4, "Cell %d: %x %x\n", view->cell, cell->file_exists, cell->process); 21 32 if (! cell->process) { continue; } 22 23 psphotDataIO (data, config, i, j); 24 25 // XXX optional mask and weight input image should be loaded here? 26 // this sets the weight map and basic mask applying CELL.BAD and CELL.SATURATION 27 pmCellSetWeights(cell); 28 29 // I have a valid mask, now mask in the analysis region of interest 30 pmCellSetMask (cell, config->recipe); 33 if (! cell->file_exists) { continue; } 34 pmFPAfileIOChecks (config->files, view, PM_FPA_BEFORE); 31 35 32 36 // process each of the readouts 33 for (int k = 0; k < cell->readouts->n; k++) { 34 pmReadout *readout = cell->readouts->data[k]; // Readout of interest in input image 37 while ((readout = pmFPAviewNextReadout (view, input->fpa, 1)) != NULL) { 38 pmFPAfileIOChecks (config->files, view, PM_FPA_BEFORE); 39 if (! readout->data_exists) { continue; } 35 40 36 41 // run a single-model test if desired 37 psphotModelTest (readout, config->arguments, config->recipe); 42 // XXX move this to psphotReadout?? 43 // psphotModelTest (readout, recipe); 38 44 39 45 // run the actual photometry analysis 40 psphotReadout ( readout, data, config);46 psphotReadout (config, view); 41 47 42 // XXX what do we do if we have multiple readouts? 43 psphotOutput (readout, data, config); 48 pmFPAfileIOChecks (config->files, view, PM_FPA_AFTER); 49 50 // write out the desired output dataset(s) 51 // psphotOutput (view, recipe); 44 52 } 45 } 53 pmFPAfileIOChecks (config->files, view, PM_FPA_AFTER); 54 } 55 pmFPAfileIOChecks (config->files, view, PM_FPA_AFTER); 46 56 } 47 psphotOutputClose (data); 57 pmFPAfileIOChecks (config->files, view, PM_FPA_AFTER); 58 59 psFree (view); 48 60 return true; 49 61 } 62 63 // I/O files related to psphot: 64 // PSPHOT.INPUT : input image file(s) 65 // PSPHOT.RESID : residual image 66 // PSPHOT.OUTPUT : output object tables (object) 67 68 // PSPHOT.BACKSUB : background subtracted image 69 // PSPHOT.BACKGND : background model (full-scale image?) 70 // PSPHOT.BACKMDL : background model (binned image?) 71 // PSPHOT.PSF : sample PSF images 72 73 74 /** 75 76 filename | pmFPAfile | pmFPA | pmFPAview 77 chip00.f | PSPHOT.IN | input | view 78 chip01.f | PSPHOT.IN | input | view 79 chip02.f | PSPHOT.IN | input | view 80 chip03.f | PSPHOT.IN | input | view 81 82 out00.f | PSPHOT.OUT | input | view 83 out01.f | PSPHOT.OUT | input | view 84 out02.f | PSPHOT.OUT | input | view 85 out03.f | PSPHOT.OUT | input | view 86 87 obj00.f | PSPHOT.OBJ | input | view 88 obj01.f | PSPHOT.OBJ | input | view 89 obj02.f | PSPHOT.OBJ | input | view 90 obj03.f | PSPHOT.OBJ | input | view 91 92 bin00.f | PSPHOT.BIN | binned | view 93 bin01.f | PSPHOT.BIN | binned | view 94 bin02.f | PSPHOT.BIN | binned | view 95 bin03.f | PSPHOT.BIN | binned | view 96 97 mosaic.f | PSPHOT.MOS | mosaic | view 98 99 **/
Note:
See TracChangeset
for help on using the changeset viewer.
