- Timestamp:
- Apr 28, 2022, 4:13:55 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20220316/fpcamera/src/fpcameraAnalysis.c
r42178 r42183 1 1 # include "fpcamera.h" 2 2 3 # define ESCAPE(ERROR, MSG) { psErrorStackPrint(stderr, MSG); return false; }3 # define ESCAPE(ERROR, MSG) { psErrorStackPrint(stderr, MSG); psFree (view); return false; } 4 4 5 5 /* \brief this function loops over chips and performs forced photometry for the references */ … … 7 7 8 8 bool status; 9 pmChip *chip; 10 pmCell *cell; 11 pmReadout *readout; 12 pmFPAview *view = NULL; 9 13 10 14 // measure the total elapsed time in fpcameraAnalysis. … … 15 19 if (!recipe) ESCAPE (FPCAMERA_ERR_CONFIG, "Can't find FPCAMERA recipe"); 16 20 17 psLogMsg("fpcamera", 3, "TIMEMARK: fpcameraMosaicAstrom: %f sec\n", psTimerMark ("complete")); 21 // loop over the input images 22 pmFPAfile *input = psMetadataLookupPtr (NULL, config->files, "FPCAMERA.INPUT"); 23 if (!input) ESCAPE(FPCAMERA_ERR_CONFIG, "Can't find or interpret output file rule FPCAMERA.INPUT!"); 24 25 // astrometry reference (smf) 26 pmFPAfile *astrom = psMetadataLookupPtr (NULL, config->files, "FPCAMERA.INPUT.ASTROM"); 27 if (!astrom) ESCAPE(FPCAMERA_ERR_CONFIG, "Can't find or interpret output file rule FPCAMERA.INPUT.ASTROM!"); 28 29 // only activate input image-type files 30 pmFPAfileActivate (config->files, false, NULL); 31 pmFPAfileActivate (config->files, true, "FPCAMERA.INPUT"); 32 pmFPAfileActivate (config->files, true, "FPCAMERA.INPUT.MASK"); 33 pmFPAfileActivate (config->files, true, "FPCAMERA.INPUT.VARIANCE"); 34 pmFPAfileActivate (config->files, true, "FPCAMERA.RESID"); 35 // Note FPCAMERA.RESID is tied to FPCAMERA.INPUT so they must be active in the same block. 36 37 view = pmFPAviewAlloc (0); 38 39 // load images at FPA level (if appropriate) 40 if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) ESCAPE(FPCAMERA_ERR_DATA, "failed to load images at FPA level"); 41 42 // load images at chip level (if appropriate) 43 while ((chip = pmFPAviewNextChip (view, input->fpa, 1)) != NULL) { 44 psTrace ("fpcamera", 4, "Chip %d: %x %x\n", view->chip, chip->file_exists, chip->process); 45 if (!chip->process || !chip->file_exists) { continue; } 46 if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) ESCAPE(FPCAMERA_ERR_DATA, "failed to load images at Chip level"); 47 48 // loop over all cells in chip 49 while ((cell = pmFPAviewNextCell (view, input->fpa, 1)) != NULL) { 50 psLogMsg ("fpcamera", 5, "Cell %d: %x %x\n", view->cell, cell->file_exists, cell->process); 51 if (!cell->process || !cell->file_exists) { continue; } 52 53 // loop over all readouts in cell 54 while ((readout = pmFPAviewNextReadout (view, input->fpa, 1)) != NULL) { 55 psLogMsg ("fpcamera", 6, "Cell %d: %x %x\n", view->cell, cell->file_exists, cell->process); 56 if (!readout->data_exists) { continue; } 57 58 fpcameraChooseRefstars (input, astrom, view); 59 } 60 } 61 if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) ESCAPE(FPCAMERA_ERR_IO, "failure in IOChecks(AFTER) at Chip"); 62 } 63 if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) ESCAPE(FPCAMERA_ERR_IO, "failure in IOChecks(AFTER) at FPA"); 64 65 psFree (view); 66 67 psLogMsg("fpcamera", 3, "TIMEMARK: fpcameraAnalysis: %f sec\n", psTimerMark ("analysis")); 18 68 return true; 19 69 } 70 71 // NOTES 72 // chip->process is set (unset) based on command-line -chip selections (in fpcameraArguments) 73 // chip->file_exists is set (in pmFPAFlags.c:pmChipSetFileStatus) by pmFPAfileDefineFromArgs (in pmFPAAddSource...)
Note:
See TracChangeset
for help on using the changeset viewer.
