Changeset 15216
- Timestamp:
- Oct 4, 2007, 9:55:03 AM (19 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
-
ppImage/src/ppImageLoop.c (modified) (10 diffs)
-
psastro/src/psastroDataLoad.c (modified) (2 diffs)
-
psastro/src/psastroDataSave.c (modified) (2 diffs)
-
psphot/src/psphotImageLoop.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppImage/src/ppImageLoop.c
r15137 r15216 4 4 5 5 #include "ppImage.h" 6 7 # define ESCAPE(MESSAGE) { \ 8 psError(PS_ERR_UNKNOWN, false, MESSAGE); \ 9 psFree (view); \ 10 return false; \ 11 } 6 12 7 13 bool ppImageLoop (pmConfig *config, ppImageOptions *options) { … … 23 29 24 30 // files associated with the science image 25 if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) { 26 psFree (view); 27 return false; 28 } 31 if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) ESCAPE ("load failure for FPA"); 29 32 30 33 while ((chip = pmFPAviewNextChip(view, input->fpa, 1)) != NULL) { … … 33 36 continue; 34 37 } 35 36 if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) { 37 psFree (view); 38 return false; 39 } 38 if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) ESCAPE ("load failure for Chip"); 40 39 41 40 while ((cell = pmFPAviewNextCell(view, input->fpa, 1)) != NULL) { … … 44 43 continue; 45 44 } 46 if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) { 47 psFree (view); 48 return false; 49 } 45 if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) ESCAPE ("load failure for Cell"); 50 46 51 47 // Put version information into the header … … 59 55 // process each of the readouts 60 56 while ((readout = pmFPAviewNextReadout (view, input->fpa, 1)) != NULL) { 61 if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) { 62 psFree (view); 63 return false; 64 } 57 if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) ESCAPE ("load failure for Readout"); 65 58 if (!readout->data_exists) { 66 59 continue; … … 68 61 69 62 // perform the detrend analysis 70 if (!ppImageDetrendReadout(config, options, view)) { 71 psError(PS_ERR_UNKNOWN, false, "Unable to detrend readout.\n"); 72 psFree (view); 73 return false; 74 } 75 63 if (!ppImageDetrendReadout(config, options, view)) 64 ESCAPE ("Unable to detrend readout"); 76 65 } 77 66 } … … 79 68 // Apply the fringe correction 80 69 if (options->doFringe) { 81 if (!ppImageDetrendFringeApply (config, chip, view, options)) { 82 psFree (view); 83 return false; 84 } 70 if (!ppImageDetrendFringeApply (config, chip, view, options)) 71 ESCAPE ("Unable to defringe"); 85 72 } 86 73 87 74 // measure various statistics for this image 88 if (!ppImagePixelStats (config, options, view)) { 89 psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to measures stats for image"); 90 psFree (view); 91 return false; 92 } 75 if (!ppImagePixelStats (config, options, view)) 76 ESCAPE ("Unable to measures stats for image"); 93 77 94 if (!ppImageMosaicChip(config, options, view, "PPIMAGE.CHIP", "PPIMAGE.OUTPUT")) { 95 psError(PS_ERR_UNKNOWN, false, "Unable to mosaic chip.\n"); 96 psFree (view); 97 return false; 98 } 99 if (!ppImageRebinChip(config, view, "PPIMAGE.BIN1")) { 100 psError(PS_ERR_UNKNOWN, false, "Unable to bin chip.\n"); 101 psFree (view); 102 return false; 103 } 104 if (!ppImageRebinChip(config, view, "PPIMAGE.BIN2")) { 105 psError(PS_ERR_UNKNOWN, false, "Unable to bin chip.\n"); 106 psFree (view); 107 return false; 108 } 78 if (!ppImageMosaicChip(config, options, view, "PPIMAGE.CHIP", "PPIMAGE.OUTPUT")) 79 ESCAPE ("Unable to mosaic chip"); 80 81 if (!ppImageRebinChip(config, view, "PPIMAGE.BIN1")) 82 ESCAPE ("Unable to bin chip (level 1)."); 83 84 if (!ppImageRebinChip(config, view, "PPIMAGE.BIN2")) 85 ESCAPE ("Unable to bin chip (level 2)."); 109 86 110 87 // we perform photometry on the readouts of this chip in the output 111 88 if (options->doPhotom) { 112 if (!ppImagePhotom(config, view)) { 113 psError(PS_ERR_UNKNOWN, false, "error running photometry.\n"); 114 psFree (view); 115 return false; 116 } 89 if (!ppImagePhotom(config, view)) ESCAPE ("error running photometry."); 117 90 } 118 91 … … 123 96 continue; 124 97 } 125 126 if (!pmFPAfileIOChecks(config, view, PM_FPA_AFTER)) { 127 psFree(view); 128 return false; 129 } 98 if (!pmFPAfileIOChecks(config, view, PM_FPA_AFTER)) ESCAPE ("save failure for Cell"); 130 99 } 131 100 132 101 // Close chip 133 if (!pmFPAfileIOChecks(config, view, PM_FPA_AFTER)) { 134 psFree(view); 135 return false; 136 } 102 if (!pmFPAfileIOChecks(config, view, PM_FPA_AFTER)) ESCAPE ("save failure for Chip"); 137 103 } 138 104 … … 140 106 // it would require us to NOT free PPIMAGE.CHIP until here 141 107 // ppImageMosaicFPA (config, "PPIMAGE.OUTPUT.FPA", "PPIMAGE.CHIP"); 142 ppImageMosaicFPA(config, options, "PPIMAGE.OUTPUT.FPA1", "PPIMAGE.BIN1");143 ppImageMosaicFPA(config, options, "PPIMAGE.OUTPUT.FPA2", "PPIMAGE.BIN2");108 if (!ppImageMosaicFPA(config, options, "PPIMAGE.OUTPUT.FPA1", "PPIMAGE.BIN1")) ESCAPE ("failure in FPA Mosaic (level 1)"); 109 if (!ppImageMosaicFPA(config, options, "PPIMAGE.OUTPUT.FPA2", "PPIMAGE.BIN2")) ESCAPE ("failure in FPA Mosaic (level 2)"); 144 110 145 111 // we perform astrometry on all chips after sources have been detected 146 112 // this also performs the psastro file IO 147 113 if (options->doAstromChip || options->doAstromMosaic) { 148 if (!ppImageAstrom(config)) { 149 psError(PS_ERR_UNKNOWN, false, "error running astrometry.\n"); 150 psFree(view); 151 return false; 152 } 114 if (!ppImageAstrom(config)) ESCAPE ("error running astrometry."); 153 115 } 154 116 … … 158 120 159 121 // Write out summary statistics 160 if (!ppImageMetadataStats (config, options)) { 161 psError(PS_ERR_UNKNOWN, false, "Unable to write statistics file.\n"); 162 psFree (view); 163 return false; 164 } 122 if (!ppImageMetadataStats (config, options)) ESCAPE ("Unable to write statistics file."); 165 123 166 124 // Write out summary statistics 167 if (!ppImageStatsOutput (config, options)) { 168 psError(PS_ERR_UNKNOWN, false, "Unable to write statistics file.\n"); 169 psFree (view); 170 return false; 171 } 125 if (!ppImageStatsOutput (config, options)) ESCAPE ("Unable to write statistics file."); 172 126 173 127 // Output and Close FPA 174 if (!pmFPAfileIOChecks(config, view, PM_FPA_AFTER)) { 175 psFree(view); 176 return false; 177 } 128 if (!pmFPAfileIOChecks(config, view, PM_FPA_AFTER)) ESCAPE ("save failure for FPA"); 178 129 179 130 psFree(view); -
trunk/psastro/src/psastroDataLoad.c
r12806 r15216 5 5 // into the correct fpa structure locations (readout.analysis:PSPHOT.SOURCES) 6 6 7 # define ESCAPE { \ 8 psError(PS_ERR_UNKNOWN, false, "Failure in psastroDataSave"); \ 9 psFree (view); \ 10 return false; \ 11 } 12 7 13 // all of the different astrometry analysis modes use the same data load loop 8 14 bool psastroDataLoad (pmConfig *config) { … … 33 39 34 40 // files associated with the science image 35 pmFPAfileIOChecks (config, view, PM_FPA_BEFORE);41 if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) ESCAPE; 36 42 37 43 while ((chip = pmFPAviewNextChip (view, input->fpa, 1)) != NULL) { 38 44 psTrace ("psastro", 4, "Chip %d: %x %x\n", view->chip, chip->file_exists, chip->process); 39 45 if (!chip->process || !chip->file_exists) { continue; } 40 pmFPAfileIOChecks (config, view, PM_FPA_BEFORE);46 if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) ESCAPE; 41 47 42 48 while ((cell = pmFPAviewNextCell (view, input->fpa, 1)) != NULL) { 43 49 psTrace ("psastro", 4, "Cell %d: %x %x\n", view->cell, cell->file_exists, cell->process); 44 50 if (!cell->process || !cell->file_exists) { continue; } 45 pmFPAfileIOChecks (config, view, PM_FPA_BEFORE);51 if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) ESCAPE; 46 52 47 53 // process each of the readouts 48 54 while ((readout = pmFPAviewNextReadout (view, input->fpa, 1)) != NULL) { 49 pmFPAfileIOChecks (config, view, PM_FPA_BEFORE);50 if (! readout->data_exists) { continue; }55 if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) ESCAPE; 56 if (!readout->data_exists) { continue; } 51 57 52 psastroConvertReadout (readout, recipe);58 if (!psastroConvertReadout (readout, recipe)) ESCAPE; 53 59 54 pmFPAfileIOChecks (config, view, PM_FPA_AFTER);60 if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) ESCAPE; 55 61 } 56 pmFPAfileIOChecks (config, view, PM_FPA_AFTER);62 if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) ESCAPE; 57 63 } 58 pmFPAfileIOChecks (config, view, PM_FPA_AFTER);64 if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) ESCAPE; 59 65 } 60 pmFPAfileIOChecks (config, view, PM_FPA_AFTER); 66 if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) ESCAPE; 67 61 68 psFree (view); 62 69 return true; -
trunk/psastro/src/psastroDataSave.c
r12806 r15216 2 2 // XXX leak free 2006.04.27 3 3 4 # define ESCAPE { \ 5 psError(PS_ERR_UNKNOWN, false, "Failure in psastroDataSave"); \ 6 psFree (view); \ 7 return false; \ 8 } 9 4 10 // this loop saves the photometry/astrometry data files 5 11 bool psastroDataSave (pmConfig *config) { … … 30 36 31 37 // open/load files as needed 32 pmFPAfileIOChecks (config, view, PM_FPA_BEFORE);38 if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) ESCAPE; 33 39 34 40 while ((chip = pmFPAviewNextChip (view, output->fpa, 1)) != NULL) { 35 41 psTrace ("psastro", 4, "Chip %d: %x %x\n", view->chip, chip->file_exists, chip->process); 36 42 if (!chip->process || !chip->file_exists) { continue; } 37 pmFPAfileIOChecks (config, view, PM_FPA_BEFORE);43 if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) ESCAPE; 38 44 39 45 while ((cell = pmFPAviewNextCell (view, output->fpa, 1)) != NULL) { 40 46 psTrace ("psastro", 4, "Cell %d: %x %x\n", view->cell, cell->file_exists, cell->process); 41 47 if (!cell->process || !cell->file_exists) { continue; } 42 pmFPAfileIOChecks (config, view, PM_FPA_BEFORE);48 if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) ESCAPE; 43 49 44 50 // process each of the readouts 45 51 while ((readout = pmFPAviewNextReadout (view, output->fpa, 1)) != NULL) { 46 pmFPAfileIOChecks (config, view, PM_FPA_BEFORE);47 if (! readout->data_exists) { continue; }52 if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) ESCAPE; 53 if (!readout->data_exists) { continue; } 48 54 49 pmFPAfileIOChecks (config, view, PM_FPA_AFTER);55 if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) ESCAPE; 50 56 } 51 pmFPAfileIOChecks (config, view, PM_FPA_AFTER);57 if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) ESCAPE; 52 58 } 53 pmFPAfileIOChecks (config, view, PM_FPA_AFTER);59 if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) ESCAPE; 54 60 } 55 pmFPAfileIOChecks (config, view, PM_FPA_AFTER);61 if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) ESCAPE; 56 62 57 63 // activate all files except PSASTRO.OUTPUT 58 pmFPAfileActivate (config->files, true, NULL);59 pmFPAfileActivate (config->files, false, "PSASTRO.OUTPUT");64 if (!pmFPAfileActivate (config->files, true, NULL)) ESCAPE; 65 if (!pmFPAfileActivate (config->files, false, "PSASTRO.OUTPUT")) ESCAPE; 60 66 61 67 psFree (view); -
trunk/psphot/src/psphotImageLoop.c
r12805 r15216 1 1 # include "psphotStandAlone.h" 2 3 # define ESCAPE(MESSAGE) { \ 4 psError(PSPHOT_ERR_DATA, false, MESSAGE); \ 5 psFree (view); \ 6 return false; \ 7 } 2 8 3 9 bool psphotImageLoop (pmConfig *config) { … … 22 28 23 29 // files associated with the science image 24 if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) { 25 psError(PSPHOT_ERR_DATA, false, "failed IO for fpa in psphot\n"); 26 psFree(view); 27 return false; 28 } 30 if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) ESCAPE ("failed input for fpa in psphot."); 29 31 30 32 // for psphot, we force data to be read at the chip level … … 38 40 pmFPAfileActivate (config->files, true, "PSPHOT.MASK"); 39 41 pmFPAfileActivate (config->files, true, "PSPHOT.WEIGHT"); 40 if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) { 41 psError(PSPHOT_ERR_DATA, false, "failed IO for chip %d in psphot\n", view->chip); 42 psFree (view); 43 return false; 44 } 42 if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) ESCAPE ("failed input for Chip in psphot."); 45 43 46 44 // mosaic the cells of a chip into a single contiguous (trimmed) chip 47 if (!psphotMosaicChip(config, view, "PSPHOT.INPUT", "PSPHOT.LOAD")) { 48 psError(PS_ERR_UNKNOWN, false, "Unable to mosaic chip.\n"); 49 return false; 50 } 45 if (!psphotMosaicChip(config, view, "PSPHOT.INPUT", "PSPHOT.LOAD")) ESCAPE ("Unable to mosaic chip."); 51 46 52 47 // try to load other supporting data (PSF, SRC, etc). … … 56 51 pmFPAfileActivate (config->files, false, "PSPHOT.MASK"); 57 52 pmFPAfileActivate (config->files, false, "PSPHOT.WEIGHT"); 58 if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) { 59 psError(PSPHOT_ERR_DATA, false, "failed IO for chip %d in psphot\n", view->chip); 60 psFree (view); 61 return false; 62 } 53 if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) ESCAPE ("failed input for Chip in psphot."); 54 63 55 // re-activate files so they will be closed and freed below 64 56 pmFPAfileActivate (config->files, true, NULL); … … 83 75 84 76 // save output which is saved at the chip level 85 if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) { 86 psError(PSPHOT_ERR_DATA, false, "failed IO for chip %d in psphot\n", view->chip); 87 psFree (view); 88 return false; 89 } 77 if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) ESCAPE ("failed output for Chip in psphot."); 90 78 } 91 79 // save output which is saved at the fpa level 92 if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) { 93 psError(PSPHOT_ERR_DATA, false, "failed IO for fpa in psphot\n"); 94 psFree (view); 95 return false; 96 } 80 if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) ESCAPE ("failed ouput for FPA in psphot."); 81 82 // fail if we failed to handle an error 83 if (psErrorCodeLast() != PS_ERR_NONE) psAbort ("failed to handle an error!"); 97 84 98 85 psFree (view); 99 100 // fail if we failed to handle an error101 if (psErrorCodeLast() != PS_ERR_NONE) return false;102 86 return true; 103 87 }
Note:
See TracChangeset
for help on using the changeset viewer.
