SAS 10 FLAGS

There is a flag page here: http://web01.psps.ifa.hawaii.edu/psps-trac/wiki/PSPSFAQ which is out of date.

Some decent description of the flags (but warning these are out of date, just use for more explanations than given below)

Here is the short version (who has flags and where they come from)

type flags column name definition
detectionfull infoFlag DVO dbflags << 45 | smf FLAGS2 << 32 | smf FLAGS
stackdetectionfull infoFlag DVO dbflags << 45 | cmf FLAGS2 << 32 | cmf FLAGS
objects objInfoFlag FLAGS from the DVO 'average'
objects xFlag FLAGS from the DVO 'secfilt' (with one bit moved)

* dvo flags come from: http://svn.pan-starrs.ifa.hawaii.edu/trac/ipp/browser/trunk/Ohana/src/libdvo/include/dvo.h

* smf/cmf flags come from: http://svn.pan-starrs.ifa.hawaii.edu/trac/ipp/browser/trunk/psModules/src/objects/pmSourceMasks.h

Below is each of the current flags (for sa10)

DetectionFull.infoFlags and StackDetectionFull.infoFlag - Lower 32 bits (From smf/cmf FLAGS)

    PM_SOURCE_MODE_DEFAULT                = 0x00000000, ///< Initial value: resets all bits
    PM_SOURCE_MODE_PSFMODEL               = 0x00000001, ///< Source fitted with a psf model (linear or non-linear)
    PM_SOURCE_MODE_EXTMODEL               = 0x00000002, ///< Source fitted with an extended-source model
    PM_SOURCE_MODE_FITTED                 = 0x00000004, ///< Source fitted with non-linear model (PSF or EXT; good or bad)
    PM_SOURCE_MODE_FAIL                   = 0x00000008, ///< Fit (non-linear) failed (non-converge, off-edge, run to zero)
    PM_SOURCE_MODE_POOR                   = 0x00000010, ///< Fit succeeds, but low-SN, high-Chisq, or large (for PSF -- drop?)
    PM_SOURCE_MODE_PAIR                   = 0x00000020, ///< Source fitted with a double psf
    PM_SOURCE_MODE_PSFSTAR                = 0x00000040, ///< Source used to define PSF model
    PM_SOURCE_MODE_SATSTAR                = 0x00000080, ///< Source model peak is above saturation
    PM_SOURCE_MODE_BLEND                  = 0x00000100, ///< Source is a blend with other sources
    PM_SOURCE_MODE_EXTERNAL               = 0x00000200, ///< Source based on supplied input position
    PM_SOURCE_MODE_BADPSF                 = 0x00000400, ///< Failed to get good estimate of object's PSF
    PM_SOURCE_MODE_DEFECT                 = 0x00000800, ///< Source is thought to be a defect
    PM_SOURCE_MODE_SATURATED              = 0x00001000, ///< Source is thought to be saturated pixels (bleed trail)
    PM_SOURCE_MODE_CR_LIMIT               = 0x00002000, ///< Source has crNsigma above limit
    PM_SOURCE_MODE_EXT_LIMIT              = 0x00004000, ///< Source has extNsigma above limit
    PM_SOURCE_MODE_MOMENTS_FAILURE        = 0x00008000, ///< could not measure the moments
    PM_SOURCE_MODE_SKY_FAILURE            = 0x00010000, ///< could not measure the local sky
    PM_SOURCE_MODE_SKYVAR_FAILURE         = 0x00020000, ///< could not measure the local sky variance
    PM_SOURCE_MODE_BELOW_MOMENTS_SN       = 0x00040000, ///< moments not measured due to low S/N
    PM_SOURCE_MODE_BIG_RADIUS             = 0x00100000, ///< poor moments for small radius, try large radius
    PM_SOURCE_MODE_AP_MAGS                = 0x00200000, ///< source has an aperture magnitude
    PM_SOURCE_MODE_BLEND_FIT              = 0x00400000, ///< source was fitted as a blend
    PM_SOURCE_MODE_EXTENDED_FIT           = 0x00800000, ///< full extended fit was used
    PM_SOURCE_MODE_EXTENDED_STATS         = 0x01000000, ///< extended aperture stats calculated
    PM_SOURCE_MODE_LINEAR_FIT             = 0x02000000, ///< source fitted with the linear fit
    PM_SOURCE_MODE_NONLINEAR_FIT          = 0x04000000, ///< source fitted with the non-linear fit
    PM_SOURCE_MODE_RADIAL_FLUX            = 0x08000000, ///< radial flux measurements calculated
    PM_SOURCE_MODE_SIZE_SKIPPED           = 0x10000000, ///< size could not be determined
    PM_SOURCE_MODE_ON_SPIKE               = 0x20000000, ///< peak lands on diffraction spike
    PM_SOURCE_MODE_ON_GHOST               = 0x40000000, ///< peak lands on ghost or glint
    PM_SOURCE_MODE_OFF_CHIP               = 0x80000000, ///< peak lands off edge of chip

Example to select detections which are extended (sgSep > 3)

    WHERE (DetectionFull.infoFlag & 0x4000 != 0)

To find stack detections that have radial aperture measurements

    WHERE (StackDetectionFull.infoFlag & 0x08000000 != 0)

DetectionFull.infoFlag and StackDetectionFull.infoFlag - Upper 32 bits part 1 - (From smf/cmf FLAGS2 shifted 32 bits left)

    PM_SOURCE_MODE2_DEFAULT               = 0x00000000, ///< Initial value: resets all bits
    PM_SOURCE_MODE2_DIFF_WITH_SINGLE      = 0x00000001, ///< diff source matched to a single positive detection
    PM_SOURCE_MODE2_DIFF_WITH_DOUBLE      = 0x00000002, ///< diff source matched to positive detections in both images
    PM_SOURCE_MODE2_MATCHED               = 0x00000004, ///< diff source matched to positive detections in both images
    PM_SOURCE_MODE2_ON_SPIKE              = 0x00000008, ///< > 25% of (PSF-weighted) pixels land on diffraction spike
    PM_SOURCE_MODE2_ON_STARCORE           = 0x00000010, ///< > 25% of (PSF-weighted) pixels land on starcore
    PM_SOURCE_MODE2_ON_BURNTOOL           = 0x00000020, ///< > 25% of (PSF-weighted) pixels land on burntool
    PM_SOURCE_MODE2_ON_CONVPOOR           = 0x00000040, ///< > 25% of (PSF-weighted) pixels land on convpoor
    PM_SOURCE_MODE2_PASS1_SRC             = 0x00000080, ///< source detected in first pass analysis
    PM_SOURCE_MODE2_HAS_BRIGHTER_NEIGHBOR = 0x00000100, ///< peak is not the brightest in its footprint
    PM_SOURCE_MODE2_BRIGHT_NEIGHBOR_1     = 0x00000200, ///< flux_n / (r^2 flux_p) > 1
    PM_SOURCE_MODE2_BRIGHT_NEIGHBOR_10    = 0x00000400, ///< flux_n / (r^2 flux_p) > 10
    PM_SOURCE_MODE2_DIFF_SELF_MATCH       = 0x00000800, ///< positive detection match is probably this source 
    PM_SOURCE_MODE2_SATSTAR_PROFILE       = 0x00001000, ///< saturated source is modeled with a radial profile

Example to exclude "matched" stack detections (If set the detection values are from forced photometry). 

    WHERE CAST(StackDetectionFull.infoFlag / 0x100000000 AS INT) & 4 = 0

To exclude detections from very bright saturated objects that were modeled with a radial profile

    WHERE CAST(StackDetectionFull.infoFlag / 0x100000000 AS INT) & 0x1000 = 0

(Note this will never set for single frame detections since that mode of psphot is only used for stack photometry)

DetectionFull.infoFlag and StackDetectionFull - Upper bits part 2 - (From DVO db (Measure) Flags shifted left 45 bits)

    ID_MEAS_NOCAL          = 0x00000001,  // detection ignored for this analysis (photcode, time range) -- internal only
    ID_MEAS_POOR_PHOTOM    = 0x00000002,  // detection is photometry outlier                                               
    ID_MEAS_SKIP_PHOTOM    = 0x00000004,  // detection was ignored for photometry measurement                               
    ID_MEAS_AREA           = 0x00000008,  // detection near image edge                                                 
    ID_MEAS_POOR_ASTROM    = 0x00000010,  // detection is astrometry outlier                                               
    ID_MEAS_SKIP_ASTROM    = 0x00000020,  // detection was ignored for astrometry measurement                               
    ID_MEAS_USED_OBJ       = 0x00000040,  // detection was used during update objects 
    ID_MEAS_USED_CHIP      = 0x00000080,  // detection was used during update chips (XXX this probably does not make it into the db)
    ID_MEAS_BLEND_MEAS     = 0x00000100,  // detection is within radius of multiple objects
    ID_MEAS_BLEND_OBJ      = 0x00000200,  // multiple detections within radius of object
    ID_MEAS_UNDEF_3        = 0x00000400,  // unused
    ID_MEAS_UNDEF_4        = 0x00000800,  // unused
    ID_MEAS_BLEND_MEAS_X   = 0x00001000,  // detection is within radius of multiple objects across catalogs                   
    ID_MEAS_ARTIFACT       = 0x00002000,  // detection is thought to be non-astronomical                               
    ID_MEAS_UNDEF_5        = 0x00004000,  // unused
    ID_MEAS_PHOTOM_UBERCAL = 0x00008000,  // externally-supplied zero point from ubercal analysis
    ID_MEAS_STACK_PRIMARY  = 0x00010000,  // externally-supplied zero point from ubercal analysis                   
    ID_MEAS_STACK_PHOT_SRC = 0x00020000,  // this measurement supplied the stack photometry

Example to select the StackDetections that supplied their Object's values for the "stack columns"

    WHERE (CAST(StackDetectionFull.infoFlag / 0x200000000000 AS INT) & 0x20000) != 0

Object.objInfoFlags

  ID_STAR_FEW       = 0x00000001, // used within relphot: skip star
  ID_STAR_POOR      = 0x00000002, // used within relphot: skip star
  * ID_PROPER         = 0x00000400, // star with large proper motion
  * ID_TRANSIENT      = 0x00001000, // is this mutually exclusive with USNO?
  * ID_VARIABLE       = 0x00002000, // not currently set?
  * ID_ASTEROID       = 0x00002000, // identified with an asteroid
  * ID_BAD_OBJECT     = 0x00004000, // if all measurements are bad, set this bit
  * ID_MOVING         = 0x00008000, // is a moving object
  * ID_ROCK           = 0x0000a000, // 0x8000 + 0x2000
  * ID_GHOST          = 0x0000c001, // 0x8000 + 0x4000 + 0x0001
  * ID_TRAIL          = 0x0000c002, // 0x8000 + 0x4000 + 0x0002
  * ID_BLEED          = 0x0000c003, // 0x8000 + 0x4000 + 0x0003
  * ID_COSMIC         = 0x0000c004, // 0x8000 + 0x4000 + 0x0004
  ID_STAR_FIT_AVE   = 0x00010000, // average position fitted
  ID_STAR_FIT_PM    = 0x00020000, // proper motion fitted
  ID_STAR_FIT_PAR   = 0x00040000, // parallax fitted
  ID_STAR_USE_AVE   = 0x00080000, // average position used (not PM or PAR)
  ID_STAR_USE_PM    = 0x00100000, // proper motion used (not AVE or PAR)
  ID_STAR_USE_PAR   = 0x00200000, // parallax used (not AVE or PM)
  ID_STAR_NO_ASTROM = 0x00400000, // mean astrometry could not be measured
  ID_OBJ_EXT        = 0x01000000, // extended in our data (eg, PS)
  ID_OBJ_EXT_ALT    = 0x02000000, // extended in external data (eg, 2MASS)
  ID_OBJ_GOOD       = 0x04000000, // good-quality measurement in our data (eg,PS)
  ID_OBJ_GOOD_ALT   = 0x08000000, // good-quality measurement in  external data (eg, 2MASS)
  ID_OBJ_GOOD_STACK = 0x10000000, // good-quality object in the stack (> 1 good stack)
  ID_OBJ_SUSPECT_STACK = 0x20000000, // suspect object in the stack (> 1 good or suspect stack, < 2 good)
  ID_OBJ_BAD_STACK  = 0x40000000, // bad-quality object in the stack (> 1 good stack)

the items marked * are deprecated and not set in SAS 10. They are here for historical purposes.

Object.xFlags

 ID_SECF_STAR_FEW    = 0x00000001, // used within relphot: skip star
 ID_SECF_STAR_POOR   = 0x00000002, // used within relphot: skip star
 ID_SECF_USE_SYNTH   = 0x00000004, // synthetic photometry used in average measurement
 ID_SECF_USE_UBERCAL = 0x00000008, // synthetic photometry used in average measurement
 ID_SECF_HAS_PS1     = 0x00000010, // PS1 photometry used in average measurement
 ID_SECF_HAS_STACK   = 0x00000020, // PS1 stack photometry exists
 ID_PHOTOM_PASS_0    = 0x00000100, // average magnitude calculated in 0th pass
 ID_PHOTOM_PASS_1    = 0x00000200, // average magnitude calculated in 1th pass
 ID_PHOTOM_PASS_2    = 0x00000400, // average magnitude calculated in 2th pass
 ID_PHOTOM_PASS_3    = 0x00000800, // average magnitude calculated in 3th pass
 ID_PHOTOM_PASS_4    = 0x00001000, // average magnitude calculated in 4th pass
 ID_PSPS_OBJ_EXT     = 0x00002000, // extended in this band (PSPS only)
 ID_SECF_OBJ_EXT     = 0x01000000, // DVO location of "extended in this band" For PSPS this bit is moved

The gap between ID_SECF_HAS_STACK and ID_PHOTOM_PASS_0 is intentional (the bits between are not used)

Note: ID_PSPS_OBJ_EXT contains the value of the bit ID_SECF_OBJ_EXT in DVO. For PSPS it is moved to fit into the 16 bit Object.xFlags