Changeset 6792 for trunk/psastro/src/psastroDataLoop.c
- Timestamp:
- Apr 5, 2006, 1:11:17 AM (20 years ago)
- File:
-
- 1 edited
-
trunk/psastro/src/psastroDataLoop.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psastro/src/psastroDataLoop.c
r6791 r6792 1 1 # include "psastro.h" 2 2 3 bool psastroDataLoop (ppFile *file, ppConfig *config) { 3 // load the data from the files in this loop. 4 // we write out the result in a second loop 5 // at the end of this function, the complete stellar data is loaded 6 // into the correct fpa structure locations (readout.analysis:PSPHOT.SOURCES) 7 bool psastroDataLoop (pmConfig *config) { 4 8 5 bool status; 6 ppImageLoadDepth imageLoadDepth; 7 8 // determine the load depth 9 const char *depth = psMetadataLookupStr(&status, config->recipe, "LOAD.DEPTH"); 10 if (! status || ! depth || strlen(depth) == 0) { 11 psLogMsg("psastro", PS_LOG_ERROR, "LOAD.DEPTH not specified in recipe."); 12 exit(EXIT_FAILURE); 13 } 14 imageLoadDepth = PP_LOAD_NONE; 15 if (!strcasecmp(depth, "FPA")) imageLoadDepth = PP_LOAD_FPA; 16 if (!strcasecmp(depth, "CHIP")) imageLoadDepth = PP_LOAD_CHIP; 17 if (!strcasecmp(depth, "CELL")) imageLoadDepth = PP_LOAD_CELL; 18 if (imageLoadDepth == PP_LOAD_NONE) { 19 psLogMsg(__func__, PS_LOG_ERROR, "LOAD.DEPTH in recipe is not FPA, CHIP or CELL."); 20 exit(EXIT_FAILURE); 9 pmFPAfile *input = psMetadataLookupPtr (&status, config->files, "PSASTRO.INPUT"); 10 if (!status) { 11 psErrorStackPrint(stderr, "Can't find input data!\n"); 12 exit(EXIT_FAILURE); 21 13 } 22 14 23 if (imageLoadDepth == PP_LOAD_FPA) { 24 psTrace(__func__, 1, "data pixels for FPA...\n"); 25 psastroLoadSMF(file, config->database, -1, -1); 15 pmFPAview *view = pmFPAviewAlloc (0); 16 17 // files associated with the science image 18 pmFPAfileIOChecks (config->files, view, PM_FPA_BEFORE); 19 20 while ((chip = pmFPAviewNextChip (view, input->fpa, 1)) != NULL) { 21 psLogMsg ("psphot", 4, "Chip %d: %x %x\n", view->chip, chip->file_exists, chip->process); 22 if (!chip->process || !chip->file_exists) { continue; } 23 pmFPAfileIOChecks (config->files, view, PM_FPA_BEFORE); 24 25 while ((cell = pmFPAviewNextCell (view, input->fpa, 1)) != NULL) { 26 psLogMsg ("psphot", 4, "Cell %d: %x %x\n", view->cell, cell->file_exists, cell->process); 27 if (!cell->process || !cell->file_exists) { continue; } 28 pmFPAfileIOChecks (config->files, view, PM_FPA_BEFORE); 29 30 // process each of the readouts 31 while ((readout = pmFPAviewNextReadout (view, input->fpa, 1)) != NULL) { 32 pmFPAfileIOChecks (config->files, view, PM_FPA_BEFORE); 33 if (! readout->data_exists) { continue; } 34 35 pmFPAfileIOChecks (config->files, view, PM_FPA_AFTER); 36 } 37 pmFPAfileIOChecks (config->files, view, PM_FPA_AFTER); 38 } 39 pmFPAfileIOChecks (config->files, view, PM_FPA_AFTER); 26 40 } 27 28 for (int i = 0; i < file->fpa->chips->n; i++) { 29 pmChip *chip = file->fpa->chips->data[i]; // Chip of interest in input image 30 31 psLogMsg ("psastro", 4, "Chip %d: %x %x\n", i, chip->exists, chip->process); 32 if (! chip->process) { continue; } 33 34 if (imageLoadDepth == PP_LOAD_CHIP) { 35 psTrace(__func__, 1, "Loading pixels for chip %d...\n", i); 36 psastroLoadSMF(file, config->database, i, -1); 37 } 38 39 for (int j = 0; j < chip->cells->n; j++) { 40 pmCell *cell = chip->cells->data[j]; // Cell of interest in input image 41 42 psLogMsg ("psastro", 4, "Cell %d: %x %x\n", j, cell->exists, cell->process); 43 if (! cell->process) { continue; } 44 45 if (imageLoadDepth == PP_LOAD_CELL) { 46 psTrace(__func__, 1, "Loading pixels for chip %d, cell %d...\n", i, j); 47 psastroLoadSMF(file, config->database, i, j); 48 } 49 50 // process each of the readouts 51 for (int k = 0; k < cell->readouts->n; k++) { 52 pmReadout *readout = cell->readouts->data[k]; // Readout of interest in input image 53 54 // run a single-model test if desired 55 psphotModelTest (readout, config->arguments, config->recipe); 56 psphotReadout (readout, config->recipe); 57 psphotOutput (readout, config->arguments); 58 } 59 } 60 } 41 pmFPAfileIOChecks (config->files, view, PM_FPA_AFTER); 61 42 return true; 62 43 } 63 64 /* this is currently written only for single-chip analysis */
Note:
See TracChangeset
for help on using the changeset viewer.
