IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 2, 2005, 3:30:32 PM (21 years ago)
Author:
Paul Price
Message:

Working with release 8. Overscan, bias, flat-fielding all working.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/archive/scripts/src/phase2/pmSubtractBias.c

    r5107 r5462  
    66 *  @author GLG, MHPCC
    77 *
    8  *  @version $Revision: 1.1 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2005-09-23 02:58:30 $
     8 *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2005-11-03 01:30:32 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2222#define PM_SUBTRACT_BIAS_SPLINE_ORDER 3
    2323
     24// XXX: put these in psConstants.h
     25void PS_POLY1D_PRINT(psPolynomial1D *poly)
     26{
     27    printf("-------------- PS_POLY1D_PRINT() --------------\n");
     28    printf("poly->nX is %d\n", poly->nX);
     29    for (psS32 i = 0 ; i < (1 + poly->nX) ; i++) {
     30        printf("poly->coeff[%d] is %f\n", i, poly->coeff[i]);
     31    }
     32}
     33
     34void PS_PRINT_SPLINE(psSpline1D *mySpline)
     35{
     36    printf("-------------- PS_PRINT_SPLINE() --------------\n");
     37    printf("mySpline->n is %d\n", mySpline->n);
     38    for (psS32 i = 0 ; i < mySpline->n ; i++) {
     39        PS_POLY1D_PRINT(mySpline->spline[i]);
     40    }
     41    PS_VECTOR_PRINT_F32(mySpline->knots);
     42}
     43
     44#define PS_IMAGE_PRINT_F32_HIDEF(NAME) \
     45printf("======== printing %s ========\n", #NAME); \
     46for (int i = 0 ; i < (NAME)->numRows ; i++) { \
     47    for (int j = 0 ; j < (NAME)->numCols ; j++) { \
     48        printf("%.5f ", (NAME)->data.F32[i][j]); \
     49    } \
     50    printf("\n"); \
     51}\
     52
    2453/******************************************************************************
    2554psSubtractFrame(): this routine will take as input a readout for the input
    2655image and a readout for the bias image.  The bias image is subtracted in
    2756place from the input image.
    28  *****************************************************************************/
     57*****************************************************************************/
    2958static pmReadout *SubtractFrame(pmReadout *in,
    3059                                const pmReadout *bias)
     
    143172    return(opt);
    144173}
     174
     175
    145176
    146177/******************************************************************************
     
    161192    psTrace(".psModule.pmSubtracBias.ScaleOverscanVector", 4,
    162193            "---- ScaleOverscanVector() begin (%d -> %d) ----\n", overscanVector->n, n);
     194    //    PS_VECTOR_PRINT_F32(overscanVector);
    163195
    164196    if (NULL == overscanVector) {
     
    182214    psF32 x;
    183215    psS32 i;
    184 
     216    printf("Got here\n");
    185217    if (fit == PM_FIT_POLYNOMIAL) {
    186218        // Fit a polynomial to the old overscan vector.
     
    204236        // Fit a spline to the old overscan vector.
    205237        mySpline = (psSpline1D *) fitSpec;
     238        // XXX: Does it make any sense to have a psSpline argument?
    206239        if (mySpline == NULL) {
    207240            mustFreeSpline = 1;
     
    210243        //
    211244        // NOTE: Since the X arg in the psVectorFitSpline1D() function is NULL,
    212         // splines enpoints will be from 0.0 to overscanVector->n-1.  Must scale
     245        // splines endpoints will be from 0.0 to overscanVector->n-1.  Must scale
    213246        // properly when doing the spline eval.
    214247        //
    215         mySpline = psVectorFitSpline1D(mySpline, NULL, overscanVector, NULL);
     248        //        mySpline = psVectorFitSpline1D(mySpline, NULL, overscanVector, NULL);
     249        mySpline = psVectorFitSpline1D(NULL, overscanVector);
    216250        if (mySpline == NULL) {
    217251            psError(PS_ERR_UNKNOWN, false, "ScaleOverscanVector()(2): Could not fit a spline to the psVector.\n");
    218252            return(NULL);
    219253        }
     254        //        PS_PRINT_SPLINE(mySpline);
    220255
    221256        // For each element of the new vector, convert the x-ordinate to that
     
    230265            psFree(mySpline);
    231266        }
     267        //        PS_VECTOR_PRINT_F32(newVec);
     268
    232269
    233270    } else {
     
    376413    tmpOverscan = (psListElem *) overscans->head;
    377414    while (NULL != tmpOverscan) {
     415        //        PS_IMAGE_PRINT_F32_HIDEF(in->image);
    378416        myOverscanImage = (psImage *) tmpOverscan->data;
    379417
     
    557595                }
    558596            } else if (fit == PM_FIT_SPLINE) {
     597                // XXX: This makes no sense
     598                // XXX: must free mySpline?
    559599                mySpline = (psSpline1D *) fitSpec;
    560                 mySpline = psVectorFitSpline1D(mySpline, NULL, overscanVector, NULL);
     600                mySpline = psVectorFitSpline1D(NULL, overscanVector);
    561601                if (mySpline == NULL) {
    562602                    psError(PS_ERR_UNKNOWN, false, "Could not fit a spline to overscan vector.  Returning in image.\n");
Note: See TracChangeset for help on using the changeset viewer.