IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 17, 2008, 12:16:38 PM (18 years ago)
Author:
Paul Price
Message:

Changing use of psDB* to pmConfig* so that the database handle only has to be set up when required.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/detrend/pmDark.c

    r18132 r18163  
    2525// Look up the value of an ordinate in a readout
    2626static bool ordinateLookup(float *value, // Value of ordinate, to return
    27                            bool *inRange, // is value within min : max range?
     27                           bool *inRange, // is value within min : max range?
    2828                           const char *name, // Name of ordinate (concept name)
    2929                           bool scale,  // Scale the value?
     
    7070        if (*value < min || *value > max) {
    7171            psWarning("Value of concept %s (%f) outside range (%f:%f)", name, *value, min, max);
    72             *inRange = false;
     72            *inRange = false;
    7373        }
    7474        *value = 2.0 * (*value - min) / (max - min) - 1.0;
     
    175175                continue;
    176176            }
    177             if (!inRange) {
     177            if (!inRange) {
    178178                roMask->data.U8[j] = 0xff;
    179179                val->data.F32[i] = NAN;
     
    282282                    mask->data.PS_TYPE_MASK_DATA[r] = readout->mask->data.PS_TYPE_MASK_DATA[yIn][xIn];
    283283                }
    284            
    285             }
    286 
    287             // XXX test
    288             if (0 && (i == 377) && (j == 80)) {
    289                 FILE *f = fopen ("test.dat", "w");     
    290                 for (int r = 0; r < inputs->n; r++) {
    291                     fprintf (f, "%d %d  %d  ", i, j, mask->data.U8[r]);
    292                     psVector *value = values->data[r];
    293                     for (int tmpj = 0; tmpj < value->n; tmpj++) {
    294                         fprintf (f, "%f ", value->data.F32[tmpj]);
    295                     }
    296                     fprintf (f, "%f\n", pixels->data.F32[r]);
    297                 }
    298                 fclose (f);
    299             }
     284
     285            }
     286
     287            // XXX test
     288            if (0 && (i == 377) && (j == 80)) {
     289                FILE *f = fopen ("test.dat", "w");
     290                for (int r = 0; r < inputs->n; r++) {
     291                    fprintf (f, "%d %d  %d  ", i, j, mask->data.U8[r]);
     292                    psVector *value = values->data[r];
     293                    for (int tmpj = 0; tmpj < value->n; tmpj++) {
     294                        fprintf (f, "%f ", value->data.F32[tmpj]);
     295                    }
     296                    fprintf (f, "%f\n", pixels->data.F32[r]);
     297                }
     298                fclose (f);
     299            }
    300300
    301301            if (!psPolynomialMDClipFit(poly, pixels, NULL, mask, maskVal, values, iter, rej)) {
     
    426426}
    427427
    428 bool pmFPAWriteDark(pmFPA *fpa, psFits *fits, psDB *db, bool blank, bool recurse)
     428bool pmFPAWriteDark(pmFPA *fpa, psFits *fits, pmConfig *config, bool blank, bool recurse)
    429429{
    430430    PS_ASSERT_PTR_NON_NULL(fpa, false);
    431431    PS_ASSERT_FITS_NON_NULL(fits, false);
    432432
    433     if (!pmFPAWrite(fpa, fits, db, blank, recurse)) {
     433    if (!pmFPAWrite(fpa, fits, config, blank, recurse)) {
    434434        psError(PS_ERR_IO, false, "Unable to write FPA dark images");
    435435        return false;
     
    481481}
    482482
    483 bool pmChipWriteDark(pmChip *chip, psFits *fits, psDB *db, bool blank, bool recurse)
     483bool pmChipWriteDark(pmChip *chip, psFits *fits, pmConfig *config, bool blank, bool recurse)
    484484{
    485485    PS_ASSERT_PTR_NON_NULL(chip, false);
    486486    PS_ASSERT_FITS_NON_NULL(fits, false);
    487487
    488     if (!pmChipWrite(chip, fits, db, blank, recurse)) {
     488    if (!pmChipWrite(chip, fits, config, blank, recurse)) {
    489489        psError(PS_ERR_IO, false, "Unable to write chip dark images");
    490490        return false;
     
    532532}
    533533
    534 bool pmCellWriteDark(pmCell *cell, psFits *fits, psDB *db, bool blank)
     534bool pmCellWriteDark(pmCell *cell, psFits *fits, pmConfig *config, bool blank)
    535535{
    536536    PS_ASSERT_PTR_NON_NULL(cell, false);
     
    538538
    539539    // Allow the usual pmFPAWrite functions to handle the heavy lifting for the images
    540     if (!pmCellWrite(cell, fits, db, blank)) {
     540    if (!pmCellWrite(cell, fits, config, blank)) {
    541541        psError(PS_ERR_UNKNOWN, false, "Unable to write dark cell.");
    542542        return false;
     
    623623
    624624
    625 bool pmFPAReadDark(pmFPA *fpa, psFits *fits, psDB *db)
     625bool pmFPAReadDark(pmFPA *fpa, psFits *fits, pmConfig *config)
    626626{
    627627    PS_ASSERT_PTR_NON_NULL(fpa, false);
    628628    PS_ASSERT_FITS_NON_NULL(fits, false);
    629629
    630     if (!pmFPARead(fpa, fits, db)) {
     630    if (!pmFPARead(fpa, fits, config)) {
    631631        psError(PS_ERR_UNKNOWN, false, "Unable to read dark FPA.");
    632632        return false;
     
    658658}
    659659
    660 bool pmChipReadDark(pmChip *chip, psFits *fits, psDB *db)
     660bool pmChipReadDark(pmChip *chip, psFits *fits, pmConfig *config)
    661661{
    662662    PS_ASSERT_PTR_NON_NULL(chip, false);
    663663    PS_ASSERT_FITS_NON_NULL(fits, false);
    664664
    665     if (!pmChipRead(chip, fits, db)) {
     665    if (!pmChipRead(chip, fits, config)) {
    666666        psError(PS_ERR_UNKNOWN, false, "Unable to read dark chip.");
    667667        return false;
     
    690690
    691691
    692 bool pmCellReadDark(pmCell *cell, psFits *fits, psDB *db)
     692bool pmCellReadDark(pmCell *cell, psFits *fits, pmConfig *config)
    693693{
    694694    PS_ASSERT_PTR_NON_NULL(cell, false);
     
    696696
    697697    // Allow the usual pmFPARead functions to handle the heavy lifting for the images
    698     if (!pmCellRead(cell, fits, db)) {
     698    if (!pmCellRead(cell, fits, config)) {
    699699        psError(PS_ERR_UNKNOWN, false, "Unable to read dark cell.");
    700700        return false;
Note: See TracChangeset for help on using the changeset viewer.