IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 6, 2008, 10:47:50 AM (18 years ago)
Author:
Paul Price
Message:

Adding multi-darks --- fitting dark current with multi-dimensional polynomial. This allows the dark current to be a function of temperature, or time since PON. To do this, added new file type, DARK. A DARK file is just like an IMAGE, except that it has a table per FITS file that contains the parameters to use in applying the dark. It's kinda like a FRINGE, but there's only one table per file, instead of one table per extension.

Location:
trunk/psModules/src/detrend
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/detrend/Makefile.am

    r14505 r16841  
    1313        pmDetrendDB.c \
    1414        pmShutterCorrection.c \
    15         pmShifts.c
     15        pmShifts.c \
     16        pmDark.c
    1617
    1718#       pmSkySubtract.c
     
    2728        pmDetrendDB.h \
    2829        pmShutterCorrection.h \
    29         pmShifts.h
     30        pmShifts.h \
     31        pmDark.h
    3032
    3133#       pmSkySubtract.h
  • trunk/psModules/src/detrend/pmBias.c

    r15162 r16841  
    113113    }
    114114    if (dark) {
     115        psWarning("Dark processing is now available using pmDark --- perhaps you should use that instead?");
    115116        PS_ASSERT_PTR_NON_NULL(view, false);
    116117        PS_ASSERT_IMAGE_NON_NULL(dark->image, false);
     
    121122
    122123    if (!pmOverscanSubtract (in, overscanOpts)) {
    123         return false;
     124        return false;
    124125    }
    125126
     
    148149        }
    149150
    150         float darkNorm = 1.0;
     151        float darkNorm = 1.0;
    151152        float inNorm = pmFPADarkNorm(in->parent->parent->parent, view, inTime);
    152153
    153         // if we have a normalized dark exposure, we simply multiply the master by inNorm.  if
    154         // we do not have a normalized exposure, we have to scale the master as well.  XXX do
    155         // we need to explicitly identify the master as normalized?
     154        // if we have a normalized dark exposure, we simply multiply the master by inNorm.  if
     155        // we do not have a normalized exposure, we have to scale the master as well.  XXX do
     156        // we need to explicitly identify the master as normalized?
    156157
    157         if (darkTime != 1.0) {
    158             darkNorm = pmFPADarkNorm(dark->parent->parent->parent, view, darkTime);
    159         }
     158        if (darkTime != 1.0) {
     159            darkNorm = pmFPADarkNorm(dark->parent->parent->parent, view, darkTime);
     160        }
    160161
    161         if (isnan(inNorm) || isnan(darkNorm)) {
     162        if (isnan(inNorm) || isnan(darkNorm)) {
    162163            psError(PS_ERR_UNKNOWN, false, "Unable to determine dark normalisations.");
    163164            return false;
  • trunk/psModules/src/detrend/pmDark.c

    r16824 r16841  
    2525static bool ordinateLookup(float *value, // Value of ordinate, to return
    2626                           const char *name, // Name of ordinate (concept name)
     27                           bool scale,  // Scale the value?
     28                           float min, float max, // Minimum and maximum values for scaling
    2729                           const pmReadout *ro // Readout of interest
    2830                           )
     
    6062        psWarning("Non-finite value (%f) of concept %s in readout", *value, name);
    6163        return false;
     64    }
     65    if (scale) {
     66        if (*value < min || *value > max) {
     67            psWarning("Value of concept %s (%f) outside range (%f:%f)", name, *value, min, max);
     68            return false;
     69        }
     70        *value = 2.0 * (*value - min) / (max - min) - 1.0;
    6271    }
    6372
     
    130139
    131140            float value = NAN;          // Value of ordinate
    132             if (!ordinateLookup(&value, ord->name, ro)) {
     141            if (!ordinateLookup(&value, ord->name, ord->scale, ord->min, ord->max, ro)) {
    133142                roMask->data.U8[j] = 0xff;
    134143                val->data.F32[i] = NAN;
    135144                numBadInputs++;
    136145                continue;
    137             }
    138             if (ord->scale) {
    139                 value = 2.0 * (value - ord->min) / (ord->max - ord->min) - 1.0;
    140146            }
    141147            val->data.F32[i] = value;
     
    280286        return false;
    281287    }
    282     PS_ASSERT_ARRAYS_SIZE_EQUAL(dark->readouts, ordinates, false);
    283288
    284289    int numOrdinates = ordinates->n;    // Number of ordinates
     
    287292        pmDarkOrdinate *ord = ordinates->data[i]; // Ordinate of interest
    288293        float value = NAN;              // Value for ordinate
    289         if (!ordinateLookup(&value, ord->name, readout)) {
     294        if (!ordinateLookup(&value, ord->name, ord->scale, ord->min, ord->max, readout)) {
    290295            psError(PS_ERR_UNKNOWN, true, "Unable to find value for %s", ord->name);
    291296            psFree(values);
     
    317322            }
    318323            float value = psPolynomialMDEval(poly, values); // Value of dark current
    319             readout->image->data.F32[y][x] = value;
     324            readout->image->data.F32[y][x] -= value;
    320325            if (readout->mask && !isfinite(value)) {
    321326                readout->mask->data.PS_TYPE_MASK_DATA[y][x] = bad;
Note: See TracChangeset for help on using the changeset viewer.