IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 7254


Ignore:
Timestamp:
May 31, 2006, 12:51:15 PM (20 years ago)
Author:
Paul Price
Message:

Changes to HDU generation: don't add chips/cells that have their own HDU; remove error message when there's no cells (it just means it's an empty PHU); don't recurse to lower levels.

Location:
trunk/psModules/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/camera/pmHDUGenerate.c

    r7168 r7254  
    2626    for (int i = 0; i < cells->n; i++) {
    2727        pmCell *cell = cells->data[i];  // A cell
    28         result |= psListAdd(list, PS_LIST_TAIL, cell);
     28        if (!cell->hdu) {               // Don't add cells that have their own HDU
     29            result |= psListAdd(list, PS_LIST_TAIL, cell);
     30        }
    2931    }
    3032
     
    4446    for (int i = 0; i < chips->n; i++) {
    4547        pmChip *chip = chips->data[i];  // A chip
    46         result |= addCellsFromChip(list, chip);
     48        if (! chip->hdu) {              // Don't add chips that have their own HDU
     49            result |= addCellsFromChip(list, chip);
     50        }
    4751    }
    4852
     
    263267    }
    264268    if (numReadouts == 0 || type == 0) {
    265         psError(PS_ERR_IO, true, "Unable to find images within HDU.\n");
     269        // Nothing from which to create an HDU
    266270        psFree(cells);
    267271        return false;
  • trunk/psModules/src/imcombine/pmReadoutCombine.c

    r7204 r7254  
    55 *  @author GLG, MHPCC
    66 *
    7  *  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2006-05-25 04:06:28 $
     7 *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2006-05-31 22:51:15 $
    99 *
    1010 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2525//////////////////////////////////////////////////////////////////////////////////////////////////////////////
    2626
     27#if 1
    2728// Return the statistic of interest
    2829static double getStat(const psStats *stats, // Statistics structure
     
    5859    return NAN;
    5960}
     61#endif
    6062
    6163// Mask for combination --- used only locally
     
    140142    long minInputCols = LONG_MAX;       // The smallest input column value
    141143    long minInputRows = LONG_MAX;       // The smallest input row value
    142     psVector *rowLower = psVectorAlloc(inputs->n, PS_TYPE_U32); // The lower y bound for each image
    143     psVector *rowUpper = psVectorAlloc(inputs->n, PS_TYPE_U32); // The upper y bound for each image
    144     psVector *colLower = psVectorAlloc(inputs->n, PS_TYPE_U32); // The lower x bound for each image
    145     psVector *colUpper = psVectorAlloc(inputs->n, PS_TYPE_U32); // The upper x bound for each image
    146     rowLower->n = inputs->n;
    147     rowUpper->n = inputs->n;
    148     colLower->n = inputs->n;
    149     colUpper->n = inputs->n;
    150144    psVector *mask   = psVectorAlloc(inputs->n, PS_TYPE_U8); // Mask for stack
    151145    mask->n = inputs->n;
     
    181175        psTrace(__func__, 7, "Readout %d: offset %d,%d; size %dx%d\n", i,
    182176                readout->col0, readout->row0, readout->image->numCols, readout->image->numRows);
    183         // Bounds of input image
    184         rowLower->data.U32[i] = readout->row0;
    185         colLower->data.U32[i] = readout->col0;
    186         rowUpper->data.U32[i] = readout->row0 + readout->image->numRows;
    187         colUpper->data.U32[i] = readout->col0 + readout->image->numCols;
    188177    }
    189178    if (!valid) {
     
    270259    psMaskType maskVal = params->maskVal; // The mask value
    271260
    272     psTrace(__func__, 3, "Iterating %d --> %d, %d --> %d\n",
     261    psTrace(__func__, 3, "Iterating output: %d --> %d, %d --> %d\n",
    273262            minInputCols - output->col0, maxInputCols - output->col0,
    274263            minInputRows - output->row0, maxInputRows - output->row0);
     264    if (psTraceGetLevel(__func__) >= 3) {
     265        for (int r = 0; r < inputs->n; r++) {
     266            pmReadout *readout = inputs->data[r]; // Input readout
     267            psTrace(__func__, 3, "Iterating input %d: %d --> %d, %d --> %d\n", r,
     268                    minInputCols - readout->col0, maxInputCols - readout->col0,
     269                    minInputRows - readout->row0, maxInputRows - readout->row0);
     270        }
     271    }
    275272
    276273    for (int i = minInputRows; i < maxInputRows; i++) {
     274        if (psTraceGetLevel(__func__) > 9) {
     275            printf("Processing row %d\r", i);
     276            fflush(stdout);
     277        }
    277278        for (int j = minInputCols; j < maxInputCols; j++) {
    278279
    279280            int numValid = 0;           // Number of valid pixels in the stack
    280281            for (int r = 0; r < inputs->n; r++) {
    281                 // Check existence and bounds
    282                 if (mask->data.U8[r] & PM_READOUT_COMBINE_NO_IMAGE ||
    283                         i <  colLower->data.U32[r] ||
    284                         i >= colUpper->data.U32[r] ||
    285                         j <  rowLower->data.U32[r] ||
    286                         j >= rowUpper->data.U32[r]) {
    287                     continue;
    288                 }
    289 
    290282                pmReadout *readout = inputs->data[r]; // Input readout
    291283                int yIn = i - readout->row0; // y position on input readout
    292284                int xIn = j - readout->col0; // x position on input readout
     285
     286                // Check existence and bounds
     287                if (mask->data.U8[r] & PM_READOUT_COMBINE_NO_IMAGE ||
     288                        xIn < 0 || xIn >= readout->image->numCols ||
     289                        yIn < 0 || yIn >= readout->image->numRows) {
     290                    continue;
     291                }
     292
     293                // Check mask
    293294                if (readout->mask && readout->mask->data.U8[yIn][xIn] & maskVal) {
    294295                    mask->data.U8[r] &= PM_READOUT_COMBINE_MASKED;
     
    317318            int yOut = i - output->row0; // y position on output readout
    318319            int xOut = j - output->col0; // x position on output readout
    319             psTrace(__func__, 10, "Output pixel: %d %d\n", xOut, yOut);
    320320
    321321            if (numValid == 0) {
    322322                output->mask->data.U8[yOut][xOut] = PM_MASK_FLAT;
     323                output->image->data.F32[yOut][xOut] = NAN;
    323324                continue;
    324325            }
    325326
    326327            // Apply fracLow,fracHigh if there are enough pixels
    327             if (numValid * keepFrac >= params->nKeep) {
     328            if (numValid * keepFrac >= params->nKeep && keepFrac != 1.0) {
    328329                index = psVectorSortIndex(index, pixels);
    329330                int numLow = numValid * params->fracLow; // Number of low pixels to clip
     
    359360        }
    360361    }
     362    if (psTraceGetLevel(__func__) > 9) {
     363        printf("\n");
     364    }
    361365
    362366    psFree(index);
    363     psFree(rowLower);
    364     psFree(rowUpper);
    365     psFree(colLower);
    366     psFree(colUpper);
    367367    psFree(pixels);
    368368    psFree(mask);
Note: See TracChangeset for help on using the changeset viewer.