IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 17, 2006, 3:05:59 PM (20 years ago)
Author:
Paul Price
Message:

Documenting pmSubtractBias.h, cleaning up pmSubtractBias.c

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/detrend/pmSubtractBias.c

    r8669 r9619  
    1 //////////////////////////////////////////////////////////////////////////////////////////////////////////////
    2 // XXX WARNING: I have completely replaced this file with an OLD VERSION (that works) instead of the
    3 // one that was being worked on.
    4 //////////////////////////////////////////////////////////////////////////////////////////////////////////////
    5 
    6 /** @file  pmSubtractBias.c
    7  *
    8  *  This file will contain a module which will subtract the detector bias
    9  *  in place from an input image.
    10  *
    11  *  @author GLG, MHPCC
    12  *
    13  *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2006-08-29 21:39:44 $
    15  *
    16  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
    17  *
    18  */
    19 
    201#if HAVE_CONFIG_H
    212#include <config.h>
     
    256#include <assert.h>
    267#include <pslib.h>
     8
     9#include "pmFPA.h"
    2710#include "pmSubtractBias.h"
    2811
     
    3114
    3215
    33 #define MAX(a,b) ((a) > (b) ? (a) : (b))
    34 #define MIN(a,b) ((a) < (b) ? (a) : (b))
    35 
    36 
    37 // XXX: put these in psConstants.h
    38 void PS_POLY1D_PRINT(psPolynomial1D *poly)
    39 {
    40     printf("-------------- PS_POLY1D_PRINT() --------------\n");
    41     printf("poly->nX is %d\n", poly->nX);
    42     for (psS32 i = 0 ; i < (1 + poly->nX) ; i++) {
    43         printf("poly->coeff[%d] is %f\n", i, poly->coeff[i]);
    44     }
    45 }
    46 
    47 void PS_PRINT_SPLINE(psSpline1D *mySpline)
    48 {
    49     printf("-------------- PS_PRINT_SPLINE() --------------\n");
    50     printf("mySpline->n is %d\n", mySpline->n);
    51     for (psS32 i = 0 ; i < mySpline->n ; i++) {
    52         PS_POLY1D_PRINT(mySpline->spline[i]);
    53     }
    54     PS_VECTOR_PRINT_F32(mySpline->knots);
    55 }
    56 
    57 #define PS_IMAGE_PRINT_F32_HIDEF(NAME) \
    58 printf("======== printing %s ========\n", #NAME); \
    59 for (int i = 0 ; i < (NAME)->numRows ; i++) { \
    60     for (int j = 0 ; j < (NAME)->numCols ; j++) { \
    61         printf("%.5f ", (NAME)->data.F32[i][j]); \
    62     } \
    63     printf("\n"); \
    64 }\
    65 
    66 
    67 void overscanOptionsFree(pmOverscanOptions *options)
     16static void overscanOptionsFree(pmOverscanOptions *options)
    6817{
    6918    psFree(options->stat);
     
    9140
    9241
    93 /******************************************************************************
    94 psSubtractFrame(): this routine will take as input a readout for the input
    95 image and a readout for the bias image.  The bias image is subtracted in
    96 place from the input image.
    97 *****************************************************************************/
    98 static bool SubtractFrame(pmReadout *in,// Input readout
     42// psSubtractFrame(): this routine will take as input a readout for the input image and a readout for the bias
     43// image.  The bias image is subtracted in place from the input image.
     44static bool SubtractFrame(pmReadout *in, // Input readout
    9945                          const pmReadout *sub, // Readout to be subtracted from input
    10046                          float scale   // Scale to apply before subtracting
     
    10955    psImage *subMask  = sub->mask;      // The mask for the subtraction image
    11056
     57    // Check parities
    11158    int xIpar = psMetadataLookupS32(NULL, in->parent->concepts, "CELL.XPARITY");
    11259    int xSpar = psMetadataLookupS32(NULL, sub->parent->concepts, "CELL.XPARITY");
     
    252199
    253200
    254 
    255 /******************************************************************************
    256 XXX: The SDRS does not specify type support.  F32 is implemented here.
    257  *****************************************************************************/
    258201bool pmSubtractBias(pmReadout *in, pmOverscanOptions *overscanOpts,
    259202                    const pmReadout *bias, const pmReadout *dark)
     
    280223        if (overscanOpts->fitType != PM_FIT_NONE && overscanOpts->fitType != PM_FIT_POLY_ORD &&
    281224                overscanOpts->fitType != PM_FIT_POLY_CHEBY && overscanOpts->fitType != PM_FIT_SPLINE) {
    282             psError(PS_ERR_UNKNOWN, true, "Invalid fit type (%d).  Returning original image.\n", overscanOpts->fitType);
     225            psError(PS_ERR_UNKNOWN, true, "Invalid fit type (%d).  Returning original image.\n",
     226                    overscanOpts->fitType);
    283227            return false;
    284228        }
     
    335279                while ((overscan = psListGetAndIncrement(iter))) {
    336280                    int diff = image->row0 - overscan->row0; // Offset between the two regions
    337                     for (int i = MAX(0,diff); i < MIN(image->numRows, overscan->numRows + diff); i++) {
     281                    for (int i = PS_MAX(0,diff); i < PS_MIN(image->numRows, overscan->numRows + diff); i++) {
    338282                        // i is row on overscan
    339283                        // XXX Reimplement with memcpy
     
    379323                while ((overscan = psListGetAndIncrement(iter))) {
    380324                    int diff = image->col0 - overscan->col0; // Offset between the two regions
    381                     for (int i = MAX(0,diff); i < MIN(image->numCols, overscan->numCols + diff); i++) {
     325                    for (int i = PS_MAX(0,diff); i < PS_MIN(image->numCols, overscan->numCols + diff); i++) {
    382326                        // i is column on overscan
    383327                        // XXX Reimplement with memcpy
Note: See TracChangeset for help on using the changeset viewer.