Changeset 9619 for trunk/psModules/src/detrend/pmSubtractBias.c
- Timestamp:
- Oct 17, 2006, 3:05:59 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/detrend/pmSubtractBias.c (modified) (9 diffs)
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 the3 // one that was being worked on.4 //////////////////////////////////////////////////////////////////////////////////////////////////////////////5 6 /** @file pmSubtractBias.c7 *8 * This file will contain a module which will subtract the detector bias9 * in place from an input image.10 *11 * @author GLG, MHPCC12 *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 Hawaii17 *18 */19 20 1 #if HAVE_CONFIG_H 21 2 #include <config.h> … … 25 6 #include <assert.h> 26 7 #include <pslib.h> 8 9 #include "pmFPA.h" 27 10 #include "pmSubtractBias.h" 28 11 … … 31 14 32 15 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) 16 static void overscanOptionsFree(pmOverscanOptions *options) 68 17 { 69 18 psFree(options->stat); … … 91 40 92 41 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. 44 static bool SubtractFrame(pmReadout *in, // Input readout 99 45 const pmReadout *sub, // Readout to be subtracted from input 100 46 float scale // Scale to apply before subtracting … … 109 55 psImage *subMask = sub->mask; // The mask for the subtraction image 110 56 57 // Check parities 111 58 int xIpar = psMetadataLookupS32(NULL, in->parent->concepts, "CELL.XPARITY"); 112 59 int xSpar = psMetadataLookupS32(NULL, sub->parent->concepts, "CELL.XPARITY"); … … 252 199 253 200 254 255 /******************************************************************************256 XXX: The SDRS does not specify type support. F32 is implemented here.257 *****************************************************************************/258 201 bool pmSubtractBias(pmReadout *in, pmOverscanOptions *overscanOpts, 259 202 const pmReadout *bias, const pmReadout *dark) … … 280 223 if (overscanOpts->fitType != PM_FIT_NONE && overscanOpts->fitType != PM_FIT_POLY_ORD && 281 224 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); 283 227 return false; 284 228 } … … 335 279 while ((overscan = psListGetAndIncrement(iter))) { 336 280 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++) { 338 282 // i is row on overscan 339 283 // XXX Reimplement with memcpy … … 379 323 while ((overscan = psListGetAndIncrement(iter))) { 380 324 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++) { 382 326 // i is column on overscan 383 327 // XXX Reimplement with memcpy
Note:
See TracChangeset
for help on using the changeset viewer.
