Changeset 5858 for trunk/ppImage/src/ppImageDetrendBias.c
- Timestamp:
- Dec 30, 2005, 7:05:28 AM (21 years ago)
- File:
-
- 1 edited
-
trunk/ppImage/src/ppImageDetrendBias.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppImage/src/ppImageDetrendBias.c
r5857 r5858 1 1 # include "ppImage.h" 2 2 3 bool ppDetrendBias (pmCell *input , psImage *bias, psImage *dark, ppRecipe*options) {3 bool ppDetrendBias (pmCell *inputCell, pmReadout *inputReadout, pmReadout *pedestal, ppOptions *options) { 4 4 5 5 psPolynomial1D *poly; 6 6 psSpline1D *spline; 7 psString coeffs; 7 8 8 // XXX EAM : this is an odd trigger for this9 if (options->overscanMode == PM_OVERSCAN_ ROWS || options->overscanMode == PM_OVERSCAN_COLUMNS) {9 // XXX EAM : renamed the general edge overscan concept 10 if (options->overscanMode == PM_OVERSCAN_EDGE) { 10 11 // Need to get the read direction 11 12 int readdir = psMetadataLookupS32(NULL, inputCell->concepts, "CELL.READDIR"); 12 13 if (readdir == 1) { 13 // psmodule-0.8.0 has confused PM_OVERSCAN_ROWS and PM_OVERSCAN_COLUMNS; bug 608.14 #ifdef PRODUCTION15 14 options->overscanMode = PM_OVERSCAN_ROWS; 16 #else 15 } else if (readdir == 2) { 17 16 options->overscanMode = PM_OVERSCAN_COLUMNS; 18 #endif19 } else if (readdir == 2) {20 #ifdef PRODUCTION21 options->overscanMode = PM_OVERSCAN_COLUMNS;22 #else23 options->overscanMode = PM_OVERSCAN_ROWS;24 #endif25 17 } else { 26 psErrorStackPrint(stderr, "CELL.READDIR (%d) is not 1 or 2 --- assuming 1.\n", 27 readdir); 28 options->overscanMode = PM_OVERSCAN_ROWS; 18 psAbort("phase2", "CELL.READDIR (%d) is not 1 or 2", readdir); 29 19 } 30 20 } 31 21 32 psList *inputOverscans = pmReadoutGetBias(inputReadout); // List of overscan bias regions 33 #ifdef PRODUCTION 34 (void)pmSubtractBias(inputReadout, overscanFit, inputOverscans, overscanMode, 35 overscanStats, overscanBins, overscanFitType, pedestal); 36 #else 37 (void)pmSubtractBias(inputReadout, overscanFit, inputOverscans, overscanMode, 38 overscanStats, overscanBins, overscanFitType, biasReadout); 39 #endif 22 // XXX : should this be a psArray? 23 psList *inputOverscans = NULL; 24 if (options->doOverscan) { 25 inputOverscans = pmReadoutGetBias(inputReadout); // List of overscan bias regions 26 } 27 28 // supplies the fit result in 'overscanFit' 29 pmSubtractBias(inputReadout, 30 options->overscanFit, 31 inputOverscans, 32 options->overscanMode, 33 options->overscanStats, 34 options->overscanBins, 35 options->overscanFitType, 36 pedestal); 40 37 psFree(inputOverscans); 41 38 42 39 // Output overscan fit results, if required 43 if (! doOverscan) {40 if (! options->doOverscan) { 44 41 return true; 45 42 } 46 43 47 if (! o verscanFit) {44 if (! options->overscanFit) { 48 45 psLogMsg("phase2", PS_LOG_WARN, "No fit generated!\n"); 49 46 return true; 50 47 } 51 48 52 switch (o verscanFitType) {49 switch (options->overscanFitType) { 53 50 case PM_FIT_POLYNOMIAL: 54 poly = (psPolynomial1D *)overscanFit; // The polynomial55 psStringcoeffs = NULL; // String containing the coefficients51 poly = (psPolynomial1D *) options->overscanFit; // The polynomial 52 coeffs = NULL; // String containing the coefficients 56 53 for (int i = 0; i < poly->nX; i++) { 57 54 psStringAppend(&coeffs, "%e ", poly->coeff[i]); … … 63 60 64 61 case PM_FIT_SPLINE: 65 spline = (psSpline1D *)overscanFit; // The spline66 psStringcoeffs = NULL; // String containing the coefficients62 spline = (psSpline1D *) options->overscanFit; // The spline 63 coeffs = NULL; // String containing the coefficients 67 64 for (int i = 0; i < spline->n; i++) { 68 65 psPolynomial1D *poly = spline->spline[i]; // i-th polynomial
Note:
See TracChangeset
for help on using the changeset viewer.
