Changeset 21365 for trunk/ppSim/src/ppSimLoop.c
- Timestamp:
- Feb 5, 2009, 4:47:00 PM (17 years ago)
- File:
-
- 1 edited
-
trunk/ppSim/src/ppSimLoop.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppSim/src/ppSimLoop.c
r18011 r21365 34 34 psArray *galaxies = psArrayAllocEmpty (1); 35 35 if (type == PPSIM_TYPE_OBJECT) { 36 // Load forced-photometry positions (these are placed on fpa->analysis for use in ppSimPhotomReadout)37 if (!ppSimLoadSpots (fpa, config)) ESCAPE (PS_ERR_UNKNOWN, "failed to load forced-photometry spots");38 39 // Load catalogue stars36 // Load forced-photometry positions (these are placed on fpa->analysis for use in ppSimPhotomReadout) 37 if (!ppSimLoadSpots (fpa, config)) ESCAPE (PS_ERR_UNKNOWN, "failed to load forced-photometry spots"); 38 39 // Load catalogue stars 40 40 if (!ppSimLoadStars (stars, fpa, config)) ESCAPE (PS_ERR_UNKNOWN, "failed to load catalog stars"); 41 41 42 // Add random stars42 // Add random stars 43 43 if (!ppSimMakeStars (stars, fpa, config, rng)) ESCAPE (PS_ERR_UNKNOWN, "failed to make random stars"); 44 44 45 // Add random galaxies45 // Add random galaxies 46 46 if (!ppSimMakeGalaxies (galaxies, fpa, config, rng)) ESCAPE (PS_ERR_UNKNOWN, "failed to make random galaxies"); 47 47 } … … 105 105 // TO DO: Decide if cell is to be windowed, reduce numCols, numRows appropriately 106 106 readout->image = psImageAlloc(numCols, numRows, PS_TYPE_F32); // Signal in pixels 107 readout-> weight= psImageAlloc(numCols, numRows, PS_TYPE_F32); // Noise in pixels107 readout->variance = psImageAlloc(numCols, numRows, PS_TYPE_F32); // Noise in pixels 108 108 109 109 psImageInit (readout->image, 0.0); 110 psImageInit (readout-> weight, 0.0);110 psImageInit (readout->variance, 0.0); 111 111 112 112 psFree(readout); // Drop reference … … 115 115 psVector *biasCols = ppSimMakeBiassec (cell, config); 116 116 117 pmReadout *readout;118 while ((readout = pmFPAviewNextReadout (view, fpa, 1))) {119 120 // if we have not read in a weightor generated a fake image above, we need to117 pmReadout *readout; 118 while ((readout = pmFPAviewNextReadout (view, fpa, 1))) { 119 120 // if we have not read in a variance or generated a fake image above, we need to 121 121 // build one here 122 if (!readout-> weight) {123 if (!pmReadoutGenerate Weight(readout, true)) {124 psError (PS_ERR_UNKNOWN, false, "trouble creating weight");122 if (!readout->variance) { 123 if (!pmReadoutGenerateVariance(readout, true)) { 124 psError (PS_ERR_UNKNOWN, false, "trouble creating variance"); 125 125 return false; 126 126 } … … 133 133 134 134 psVector *biasRows = ppSimMakeBias (&status, readout, config, rng); 135 if (!status) ESCAPE (PS_ERR_UNKNOWN, "problem generating dark structure");135 if (!status) ESCAPE (PS_ERR_UNKNOWN, "problem generating dark structure"); 136 136 if (type == PPSIM_TYPE_BIAS) goto done; 137 137 138 if (!ppSimMakeDark (readout, config)) ESCAPE (PS_ERR_UNKNOWN, "problem generating dark structure");138 if (!ppSimMakeDark (readout, config)) ESCAPE (PS_ERR_UNKNOWN, "problem generating dark structure"); 139 139 if (type == PPSIM_TYPE_DARK) goto done; 140 140 … … 153 153 154 154 done: 155 if (!ppSimAddNoise(readout->image, readout-> weight, cell, config, rng)) ESCAPE (PS_ERR_UNKNOWN, "problem adding noise");155 if (!ppSimAddNoise(readout->image, readout->variance, cell, config, rng)) ESCAPE (PS_ERR_UNKNOWN, "problem adding noise"); 156 156 if (!ppSimSaturate(readout, config)) ESCAPE (PS_ERR_UNKNOWN, "problem setting saturation levels"); 157 157 … … 165 165 readout->parent->parent->data_exists = true; 166 166 167 // if there is an input image, merge it with the simulated image168 if (!ppSimMergeReadouts (config, view)) ESCAPE (PS_ERR_UNKNOWN, "problem merging input image with simulated image");167 // if there is an input image, merge it with the simulated image 168 if (!ppSimMergeReadouts (config, view)) ESCAPE (PS_ERR_UNKNOWN, "problem merging input image with simulated image"); 169 169 } 170 170 psFree(biasCols); … … 173 173 174 174 if (cell->hdu) { 175 // XXX only do this if there is no INPUT image?175 // XXX only do this if there is no INPUT image? 176 176 if (!ppSimInitHeader(config, NULL, NULL, cell)) ESCAPE (PS_ERR_UNKNOWN, "problem setting output header"); 177 177 } … … 186 186 } 187 187 188 // XXX why no UpdateConceptsChip??188 // XXX why no UpdateConceptsChip?? 189 189 190 190 if (chip->hdu) { 191 // XXX only do this if there is no INPUT image191 // XXX only do this if there is no INPUT image 192 192 if (!ppSimInitHeader(config, NULL, chip, NULL)) ESCAPE (PS_ERR_UNKNOWN, "problem setting output header"); 193 193 } 194 194 195 195 // we perform photometry on the readouts of this chip in the output 196 if (!ppSimPhotom (config, view)) ESCAPE (PS_ERR_UNKNOWN, "problem performing photometry");196 if (!ppSimPhotom (config, view)) ESCAPE (PS_ERR_UNKNOWN, "problem performing photometry"); 197 197 198 198 if (!pmFPAfileIOChecks(config, view, PM_FPA_AFTER)) {
Note:
See TracChangeset
for help on using the changeset viewer.
