Changeset 15216 for trunk/ppImage/src/ppImageLoop.c
- Timestamp:
- Oct 4, 2007, 9:55:03 AM (19 years ago)
- File:
-
- 1 edited
-
trunk/ppImage/src/ppImageLoop.c (modified) (10 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);
Note:
See TracChangeset
for help on using the changeset viewer.
