IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changes between Initial Version and Version 1 of IPP_Detection_Bitmasks


Ignore:
Timestamp:
Feb 24, 2009, 4:23:55 PM (17 years ago)
Author:
trac
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • IPP_Detection_Bitmasks

    v1 v1  
     1=== IPP Object Catalog Bit Masks ===
     2
     3The IPP pipeline stores some information about object in the FLAGS value in the CMF file.  These values represent  "bit masks", not standard integer values.  That is, individual bits within the value have meaning, rather than the value itself.  The bit masks for CMF files are
     4
     5<code>
     6<pre>
     7typedef enum {
     8    PM_SOURCE_MODE_DEFAULT    = 0x0000, ///<
     9    PM_SOURCE_MODE_PSFMODEL   = 0x0001, ///< Source fitted with a psf model (linear or non-linear)
     10    PM_SOURCE_MODE_EXTMODEL   = 0x0002, ///< Source fitted with an extended-source model
     11    PM_SOURCE_MODE_FITTED     = 0x0004, ///< Source fitted with non-linear model (PSF or EXT; good or bad)
     12    PM_SOURCE_MODE_FAIL       = 0x0008, ///< Fit (non-linear) failed (non-converge, off-edge, run to zero)
     13    PM_SOURCE_MODE_POOR       = 0x0010, ///< Fit succeeds, but low-SN, high-Chisq, or large (for PSF -- drop?)
     14    PM_SOURCE_MODE_PAIR       = 0x0020, ///< Source fitted with a double psf
     15    PM_SOURCE_MODE_PSFSTAR    = 0x0040, ///< Source used to define PSF model
     16    PM_SOURCE_MODE_SATSTAR    = 0x0080, ///< Source model peak is above saturation
     17    PM_SOURCE_MODE_BLEND      = 0x0100, ///< Source is a blend with other sourcers
     18    PM_SOURCE_MODE_EXTERNAL   = 0x0200, ///< Source based on supplied input position
     19    PM_SOURCE_MODE_BADPSF     = 0x0400, ///< Failed to get good estimate of object's PSF
     20    PM_SOURCE_MODE_DEFECT     = 0x0800, ///< Source is thought to be a defect
     21    PM_SOURCE_MODE_SATURATED  = 0x1000, ///< Source is thought to be saturated pixels (bleed trail)
     22    PM_SOURCE_MODE_CR_LIMIT   = 0x2000, ///< Source has crNsigma above limit
     23    PM_SOURCE_MODE_EXT_LIMIT  = 0x4000, ///< Source has extNsigma above limit
     24    PM_SOURCE_MODE_SUBTRACTED = 0x8000, ///< XXX this flag is actually only used internally (move)
     25} pmSourceMode;
     26</pre>
     27</code>
     28
     29These are defined in the IPP code base in "ipp/psModules/src/objects/pmSource.h"
     30
     31If I were in charge of the Transient Classification Server and only wanted to consider objects that were single PSF-like, I might use the following bitmasks to denote bad and good objects:
     32
     33<code>
     34<pre>
     35badbitmask = PM_SOURCE_MODE_FAIL + PM_SOURCE_MODE_POOR + PM_SOURCE_MODE_SATSTAR + PM_SOURCE_MODE_BLEND +
     36PM_SOURCE_MODE_EXTERNAL + PM_SOURCE_MODE_BADPSF + PM_SOURCE_MODE_DEFECT + PM_SOURCE_MODE_SATURATED +
     37PM_SOURCE_MODE_CR_LIMIT + PM_SOURCE_MODE_EXT_LIMIT
     38
     39goodbitmask = PM_SOURCE_MODE_PSFMODEL + PM_SOURCE_MODE_FITTED
     40</pre>
     41</code>
     42
     43=== Intro to Bit Masks ===
     44
     45[Paul Price]
     46For an introduction to this idea, see:
     47http://en.wikipedia.org/wiki/Bitmask
     48
     49A real quick example may also help.  Let's say I want to encode some
     50boolean values about food.  Below I list some food characteristics, and
     51their mask value in binary and decimal:
     52
     53<code><pre>
     54DELICIOUS       0001 => 1
     55SPICY           0010 => 2
     56CHEAP           0100 => 4
     57MEAT            1000 => 8
     58</pre></code>
     59
     60Now, some typical dishes might be:
     61
     62<code><pre>
     63Lobster         MEAT => 1000 => 8
     64Chicken salad   CHEAP | MEAT => 1100 => 12
     65Chicken curry   DELICIOUS | SPICY | CHEAP | MEAT => 1111 => 15
     66Tofu curry      SPICY | CHEAP => 0110 => 6
     67Spaghetti       DELICIOUS | CHEAP => 0101 => 5
     68</pre></code>
     69
     70Here, the pipe ("|") between symbols means a bitwise OR operation on the
     71mask values (i.e., do an OR for each bit).
     72
     73Now, with such a list, say I want to find something to eat tonight.  I'm
     74in the mood for something spicy, so I go down the list, looking for
     75lines that have the SPICY bit set.  This is done using the "&" (bitwise
     76AND) operation --- look for values for which "value & SPICY" is true.
     77In this case, it could be either chicken curry (value 15) or tofu curry
     78(value 6).  Despite the fact that the values are very different, they
     79both have the appropriate bit set, so they both match the filter.