IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Dec 30, 2005, 7:05:28 AM (21 years ago)
Author:
eugene
Message:

cleanups, segfault fixes, etc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppImage/src/ppImageDetrendBias.c

    r5857 r5858  
    11# include "ppImage.h"
    22
    3 bool ppDetrendBias (pmCell *input, psImage *bias, psImage *dark, ppRecipe *options) {
     3bool ppDetrendBias (pmCell *inputCell, pmReadout *inputReadout, pmReadout *pedestal, ppOptions *options) {
    44
    55    psPolynomial1D *poly;
    66    psSpline1D *spline;
     7    psString coeffs;
    78
    8     // XXX EAM : this is an odd trigger for this
    9     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) {
    1011        // Need to get the read direction
    1112        int readdir = psMetadataLookupS32(NULL, inputCell->concepts, "CELL.READDIR");
    1213        if (readdir == 1) {
    13 // psmodule-0.8.0 has confused PM_OVERSCAN_ROWS and PM_OVERSCAN_COLUMNS; bug 608.
    14 #ifdef PRODUCTION
    1514            options->overscanMode = PM_OVERSCAN_ROWS;
    16 #else
     15        } else if (readdir == 2) {
    1716            options->overscanMode = PM_OVERSCAN_COLUMNS;
    18 #endif
    19         } else if (readdir == 2) {
    20 #ifdef PRODUCTION
    21             options->overscanMode = PM_OVERSCAN_COLUMNS;
    22 #else
    23             options->overscanMode = PM_OVERSCAN_ROWS;
    24 #endif
    2517        } 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);
    2919        }
    3020    }
    3121
    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);
    4037    psFree(inputOverscans);
    41 
     38   
    4239    // Output overscan fit results, if required
    43     if (!doOverscan) {
     40    if (! options->doOverscan) {
    4441        return true;
    4542    }
    4643
    47     if (! overscanFit) {
     44    if (! options->overscanFit) {
    4845        psLogMsg("phase2", PS_LOG_WARN, "No fit generated!\n");
    4946        return true;
    5047    }
    5148
    52     switch (overscanFitType) {
     49    switch (options->overscanFitType) {
    5350      case PM_FIT_POLYNOMIAL:
    54         poly = (psPolynomial1D*)overscanFit; // The polynomial
    55         psString coeffs = NULL;     // String containing the coefficients
     51        poly = (psPolynomial1D *) options->overscanFit; // The polynomial
     52        coeffs = NULL;     // String containing the coefficients
    5653        for (int i = 0; i < poly->nX; i++) {
    5754            psStringAppend(&coeffs, "%e ", poly->coeff[i]);
     
    6360
    6461      case PM_FIT_SPLINE:
    65         spline = (psSpline1D*)overscanFit; // The spline
    66         psString coeffs = NULL;     // String containing the coefficients
     62        spline = (psSpline1D *) options->overscanFit; // The spline
     63        coeffs = NULL;     // String containing the coefficients
    6764        for (int i = 0; i < spline->n; i++) {
    6865            psPolynomial1D *poly = spline->spline[i]; // i-th polynomial
Note: See TracChangeset for help on using the changeset viewer.