IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 31, 2006, 3:24:14 PM (20 years ago)
Author:
Paul Price
Message:

ppImage now working again.

File:
1 edited

Legend:

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

    r5858 r6747  
    1 # include "ppImage.h"
     1#include <stdio.h>
     2#include "pslib.h"
     3#include "psmodules.h"
     4#include "ppImage.h"
    25
    36// XXX check on image overlaps, as well as image sizes
     
    1316
    1417    if (options->doDark) {
    15         // Dark time for input image
    16         float inputTime = psMetadataLookupF32(NULL, input->concepts, "CELL.DARKTIME");
    17         if (inputTime <= 0) {
    18             psErrorStackPrint(stderr, "DARKTIME for input image (%f) is non-positive.\n",
    19                               inputTime);
    20             exit(EXIT_FAILURE);
    21         }
     18        // Dark time for input image
     19        float inputTime = psMetadataLookupF32(NULL, input->concepts, "CELL.DARKTIME");
     20        if (inputTime <= 0) {
     21            psErrorStackPrint(stderr, "DARKTIME for input image (%f) is non-positive.\n",
     22                              inputTime);
     23            exit(EXIT_FAILURE);
     24        }
    2225
    23         if (inputTime != lastExptime) {
    24             // this will create a new pedestal if the input one is NULL
    25             // XXX EAM : this function had darkTime * inputTime, which is wrong, yes?
    26             if (pedestal == NULL) {
    27                 pedestal = pmReadoutAlloc (NULL);
    28             }
    29             pedestal->col0    = dark->col0;
    30             pedestal->row0    = dark->row0;
    31             pedestal->colBins = dark->colBins;
    32             pedestal->rowBins = dark->rowBins;
     26        if (inputTime != lastExptime) {
     27            // this will create a new pedestal if the input one is NULL
     28            // XXX EAM : this function had darkTime * inputTime, which is wrong, yes?
     29            if (pedestal == NULL) {
     30                pedestal = pmReadoutAlloc (NULL);
     31            }
     32            pedestal->col0    = dark->col0;
     33            pedestal->row0    = dark->row0;
     34            pedestal->colBins = dark->colBins;
     35            pedestal->rowBins = dark->rowBins;
    3336
    34             pedestal->image   = (psImage *) psBinaryOp(pedestal->image, dark->image, "*", psScalarAlloc(inputTime / darkTime, PS_TYPE_F32));
    35             reusePedestal = false;
    36             lastExptime = inputTime
    37         }
     37            pedestal->image   = (psImage *) psBinaryOp(pedestal->image, dark->image, "*", psScalarAlloc(inputTime / darkTime, PS_TYPE_F32));
     38            reusePedestal = false;
     39            lastExptime = inputTime
     40        }
    3841    }
    3942
    4043    // no bias image, return dark pedestal or NULL
    4144    if (!options->doBias) {
    42         return pedestal;
     45        return pedestal;
    4346    }
    4447
    4548    // no dark image, return bias pedestal, or reuse
    4649    if (!options->doDark) {
    47         if (!pedestal) {
    48             pedestal = psMemIncrRefCounter(bias);
    49         }
    50         return pedestal;
     50        if (!pedestal) {
     51            pedestal = psMemIncrRefCounter(bias);
     52        }
     53        return pedestal;
    5154    }
    5255
    5356    if (reusePedestal) {
    54         return pedestal;
     57        return pedestal;
    5558    }
    5659
    5760    if (bias->image->numRows != dark->image->numRows ||
    58         bias->image->numCols != dark->image->numCols) {
    59         psError(PS_ERR_IO, true, "Bias and dark images have different dimensions: %dx%d vs %dx%d\n",
    60                 bias->image->numCols, bias->image->numRows,
    61                 dark->image->numCols, dark->image->numRows);
    62         exit(EXIT_FAILURE);
     61        bias->image->numCols != dark->image->numCols) {
     62        psError(PS_ERR_IO, true, "Bias and dark images have different dimensions: %dx%d vs %dx%d\n",
     63                bias->image->numCols, bias->image->numRows,
     64                dark->image->numCols, dark->image->numRows);
     65        exit(EXIT_FAILURE);
    6366    }
    6467
     
    7174
    7275// creates a new pedestal image for this readout
    73 // if the current exptime is the same as the last exptime, 
     76// if the current exptime is the same as the last exptime,
    7477// reuses the supplied pedestal
Note: See TracChangeset for help on using the changeset viewer.