Changeset 14657 for trunk/ppSim/src/ppSimLoop.c
- Timestamp:
- Aug 23, 2007, 2:52:55 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/ppSim/src/ppSimLoop.c (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppSim/src/ppSimLoop.c
r14531 r14657 1 1 #include "ppSim.h" 2 2 3 psExitppSimLoop(pmConfig *config)3 bool ppSimLoop(pmConfig *config) 4 4 { 5 5 PS_ASSERT_PTR_NON_NULL(config, PS_EXIT_PROG_ERROR); … … 29 29 pmFPAview *view = pmFPAviewAlloc(0);// View for iterating over FPA 30 30 31 // XXX if we include the psphot analysis, we will need to activate the correct pmFPAfiles 32 // at the correct times. ppSim operates on PPSIM.OUTPUT and PPSIM.SOURCES 33 31 34 // load any needed files (eg, input image, PSF) 32 35 if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) { 33 psError(PS PHOT_ERR_DATA, false, "failed IO for fpa in ppSim\n");36 psError(PS_ERR_UNKNOWN, false, "failed IO for fpa in ppSim\n"); 34 37 psFree(view); 35 38 return false; … … 43 46 // load any needed files (eg, input image, PSF) 44 47 if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) { 45 psError(PS PHOT_ERR_DATA, false, "failed IO for chip %d in ppSim\n", view->chip);48 psError(PS_ERR_UNKNOWN, false, "failed IO for chip %d in ppSim\n", view->chip); 46 49 psFree (view); 47 50 return false; 48 51 } 49 52 50 pmPSF *psf = NULL;51 53 if (type == PPSIM_TYPE_OBJECT) { 52 psf = ppSimSetPSF (config); 54 if (!ppSimSetPSF (chip, config)) { 55 psError(PS_ERR_UNKNOWN, false, "failed IO for chip %d in ppSim\n", view->chip); 56 psFree (view); 57 return false; 58 } 53 59 } 54 60 … … 64 70 psError(PS_ERR_BAD_PARAMETER_VALUE, true, "CELL.READDIR = 1 is the only supported mode."); 65 71 psFree(rng); 66 return PS_EXIT_CONFIG_ERROR;72 return false; 67 73 } 68 74 … … 74 80 75 81 // TO DO: Decide if cell is to be windowed, reduce numCols, numRows appropriately 76 psImage *signal= psImageAlloc(numCols, numRows, PS_TYPE_F32); // Signal in pixels77 psImage *variance= psImageAlloc(numCols, numRows, PS_TYPE_F32); // Noise in pixels82 readout->image = psImageAlloc(numCols, numRows, PS_TYPE_F32); // Signal in pixels 83 readout->weight = psImageAlloc(numCols, numRows, PS_TYPE_F32); // Noise in pixels 78 84 79 85 psImage *expCorr = NULL; // Exposure correction per pixel, for adding objects … … 82 88 } 83 89 84 psVector *biasRows = ppSimMakeBias ( signal, variance, cell, config, rng);90 psVector *biasRows = ppSimMakeBias (readout, config, rng); 85 91 if (type == PPSIM_TYPE_BIAS) goto done; 86 92 87 ppSimMakeDark ( signal, variance, config);93 ppSimMakeDark (readout, config); 88 94 if (type == PPSIM_TYPE_DARK) goto done; 89 95 90 ppSimMakeSky ( signal, variance, expCorr, type, config, fpa, chip, cell);96 ppSimMakeSky (readout, expCorr, type, config); 91 97 if (type == PPSIM_TYPE_FLAT) goto done; 92 98 93 99 if (type == PPSIM_TYPE_OBJECT) { 94 ppSimInsertS tars (signal, variance, expCorr, stars, config, chip, cell);100 ppSimInsertSources (readout, expCorr, stars, config); 95 101 } 96 102 97 103 done: 98 ppSimAddNoise(signal, variance, config, cell, rng); 99 ppSimSaturate(signal, config, cell); 100 101 readout->image = signal; 102 psFree(variance); 103 psFree(expCorr); 104 ppSimAddNoise(readout->image, readout->weight, cell, config, rng); 105 ppSimSaturate(readout, config); 104 106 105 107 ppSimAddOverscan (readout, config, biasCols, biasRows, rng); … … 123 125 psFree(rng); 124 126 psFree(view); 125 return PS_EXIT_SYS_ERROR; 127 // return PS_EXIT_SYS_ERROR; 128 return false; 126 129 } 127 130 } … … 135 138 psFree(rng); 136 139 psFree(view); 137 return PS_EXIT_SYS_ERROR; 140 // return PS_EXIT_SYS_ERROR; 141 return false; 138 142 } 139 143 … … 148 152 psFree(rng); 149 153 psFree(view); 150 return PS_EXIT_SYS_ERROR; 154 // return PS_EXIT_SYS_ERROR; 155 return false; 151 156 } 152 157 … … 154 159 psFree(view); 155 160 156 return 0;161 return true; 157 162 }
Note:
See TracChangeset
for help on using the changeset viewer.
