Changeset 7014 for trunk/psastro/src/psastroDataSave.c
- Timestamp:
- Apr 30, 2006, 12:15:03 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/psastro/src/psastroDataSave.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psastro/src/psastroDataSave.c
r6792 r7014 1 1 # include "psastro.h" 2 // XXX leak free 2006.04.27 2 3 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) 4 // this loop saves the photometry/astrometry data files 7 5 bool psastroDataSave (pmConfig *config) { 8 6 9 // define the output files: 10 pmFPAfile *input = psMetadataLookupPtr (&status, config->files, "PSASTRO.INPUT"); 11 if (!status) { 12 psErrorStackPrint(stderr, "Can't find input data!\n"); 7 pmChip *chip; 8 pmCell *cell; 9 pmReadout *readout; 10 11 // select the current recipe 12 psMetadata *recipe = psMetadataLookupPtr (NULL, config->recipes, "PSASTRO"); 13 if (!recipe) { 14 psErrorStackPrint(stderr, "Can't find PSASTRO recipe!\n"); 13 15 exit(EXIT_FAILURE); 14 16 } 15 17 16 // this is the output target 17 pmFPAfileDefine (config->files, format, input, "PSASTRO.OUTPUT"); 18 // select the output data sources 19 pmFPAfile *output = psMetadataLookupPtr (NULL, config->files, "PSASTRO.OUTPUT"); 20 if (!output) { 21 psErrorStackPrint(stderr, "Can't find output data!\n"); 22 exit(EXIT_FAILURE); 23 } 18 24 19 char *output = psMetadataLookupPtr(&status, config->arguments, "OUTPUT"); 20 pmFPAfileAddOutputName (config->files, "OUTPUT", output, PM_FPA_MODE_WRITE); 25 // de-activate all files except PSASTRO.OUTPUT 26 pmFPAfileActivate (config->files, false, NULL); 27 pmFPAfileActivate (config->files, true, "PSASTRO.OUTPUT"); 21 28 22 29 pmFPAview *view = pmFPAviewAlloc (0); 23 30 24 // files associated with the science image31 // open/load files as needed 25 32 pmFPAfileIOChecks (config->files, view, PM_FPA_BEFORE); 26 33 27 while ((chip = pmFPAviewNextChip (view, input->fpa, 1)) != NULL) {28 ps LogMsg ("psphot", 4, "Chip %d: %x %x\n", view->chip, chip->file_exists, chip->process);34 while ((chip = pmFPAviewNextChip (view, output->fpa, 1)) != NULL) { 35 psTrace (__func__, 4, "Chip %d: %x %x\n", view->chip, chip->file_exists, chip->process); 29 36 if (!chip->process || !chip->file_exists) { continue; } 30 37 pmFPAfileIOChecks (config->files, view, PM_FPA_BEFORE); 31 38 32 while ((cell = pmFPAviewNextCell (view, input->fpa, 1)) != NULL) {33 ps LogMsg ("psphot", 4, "Cell %d: %x %x\n", view->cell, cell->file_exists, cell->process);39 while ((cell = pmFPAviewNextCell (view, output->fpa, 1)) != NULL) { 40 psTrace (__func__, 4, "Cell %d: %x %x\n", view->cell, cell->file_exists, cell->process); 34 41 if (!cell->process || !cell->file_exists) { continue; } 35 42 pmFPAfileIOChecks (config->files, view, PM_FPA_BEFORE); 36 43 37 44 // process each of the readouts 38 while ((readout = pmFPAviewNextReadout (view, input->fpa, 1)) != NULL) {45 while ((readout = pmFPAviewNextReadout (view, output->fpa, 1)) != NULL) { 39 46 pmFPAfileIOChecks (config->files, view, PM_FPA_BEFORE); 40 47 if (! readout->data_exists) { continue; } … … 47 54 } 48 55 pmFPAfileIOChecks (config->files, view, PM_FPA_AFTER); 56 57 psFree (view); 49 58 return true; 50 59 }
Note:
See TracChangeset
for help on using the changeset viewer.
