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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.