Changeset 21365 for trunk/ppSim/src/ppSimMakeBias.c
- Timestamp:
- Feb 5, 2009, 4:47:00 PM (17 years ago)
- File:
-
- 1 edited
-
trunk/ppSim/src/ppSimMakeBias.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppSim/src/ppSimMakeBias.c
r18011 r21365 20 20 float readnoise = psMetadataLookupF32(NULL, cell->concepts, "CELL.READNOISE");// CCD read noise, e 21 21 if (isnan(readnoise)) { 22 psWarning("CELL.READNOISE is not set; reverting to recipe value READNOISE.");23 readnoise = psMetadataLookupF32(&mdok, recipe, "READNOISE");24 if (!mdok) {25 psError(PS_ERR_BAD_PARAMETER_VALUE, false, "Unable to find READNOISE in recipe.");26 *status = false;27 return NULL;28 }22 psWarning("CELL.READNOISE is not set; reverting to recipe value READNOISE."); 23 readnoise = psMetadataLookupF32(&mdok, recipe, "READNOISE"); 24 if (!mdok) { 25 psError(PS_ERR_BAD_PARAMETER_VALUE, false, "Unable to find READNOISE in recipe."); 26 *status = false; 27 return NULL; 28 } 29 29 } 30 30 31 31 psImage *signal = readout->image; 32 psImage *variance = readout-> weight;32 psImage *variance = readout->variance; 33 33 34 34 int numRows = signal->numRows; … … 38 38 psPolynomial1D *biasPoly = psPolynomial1DAlloc(PS_POLYNOMIAL_CHEB, biasOrder); 39 39 for (int j = 0; j < biasOrder + 1; j++) { 40 biasPoly->coeff[j] = biasRange * psRandomGaussian(rng);40 biasPoly->coeff[j] = biasRange * psRandomGaussian(rng); 41 41 } 42 42 … … 45 45 46 46 for (int y = 0; y < numRows; y++) { 47 // Adjust bias level for this row48 biasRows->data.F32[y] = psPolynomial1DEval(biasPoly, (float)(y + biasOffset) /49 (float)numRows - 0.5) + biasLevel;47 // Adjust bias level for this row 48 biasRows->data.F32[y] = psPolynomial1DEval(biasPoly, (float)(y + biasOffset) / 49 (float)numRows - 0.5) + biasLevel; 50 50 51 for (int x = 0; x < numCols; x++) {51 for (int x = 0; x < numCols; x++) { 52 52 53 // Bias level54 signal->data.F32[y][x] += biasRows->data.F32[y];55 variance->data.F32[y][x] += PS_SQR(readnoise);53 // Bias level 54 signal->data.F32[y][x] += biasRows->data.F32[y]; 55 variance->data.F32[y][x] += PS_SQR(readnoise); 56 56 57 }57 } 58 58 } 59 59 psFree(biasPoly);
Note:
See TracChangeset
for help on using the changeset viewer.
