IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 13591


Ignore:
Timestamp:
Jun 1, 2007, 5:51:03 PM (19 years ago)
Author:
Paul Price
Message:

Adding pmConfigMask to use symbolic names for mask values. Need to adapt APIs that use mask values to accept the values for those masks (which can be obtained from pmConfigMask).

Location:
trunk/psModules/src
Files:
2 added
9 edited

Legend:

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

    r12696 r13591  
    9393//////////////////////////////////////////////////////////////////////////////////////////////////////////////
    9494
    95 bool pmReadoutSetMask(pmReadout *readout)
     95bool pmReadoutSetMask(pmReadout *readout, psMaskType satMask, psMaskType badMask)
    9696{
    9797    PS_ASSERT_PTR_NON_NULL(readout, false);
     
    131131        for (int j = 0; j < image->numCols; j++) {
    132132            if (imageData[i][j] >= saturation) {
    133                 maskData[i][j] |= PM_MASK_SAT;
     133                maskData[i][j] |= satMask;
    134134            }
    135135            if (imageData[i][j] <= bad) {
    136                 maskData[i][j] |= PM_MASK_BAD;
     136                maskData[i][j] |= badMask;
    137137            }
    138138        }
     
    145145// pixels.  currently, it will set mask bits if (value <= BAD) or (value >= SATURATION)
    146146// should we optionally ignore these tests?
    147 bool pmReadoutGenerateMask(pmReadout *readout)
     147bool pmReadoutGenerateMask(pmReadout *readout, psMaskType satMask, psMaskType badMask)
    148148{
    149149    PS_ASSERT_PTR_NON_NULL(readout, false);
     
    188188    }
    189189
    190     return pmReadoutSetMask(readout);
     190    return pmReadoutSetMask(readout, satMask, badMask);
    191191}
    192192
     
    282282}
    283283
    284 bool pmReadoutGenerateMaskWeight(pmReadout *readout, bool poisson)
     284bool pmReadoutGenerateMaskWeight(pmReadout *readout, psMaskType satMask, psMaskType badMask, bool poisson)
    285285{
    286286    PS_ASSERT_PTR_NON_NULL(readout, false);
     
    288288    bool success = true;                // Was everything successful?
    289289
    290     success &= pmReadoutGenerateMask(readout);
     290    success &= pmReadoutGenerateMask(readout, satMask, badMask);
    291291    success &= pmReadoutGenerateWeight(readout, poisson);
    292292
     
    294294}
    295295
    296 bool pmCellGenerateMaskWeight(pmCell *cell, bool poisson)
     296bool pmCellGenerateMaskWeight(pmCell *cell, psMaskType satMask, psMaskType badMask, bool poisson)
    297297{
    298298    PS_ASSERT_PTR_NON_NULL(cell, false);
     
    302302    for (int i = 0; i < readouts->n; i++) {
    303303        pmReadout *readout = readouts->data[i]; // The readout
    304         pmReadoutGenerateMaskWeight(readout, poisson);
     304        pmReadoutGenerateMaskWeight(readout, poisson, satMask, badMask);
    305305    }
    306306
  • trunk/psModules/src/camera/pmFPAMaskWeight.h

    r12696 r13591  
    55 * @author Eugene Magnier, IfA
    66 *
    7  * @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
    8  * @date $Date: 2007-03-30 21:12:56 $
     7 * @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
     8 * @date $Date: 2007-06-02 03:51:03 $
    99 * Copyright 2005-2006 Institute for Astronomy, University of Hawaii
    1010 */
     
    1616/// @{
    1717
     18#if 0
    1819/// Pixel mask values
    1920typedef enum {
    20     PM_MASK_CLEAR   = 0x00,   ///< The pixel is not masked
    21     PM_MASK_TRAP    = 0x01,   ///< The pixel is a charge trap.
    22     PM_MASK_BADCOL  = 0x02,   ///< The pixel is a bad column.
    23     PM_MASK_SAT     = 0x04,   ///< The pixel is saturated.
    24     PM_MASK_BAD     = 0x08,   ///< The pixel is low
    25     PM_MASK_FLAT    = 0x10,   ///< The pixel is non-positive in the flat-field.
    26     PM_MASK_MARK    = 0x20,   ///< The pixel is marked as temporarily ignored
    27     PM_MASK_EXT1    = 0x40,   ///< This mask value is not used
    28     PM_MASK_EXT2    = 0x80,   ///< This mask value is not used
     21    PM_MASK_CLEAR    = 0x00,            ///< The pixel is not masked
     22    PM_MASK_BLANK    = 0x01,            ///< The pixel is blank or has no (valid) data
     23    PM_MASK_FLAT     = 0x02,            ///< The pixel is non-positive in the flat-field
     24    PM_MASK_DETECTOR = 0x02,            ///< The detector pixel is bad (e.g., bad column, charge trap)
     25    PM_MASK_SAT      = 0x04,            ///< The pixel is saturated in the image of interest
     26    PM_MASK_BAD      = 0x04,            ///< The pixel is low in the image of interest
     27    PM_MASK_RANGE    = 0x04,            ///< The pixel is out of range in the image of interest
     28    PM_MASK_CR       = 0x08,            ///< The pixel is probably a CR
     29    PM_MASK_SPARE1   = 0x10,            ///< Spare mask value
     30    PM_MASK_SPARE2   = 0x20,            ///< Spare mask value
     31    PM_MASK_SUSPECT  = 0x40,            ///< The pixel is suspected of being bad, but may not be
     32    PM_MASK_MARK     = 0x80,            ///< The pixel is marked as temporarily ignored
    2933} pmMaskValue;
    30 
     34#else
     35#define PM_MASK_MARK 0x80            ///< The pixel is marked as temporarily ignored
     36#define PM_MASK_SAT  0x04            ///< The pixel is saturated in the image of interest
     37#endif
    3138
    3239/// Set a temporary readout mask using CELL.SATURATION and CELL.BAD
     
    3542/// within the readout is temporary --- it is not added to the HDU.  This is intended for when the user is
    3643/// iterating using pmReadoutReadNext, in which case the HDU can't be generated.
    37 bool pmReadoutSetMask(pmReadout *readout ///< Readout for which to set mask
    38                      );
     44bool pmReadoutSetMask(pmReadout *readout, ///< Readout for which to set mask
     45                      psMaskType sat,   ///< Mask value to give saturated pixels
     46                      psMaskType bad    ///< Mask value to give bad (low) pixels
     47    );
    3948
    4049
     
    5362/// Identifies pixels that are saturated (>= CELL.SATURATION) or bad (<= CELL.BAD).  The mask that is produced
    5463/// is suitable for output (complete with HDU entry).  This is intended for most operations.
    55 bool pmReadoutGenerateMask(pmReadout *readout ///< Readout for which to generate mask
    56                           );
     64bool pmReadoutGenerateMask(pmReadout *readout, ///< Readout for which to generate mask
     65                           psMaskType sat, ///< Mask value to give saturated pixels
     66                           psMaskType bad ///< Mask value to give bad (low) pixels
     67    );
    5768
    5869/// Generate a weight map (suitable for output) using CELL.GAIN and CELL.READNOISE
     
    6980/// Calls pmReadoutGenerateMask and pmReadoutGenerateWeight for the readout
    7081bool pmReadoutGenerateMaskWeight(pmReadout *readout, ///< Readout for which to generate mask and weights
    71                                  bool poisson    ///< Use poisson weights (in addition to read noise)?
     82                                 psMaskType sat, ///< Mask value to give saturated pixels
     83                                 psMaskType bad, ///< Mask value to give bad (low) pixels
     84                                 bool poisson ///< Use poisson weights (in addition to read noise)?
    7285                                );
    7386
     
    7689/// Calls pmReadoutGenerateMaskWeight for each readout within the cell.
    7790bool pmCellGenerateMaskWeight(pmCell *cell, ///< Cell for which to generate mask and weights
    78                               bool poisson    ///< Use poisson weights (in addition to read noise)?
     91                              psMaskType sat, ///< Mask value to give saturated pixels
     92                              psMaskType bad, ///< Mask value to give bad (low) pixels
     93                              bool poisson ///< Use poisson weights (in addition to read noise)?
    7994                             );
    8095/// @}
  • trunk/psModules/src/config/Makefile.am

    r11550 r13591  
    88    pmConfigCamera.c \
    99    pmConfigCommand.c \
     10    pmConfigMask.c \
    1011    pmVersion.c \
    1112    pmErrorCodes.c
     
    1617    pmConfigCamera.h \
    1718    pmConfigCommand.h \
     19    pmConfigMask.h \
    1820    pmVersion.h \
    1921    pmErrorCodes.h
  • trunk/psModules/src/detrend/pmFlatField.c

    r12696 r13591  
    1212#include "pmFlatField.h"
    1313
    14 bool pmFlatField(pmReadout *in, const pmReadout *flat)
     14bool pmFlatField(pmReadout *in, const pmReadout *flat, psMaskType badFlat)
    1515{
    1616    PS_ASSERT_PTR_NON_NULL(in, false);
     
    7979            if (flatValue <= 0.0 || (flatMask && flatMask->data.U8[j + yOffset][i + xOffset])) { \
    8080                if (inMask) { \
    81                     inMask->data.U8[j][i] |= PM_MASK_FLAT; \
     81                    inMask->data.PS_TYPE_MASK_DATA[j][i] |= badFlat; \
    8282                } \
    8383                inImage->data.TYPE[j][i] = SPECIAL; \
  • trunk/psModules/src/detrend/pmFlatField.h

    r12696 r13591  
    55 * @author Paul Price, IfA
    66 *
    7  * @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
    8  * @date $Date: 2007-03-30 21:12:56 $
     7 * @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
     8 * @date $Date: 2007-06-02 03:51:03 $
    99 * Copyright 2004-2006 Institute for Astronomy, University of Hawaii
    1010 */
     
    2424/// are masked, if there is a mask present in the input readout.
    2525bool pmFlatField(pmReadout *in,         ///< Readout with input image
    26                  const pmReadout *flat  ///< Readout with flat image
     26                 const pmReadout *flat,  ///< Readout with flat image
     27                 psMaskType badFlat     ///< Mask value to give bad flat pixels
    2728                );
    2829/// @}
  • trunk/psModules/src/detrend/pmMaskBadPixels.c

    r12696 r13591  
    6666            }
    6767        }
    68     } else {
    69         // set raised pixels in exMask which are selected by maskVal
    70         for (int j = 0; j < inMask->numRows; j++) {
    71             int xJ = j - offRow;
    72             for (int i = 0; i < inMask->numCols; i++) {
    73                 int xI = i - offCol;
    74                 if (exVal[xJ][xI] == 0) {
    75                     inVal[j][i] |= PM_MASK_BAD;
    76                 }
    77             }
    78         }
    7968    }
    8069
     
    8271    psString timeString = psTimeToISO(time); // String with time
    8372    psFree(time);
    84     psStringPrepend(&timeString, "Static mask applied at ");
     73    psStringPrepend(&timeString, "Static mask (selecting %x) applied at ", maskVal);
    8574    psMetadataAddStr(hdu->header, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK,
    8675                     timeString, "");
  • trunk/psModules/src/imcombine/pmReadoutCombine.c

    r12696 r13591  
    2929    params->combine = combine;
    3030    params->maskVal = 0;
     31    params->blank = 0;
    3132    params->nKeep = 0;
    3233    params->fracHigh = 0.0;
     
    335336
    336337            if (numValid == 0) {
    337                 outputMask[yOut][xOut] = PM_MASK_FLAT;
     338                outputMask[yOut][xOut] = params->blank;
    338339                outputImage[yOut][xOut] = NAN;
    339340                continue;
  • trunk/psModules/src/imcombine/pmReadoutCombine.h

    r12696 r13591  
    11/* @file  pmReadoutCombine.h
    22 * @brief Combine multiple readouts
    3  * 
     3 *
    44 * @author George Gusciora, MHPCC
    55 * @author Paul Price, IfA
    6  * 
    7  * @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
    8  * @date $Date: 2007-03-30 21:12:56 $
     6 *
     7 * @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
     8 * @date $Date: 2007-06-02 03:51:03 $
    99 * Copyright 2004-2006 Institute for Astronomy, University of Hawaii
    1010 */
     
    2424    psStatsOptions combine;             ///< Statistic to use when performing the combination
    2525    psMaskType maskVal;                 ///< Mask value
     26    psMaskType blank;                   ///< Mask value to give blank (i.e., no data) pixels
    2627    int nKeep;                          ///< Mimimum number of pixels to keep
    2728    float fracHigh;                     ///< Fraction of high pixels to immediately throw
  • trunk/psModules/src/psmodules.h

    r13457 r13591  
    2424#include <pmConfigCamera.h>
    2525#include <pmConfigCommand.h>
     26#include <pmConfigMask.h>
    2627#include <pmVersion.h>
    2728
Note: See TracChangeset for help on using the changeset viewer.