IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 14505


Ignore:
Timestamp:
Aug 15, 2007, 10:21:18 AM (19 years ago)
Author:
magnier
Message:

moving mods from ipp-2-2

Location:
trunk/psModules/src
Files:
2 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/config/pmConfig.c

    r14399 r14505  
    44 *  @author EAM (IfA)
    55 *
    6  *  @version $Revision: 1.100 $ $Name: not supported by cvs2svn $
    7  *  @date $Date: 2007-07-27 00:11:03 $
     6 *  @version $Revision: 1.101 $ $Name: not supported by cvs2svn $
     7 *  @date $Date: 2007-08-15 20:21:18 $
    88 *
    99 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    552552                if (newFile) {
    553553                    cameraFile = newFile;
    554                 }
     554                } else {
     555                    psLogMsg ("psModules.config", PS_LOG_INFO,
     556                              "%s is not listed in the site CAMERAS list,\n"
     557                              "trying as a camera configuration file\n", cameraFile);
     558                }
    555559            } else {
    556560                psError(PS_ERR_IO, false, "Unable to find CAMERAS in site configuration.\n");
  • trunk/psModules/src/detrend/Makefile.am

    r12098 r14505  
    1010        pmNonLinear.c \
    1111        pmBias.c \
     12        pmOverscan.c \
    1213        pmDetrendDB.c \
    1314        pmShutterCorrection.c \
     
    2324        pmNonLinear.h \
    2425        pmBias.h \
     26        pmOverscan.h \
    2527        pmDetrendDB.h \
    2628        pmShutterCorrection.h \
  • trunk/psModules/src/detrend/pmBias.c

    r13956 r14505  
    1515#include "pmFPACalibration.h"
    1616
     17#include "pmOverscan.h"
    1718#include "pmBias.h"
    1819
    19 #define SMOOTH_NSIGMA 4.0               // Number of Gaussian sigma the smoothing kernel extends
    20 
    21 
    22 static void overscanOptionsFree(pmOverscanOptions *options)
    23 {
    24     psFree(options->stat);
    25     psFree(options->poly);
    26     psFree(options->spline);
    27 }
    28 
    29 pmOverscanOptions *pmOverscanOptionsAlloc(bool single, pmFit fitType, unsigned int order, psStats *stat,
    30                                           int boxcar, float gauss)
    31 {
    32     pmOverscanOptions *opts = psAlloc(sizeof(pmOverscanOptions));
    33     psMemSetDeallocator(opts, (psFreeFunc)overscanOptionsFree);
    34 
    35     // Inputs
    36     opts->single = single;
    37     opts->fitType = fitType;
    38     opts->order = order;
    39     opts->stat = psMemIncrRefCounter(stat);
    40 
    41     // Smoothing
    42     opts->boxcar = boxcar;
    43     opts->gauss = gauss;
    44 
    45     // Outputs
    46     opts->poly = NULL;
    47     opts->spline = NULL;
    48 
    49     return opts;
    50 }
    51 
    52 
    53 // subtractFrame(): this routine will take as input a readout for the input image and a readout for the bias
     20// pmBiasSubtractFrame(): this routine will take as input a readout for the input image and a readout for the bias
    5421// image.  The bias image is subtracted in place from the input image.
    55 static bool subtractFrame(pmReadout *in, // Input readout
     22bool pmBiasSubtractFrame(pmReadout *in, // Input readout
    5623                          const pmReadout *sub, // Readout to be subtracted from input
    5724                          float scale   // Scale to apply before subtracting
     
    12592}
    12693
    127 // Produce an overscan vector from an array of pixels
    128 static psVector *overscanVector(float *chi2, // chi^2 from fit
    129                                 pmOverscanOptions *overscanOpts, // Overscan options
    130                                 const psArray *pixels, // Array of vectors containing the pixel values
    131                                 psStats *myStats // Statistic to use in reducing the overscan
    132                                )
    133 {
    134     assert(overscanOpts);
    135     assert(pixels);
    136     assert(myStats);
    137 
    138     psStatsOptions statistic = psStatsSingleOption(myStats->options); // Statistic to use
    139     assert(statistic != 0);
    140 
    141     // Reduce the overscans
    142     psVector *reduced = psVectorAlloc(pixels->n, PS_TYPE_F32); // Overscan for each row
    143     psVector *ordinate = psVectorAlloc(pixels->n, PS_TYPE_F32); // Ordinate
    144     psVector *mask = psVectorAlloc(pixels->n, PS_TYPE_U8); // Mask for fitting
    145 
    146     for (int i = 0; i < pixels->n; i++) {
    147         psVector *values = pixels->data[i]; // Vector with overscan values
    148         if (values->n > 0) {
    149             mask->data.U8[i] = 0;
    150             ordinate->data.F32[i] = 2.0*(float)i/(float)pixels->n - 1.0; // Scale to [-1,1]
    151             psVectorStats(myStats, values, NULL, NULL, 0);
    152             reduced->data.F32[i] = psStatsGetValue(myStats, statistic);
    153         } else if (overscanOpts->fitType == PM_FIT_NONE) {
    154             psError(PS_ERR_UNKNOWN, true, "The overscan is not supplied for all points on the "
    155                     "image, and no fit is requested.\n");
    156             return NULL;
    157         } else {
    158             // We'll fit this one out
    159             mask->data.U8[i] = 1;
    160         }
    161     }
    162 
    163     // Smooth the reduced vector
    164     if (overscanOpts->boxcar > 0) {
    165         psVector *smoothed = psVectorBoxcar(NULL, reduced, overscanOpts->boxcar); // Smoothed vector
    166         psFree(reduced);
    167         reduced = smoothed;
    168     }
    169     if (isfinite(overscanOpts->gauss) && overscanOpts->gauss > 0) {
    170         if (overscanOpts->boxcar > 0) {
    171             psWarning("Gaussian smoothing the boxcar smoothed overscan --- you asked for it.");
    172         }
    173         psVector *smoothed = psVectorSmooth(NULL, reduced, overscanOpts->gauss, SMOOTH_NSIGMA);
    174         psFree(reduced);
    175         reduced = smoothed;
    176     }
    177 
    178     // Fit the overscan, if required
    179     psVector *fitted;                   // Fitted overscan values
    180     switch (overscanOpts->fitType) {
    181     case PM_FIT_NONE:
    182         // No fitting --- that's easy.
    183         fitted = psMemIncrRefCounter(reduced);
    184         break;
    185     case PM_FIT_POLY_ORD:
    186         if (overscanOpts->poly && (overscanOpts->poly->nX != overscanOpts->order ||
    187                                    overscanOpts->poly->type != PS_POLYNOMIAL_ORD)) {
    188             psFree(overscanOpts->poly);
    189             overscanOpts->poly = NULL;
    190         }
    191         if (! overscanOpts->poly) {
    192             overscanOpts->poly = psPolynomial1DAlloc(PS_POLYNOMIAL_ORD, overscanOpts->order);
    193         }
    194         psVectorFitPolynomial1D(overscanOpts->poly, mask, 1, reduced, NULL, ordinate);
    195         fitted = psPolynomial1DEvalVector(overscanOpts->poly, ordinate);
    196         break;
    197     case PM_FIT_POLY_CHEBY:
    198         if (overscanOpts->poly && (overscanOpts->poly->nX != overscanOpts->order ||
    199                                    overscanOpts->poly->type != PS_POLYNOMIAL_CHEB)) {
    200             psFree(overscanOpts->poly);
    201             overscanOpts->poly = NULL;
    202         }
    203         if (! overscanOpts->poly) {
    204             overscanOpts->poly = psPolynomial1DAlloc(PS_POLYNOMIAL_CHEB, overscanOpts->order);
    205         }
    206         psVectorFitPolynomial1D(overscanOpts->poly, mask, 1, reduced, NULL, ordinate);
    207         fitted = psPolynomial1DEvalVector(overscanOpts->poly, ordinate);
    208         break;
    209     case PM_FIT_SPLINE:
    210         // XXX I don't think psSpline1D is up to scratch yet --- it has no mask, and requires an
    211         // input spline
    212         overscanOpts->spline = psVectorFitSpline1D(reduced, ordinate);
    213         fitted = psSpline1DEvalVector(overscanOpts->spline, ordinate);
    214         break;
    215     default:
    216         psError(PS_ERR_UNKNOWN, true, "Unknown value for the fitting type: %d\n", overscanOpts->fitType);
    217         return NULL;
    218         break;
    219     }
    220 
    221     if (chi2) {
    222         *chi2 = 0.0;                    // chi^2 (sort of)
    223         for (int i = 0; i < reduced->n; i++) {
    224             *chi2 += PS_SQR(fitted->data.F32[i] - reduced->data.F32[i]);
    225         }
    226     }
    227 
    228     psFree(reduced);
    229     psFree(ordinate);
    230     psFree(mask);
    231 
    232     return fitted;
    233 }
    234 
    235 bool pmBiasSubtract(pmReadout *inRO, pmOverscanOptions *overscanOpts,
    236                     const pmReadout *biasRO, const pmReadout *darkRO, const pmFPAview *view)
     94bool pmBiasSubtract(pmReadout *in, pmOverscanOptions *overscanOpts,
     95                    const pmReadout *bias, const pmReadout *dark, const pmFPAview *view)
    23796{
    23897    psTrace("psModules.detrend", 4,
    23998            "---- pmBiasSubtract() begin ----\n");
    24099
    241     PS_ASSERT_PTR_NON_NULL(inRO, false);
    242     PS_ASSERT_IMAGE_NON_NULL(inRO->image, false);
    243     PS_ASSERT_IMAGE_TYPE(inRO->image, PS_TYPE_F32, false);
    244     if (biasRO) {
    245         PS_ASSERT_IMAGE_NON_NULL(biasRO->image, false);
    246         PS_ASSERT_IMAGE_TYPE(biasRO->image, PS_TYPE_F32, false);
     100    PS_ASSERT_PTR_NON_NULL(in, false);
     101    PS_ASSERT_IMAGE_NON_NULL(in->image, false);
     102    PS_ASSERT_IMAGE_TYPE(in->image, PS_TYPE_F32, false);
     103    if (bias) {
     104        PS_ASSERT_IMAGE_NON_NULL(bias->image, false);
     105        PS_ASSERT_IMAGE_TYPE(bias->image, PS_TYPE_F32, false);
    247106    }
    248     if (darkRO) {
     107    if (dark) {
    249108        PS_ASSERT_PTR_NON_NULL(view, false);
    250         PS_ASSERT_IMAGE_NON_NULL(darkRO->image, false);
    251         PS_ASSERT_IMAGE_TYPE(darkRO->image, PS_TYPE_F32, false);
     109        PS_ASSERT_IMAGE_NON_NULL(dark->image, false);
     110        PS_ASSERT_IMAGE_TYPE(dark->image, PS_TYPE_F32, false);
    252111    }
    253112
    254     pmHDU *hdu = pmHDUFromReadout(inRO);  // HDU of interest
    255     psImage *image = inRO->image;         // The input image
     113    pmHDU *hdu = pmHDUFromReadout(in);  // HDU of interest
    256114
    257     // Overscan processing
    258     if (overscanOpts) {
    259         // Check for an unallowable pmFit.
    260         if (overscanOpts->fitType != PM_FIT_NONE && overscanOpts->fitType != PM_FIT_POLY_ORD &&
    261                 overscanOpts->fitType != PM_FIT_POLY_CHEBY && overscanOpts->fitType != PM_FIT_SPLINE) {
    262             psError(PS_ERR_UNKNOWN, true, "Invalid fit type (%d).  Returning original image.\n",
    263                     overscanOpts->fitType);
    264             return false;
    265         }
    266 
    267         psList *overscans = inRO->bias; // List of the overscan images
    268 
    269         psStatsOptions statistic = psStatsSingleOption(overscanOpts->stat->options); // Statistic to use
    270         if (statistic == 0) {
    271             psError(PS_ERR_BAD_PARAMETER_VALUE, false, "Multiple or no statistics options set: %p\n",
    272                     overscanOpts->stat);
    273             return false;
    274         }
    275         psStats *stats = psStatsAlloc(statistic); // A new psStats, to avoid clobbering original
    276 
    277         psString comment = NULL;    // Comment to add
    278         psStringAppend(&comment, "Subtracting overscan (stat %x; type %x; order %d)",
    279                        statistic, overscanOpts->fitType, overscanOpts->order);
    280         psMetadataAddStr(hdu->header, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK,
    281                          comment, "");
    282         psFree(comment);
    283 
    284         // Reduce all overscan pixels to a single value
    285         if (overscanOpts->single) {
    286             psVector *pixels = psVectorAlloc(0, PS_TYPE_F32);
    287             psListIterator *iter = psListIteratorAlloc(overscans, PS_LIST_HEAD, false); // Iterator
    288             psImage *overscan = NULL;   // Overscan image from iterator
    289             while ((overscan = psListGetAndIncrement(iter))) {
    290                 int index = pixels->n;  // Index
    291                 pixels = psVectorRealloc(pixels, pixels->n + overscan->numRows * overscan->numCols);
    292                 pixels->n += overscan->numRows * overscan->numCols;
    293                 for (int i = 0; i < overscan->numRows; i++) {
    294                     memcpy(&pixels->data.F32[index], overscan->data.F32[i],
    295                            overscan->numCols * sizeof(psF32));
    296                     index += overscan->numCols;
    297                 }
    298             }
    299             psFree(iter);
    300 
    301             (void)psVectorStats(stats, pixels, NULL, NULL, 0);
    302             psFree(pixels);
    303             double reduced = psStatsGetValue(stats, statistic); // Result of statistics
    304 
    305             psString comment = NULL;    // Comment to add
    306             psStringAppend(&comment, "Overscan value: %f", reduced);
    307             psMetadataAddStr(hdu->header, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, comment, "");
    308             psFree(comment);
    309 
    310             // write metadata header value
    311             psMetadataAddF32(hdu->header, PS_LIST_TAIL, "OVER_VAL", PS_META_REPLACE, "Overscan value",
    312                              reduced);
    313             psMetadataAddF32(hdu->header, PS_LIST_TAIL, "OVER_SIG", PS_META_REPLACE, "Overscan stdev", NAN);
    314 
    315             (void)psBinaryOp(image, image, "-", psScalarAlloc((float)reduced, PS_TYPE_F32));
    316         } else {
    317             // We do the regular overscan subtraction
    318             bool readRows = psMetadataLookupBool(NULL, inRO->parent->concepts,
    319                                                  "CELL.READDIR"); // Read direction
    320             float chi2 = NAN;           // chi^2 from fit
    321 
    322             if (readRows) {
    323                 // The read direction is rows
    324                 psArray *pixels = psArrayAlloc(image->numRows); // Array of vectors containing pixels
    325                 for (int i = 0; i < pixels->n; i++) {
    326                     pixels->data[i] = psVectorAlloc(0, PS_TYPE_F32);
    327                 }
    328 
    329                 // Pull the pixels out into the vectors
    330                 psListIterator *iter = psListIteratorAlloc(overscans, PS_LIST_HEAD, false); // Iterator
    331                 psImage *overscan = NULL; // Overscan image from iterator
    332                 while ((overscan = psListGetAndIncrement(iter))) {
    333                     // the overscan and image might not be aligned.  pixels->data represents
    334                     // the image row pixels.
    335                     int diff = overscan->row0 - image->row0; // Offset between the two regions
    336                     for (int i = PS_MAX(0,diff); i < PS_MIN(image->numRows, overscan->numRows + diff); i++) {
    337                         int j = i - diff;
    338                         // i is row on image
    339                         // j is row on overscan
    340                         psVector *values = pixels->data[i];
    341                         int index = values->n; // Index in the vector
    342                         values = psVectorRealloc(values, values->n + overscan->numCols);
    343                         values->n += overscan->numCols;
    344                         memcpy(&values->data.F32[index], overscan->data.F32[j],
    345                                overscan->numCols * PSELEMTYPE_SIZEOF(PS_TYPE_F32));
    346                         index += overscan->numCols;
    347                         pixels->data[i] = values; // Update the pointer in case it's moved
    348                     }
    349                 }
    350                 psFree(iter);
    351 
    352                 // Reduce the overscans
    353                 psVector *reduced = overscanVector(&chi2, overscanOpts, pixels, stats);
    354                 psFree(pixels);
    355                 if (! reduced) {
    356                     psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to generate overscan vector.\n");
    357                     return false;
    358                 }
    359 
    360                 // Subtract row by row
    361                 for (int i = 0; i < image->numRows; i++) {
    362                     for (int j = 0; j < image->numCols; j++) {
    363                         image->data.F32[i][j] -= reduced->data.F32[i];
    364                     }
    365                 }
    366                 psFree(reduced);
    367 
    368             } else {
    369                 // The read direction is columns
    370                 psArray *pixels = psArrayAlloc(image->numCols); // Array of vectors containing pixels
    371                 for (int i = 0; i < pixels->n; i++) {
    372                     psVector *values = psVectorAlloc(0, PS_TYPE_F32);
    373                     pixels->data[i] = values;
    374                 }
    375 
    376                 // Pull the pixels out into the vectors
    377                 psListIterator *iter = psListIteratorAlloc(overscans, PS_LIST_HEAD, false); // Iterator
    378                 psImage *overscan = NULL; // Overscan image from iterator
    379                 while ((overscan = psListGetAndIncrement(iter))) {
    380                     // the overscan and image might not be aligned.  pixels->data represents
    381                     // the image row pixels.
    382                     int diff = overscan->col0 - image->col0; // Offset between the two regions
    383                     for (int i = PS_MAX(0,diff); i < PS_MIN(image->numCols, overscan->numCols + diff); i++) {
    384                         int iFixed = i - diff;
    385                         // i is column on image
    386                         // iFixed is column on overscan
    387                         psVector *values = pixels->data[i];
    388                         int index = values->n; // Index in the vector
    389                         values = psVectorRealloc(values, values->n + overscan->numRows);
    390                         for (int j = 0; j < overscan->numRows; j++) {
    391                             values->data.F32[index++] = overscan->data.F32[j][iFixed];
    392                         }
    393                         values->n += overscan->numRows;
    394                         pixels->data[i] = values; // Update the pointer in case it's moved
    395                     }
    396                 }
    397                 psFree(iter);
    398 
    399                 // Reduce the overscans
    400                 psVector *reduced = overscanVector(&chi2, overscanOpts, pixels, stats);
    401                 psFree(pixels);
    402                 if (! reduced) {
    403                     psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to generate overscan vector.\n");
    404                     return false;
    405                 }
    406 
    407                 // Subtract column by column
    408                 for (int i = 0; i < image->numCols; i++) {
    409                     for (int j = 0; j < image->numRows; j++) {
    410                         image->data.F32[j][i] -= reduced->data.F32[i];
    411                     }
    412                 }
    413                 psFree(reduced);
    414             }
    415 
    416             switch (overscanOpts->fitType) {
    417             case PM_FIT_POLY_ORD:
    418             case PM_FIT_POLY_CHEBY: {
    419                     psString comment = NULL;    // Comment to add
    420                     psStringAppend(&comment, "Overscan fit (chi2: %.2f): ", chi2);
    421                     psPolynomial1D *poly = overscanOpts->poly; // The polynomial
    422                     for (int i = 0; i < poly->nX; i++) {
    423                         psStringAppend(&comment, "%.1f ", poly->coeff[i]);
    424                     }
    425                     psMetadataAddStr(hdu->header, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, comment, "");
    426                     psFree(comment);
    427 
    428                     // write metadata header value
    429                     psMetadataAddF32(hdu->header, PS_LIST_TAIL, "OVER_VAL", PS_META_REPLACE,
    430                                      "Overscan value", poly->coeff[0]);
    431                     psMetadataAddF32(hdu->header, PS_LIST_TAIL, "OVER_SIG", PS_META_REPLACE,
    432                                      "Overscan stdev", poly->coeffErr[0]);
    433                     break;
    434                 }
    435             case PM_FIT_SPLINE: {
    436                     psSpline1D *spline = overscanOpts->spline; // The spline
    437                     for (int i = 0; i < spline->n; i++) {
    438                         psStringAppend(&comment, "Overscan fit (chi2: %.2f) %d:", chi2, i);
    439                         psPolynomial1D *poly = spline->spline[i]; // i-th polynomial
    440                         for (int j = 0; j < poly->nX; j++) {
    441                             psStringAppend(&comment, "%.1f ", poly->coeff[i]);
    442                         }
    443                         psMetadataAddStr(hdu->header, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK,
    444                                          comment, "");
    445                         psFree(comment);
    446                     }
    447                     // write metadata header value
    448                     psMetadataAddF32(hdu->header, PS_LIST_TAIL, "OVER_VAL", PS_META_REPLACE,
    449                                      "Overscan value", NAN);
    450                     psMetadataAddF32(hdu->header, PS_LIST_TAIL, "OVER_SIG", PS_META_REPLACE,
    451                                      "Overscan stdev", NAN);
    452                     break;
    453                 }
    454             case PM_FIT_NONE:
    455                 break;
    456             default:
    457                 psAbort("Should never get here!!!\n");
    458             }
    459 
    460 
    461         }
    462         psFree(stats);
    463     } // End of overscan subtraction
     115    if (!pmOverscanSubtract (in, overscanOpts)) {
     116        return false;
     117    }
    464118
    465119    // Bias frame subtraction
    466     if (biasRO) {
    467         psVector *md5 = psImageMD5(biasRO->image); // md5 hash
     120    if (bias) {
     121        psVector *md5 = psImageMD5(bias->image); // md5 hash
    468122        psString md5string = psMD5toString(md5); // String
    469123        psFree(md5);
     
    473127        psFree(md5string);
    474128
    475         if (!subtractFrame(inRO, biasRO, 1.0)) {
     129        if (!pmBiasSubtractFrame(in, bias, 1.0)) {
    476130            return false;
    477131        }
    478132    }
    479133
    480     if (darkRO) {
     134    if (dark) {
    481135        // Get the scaling
    482         float inTime = psMetadataLookupF32(NULL, inRO->parent->concepts, "CELL.DARKTIME");
    483         float darkTime = psMetadataLookupF32(NULL, darkRO->parent->concepts, "CELL.DARKTIME");
     136        float inTime = psMetadataLookupF32(NULL, in->parent->concepts, "CELL.DARKTIME");
     137        float darkTime = psMetadataLookupF32(NULL, dark->parent->concepts, "CELL.DARKTIME");
    484138        if (isnan(inTime) || isnan(darkTime)) {
    485139            psError(PS_ERR_UNKNOWN, false, "Unable to determine dark scaling.");
     
    488142
    489143        float darkNorm = 1.0;
    490         float inNorm = pmFPADarkNorm(inRO->parent->parent->parent, view, inTime);
     144        float inNorm = pmFPADarkNorm(in->parent->parent->parent, view, inTime);
    491145
    492146        // if we have a normalized dark exposure, we simply multiply the master by inNorm.  if
     
    495149
    496150        if (darkTime != 1.0) {
    497             darkNorm = pmFPADarkNorm(darkRO->parent->parent->parent, view, darkTime);
     151            darkNorm = pmFPADarkNorm(dark->parent->parent->parent, view, darkTime);
    498152        }
    499153
     
    505159        float scale = inNorm / darkNorm;// Scaling to apply to dark exposure
    506160
    507         psVector *md5 = psImageMD5(darkRO->image); // md5 hash
     161        psVector *md5 = psImageMD5(dark->image); // md5 hash
    508162        psString md5string = psMD5toString(md5); // String
    509163        psFree(md5);
     
    513167        psFree(md5string);
    514168
    515         if (!subtractFrame(inRO, darkRO, scale)) {
     169        if (!pmBiasSubtractFrame(in, dark, scale)) {
    516170            return false;
    517171        }
  • trunk/psModules/src/detrend/pmBias.h

    r13920 r14505  
    55 * @author Paul Price, IfA
    66 *
    7  * @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
    8  * @date $Date: 2007-06-20 20:45:00 $
     7 * @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
     8 * @date $Date: 2007-08-15 20:21:18 $
    99 * Copyright 2004--2006 Institute for Astronomy, University of Hawaii
    1010 */
    1111
    12 #ifndef PM__BIAS_H
    13 #define PM__BIAS_H
     12#ifndef PM_BIAS_H
     13#define PM_BIAS_H
    1414
    1515/// @addtogroup detrend Detrend Creation and Application
    1616/// @{
    17 
    18 /// Type of fit to perform
    19 typedef enum {
    20     PM_FIT_NONE,                        ///< No fit
    21     PM_FIT_POLY_ORD,                    ///< Fit ordinary polynomial
    22     PM_FIT_POLY_CHEBY,                  ///< Fit Chebyshev polynomial
    23     PM_FIT_SPLINE                       ///< Fit cubic splines
    24 } pmFit;
    25 
    26 /// Options for overscan subtraction
    27 ///
    28 /// The overscan subtraction may be performed by reducing all overscan regions to a single value (e.g., if
    29 /// there is no structure); or the overscan may be fit perpendicular to the read direction (usually the
    30 /// columns) with a particular functional form; or a single value may be subtracted for each read/scan without
    31 /// fitting (if the structure defies characterisation).  In any case, statistics are required to reduce
    32 /// multiple values to a single value (either for the scan, or for the entire overscan regions).
    33 typedef struct
    34 {
    35     // Inputs
    36     bool single;                        ///< Reduce all overscan regions to a single value?
    37     pmFit fitType;                      ///< Type of fit to overscan
    38     unsigned int order;                 ///< Order of polynomial, or number of spline pieces
    39     psStats *stat;                      ///< Statistic to use when reducing the minor direction
    40     int boxcar;                         ///< Boxcar smoothing radius
    41     float gauss;                        ///< Gaussian smoothing sigma
    42     // Outputs
    43     psPolynomial1D *poly;               ///< Result of polynomial fit
    44     psSpline1D *spline;                 ///< Result of spline fit
    45 }
    46 pmOverscanOptions;
    47 
    48 /// Allocator for overscan options
    49 pmOverscanOptions *pmOverscanOptionsAlloc(bool single, ///< Reduce all overscan regions to a single value?
    50                                           pmFit fitType, ///< Type of fit to overscan
    51                                           unsigned int order, ///< Order of polynomial, or number of splines
    52                                           psStats *stat, ///< Statistic to use
    53                                           int boxcar, ///< Boxcar smoothing radius
    54                                           float gauss ///< Gaussian smoothing sigma
    55                                          );
    5617
    5718/// Subtract the overscan, bias and/or dark
     
    6627                   );
    6728
     29// pmBiasSubtractFrame(): this routine will take as input a readout for the input image and a readout for the bias
     30// image.  The bias image is subtracted in place from the input image.
     31bool pmBiasSubtractFrame(pmReadout *in, // Input readout
     32                          const pmReadout *sub, // Readout to be subtracted from input
     33                          float scale   // Scale to apply before subtracting
     34    );
     35
    6836/// @}
    6937#endif
  • trunk/psModules/src/objects/pmPSFtry.h

    r13898 r14505  
    66 * @author EAM, IfA
    77 *
    8  * @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
    9  * @date $Date: 2007-06-20 02:22:26 $
     8 * @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
     9 * @date $Date: 2007-08-15 20:21:18 $
    1010 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii
    1111 */
     
    107107 */
    108108bool pmPSFtryMetric_Alt(
    109     pmPSFtry *try
    110     ,                      ///< Add comment.
     109    pmPSFtry *try,                      ///< Add comment.
    111110    float RADIUS                        ///< Add comment.
    112111);
  • trunk/psModules/src/objects/pmSource.h

    r14333 r14505  
    33 * @author EAM, IfA; GLG, MHPCC
    44 *
    5  * @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
    6  * @date $Date: 2007-07-20 20:12:59 $
     5 * @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
     6 * @date $Date: 2007-08-15 20:21:18 $
    77 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii
    88 */
     
    7777    float extMag;                       ///< calculated from flux in modelEXT
    7878    float errMag;                       ///< error in psfMag OR extMag (depending on type)
    79     float apMag;               ///< apMag corresponding to psfMag or extMag (depending on type)
    80     float pixWeight;                    // model-weighted coverage of valid pixels
    81     psRegion region;                    // area on image covered by selected pixels
    82     float sky, skyErr;                  //?< The sky and its error at the center of the object
     79    float apMag;                        ///< apMag corresponding to psfMag or extMag (depending on type)
     80    float pixWeight;                    ///< model-weighted coverage of valid pixels
     81    psRegion region;                    ///< area on image covered by selected pixels
     82    float sky, skyErr;                  ///< The sky and its error at the center of the object
    8383}
    8484pmSource;
  • trunk/psModules/src/psmodules.h

    r13898 r14505  
    6161#include <pmMaskBadPixels.h>
    6262#include <pmNonLinear.h>
     63#include <pmOverscan.h>
    6364#include <pmBias.h>
    6465#include <pmShutterCorrection.h>
Note: See TracChangeset for help on using the changeset viewer.